/* =========================
   GLOBAL
========================= */

html {
    background-color: var(--color-background);
}

body {
    min-height: 100vh;

    background-color: var(--color-background);
    color: var(--color-text);

    font-family: var(--font-mono);
    font-weight: var(--weight-regular);

    overflow-x: hidden;
    overflow-y: scroll;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* =========================
   SCREEN READER TEXT
========================= */

/*
 * Read by screen readers, never drawn: status
 * messages and text whose visible version is
 * animated.
 */

.visually-hidden {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;

    margin: -1px !important;
    padding: 0 !important;

    overflow: hidden !important;

    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;

    white-space: nowrap !important;

    border: 0 !important;
}


/* =========================
   SECTION SPACING
========================= */

/*
 * Hero → About agora é controlado
 * pela transição GSAP.
 */

main > .works {
    margin-top: min(120px, 11.72svh);
}

main > .contact {
    margin-top: min(88px, 8.59svh);
}


/* =========================
   HERO → ABOUT PANEL SYSTEM
========================= */

.panel-stage {
    position: relative;

    width: 100%;

    isolation: isolate;
}


.panel-stage > .hero,
.panel-stage > .about {
    position: relative;

    width: 100%;
}


/* =========================
   HERO PANEL
========================= */

.panel-stage > .hero {
    z-index: 1;

    height: 100svh;

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

    transform-origin: center center;
}


/* =========================
   ABOUT PANEL
========================= */

.panel-stage > .about {
    z-index: 2;

    margin-top: 35svh;

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

    border-radius: 16px 16px 0 0;

    box-shadow:
        0 -12px 40px rgba(33, 33, 33, 0.045);
}

/* =========================
   ABOUT — HOLD / STICKY VIEWPORT
========================= */

/*
 * A seção possui uma viewport extra de scroll.
 * Isso cria o tempo de permanência.
 */

.panel-stage > .about {
    height: 240svh;
    min-height: 240svh;

    display: block;
    overflow: visible;
}


/*
 * O conteúdo visual continua tendo exatamente
 * uma viewport e fica preso enquanto percorremos
 * os 75svh extras da seção.
 */

.panel-stage > .about .about__inner {
    position: sticky;

    top: 0;

    height: 100svh;
}


/* =========================
   HERO TITLE — STAGGERED FLIP EXIT
========================= */

/*
 * js/hero-title-exit.js lays a hidden copy of the
 * /works and project Hero titles over each line,
 * one box per letter, each exactly on its glyph.
 * At rest the title is its own text; while the
 * letters turn, the copy shows and the text below
 * turns transparent (screen readers still read it).
 */

.title-exit__line {
    position: relative;
}

.title-exit__layer {
    position: absolute;
    top: 0;
    left: 0;

    visibility: hidden;

    pointer-events: none;

    -webkit-user-select: none;
    user-select: none;
}

.title-exit__word,
.title-exit__letter {
    position: absolute;
    top: 0;
    left: 0;
}

.title-exit__letter {
    white-space: pre;

    transform-origin: 50% 60%;
}

.is-exiting .title-exit__text {
    opacity: 0;
}

.is-exiting .title-exit__layer {
    visibility: visible;
}

.is-exiting .title-exit__word {
    perspective: 850px;
}

/*
 * No will-change: a promoted letter is drawn on
 * whole device pixels, so the copy would visibly
 * shift as it replaced the text. Each letter is
 * promoted anyway once it starts turning.
 */

.is-exiting .title-exit__letter {
    transform-style: preserve-3d;

    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}