/* ==========================================================================
   Rodapé

   O fim da referência na forma da marca: o azul fecha em volta da frase até sobrar um
   hexágono de papel, o inverso do hexágono azul que abre o site. Abaixo, o mapa do site no
   formato da ficha cadastral (rótulo pequeno em cima, valor embaixo) e a volta ao início.

   Duas formas, mesmo HTML:
   · base (sem JS ou com movimento reduzido): visor fechado e frase à vista;
   · .is-live: o JS informa --open-x e --open-y (escala do visor: cobre a faixa inteira e
     encolhe até 1) e põe .is-framed perto do fim. A frase só aparece aí, decifrando-se.
   ========================================================================== */

.site-footer {
    /* Visor: o corte é o mesmo do hexágono do hero, 0,236 da altura. footer.js lê --win-slant. */
    --win-slant: 0.236;
    --win-h: min(calc(var(--screen) * 0.42), 78vw);
    --win-w: calc(100% - var(--gutter) * 2);
    --win-cut: calc(var(--win-h) * var(--win-slant));
    --win-band: calc(var(--win-h) * 0.05);

    /* Azul que sobra em cima e embaixo do visor. */
    --frame: clamp(3rem, 12vw, 5rem);

    position: relative;
    color: var(--white);
    background: var(--navy);
}

/* --- Visor ---------------------------------------------------------------- */
.footer-close {
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: calc(var(--win-h) + var(--frame) * 2);
    overflow: hidden;
}

/* O papel e, atrás dele, a mesma forma em laranja deslocada: sobra o filete do hero, à esquerda. */
.footer-close__window,
.footer-close__stripe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--win-w);
    height: var(--win-h);
    clip-path: polygon(
        var(--win-cut) 0,
        calc(100% - var(--win-cut)) 0,
        100% 50%,
        calc(100% - var(--win-cut)) 100%,
        var(--win-cut) 100%,
        0 50%
    );
}

.footer-close__window {
    z-index: -1;
    background: var(--paper);
    transform: translate(-50%, -50%) scale(var(--open-x, 1), var(--open-y, 1));
}

/* Um pixel mais baixo em cima e embaixo: as bordas retas coincidiriam com as do papel e o
   antisserrilhado deixaria um fio laranja nelas. */
.footer-close__stripe {
    z-index: -2;
    background: var(--orange);
    clip-path: polygon(
        var(--win-cut) 1px,
        calc(100% - var(--win-cut)) 1px,
        100% 50%,
        calc(100% - var(--win-cut)) calc(100% - 1px),
        var(--win-cut) calc(100% - 1px),
        0 50%
    );
    transform: translate(calc(-50% - var(--win-band)), -50%) scale(var(--open-x, 1), var(--open-y, 1));
}

/* A frase usa a largura do meio do hexágono, onde ele é mais largo. */
.footer-close__statement {
    max-width: calc(var(--win-w) - var(--win-cut));
    color: var(--ink);
    font-size: var(--fs-closing);
    font-weight: var(--fw-title);
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-title);
    text-align: center;
}

.footer-close__visual,
.footer-close__line {
    display: block;
}

.footer-close__line {
    text-wrap: balance;
}

.footer-close__line--soft {
    color: var(--ink-3);
}

/* O hexágono anda com a palavra de antes: numa tela estreita, ele nunca abre a linha seguinte. */
.footer-close__keep {
    white-space: nowrap;
}

/* O texto final, invisível, dá a medida do trecho: as letras sorteadas por cima não mexem
   na linha centrada. */
.footer-close__word {
    position: relative;
    display: inline-block;
    white-space: nowrap;
}

.footer-close__word::after {
    content: attr(data-text);
    visibility: hidden;
}

.footer-close__text {
    position: absolute;
    top: 0;
    left: 0;
}

/* O hexágono da marca no lugar de uma palavra, como nos outros títulos. */
.footer-close__hex {
    display: inline-block;
    width: 0.94em;
    height: 0.8em;
    margin-inline: 0.06em;
    vertical-align: -0.1em;
    background: var(--navy);
    clip-path: polygon(20% 0, 80% 0, 100% 50%, 80% 100%, 20% 100%, 0 50%);
}

/* --- Ficha: marca, mapa do site e contato ----------------------------------- */
.footer-sheet {
    display: grid;
    gap: 2.5rem;
    margin-inline: var(--gutter);

    /* Em cima, o azul em volta do visor já separa. */
    padding-block: 0 clamp(2.5rem, 8vw, 4rem);
}

.footer-brand {
    display: grid;
    justify-items: start;
    gap: 1rem;
}

.footer-brand__logo {
    width: auto;
    height: 2.5rem;
    aspect-ratio: 181.91 / 51.64;
    color: var(--white);
}

.footer-brand__text {
    max-width: 26rem;
    font-size: var(--fs-small);
    line-height: var(--lh-text);
    color: var(--white-2);
    text-wrap: pretty;
}

.footer-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    font-size: var(--fs-label);
    font-weight: 500;
}

.footer-more .icon {
    color: var(--orange);
    transition: transform var(--t-fast) var(--ease);
}

/* No celular as listas viram sanfona: o toque no título abre a lista. */
.footer-map {
    display: grid;
    border-top: 1px solid var(--hairline-light);
}

.footer-col {
    border-bottom: 1px solid var(--hairline-light);
}

.footer-col__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.5rem;
    list-style: none;
    cursor: pointer;
}

.footer-col__head::-webkit-details-marker {
    display: none;
}

.footer-col__title {
    font-size: var(--fs-label);
    font-weight: 500;
    color: var(--white);
}

/* O mais vira x com a lista aberta. */
.footer-col__toggle {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--orange);
    transition: transform var(--t-base) var(--ease);
}

.footer-col[open] .footer-col__toggle {
    transform: rotate(45deg);
}

.footer-col__list {
    display: grid;
    padding-bottom: 1rem;
}

/* Um fio laranja entra antes do texto no hover, como o fio técnico do hero. */
.footer-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    font-size: var(--fs-small);
    color: var(--white-2);
    transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}

.footer-link::before {
    content: "";
    width: 0;
    height: 2px;
    background: var(--orange);
    transition: width var(--t-base) var(--ease), margin-right var(--t-base) var(--ease);
}

/* Ação ao lado de um dado: WhatsApp do número, rota do endereço. */
.footer-link--tag {
    padding-inline: 1rem;
    font-size: var(--fs-label);
    font-weight: 500;
    color: var(--white);
    border: 1px solid var(--hairline-light);
    border-radius: var(--radius-pill);
}

.footer-link--tag::before {
    content: none;
}

/* --- Contato, no formato da ficha ------------------------------------------- */
.footer-reach {
    display: grid;
    gap: 1.25rem;
}

.footer-facts {
    font-style: normal;
}

.footer-facts dl {
    display: grid;
    gap: 1.25rem;
}

/* O rótulo cola no valor mesmo quando a vizinha da linha é mais alta. */
.footer-fact {
    display: grid;
    align-content: start;
    gap: 0.125rem;
}

.footer-fact dt {
    font-size: var(--fs-micro);
    color: var(--white-3);
}

.footer-fact dd {
    display: grid;
    justify-items: start;
    font-size: var(--fs-small);
    line-height: var(--lh-text);
    color: var(--white-2);
}

.footer-fact dd .footer-link--tag {
    margin-top: 0.5rem;
}

.footer-fact .footer-fact__pair {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 1rem;
}

.footer-fact__pair .footer-link--tag {
    margin-top: 0;
}

.footer-fact__line {
    display: block;
}

/* --- Linha legal e volta ao início ------------------------------------------ */
.footer-legal {
    display: grid;
    gap: 1rem;
    margin-inline: var(--gutter);
    padding-block: 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--hairline-light);
}

.footer-legal__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 1.25rem;
    font-size: var(--fs-micro);
    line-height: var(--lh-text);
    color: var(--white-3);
}

.footer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3rem;
    font-size: var(--fs-label);
    font-weight: 500;
}

.footer-top__icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    color: var(--white);
    background: var(--glass);
    border-radius: 50%;
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.footer-top__icon .icon {
    transform: rotate(-90deg);
    transition: transform var(--t-base) var(--ease);
}

/* Blocos da volta ao início: cobrem a tela inteira, header incluído, só durante a passagem. */
.footer-veil {
    position: fixed;
    inset: 0;
    z-index: var(--z-veil);
    display: none;
    width: 100%;
    height: 100%;
}

.footer-veil.is-active {
    display: block;
}

@media (hover: hover) {
    .footer-link:hover {
        color: var(--white);
    }

    .footer-link:hover::before {
        width: 0.75rem;
        margin-right: 0.5rem;
    }

    .footer-link--tag:hover {
        background: var(--glass-hover);
    }

    .footer-more:hover .icon {
        transform: translate3d(0.2rem, 0, 0);
    }

    .footer-top:hover .footer-top__icon {
        color: var(--abyss);
        background: var(--orange);
    }

    .footer-top:hover .footer-top__icon .icon {
        transform: rotate(-90deg) translate3d(0.15rem, 0, 0);
    }
}

/* ==========================================================================
   Palco: o visor fecha com a rolagem e a frase se decifra
   ========================================================================== */

.site-footer.is-live .footer-close__window,
.site-footer.is-live .footer-close__stripe {
    will-change: transform;
}

.site-footer.is-live .footer-close__visual {
    opacity: 0;
}

.site-footer.is-framed .footer-close__visual {
    opacity: 1;
}

.site-footer.is-framed .footer-close__line {
    animation: decode 0.9s var(--ease) backwards;
}

.site-footer.is-framed .footer-close__line--soft {
    animation-delay: 0.12s;
}

.site-footer.is-framed .footer-close__hex {
    animation: pop 0.7s var(--ease) 0.25s backwards;
}

/* A ficha sobe quando chega à tela. */
.site-footer.is-live .footer-sheet > *,
.site-footer.is-live .footer-legal {
    opacity: 0;
}

.site-footer.is-shown .footer-sheet > *,
.site-footer.is-shown .footer-legal {
    opacity: 1;
    animation: rise 0.9s var(--ease) backwards;
}

.site-footer.is-shown .footer-sheet > :nth-child(2) {
    animation-delay: 0.08s;
}

.site-footer.is-shown .footer-sheet > :nth-child(3) {
    animation-delay: 0.16s;
}

.site-footer.is-shown .footer-legal {
    animation-delay: 0.24s;
}

/* Lista que acabou de abrir na sanfona. */
@media (max-width: 767.98px) {
    .motion .footer-col[open] .footer-col__list {
        animation: rise 0.55s var(--ease) backwards;
    }
}

/* ==========================================================================
   Tablet: listas sempre abertas, lado a lado
   ========================================================================== */
@media (min-width: 768px) {
    .site-footer {
        --win-h: min(calc(var(--screen) * 0.44), 52vw);
        --win-w: min(100% - var(--gutter) * 2, var(--win-h) * 2.4);
        --frame: clamp(4rem, 10vh, 6rem);
    }

    .footer-sheet {
        gap: 3rem;
    }

    .footer-map {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--gutter);
        border-top: 0;
    }

    .footer-col {
        border-bottom: 0;
    }

    /* Aberta sempre: o título deixa de ser botão (footer.js também tira o foco dele). */
    .footer-col__head {
        min-height: 0;
        margin-bottom: 0.75rem;
        cursor: default;
        pointer-events: none;
    }

    .footer-col__toggle {
        display: none;
    }

    .footer-col__list {
        padding-bottom: 0;
    }

    .footer-facts dl {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem var(--gutter);
    }

    .footer-legal {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem 2rem;
    }

    .footer-top {
        flex: none;
    }
}

@media (min-width: 768px) and (pointer: fine) {
    .footer-link {
        min-height: 2rem;
    }

    .footer-link--tag {
        min-height: 2.25rem;
    }
}

/* ==========================================================================
   Desktop: o visor vira a placa larga da abertura do hero. A ficha tem a marca em cima e
   três colunas embaixo; a partir de 1280px, quatro colunas lado a lado.
   ========================================================================== */
@media (min-width: 1024px) {
    .site-footer {
        --win-h: min(calc(var(--screen) * 0.5), 31vw);
        --win-w: min(100% - var(--gutter) * 2, var(--win-h) * 2.9);
        --frame: clamp(4rem, 13vh, 8rem);
    }

    .footer-sheet {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        align-items: start;
        gap: 3rem var(--gutter);
        padding-block: 0 clamp(3rem, 7vh, 5rem);
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .footer-brand__logo {
        height: 2.75rem;
    }

    .footer-col__title {
        font-size: var(--fs-small);
    }

    .footer-reach {
        gap: 0.75rem;
    }

    .footer-facts dl {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }
}

@media (min-width: 1280px) {
    .footer-sheet {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) minmax(0, 1.1fr);
        gap: var(--gutter);
    }

    .footer-brand {
        grid-column: auto;
    }
}
