/* ═══════════════════════════════════
   GLOBAL FOOTER
   Brand mark (left) + nav columns + social/legal row.
   Loaded site-wide by Charlies_Header, so it is self-contained
   (it does not rely on the homepage stylesheet's variables).
   ═══════════════════════════════════ */

/* ── Hide the theme's own footer (betheme + generic) ──
   This global footer injects at wp_footer, i.e. after the theme has already
   output its own footer, which left a faint grey strip sitting above ours.
   Every selector targets a known theme footer container — never .cfc-footer. */
#Footer,
#Footer_wrapper,
#Footer_creative,
.mfn-footer,
#colophon,
#site-footer,
.site-footer:not(.cfc-footer),
.wp-block-template-part[data-area="footer"] {
    display: none !important;
}

/* Betheme renders an empty "page pager" section at the end of every page.
   It has no content but keeps its padding/background, which showed up as a
   faint grey bar directly above this footer. */
.section-page-footer {
    display: none !important;
}

.cfc-footer {
    --cfc-footer-red: #ff0006;
    --cfc-footer-bg: #ffffff;
    --cfc-footer-text: #111111;
    position: relative;
    /* Clips the oversized brand mark that bleeds off the bottom edge. */
    overflow: hidden;
    background: var(--cfc-footer-bg);
    color: var(--cfc-footer-text);
    font-family: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
}

.cfc-footer * {
    box-sizing: border-box;
}

.cfc-footer__inner {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 72px 64px 72px;
    /* Reserve height so the cropped logo has room to read as a big mark. */
    min-height: 440px;
}

/* Big brand mark, anchored bottom-left and bleeding off the bottom edge
   (clipped by the footer's overflow) so it reads like the reference. */
.cfc-footer__brand {
    position: absolute;
    /* Oversized so it bleeds off the left and bottom edges (clipped by the
       footer's overflow) — reads as a huge cropped mark like the reference. */
    left: -270px;
    bottom: -360px;
    width: 620px;
    max-width: 48%;
    margin: 0;
    display: block;
    line-height: 0;
}

.cfc-footer__brand-logo {
    width: 100%;
    height: auto;
    display: block;
}

.cfc-footer__content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Clear the absolutely-positioned logo on the left. */
    padding-left: 440px;
}

/* Grouped link columns, each with its own heading. */
.cfc-footer__nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px 40px;
    margin-bottom: 36px;
}

.cfc-footer__col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cfc-footer__col-title {
    margin: 0 0 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.01em;
    color: #6b6b6b;
}

.cfc-footer__link {
    display: flex;
    align-items: center;
    color: var(--cfc-footer-red);
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    padding: 9px 0;
    min-height: 44px; /* landed at 41.4px from padding alone */
    transition: opacity 0.2s;
}

.cfc-footer__link:hover {
    opacity: 0.6;
}

.cfc-footer__divider {
    border: none;
    border-top: 1px solid #e6e6e6;
    margin: 0 0 24px;
}

.cfc-footer__bottom {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px 32px;
    margin-bottom: 20px;
}

.cfc-footer__social {
    display: flex;
    align-items: center;
    /* 0 because each link now carries a 44px hit box (22px icon + padding);
       icon-to-icon spacing works out about the same as the old 20px gap. */
    gap: 0;
    margin-left: -11px; /* keep the first icon optically flush with the column */
}

/* The icons render in two slots (see render_footer_social) and each breakpoint
   shows exactly one. Default = the below-divider copy, inline with the legal
   links; the in-nav copy only appears under 540px. */
.cfc-footer__social--in-nav {
    display: none;
}

.cfc-footer__social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    /* The icons stay 22px; the link is padded out to a 44px hit area. These are
       the only social links in the footer and were 22x22 targets. The parent's
       gap is reduced to keep the icons the same distance apart. */
    min-width: 44px;
    min-height: 44px;
    color: var(--cfc-footer-red);
    transition: opacity 0.2s;
}

.cfc-footer__social-link:hover {
    opacity: 0.6;
}

.cfc-footer__social-link svg {
    width: 22px;
    height: 22px;
    display: block;
    fill: currentColor;
}

.cfc-footer__social-img {
    width: 22px;
    height: 22px;
    display: block;
}

.cfc-footer__legal {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
}

.cfc-footer__legal-link {
    color: #4a4a4a;
    text-decoration: none;
    font-size: 14px;
    /* Was a ~19px-tall target. Hit area only — the text does not move. */
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    transition: color 0.2s;
}

.cfc-footer__legal-link:hover {
    color: var(--cfc-footer-red);
}

/* Very bottom row: copyright + credit (left), payment methods (right). */
.cfc-footer__baseline {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px 32px;
    margin-top: 16px;
}

.cfc-footer__copyright {
    font-size: 13px;
    color: #8a8a8a;
    margin: 0;
    line-height: 1.6;
}

/* Sits on its own line beneath the copyright, flush-left with the © symbol. */
.cfc-footer__credit {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: #a5a5a5;
}

.cfc-footer__credit a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.cfc-footer__credit a:hover {
    color: var(--cfc-footer-red);
}

/* Accepted payment methods (Mastercard, Visa, Google Pay, Apple Pay). */
.cfc-footer__payments {
    margin: 0;
}

.cfc-footer__payments-img {
    height: 30px;
    width: auto;
    max-width: 100%;
    display: block;
    /* Lift the white payment cards off the white footer background. */
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.12));
}

/* ── Entrance animation ──
   JS adds .cfc-footer--reveal (initial hidden state) then .is-visible when the
   footer scrolls into view. Guarded by prefers-reduced-motion so it never
   hides content for users who opt out, and never runs when JS is absent. */
@media (prefers-reduced-motion: no-preference) {
    .cfc-footer--reveal .cfc-footer__nav,
    .cfc-footer--reveal .cfc-footer__divider,
    .cfc-footer--reveal .cfc-footer__bottom,
    .cfc-footer--reveal .cfc-footer__baseline {
        opacity: 0;
        transform: translateY(26px);
        transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
                    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    }

    /* The cropped logo rises from further down (and stays clipped) for a
       gentle reveal, so it uses its own offset from its anchored position. */
    .cfc-footer--reveal .cfc-footer__brand {
        opacity: 0;
        transform: translateY(60px);
        transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .cfc-footer--reveal.is-visible .cfc-footer__nav,
    .cfc-footer--reveal.is-visible .cfc-footer__divider,
    .cfc-footer--reveal.is-visible .cfc-footer__bottom,
    .cfc-footer--reveal.is-visible .cfc-footer__baseline,
    .cfc-footer--reveal.is-visible .cfc-footer__brand {
        opacity: 1;
        transform: none;
    }

    /* Staggered cascade. */
    .cfc-footer--reveal.is-visible .cfc-footer__brand    { transition-delay: 0.02s; }
    .cfc-footer--reveal.is-visible .cfc-footer__nav      { transition-delay: 0.10s; }
    .cfc-footer--reveal.is-visible .cfc-footer__divider  { transition-delay: 0.18s; }
    .cfc-footer--reveal.is-visible .cfc-footer__bottom   { transition-delay: 0.24s; }
    .cfc-footer--reveal.is-visible .cfc-footer__baseline { transition-delay: 0.30s; }
}

/* ── Mobile: hide the logo and compact the whole footer right down ── */
@media (max-width: 900px) {
    .cfc-footer {
        overflow: visible;
    }

    .cfc-footer__inner {
        padding: 32px 20px 40px;
        min-height: 0;
    }

    /* Logo is hidden on mobile. */
    .cfc-footer__brand {
        display: none;
    }

    .cfc-footer__content {
        padding-left: 0;
    }

    /* One uniform gap drives the spacing between every stacked section
       (nav → divider → social/legal → copyright/payments) so they're even. */
    .cfc-footer__content {
        gap: 26px;
    }

    .cfc-footer__nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 24px;
        margin-bottom: 0;
    }

    .cfc-footer__col-title {
        font-size: 13px;
        margin-bottom: 2px;
    }

    .cfc-footer__link {
        font-size: 15px;
        padding: 5px 0;
    }

    .cfc-footer__divider {
        margin: 0;
    }

    .cfc-footer__bottom {
        gap: 18px 20px;
        margin-bottom: 0;
    }

    .cfc-footer__social {
        gap: 16px;
    }

    .cfc-footer__social-link svg,
    .cfc-footer__social-img {
        width: 19px;
        height: 19px;
    }

    .cfc-footer__legal {
        gap: 8px 18px;
    }

    .cfc-footer__legal-link {
        font-size: 13px;
    }

    .cfc-footer__baseline {
        margin-top: 0;
        /* Slightly tighter than the 26px stack gap: the copyright paragraph's
           line-height adds trailing leading under "Website by Sketch", so this
           lands optically level with the legal-links → copyright gap. */
        gap: 18px 20px;
    }

    .cfc-footer__copyright,
    .cfc-footer__credit {
        font-size: 11.5px;
    }

    /* Smaller payment badges on mobile. */
    .cfc-footer__payments-img {
        height: 20px;
    }
}

@media (max-width: 540px) {
    /* Stay at two columns rather than collapsing to one — a single column of
       18px links ran the footer nav to ~900px of scrolling on a phone. The
       columns are minmax(0, 1fr) so long labels wrap instead of overflowing. */
    .cfc-footer__nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px 20px;
    }

    /* Three link groups in a 2-column grid leave row 2 / column 2 empty — put
       the social icons there instead of below the divider, and hide the
       below-divider copy. Swapped back over 540px. */
    .cfc-footer__social--in-nav {
        display: flex;
        align-self: start;
        margin-left: -11px; /* optically flush with the column above */
    }

    .cfc-footer__social--in-bottom {
        display: none;
    }

    /* ── Even rhythm for the stack under the divider ──
       Everything below the divider (legal links → copyright → payments) sits
       20px apart *visually*. The boxes don't line up with the ink, so the
       gaps are corrected per edge rather than by one uniform `gap`:
       the legal links keep their 44px tap target, which is 14px taller than
       the 13px text on each side, and the copyright paragraph carries ~2px of
       leading above its first line and ~2.5px below its last. */
    .cfc-footer__content {
        gap: 20px;
    }

    .cfc-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        /* -14px cancels the tap-target padding; the extra -2px on the bottom
           cancels the copyright's leading. Only the boxes shrink — the links
           still render a full 44px hit area. */
        margin-top: -14px;
        margin-bottom: -16px;
    }

    .cfc-footer__baseline {
        flex-direction: column;
        align-items: flex-start;
        /* 20px minus the ~2.5px of trailing leading under "Website by Sketch". */
        gap: 17.5px;
    }
}
