/* ==========================================================================
   MOD TABLETOP — Phase 1 (static design)
   One layout system shared by all six slides.
   ========================================================================== */


/* ---------- Fonts (self-hosted, no third-party requests) ---------------- */

@font-face {
    font-family: "Archivo Black";
    src: url("../fonts/archivo-black-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Archivo";
    src: url("../fonts/archivo-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Archivo";
    src: url("../fonts/archivo-latin-500-normal.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Archivo";
    src: url("../fonts/archivo-latin-600-normal.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}


/* ---------- Tokens ------------------------------------------------------- */

:root {
    /* Brand palette */
    --c-bg:        #393D2D;   /* main background — dark olive */
    --c-bg-light:  #787A5B;   /* gradient highlight — lighter olive */
    --bg-gradient: linear-gradient(135deg, var(--c-bg-light) 0%, var(--c-bg) 65%);
    --c-bg-2:      #333B35;   /* secondary dark green */
    --c-mint:      #C6DCCB;   /* pale mint — rules */
    --c-orange:    #FFA802;   /* accent — amber */
    --c-text:      #E8E7DA;   /* warm ivory */
    --c-muted:     #838A83;   /* muted outlines */

    --c-text-soft: rgba(232, 231, 218, 0.72);
    --c-rule:      rgba(232, 231, 218, 0.82);   /* warm ivory dividers (reference) */
    --c-marker:    #7A886C;                     /* sage — inactive progress markers (reference) */

    /* Type */
    --f-display: "Archivo Black", "Arial Black", "Helvetica Neue", Arial, sans-serif;
    --f-text:    "Archivo", "Inter Tight", "Helvetica Neue", Arial, sans-serif;

    --fs-intro:     clamp(84px, min(14vw, 26vh), 180px);
    --fs-brand:     clamp(28px, 3.1vw, 48px);
    --fs-brand-sub: clamp(11px, 1vw, 17px);
    --fs-chapter:   clamp(40px, min(6.8vw, 10.5vh), 104px);   /* slides 02–05 headline */
    --fs-label:     clamp(15px, 1.35vw, 22px);                /* slides 02–05 section label */
    --fs-final:     clamp(64px, min(13vw, 23vh), 190px);
    --fs-counter:   clamp(14px, 1.1vw, 18px);
    --fs-small:     clamp(15px, 1.15vw, 20px);
    --fs-legal:     clamp(11px, 0.8vw, 13px);

    /* Layout */
    --gutter:     clamp(20px, 4.6vw, 88px);
    --rule-w:     1px;
    --icon-max-w: 600px;
    --icon-max-h: 430px;
}


/* ---------- Base --------------------------------------------------------- */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    background-color: var(--c-bg);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--c-text);
    overflow: hidden;
}

body {
    font-family: var(--f-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid var(--c-orange);
    outline-offset: 4px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Orange round full stop used after MOD / SOON */
.dot {
    display: inline-block;
    width: 0.24em;
    height: 0.24em;
    margin-left: 0.05em;
    border-radius: 50%;
    background: var(--c-orange);
}


/* ---------- Page frame --------------------------------------------------- */

.site {
    height: 100vh;
    height: 100svh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding-inline: var(--gutter);
}


/* ---------- Header ------------------------------------------------------- */

.site-header {
    padding-top: clamp(18px, 3.4vh, 40px);
    padding-bottom: clamp(14px, 2.6vh, 30px);
    border-bottom: var(--rule-w) solid var(--c-rule);
}

.brand {
    display: inline-flex;
    align-items: baseline;
    gap: clamp(14px, 1.7vw, 28px);
    line-height: 1;
}

.brand__mod {
    font-family: var(--f-display);
    font-size: var(--fs-brand);
    letter-spacing: -0.045em;
    color: var(--c-text);
}

.brand__name {
    font-family: var(--f-text);
    font-weight: 500;
    font-size: var(--fs-brand-sub);
    letter-spacing: 0.42em;
    color: var(--c-text);
    /* optical: sit on the logo's baseline, slightly raised */
    position: relative;
    top: -0.28em;
}


/* ---------- Stage & slides ---------------------------------------------- */

.stage {
    position: relative;
    min-height: 0;
    overflow: hidden;
    /* bleed to the viewport edges so the final orange rule can run off-screen */
    margin-inline: calc(var(--gutter) * -1);
}

.slide {
    position: absolute;
    inset: 0;
    padding: clamp(20px, 4.5vh, 56px) var(--gutter);
    visibility: hidden;
    opacity: 0;
}

.slide.is-active {
    visibility: visible;
    opacity: 1;
}

.counter {
    font-family: var(--f-text);
    font-weight: 500;
    font-size: var(--fs-counter);
    letter-spacing: 0.08em;
    color: var(--c-text);
    font-variant-numeric: tabular-nums;
}

.counter__num {
    color: var(--c-orange);
}


/* ---------- 01 · Intro --------------------------------------------------- */

.slide--intro {
    display: grid;
    place-items: center;
}

.intro-logo {
    display: flex;
    align-items: baseline;
    font-family: var(--f-display);
    font-weight: 400;
    font-size: var(--fs-intro);
    line-height: 0.8;
    letter-spacing: -0.05em;
    color: var(--c-text);
    /* the full stop adds visual weight on the right — nudge back to optical centre */
    transform: translateX(0.04em);
}

.intro-logo__mark {
    width: 0.25em;
    height: 0.25em;
    margin-left: 0.07em;
    overflow: visible;
}

.intro-mark__shape {
    fill: var(--c-orange);
}


/* ---------- 02–05 · Chapters -------------------------------------------- */

.slide--chapter {
    display: grid;
    grid-template-columns: minmax(0, 1fr);   /* column = slide width, never the headline's */
    grid-template-rows: minmax(0, 1fr) auto;
    row-gap: clamp(12px, 3vh, 36px);
}

.chapter__art {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon {
    display: block;
    width: 100%;
    height: 100%;
    max-width: var(--icon-max-w);
    max-height: var(--icon-max-h);
    overflow: visible;
}

/* Section label: slightly more prominent than the other small text so the
   core word (MOD / MAKE IT REAL …) stays recognisable */
.slide--chapter .counter {
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: 0.1em;
}

/* Headline: prominent, never larger than the column allows (--fs-fit is set
   by site.js), always one line */
.chapter__headline {
    margin-top: clamp(6px, 1vh, 12px);
    font-family: var(--f-display);
    font-weight: 400;
    font-size: min(var(--fs-chapter), var(--fs-fit, 999px));
    line-height: 0.82;
    letter-spacing: -0.04em;
    color: var(--c-text);
    margin-left: -0.045em;
    white-space: nowrap;
    width: max-content;
}

/* orange full stop, same shape and proportion as the MOD. logo */
.chapter__headline .dot {
    width: 0.25em;
    height: 0.25em;
    margin-left: 0.06em;
}

.chapter__sub {
    margin-top: clamp(6px, 1.2vh, 14px);
    font-size: var(--fs-small);
    line-height: 1.4;
    color: var(--c-text-soft);
}


/* ---------- Icon geometry ------------------------------------------------ */

/* MOD */
.mod-square  { fill: none; stroke: var(--c-orange); stroke-width: 14; }
.mod-circle  { fill: var(--c-mint); }
.mod-diamond { fill: var(--c-orange); }

/* PRINT — each layer is filled with the background so it occludes the one below */
.print-layer {
    fill: var(--c-bg);
    stroke: var(--c-muted);
    stroke-width: 8;
    stroke-linejoin: miter;
}
.print-layer--top { stroke: var(--c-orange); }

/* PLAY */
.play-cell {
    fill: none;
    stroke: var(--c-muted);
    stroke-width: 6;
}
.play-cell--active {
    fill: var(--c-orange);
    stroke: var(--c-orange);
}
.play-token { fill: var(--c-text); }

/* SHARE */
.share-diamond {
    fill: none;
    stroke: var(--c-muted);
    stroke-width: 9;
    stroke-linejoin: miter;
}
.share-link {
    stroke: var(--c-orange);
    stroke-width: 10;
    stroke-linecap: round;
}
.share-node { fill: var(--c-orange); }


/* ---------- 06 · Coming soon -------------------------------------------- */

.slide--final {
    display: flex;
    align-items: center;
}

.final {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.counter--final {
    font-size: clamp(18px, min(2vw, 3.6vh), 34px);
    letter-spacing: 0.02em;
    margin-bottom: clamp(14px, 4.5vh, 52px);
}

.final__headline {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: var(--fs-final);
    line-height: 0.84;
    letter-spacing: -0.045em;
    color: var(--c-text);
    margin-left: -0.045em;
}

.final__line {
    display: block;
}

.final__dot {
    position: relative;
    display: inline-block;
    width: 0.3em;
    height: 0.3em;
    margin-left: 0.04em;
    border-radius: 50%;
    background: var(--c-orange);
}

/* Static in Phase 1 — will draw out in Phase 3 */
.final__rule {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100vw;
    height: max(3px, 0.05em);
    margin-top: calc(max(3px, 0.05em) / -2);
    background: var(--c-orange);
}

.final__accent {
    display: block;
    width: clamp(52px, 6vw, 104px);
    height: clamp(8px, 0.9vw, 14px);
    margin-top: clamp(18px, 4.5vh, 48px);
    background: var(--c-orange);
}

.final__steps {
    margin-top: clamp(14px, 3vh, 32px);
    font-family: var(--f-text);
    font-weight: 500;
    /* one line on desktop: size scales with the viewport so the full
       slogan always fits the content width */
    font-size: clamp(12px, min(1.3vw, 2.4vh), 22px);
    letter-spacing: 0.26em;
    line-height: 1.75;
    color: var(--c-text);
    white-space: nowrap;
}

/* the slogan sits on two left-aligned lines at every size */
.final__phrase {
    display: block;
    white-space: nowrap;
}


/* ---------- Footer ------------------------------------------------------- */

.site-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 24px;
    padding-top: clamp(14px, 2.6vh, 30px);
    padding-bottom: max(clamp(16px, 3.4vh, 40px), env(safe-area-inset-bottom));
    border-top: var(--rule-w) solid var(--c-rule);
}

.copyright {
    font-size: var(--fs-legal);
    letter-spacing: 0.06em;
    color: var(--c-text-soft);
    white-space: nowrap;
}

/* if the line must wrap (small screens), it breaks before the patent note */
.copyright__patent {
    white-space: nowrap;
}

.progress {
    display: flex;
    gap: clamp(6px, 0.6vw, 10px);
}

.progress__mark {
    position: relative;
    width: clamp(26px, 3vw, 50px);
    height: 6px;
    border-radius: 3px;
    background: var(--c-marker);
}

/* larger invisible hit area */
.progress__mark::before {
    content: "";
    position: absolute;
    inset: -14px -3px;
}

.progress__mark {
    transition: background-color 0.35s ease;
}

.progress__mark:hover {
    background: var(--c-mint);
}

.progress__mark.is-active {
    background: var(--c-orange);
}

.replay {
    justify-self: end;
    font-family: var(--f-text);
    font-weight: 500;
    font-size: clamp(12px, 1vw, 16px);
    letter-spacing: 0.12em;
    color: var(--c-text);
    padding: 6px 0;
}

.replay:hover {
    color: var(--c-orange);
}


/* ---------- Phase 2 · animation support -------------------------------- */

/* Before the timelines take over, keep animated content out of sight.
   (Removed automatically if scripts fail — the static design shows.) */
.js-anim:not(.anim-ready) .site-header,
.js-anim:not(.anim-ready) .site-footer,
.js-anim:not(.anim-ready) .slide {
    visibility: hidden;
}

/* Masks: clip-path keeps the text baseline intact (overflow:hidden would not).
   Bottom edge clips; top and sides leave room for glyph overhang. */
.intro-logo__word,
.mask,
.word {
    display: inline-block;
    clip-path: inset(-0.35em -0.25em 0 -0.25em);
}

/* No permanent will-change: GSAP promotes layers only while a tween runs,
   so dozens of glyph spans don't hold GPU layers between animations. */
.char,
.mask__inner,
.word__inner {
    display: inline-block;
}

/* Slides 02–05: icon centred in the full stage (same optical centre as the
   intro logo). --text-h is the tallest headline block, measured in site.js,
   reserved equally above and below so the icon never meets the text. */
@media (min-width: 641px) {
    .slide--chapter {
        --art-gap: clamp(12px, 3vh, 36px);
    }

    .chapter__art {
        grid-row: 1 / -1;
        grid-column: 1;
        padding-block: calc(var(--text-h, 0px) + var(--art-gap));
    }

    /* Short screens (e.g. 1280×720 laptops): reserve a little less above the
       icon so it keeps a useful size; it stays near the optical centre. */
    @media (max-height: 820px) {
        .chapter__art {
            padding-top: calc(var(--text-h, 0px) * 0.55 + var(--art-gap));
        }
    }

    .chapter__text {
        grid-row: 2;
        grid-column: 1;
        position: relative;
        z-index: 1;
    }
}

/* Loop transition layer (COMING SOON line → MOD. dot) */
.transit {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    visibility: hidden;
    overflow: visible;
}

.transit__line {
    fill: none;
    stroke: var(--c-orange);
    stroke-linecap: butt;
    stroke-linejoin: round;
}

.transit__dot {
    fill: var(--c-orange);
}


/* ---------- Footer: narrower desktops / landscape tablets --------------
   The longer copyright line needs more room than a third of the footer,
   so the markers centre in the space between it and REPLAY INTRO.     */

@media (max-width: 1399px) {
    .site-footer {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .progress {
        justify-self: center;
    }
}


/* ---------- Tablet ------------------------------------------------------- */

@media (max-width: 900px) {
    :root {
        --icon-max-w: 480px;
        --icon-max-h: 340px;
    }

    .site-footer {
        column-gap: 16px;
    }
}


/* ---------- Two-row footer: portrait tablets and phones ------------------ */

@media (max-width: 999px) and (orientation: portrait), (max-width: 640px) {
    .site-footer {
        grid-template-columns: 1fr auto;
        row-gap: 14px;
    }

    .progress   { grid-column: 1; grid-row: 1; justify-self: start; }
    .replay     { grid-column: 2; grid-row: 1; }
    .copyright  { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
}


/* ---------- Mobile ------------------------------------------------------- */

@media (max-width: 640px) {
    :root {
        --fs-brand:     30px;
        --fs-brand-sub: 11px;
        --fs-intro:     clamp(76px, 24vw, 120px);
        --fs-chapter:   clamp(34px, min(12vw, 7vh), 56px);
        --fs-label:     15px;
        --fs-final:     clamp(52px, min(19vw, 13vh), 96px);
        --fs-small:     15px;
        --icon-max-w:   340px;
        --icon-max-h:   300px;
    }

    .brand__name {
        letter-spacing: 0.34em;
    }

    .counter--final {
        font-size: 18px;
    }

    .final__steps {
        font-size: clamp(11px, 3.4vw, 14px);
        letter-spacing: 0.2em;
    }

    .replay     { font-size: 12px; }
    .copyright  { font-size: 10.5px; }

    .progress__mark {
        width: clamp(22px, 7vw, 32px);
    }
}

/* Very short landscape screens (phones turned sideways) */
@media (max-height: 460px) and (orientation: landscape) {
    :root {
        --fs-brand: 24px;
    }

    .chapter__sub {
        display: none;
    }

    .copyright {
        font-size: 10.5px;
    }

    .slide--chapter {
        grid-template-rows: minmax(0, 1fr);
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: end;
    }

    .chapter__art {
        grid-column: 2;
        grid-row: 1;
        height: 100%;
        padding-block: 0;
    }

    .chapter__text {
        grid-column: 1;
        grid-row: 1;
    }

}
