@font-face {
    font-family: "Space Grotesk";
    src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

@property --accent {
    syntax: "<color>";
    inherits: true;
    initial-value: #d4a574;
}

:root {
    --bg: #07070c;
    --fg: #f2ede6;
    --mut: rgba(242, 237, 230, 0.58);
    --line: rgba(242, 237, 230, 0.16);
    --accent: #d4a574;
    --pad: clamp(20px, 5vw, 72px);
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    transition: --accent 0.9s ease;
}

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

html {
    background:
        radial-gradient(70% 55% at 50% 25%, color-mix(in srgb, var(--accent) 16%, transparent), transparent),
        var(--bg);
    background-attachment: fixed;
    color: var(--fg);
    font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
}
html { scrollbar-width: thin; scrollbar-color: rgba(242, 237, 230, 0.25) transparent; }
html.js:not(.ready) { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body { min-height: 100svh; overflow-x: clip; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--accent); color: var(--bg); }

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

/* 4-point star, pure CSS (no glyph dependency) */
.sep {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    background: var(--accent);
    clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
    vertical-align: -0.08em;
    margin: 0 0.35em;
}

.live { color: var(--accent); }
.live i {
    display: inline-block;
    width: 0.55em;
    height: 0.55em;
    border-radius: 50%;
    background: currentColor;
    margin-right: 0.5em;
    animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

/* ------------------------------------------------------------------ canvas */
#gl {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    display: block;
    opacity: 0;
    transition: opacity 1.2s ease;
    pointer-events: none;
}
html.gl #gl { opacity: 1; }

/* ------------------------------------------------------------------ HUD */
.frame i {
    position: fixed;
    width: 14px;
    height: 14px;
    z-index: 20;
    pointer-events: none;
    border: 0 solid var(--mut);
    transition: opacity 1s 0.8s;
}
html.js .frame i { opacity: 0; }
html.ready .frame i { opacity: 0.7; }
.frame i:nth-child(1) { top: 10px; left: 10px; border-width: 1px 0 0 1px; }
.frame i:nth-child(2) { top: 10px; right: 10px; border-width: 1px 1px 0 0; }
.frame i:nth-child(3) { bottom: 10px; left: 10px; border-width: 0 0 1px 1px; }
.frame i:nth-child(4) { bottom: 10px; right: 10px; border-width: 0 1px 1px 0; }

.hud-top, .hud-bot {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 max(var(--pad), env(safe-area-inset-left));
    pointer-events: none;
    transition: opacity 0.9s 0.7s, transform 0.9s 0.7s var(--ease);
}
html.js .hud-top, html.js .hud-bot { opacity: 0; transform: translateY(-8px); }
html.js .hud-bot { transform: translateY(8px); }
.hud-top { top: max(22px, env(safe-area-inset-top)); }
.hud-bot { bottom: max(22px, env(safe-area-inset-bottom)); }
html.ready .hud-top, html.ready .hud-bot { opacity: 1; transform: none; }
.hud-top a, .hud-bot button { pointer-events: auto; }
.logo { display: inline-flex; align-items: center; }
.logo .sep { margin-left: 0; }
.meta { display: flex; gap: 1.4em; color: var(--mut); }
.meta #hudChap { color: var(--accent); }
.meta span { font-variant-numeric: tabular-nums; }

.hud-bot { color: var(--mut); }
.hint { display: flex; align-items: center; gap: 0.9em; transition: opacity 0.5s; }
.hint::before { content: ""; width: 1px; height: 28px; background: linear-gradient(var(--accent), transparent); animation: drip 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }
html.scrolled .hint { opacity: 0; }
.clock { position: absolute; left: 50%; transform: translateX(-50%); }
.clock span { font-variant-numeric: tabular-nums; color: var(--fg); }
.pager { display: flex; gap: 1.6em; }
.pager button { padding: 0.8em 0; color: var(--fg); letter-spacing: inherit; font-family: inherit; font-size: inherit; text-transform: inherit; }
.pager button:hover { color: var(--accent); }
.pager button[aria-disabled="true"] { opacity: 0.3; pointer-events: none; }
button:focus-visible, a:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

.rail {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: opacity 0.9s 0.8s;
}
html.js .rail { opacity: 0; }
html.ready .rail { opacity: 1; }
.rail a { display: flex; align-items: center; justify-content: flex-end; gap: 10px; color: var(--mut); padding: 4px 0; }
.rail a span { font-size: 10px; opacity: 0; transform: translateX(6px); transition: 0.4s var(--ease); }
.rail a::after { content: ""; width: 14px; height: 1px; background: currentColor; transition: width 0.5s var(--ease), background 0.3s; }
.rail a.on { color: var(--accent); }
.rail a.on::after { width: 30px; }
.rail a.on span, .rail a:hover span { opacity: 1; transform: none; }

/* ------------------------------------------------------------------ sections */
.sec { position: relative; min-height: 100svh; padding: 14svh var(--pad); display: flex; flex-direction: column; justify-content: center; }

.hero { padding-top: 16svh; padding-bottom: 14svh; }
.eyebrow { color: var(--mut); margin-bottom: 2.2svh; }
.eyebrow .live { margin-left: 1em; }

.hero h1 {
    font-size: min(18vw, 24svh);
    font-weight: 700;
    line-height: 0.86;
    letter-spacing: -0.03em;
}
.hero h1 .ln { display: block; white-space: nowrap; }
.hero h1 .acc { color: transparent; -webkit-text-stroke: 1.5px var(--accent); }
.sub { margin-top: 3.5svh; color: var(--mut); }

.label { display: flex; align-items: center; gap: 1em; color: var(--accent); }
.label i { width: 36px; height: 1px; background: currentColor; }

.stmt {
    font-size: clamp(2.8rem, min(9.4vw, 13svh), 9.5rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.035em;
    margin: 0.35em 0 0.45em;
}
.stmt .ln { display: block; white-space: nowrap; }
.stmt .acc { color: var(--accent); }
.stmt .ln:not(.acc) + .ln.acc { margin-top: 0.2em; }
.lead { max-width: 30ch; font-size: clamp(1.05rem, 1.5vw, 1.4rem); line-height: 1.45; color: var(--mut); }

.bignum {
    position: absolute;
    right: calc(var(--pad) * 0.6);
    top: 50%;
    z-index: -1;
    font-size: clamp(12rem, 44vw, 40rem);
    font-weight: 700;
    line-height: 0.75;
    letter-spacing: -0.06em;
    color: transparent;
    -webkit-text-stroke: 1px color-mix(in srgb, var(--accent) 35%, transparent);
    pointer-events: none;
    user-select: none;
    margin-top: -0.35em;
    will-change: transform;
}
.alt { align-items: flex-end; text-align: right; }
.alt .label { flex-direction: row-reverse; }
.alt .bignum { right: auto; left: calc(var(--pad) * 0.6); }

/* split letters */
.l { display: inline-block; will-change: transform; }
.li {
    display: inline-block;
    opacity: 0;
    transform: translate3d(0, 55%, 0) rotate(7deg) scale(0.92);
    filter: blur(10px);
    transition: transform 1.1s var(--ease), opacity 0.7s ease, filter 0.9s ease;
}
.w { display: inline-block; white-space: nowrap; }

html.ready .hero .li, .sec.in .li {
    opacity: 1;
    transform: none;
    filter: none;
    transition-delay: calc(var(--d, 0s) + var(--i) * 28ms);
}
html.ready .hero .li { transition-delay: calc(0.15s + var(--i) * 45ms); }

.label, .lead, .eyebrow, .sub { transition: opacity 0.9s ease, transform 0.9s var(--ease); }
html.js .label, html.js .lead, html.js .eyebrow, html.js .sub { opacity: 0; transform: translateY(14px); }
html.ready .hero .eyebrow, html.ready .hero .sub, .sec.in .label, .sec.in .lead { opacity: 1; transform: none; }
html.ready .hero .eyebrow { transition-delay: 0.1s; }
html.ready .hero .sub { transition-delay: 0.9s; }
.sec.in .lead { transition-delay: 0.7s; }
.sec.in .label { transition-delay: 0.1s; }

/* ------------------------------------------------------------------ marquee */
.mq {
    position: relative;
    overflow: hidden;
    padding: 2svh 0;
    border-block: 1px solid var(--line);
    background: rgba(7, 7, 12, 0.35);
}
.mq-track { display: flex; width: max-content; will-change: transform; }
.mq-item {
    display: flex;
    align-items: center;
    flex: none;
    font-size: clamp(3.4rem, 12vw, 11rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.05;
    text-transform: uppercase;
    white-space: nowrap;
}
.mq-item .sep { width: 0.4em; height: 0.4em; margin: 0 0.45em; }
.mq-item .o { color: transparent; -webkit-text-stroke: 1.5px var(--fg); }

/* ------------------------------------------------------------------ index */
.fin { justify-content: flex-end; padding-bottom: calc(12svh + env(safe-area-inset-bottom)); }
.idx { margin: 6svh 0 10svh; }
.idx a {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 1.2em;
    padding: 0.18em 0;
    border-top: 1px solid var(--line);
    font-size: clamp(3rem, min(11vw, 14svh), 10rem);
    font-weight: 600;
    letter-spacing: -0.045em;
    line-height: 1;
    overflow: hidden;
    transition: color 0.5s var(--ease), padding 0.6s var(--ease);
}
.idx a:last-child { border-bottom: 1px solid var(--line); }
.idx a .mono { color: var(--accent); min-width: 2.4em; }
.idx a b { font-weight: inherit; flex: 1; }
.idx a .arr { font-family: var(--mono); font-size: 0.4em; color: var(--accent); transition: transform 0.6s var(--ease); }
.idx a::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--accent); transform: scaleY(0); transform-origin: bottom; transition: transform 0.6s var(--ease); }
@media (hover: hover) {
    .idx a:hover { color: var(--bg); padding-left: 0.4em; }
    .idx a:hover::before { transform: scaleY(1); }
    .idx a:hover .mono, .idx a:hover .arr { color: var(--bg); }
    .idx a:hover .arr { transform: translateX(-0.6em); }
}
.foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--mut); }
.foot a { margin-left: 1.4em; }
.foot a:hover { color: var(--accent); }

/* ------------------------------------------------------------------ cursor ring */
.ring {
    position: fixed;
    left: 0;
    top: 0;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    z-index: 90;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s, width 0.4s var(--ease), height 0.4s var(--ease), margin 0.4s var(--ease);
    will-change: transform;
}
html.ready.has-pointer .ring { opacity: 0.8; }
.ring.big { width: 70px; height: 70px; margin: -35px 0 0 -35px; }
@media (hover: none) { .ring { display: none; } }

/* ------------------------------------------------------------------ small screens */
@media (max-width: 700px) {
    .mono { font-size: 10px; letter-spacing: 0.1em; }
    .clock, .frame, .rail a span { display: none; }
    .rail { right: 10px; gap: 10px; }
    .meta { gap: 0.9em; }
    #hudPct { display: none; }
    .sec { padding-block: 13svh; }
    .stmt { font-size: clamp(2.6rem, 13.2vw, 5.5rem); }
    .idx a { font-size: clamp(2.6rem, 15vw, 5rem); gap: 0.8em; }
    .bignum { font-size: 62vw; opacity: 0.8; }
}
@media (max-aspect-ratio: 1/1) and (min-width: 701px) {
    .hero h1 { font-size: min(17vw, 20svh); }
}

/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
    .li, .label, .lead, .eyebrow, .sub, .hud-top, .hud-bot, .rail, .frame i {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        transition: none !important;
    }
    .live i, .hint::before { animation: none; }
}
