/**
 * ==========================================================================
 * GEC Frontend Framework
 * Footer Component
 *
 * Four-region footer: brand statement, two menu columns driven by the
 * `footer` and `footer_secondary` menu locations, and the company legal
 * block. Column count adapts to how many of those regions actually render.
 * ==========================================================================
 */

/* ==========================================================================
   FOOTER
   ========================================================================== */

.gec-footer {

    /* Height of a column heading plus its bottom margin, and of the menu
       column's link list below it: four 1.5rem lines and the three gaps
       between them. Together they give the depth of a menu column, which the
       brand column bottom-aligns against. Revisit the link count when the
       footer menus change length. */

    --gec-footer-heading-band: 34px;

    --gec-footer-menu-depth: calc(4 * 1.5rem + 3 * var(--space-3));

    --gec-footer-logo-size: 96px;

    position: relative;

    overflow: hidden;

    background: var(--color-footer-surface);

    color: var(--color-secondary-200);

    border-top: 3px solid var(--color-footer-accent);

}

/* Ambient corner glow. Decorative only. */

.gec-footer__glow {

    position: absolute;

    top: -140px;

    inset-inline-end: -150px;

    width: 560px;

    height: 560px;

    border-radius: var(--radius-full);

    background: radial-gradient(
        circle at 30% 30%,
        rgba(233, 168, 60, .10),
        rgba(255, 255, 255, .035) 55%,
        rgba(255, 255, 255, 0) 72%
    );

    pointer-events: none;

}

/* ==========================================================================
   CONTAINER
   ========================================================================== */

.gec-footer__container {

    position: relative;

    max-width: var(--container-xl);

    margin-inline: auto;

    padding-inline: var(--space-9);

    padding-block: var(--space-12) 0;

}

/* ==========================================================================
   TOP
   ========================================================================== */

/* The menu group is a single content-sized track centred between two equal
   flexible tracks, so the brand and company columns keep matching width and
   the menus stay optically centred however many links they hold. */

.gec-footer__top {

    display: grid;

    grid-template-columns: 1fr auto 1fr;

    gap: var(--space-10);

    justify-items: center;

    align-items: start;

}

/* Collapse the track count when an optional region renders nothing, so a
   footer without company details or without menus stays balanced. */

.gec-footer__top:not(:has(.gec-footer__company)) {

    grid-template-columns: 1fr auto;

}

.gec-footer__top:not(:has(.gec-footer__navigation)) {

    grid-template-columns: 1fr 1fr;

}

.gec-footer__top:not(:has(.gec-footer__navigation)):not(:has(.gec-footer__company)) {

    grid-template-columns: minmax(0, 1fr);

}

/* ==========================================================================
   BOTTOM
   ========================================================================== */

.gec-footer__bottom {

    margin-top: var(--space-10);

    border-top: 1px solid var(--color-border-inverse);

    padding-block: var(--space-6) var(--space-8);

}

/* ==========================================================================
   BRANDING
   ========================================================================== */

.gec-footer__branding {

    display: flex;

    flex-direction: column;

    gap: var(--space-4);

    /* The column is exactly as deep as a menu column and packs its content
       against the bottom, so the last line of copy lands on the same baseline
       as the last menu link. The lockup is taller than the remaining room, so
       it overflows upward into the footer's top padding — which is what keeps
       the logo-to-copy gap at the designed rhythm instead of a stretched one. */

    justify-content: flex-end;

    height: calc(
        var(--gec-footer-heading-band) + var(--gec-footer-menu-depth)
    );

    justify-self: start;

    max-width: 42ch;

}

/* Kept as one block so the column packs the whole copy against its bottom
   edge rather than spreading the paragraphs apart. */

.gec-footer__brand-copy {

    display: flex;

    flex-direction: column;

    gap: var(--space-4);

}

.gec-footer__logo {

    display: inline-flex;

    align-items: center;

    gap: var(--space-4);

    text-decoration: none;

}

.gec-footer__logo img {

    display: block;

    max-height: var(--gec-footer-logo-size);

    width: auto;

}

.gec-footer__title {

    color: var(--color-footer-accent);

    font-size: var(--font-size-xl);

    font-weight: var(--font-weight-normal);

}

.gec-footer__statement {

    margin: 0;

    color: var(--color-white);

    font-weight: var(--font-weight-bold);

}

.gec-footer__description {

    margin: 0;

    color: var(--color-secondary-200);

    line-height: var(--line-height-relaxed);

}

/* ==========================================================================
   HEADING
   ========================================================================== */

.gec-footer__heading {

    margin: 0 0 var(--space-5);

    color: var(--color-footer-accent);

    font-size: var(--font-size-xs);

    font-weight: var(--font-weight-bold);

    letter-spacing: var(--letter-spacing-caps);

    text-transform: uppercase;

}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.gec-footer__navigation {

    display: flex;

    gap: var(--space-10);

}

.gec-footer__group {

    display: flex;

    flex-direction: column;

}

.gec-footer__menu {

    list-style: none;

    margin: 0;

    padding: 0;

    display: flex;

    flex-direction: column;

    gap: var(--space-3);

}

.gec-footer__link {

    color: var(--color-secondary-200);

    text-decoration: none;

    transition: color .18s ease;

}

.gec-footer__link:hover,
.gec-footer__link:focus-visible {

    color: var(--color-footer-accent);

}

/* ==========================================================================
   COMPANY
   ========================================================================== */

.gec-footer__company {

    justify-self: end;

    max-width: 42ch;

}

.gec-footer__company-body {

    display: flex;

    flex-direction: column;

    gap: var(--space-3);

    line-height: var(--line-height-relaxed);

}

.gec-footer__company-name,
.gec-footer__company-line {

    margin: 0;

    color: var(--color-secondary-200);

}

.gec-footer__company-name {

    color: var(--color-white);

    font-weight: var(--font-weight-bold);

}

.gec-footer__company-label {

    color: var(--color-white);

    font-weight: var(--font-weight-bold);

}

.gec-footer__company-email,
.gec-footer__company-link {

    align-self: flex-start;

    color: var(--color-footer-accent);

    text-decoration: none;

    border-bottom: 1px solid rgba(233, 168, 60, .5);

    padding-bottom: 2px;

    transition: color .18s ease, border-color .18s ease;

}

.gec-footer__company-email:hover,
.gec-footer__company-email:focus-visible,
.gec-footer__company-link:hover,
.gec-footer__company-link:focus-visible {

    color: var(--color-footer-accent-hover);

    border-bottom-color: var(--color-footer-accent-hover);

}

/* ==========================================================================
   COPYRIGHT
   ========================================================================== */

.gec-footer__copyright {

    display: flex;

    flex-wrap: wrap;

    align-items: center;

    justify-content: space-between;

    gap: var(--space-4) var(--space-7);

    color: var(--color-secondary-300);

    font-size: var(--font-size-sm);

}

.gec-footer__copyright a {

    color: var(--color-secondary-300);

    text-decoration: none;

    transition: color .18s ease;

}

.gec-footer__copyright a:hover,
.gec-footer__copyright a:focus-visible {

    color: var(--color-footer-accent);

}

.gec-footer__legal {

    display: flex;

    flex-wrap: wrap;

    gap: var(--space-7);

}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {

    .gec-footer__container {

        padding-inline: var(--space-6);

    }

    /* Below the three-track layout the columns stack side by side and the
       centring / edge alignment above would only misalign them. */

    .gec-footer__top,
    .gec-footer__top:not(:has(.gec-footer__company)),
    .gec-footer__top:not(:has(.gec-footer__navigation)) {

        grid-template-columns: repeat(2, minmax(0, 1fr));

        justify-items: stretch;

    }

    .gec-footer__branding,
    .gec-footer__company {

        justify-self: stretch;

        max-width: none;

    }

    /* Stacked columns no longer share a first-line baseline, so the brand
       lift and the padding that absorbed it are both dropped. */

    .gec-footer__branding {

        height: auto;

        justify-content: flex-start;

    }

    .gec-footer__container {

        padding-block: var(--space-9) 0;

    }

}

@media (max-width: 767px) {

    .gec-footer__container {

        padding-inline: var(--space-4);

        padding-block: var(--space-9) 0;

    }

    .gec-footer__top,
    .gec-footer__top:not(:has(.gec-footer__company)),
    .gec-footer__top:not(:has(.gec-footer__navigation)) {

        grid-template-columns: 1fr;

        gap: var(--space-8);

    }

    .gec-footer__navigation {

        flex-direction: column;

        gap: var(--space-8);

    }

    .gec-footer__glow {

        display: none;

    }

    .gec-footer__copyright {

        flex-direction: column;

        align-items: flex-start;

    }

}
