/* ==========================================================
   CYBERFICTION — tokens
========================================================== */
:root {
    --bg: #efefec;
    --ink: #0c0c0c;
    --muted: #7c7c7a;
    --line: rgba(12, 12, 12, 0.12);
    --accent: #c8ff2e;
    --dark: #0b0b0b;
    --dark-2: #151515;
    --paper: #f1f1ee;

    --sans: "Space Grotesk", system-ui, sans-serif;
    --serif: "Instrument Serif", Georgia, serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;

    --gutter: clamp(16px, 3vw, 40px);
    --ease: cubic-bezier(0.76, 0, 0.24, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.is-loading {
    overflow: hidden;
}

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

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

img {
    display: block;
    max-width: 100%;
}

em {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.mono {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

::selection {
    background: var(--accent);
    color: var(--ink);
}

/* split helpers */
.line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.06em;
    margin-bottom: -0.06em;
}

.line-inner {
    display: block;
    will-change: transform;
}

.w {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
}

.wi {
    display: inline-block;
    will-change: transform;
}

/* ==========================================================
   Grain + cursor
========================================================== */
.grain {
    position: fixed;
    inset: -50%;
    z-index: 200;
    pointer-events: none;
    opacity: 0.07;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 0.8s steps(4) infinite;
}

@keyframes grain {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-3%, 2%); }
    50% { transform: translate(2%, -3%); }
    75% { transform: translate(-2%, -1%); }
    100% { transform: translate(0, 0); }
}

#cursor,
#cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 300;
    pointer-events: none;
    border-radius: 50%;
    display: none;
}

#cursor {
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 1px solid #fff;
    mix-blend-mode: difference;
    display: none;
    align-items: center;
    justify-content: center;
    transition: width 0.45s var(--ease-out), height 0.45s var(--ease-out), margin 0.45s var(--ease-out),
        background-color 0.3s, border-color 0.3s;
}

#cursor-dot {
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background: #fff;
    mix-blend-mode: difference;
}

.cursor-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--ink);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.25s, transform 0.4s var(--ease-out);
}

#cursor.is-label {
    width: 88px;
    height: 88px;
    margin: -44px 0 0 -44px;
    background: var(--accent);
    border-color: var(--accent);
    mix-blend-mode: normal;
}

#cursor.is-label .cursor-label {
    opacity: 1;
    transform: scale(1);
}

#cursor.is-down {
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
}

@media (hover: hover) and (pointer: fine) {
    #cursor { display: flex; }
    #cursor-dot { display: block; }
    body, a, button { cursor: none; }
}

/* ==========================================================
   Preloader
========================================================== */
#loader {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--dark);
    color: var(--paper);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--gutter);
    clip-path: inset(0 0 0 0);
}

.loader-top,
.loader-bottom {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: rgba(241, 241, 238, 0.55);
}

.loader-count {
    font-size: clamp(96px, 26vw, 380px);
    font-weight: 500;
    line-height: 0.8;
    letter-spacing: -0.06em;
    font-variant-numeric: tabular-nums;
    align-self: flex-end;
}

.loader-count sup {
    font-size: 0.18em;
    vertical-align: top;
    letter-spacing: 0;
    color: var(--accent);
    margin-left: 0.1em;
}

.loader-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: rgba(241, 241, 238, 0.08);
}

.loader-bar i {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
}

/* ==========================================================
   Nav + menu
========================================================== */
#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 120;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 18px var(--gutter);
    color: #fff;
    mix-blend-mode: difference;
}

.logo {
    font-size: 20px;
    font-weight: 400;
    letter-spacing: -0.01em;
    justify-self: start;
}

.logo b {
    font-weight: 700;
}

.logo sup {
    font-size: 0.6em;
}

.nav-hud {
    display: flex;
    align-items: center;
    gap: 10px;
    font-variant-numeric: tabular-nums;
}

.nav-hud b {
    font-weight: 500;
}

.hud-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: blink 1.4s steps(2) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.nav-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pill {
    padding: 10px 18px;
    border: 1px solid currentColor;
    border-radius: 999px;
}

.menu-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid currentColor;
    display: grid;
    place-content: center;
    gap: 6px;
}

.menu-btn span {
    display: block;
    width: 16px;
    height: 1px;
    background: currentColor;
    transition: transform 0.5s var(--ease);
}

body.menu-open .menu-btn span:first-child {
    transform: translateY(3.5px) rotate(45deg);
}

body.menu-open .menu-btn span:last-child {
    transform: translateY(-3.5px) rotate(-45deg);
}

#menu {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: var(--dark);
    color: var(--paper);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 110px var(--gutter) var(--gutter);
    clip-path: inset(0 0 100% 0);
    visibility: hidden;
}

.menu-inner {
    display: flex;
    flex-direction: column;
}

.menu-link {
    display: flex;
    align-items: baseline;
    gap: 20px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(241, 241, 238, 0.1);
    overflow: hidden;
}

.menu-link span {
    color: var(--accent);
    width: 28px;
}

.menu-link em {
    display: inline-block;
    font-size: clamp(40px, 8.5vh, 96px);
    line-height: 1;
    transition: transform 0.6s var(--ease-out), color 0.3s;
}

.menu-link:hover em {
    transform: translateX(24px);
    color: var(--accent);
}

.menu-foot {
    display: flex;
    justify-content: space-between;
    color: rgba(241, 241, 238, 0.5);
}

/* ==========================================================
   Rail
========================================================== */
#rail {
    position: fixed;
    right: var(--gutter);
    top: 50%;
    z-index: 100;
    transform: translateY(-50%);
    display: flex;
    gap: 10px;
    align-items: stretch;
    height: 34vh;
    transition: opacity 0.5s;
}


.rail-track {
    width: 1px;
    background: var(--line);
    position: relative;
}

.rail-track i {
    position: absolute;
    inset: 0;
    background: var(--ink);
    transform: scaleY(0);
    transform-origin: top;
}

.rail-ticks {
    list-style: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--muted);
    font-size: 10px;
}

.rail-ticks li {
    transition: color 0.3s, transform 0.4s var(--ease-out);
}

.rail-ticks li.is-active {
    color: var(--ink);
    transform: translateX(-4px);
}

/* ==========================================================
   Story — sticky frame sequence
========================================================== */
#story {
    position: relative;
    height: 900vh;
}

.anchor {
    position: absolute;
    left: 0;
    width: 1px;
    height: 1px;
}

.stage {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
}

.backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.grid-lines {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line) 1px, transparent 1px);
    background-size: calc(100% / 12) calc(100% / 6);
    mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
    opacity: 0.55;
}

.marquee {
    position: absolute;
    top: 30%;
    left: 0;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.marquee-track {
    display: flex;
    width: max-content;
    will-change: transform;
}

.marquee-item {
    font-size: clamp(64px, 9vw, 150px);
    font-weight: 400;
    letter-spacing: -0.045em;
    line-height: 1;
    padding-right: 0.2em;
}

.marquee-item b {
    font-weight: 700;
}

.marquee-item em {
    letter-spacing: -0.02em;
}

.outline {
    color: transparent;
    -webkit-text-stroke: 1.2px var(--ink);
    font-weight: 600;
}

.giant-word {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: clamp(140px, 34vw, 620px);
    font-weight: 700;
    letter-spacing: -0.07em;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(12, 12, 12, 0.14);
    opacity: 0;
    user-select: none;
}

#frames {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
}

.chapter {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    visibility: hidden;
}

.chapter.ch-0 {
    visibility: visible;
}

.intro {
    position: absolute;
    left: var(--gutter);
    bottom: 18vh;
    max-width: 26ch;
    font-size: clamp(18px, 1.6vw, 24px);
    line-height: 1.25;
    color: var(--muted);
    letter-spacing: -0.01em;
}

.scroll-cue {
    position: absolute;
    left: var(--gutter);
    bottom: var(--gutter);
    display: flex;
    align-items: center;
    gap: 14px;
}

.cue-line {
    position: relative;
    width: 64px;
    height: 1px;
    background: var(--line);
    overflow: hidden;
}

.cue-line i {
    position: absolute;
    inset: 0;
    background: var(--ink);
    animation: cue 2.2s var(--ease) infinite;
}

@keyframes cue {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

.coords {
    position: absolute;
    right: calc(var(--gutter) + 48px);
    bottom: var(--gutter);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    color: var(--muted);
}

.ch-block {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ch-block.left {
    left: var(--gutter);
    top: 24vh;
}

.ch-block.right {
    right: calc(var(--gutter) + 56px);
    bottom: 16vh;
    text-align: right;
    align-items: flex-end;
}

.ch-block h2 {
    font-size: clamp(38px, 4.6vw, 84px);
    font-weight: 500;
    line-height: 0.98;
    letter-spacing: -0.045em;
    text-transform: uppercase;
}

.ch-block h2 em {
    text-transform: none;
    font-size: 1.08em;
}

.ch-block h2.huge {
    font-size: clamp(52px, 7vw, 132px);
    line-height: 0.9;
}

.ch-block .label {
    color: var(--muted);
}

.ch-block.small p {
    max-width: 32ch;
    font-size: clamp(16px, 1.3vw, 20px);
    line-height: 1.35;
    color: var(--muted);
}

.ch-3 .ch-block.right {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

/* ==========================================================
   Manifesto
========================================================== */
#manifesto {
    position: relative;
    background: var(--dark);
    color: var(--paper);
    padding: 16vh var(--gutter) 14vh;
    border-radius: 28px 28px 0 0;
    margin-top: -28px;
    z-index: 5;
}

.section-head {
    display: flex;
    justify-content: space-between;
    color: rgba(241, 241, 238, 0.45);
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(241, 241, 238, 0.12);
    margin-bottom: 10vh;
}

.manifesto-text {
    font-size: clamp(34px, 5.2vw, 96px);
    font-weight: 500;
    line-height: 1.02;
    letter-spacing: -0.04em;
    max-width: 18ch;
}

.manifesto-text .sw {
    color: rgba(241, 241, 238, 0.13);
    transition: none;
}

.pillars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin-top: 16vh;
    background: rgba(241, 241, 238, 0.12);
    border: 1px solid rgba(241, 241, 238, 0.12);
}

.pillar {
    position: relative;
    background: var(--dark);
    padding: 32px 28px 40px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: color 0.5s var(--ease);
}

.pillar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.6s var(--ease);
    z-index: 0;
}

.pillar > * {
    position: relative;
    z-index: 1;
}

.pillar span {
    color: var(--accent);
    transition: color 0.4s;
}

.pillar h3 {
    margin-top: auto;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(56px, 6vw, 104px);
    line-height: 1;
    letter-spacing: -0.02em;
}

.pillar p {
    margin-top: 14px;
    max-width: 30ch;
    color: rgba(241, 241, 238, 0.55);
    line-height: 1.4;
    transition: color 0.4s;
}

@media (hover: hover) {
    .pillar:hover {
        color: var(--ink);
    }
    .pillar:hover::before {
        transform: scaleY(1);
    }
    .pillar:hover span,
    .pillar:hover p {
        color: var(--ink);
    }
}

/* ==========================================================
   Citizen
========================================================== */
#citizen {
    position: relative;
    z-index: 5;
    background: var(--dark);
    color: var(--paper);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6vw;
    align-items: center;
    padding: 10vh var(--gutter) 18vh;
}

.citizen-copy {
    display: flex;
    flex-direction: column;
    gap: 26px;
    align-items: flex-start;
}

.citizen-copy .label {
    color: rgba(241, 241, 238, 0.45);
}

.citizen-copy h2 {
    font-size: clamp(48px, 6.4vw, 120px);
    font-weight: 500;
    line-height: 0.92;
    letter-spacing: -0.05em;
    text-transform: uppercase;
}

.citizen-copy h2 em {
    text-transform: none;
    color: var(--accent);
}

.citizen-copy p {
    max-width: 34ch;
    color: rgba(241, 241, 238, 0.55);
    font-size: 18px;
    line-height: 1.4;
}

.cta {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 18px;
    padding: 20px 30px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--ink);
    font-weight: 500;
    overflow: hidden;
    margin-top: 10px;
}

.cta::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--paper);
    border-radius: inherit;
    transform: translateY(101%);
    transition: transform 0.55s var(--ease);
}

.cta:hover::before {
    transform: translateY(0);
}

.cta > span {
    position: relative;
}

.cta-arrow {
    transition: transform 0.5s var(--ease);
}

.cta:hover .cta-arrow {
    transform: translateX(6px) rotate(-45deg);
}

.card-wrap {
    perspective: 1200px;
    display: grid;
    place-items: center;
}

.card {
    position: relative;
    width: min(440px, 100%);
    aspect-ratio: 3 / 4;
    border-radius: 22px;
    background:
        radial-gradient(120% 80% at 50% 0%, #2a2a2a 0%, #121212 60%),
        var(--dark-2);
    border: 1px solid rgba(241, 241, 238, 0.12);
    overflow: hidden;
    transform-style: preserve-3d;
    will-change: transform;
    display: flex;
    flex-direction: column;
    box-shadow: 0 60px 120px -40px rgba(0, 0, 0, 0.8);
}

.card img {
    flex: 1;
    min-height: 0;
    width: 100%;
    object-fit: cover;
    object-position: top;
    transform: translateZ(40px) scale(1.02);
}

.card-top {
    display: flex;
    justify-content: space-between;
    padding: 18px 20px 0;
    color: rgba(241, 241, 238, 0.5);
    transform: translateZ(30px);
}

.card-top span:last-child {
    color: var(--accent);
}

.card-bottom {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid rgba(241, 241, 238, 0.12);
    transform: translateZ(30px);
}

.card-bottom > div {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-bottom > div + div {
    border-left: 1px solid rgba(241, 241, 238, 0.12);
}

.card-bottom .mono {
    font-size: 9px;
    color: rgba(241, 241, 238, 0.45);
}

.card-bottom b {
    font-weight: 500;
    font-size: 14px;
}

.card-shine {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background: radial-gradient(
        circle at var(--mx, 50%) var(--my, 30%),
        rgba(200, 255, 46, 0.22),
        rgba(120, 200, 255, 0.08) 30%,
        transparent 60%
    );
    mix-blend-mode: screen;
}

/* ==========================================================
   Footer
========================================================== */
#footer {
    position: relative;
    z-index: 5;
    background: var(--accent);
    color: var(--ink);
    padding: 28px var(--gutter) 0;
    overflow: hidden;
}

.footer-row {
    display: flex;
    justify-content: space-between;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(12, 12, 12, 0.2);
}

.to-top {
    transition: opacity 0.3s;
}

.to-top:hover {
    opacity: 0.55;
}

.wordmark {
    display: flex;
    justify-content: space-between;
    font-size: 15.2vw;
    font-weight: 700;
    letter-spacing: -0.06em;
    line-height: 0.78;
    padding: 4vh 0 1.5vh;
    overflow: hidden;
}

.wordmark span {
    display: inline-block;
    will-change: transform;
}

/* ==========================================================
   Responsive
========================================================== */
@media (max-width: 900px) {
    .nav-hud {
        display: none;
    }

    #nav {
        grid-template-columns: 1fr auto;
    }

    .pill {
        display: none;
    }

    #rail {
        display: none;
    }

    .marquee {
        top: 13vh;
    }

    .intro {
        top: 30vh;
        bottom: auto;
        right: var(--gutter);
    }

    .coords {
        display: none;
    }

    .ch-block.left {
        top: 13vh;
        right: var(--gutter);
    }

    .ch-block.right {
        right: var(--gutter);
        left: var(--gutter);
        top: 33vh;
        bottom: auto;
    }

    .ch-3 .ch-block.right {
        top: 13vh;
        transform: none;
    }

    .ch-2 .ch-block.right {
        top: 38vh;
    }

    .ch-block h2 {
        font-size: clamp(32px, 9vw, 56px);
    }

    .ch-block h2.huge {
        font-size: clamp(42px, 12vw, 72px);
    }


    .pillars {
        grid-template-columns: 1fr;
    }

    .pillar {
        min-height: 220px;
    }

    #citizen {
        grid-template-columns: 1fr;
        gap: 60px;
    }

    .menu-foot {
        flex-direction: column;
        gap: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .grain,
    .hud-dot,
    .cue-line i {
        animation: none;
    }
}
