/* ================================================================
   Runner — full-viewport WebGL hero.
   Loaded after site.css, which supplies the nav, .wrap and the tokens.
   This page is dark in both themes: the scene has one palette.
   ================================================================ */

:root {
    /* --runner-bg, -teal, -warm and -tint are overwritten by scene.js from
       the active palette; these match the default one so nothing flashes. */
    --runner-bg: #07060d;
    --runner-ink: #eef1f8;
    --runner-ink-soft: #a7b2c6;
    --runner-teal: #2b5fd6;
    --runner-warm: #e03bff;
    --runner-tint: #3bffe6;
    --runner-red: #ff3b59;
    --runner-nav-height: 64px;
}

html, body.runner-page { background: var(--runner-bg); }

body.runner-page { color: var(--runner-ink); }

/* The canvas stays put while the page scrolls over it; scroll position is
   what moves the camera. */
#runner-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.runner-ready #runner-canvas { opacity: 1; }

/* Pulled up under the sticky nav so the hero is a true 100vh and scroll
   progress through it runs 0 to 1 over exactly one viewport. */
#runner-hero {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100svh;
    margin-top: calc(-1 * var(--runner-nav-height) - 1px);
    padding: var(--runner-nav-height) 1.5rem 0;
    text-align: center;
    scroll-margin-top: 0;
}

.runner-copy { max-width: 46rem; }

.runner-eyebrow {
    display: block;
    margin-bottom: 0.9rem;
    color: var(--runner-teal);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.runner-copy h1 {
    margin: 0;
    font-size: clamp(3rem, 11vw, 7.5rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.04em;
    text-shadow: 0 2px 30px rgba(7, 8, 11, 0.85);
}

.runner-sub {
    margin: 1.1rem auto 0;
    max-width: 34rem;
    color: var(--runner-ink-soft);
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    text-shadow: 0 1px 14px rgba(7, 8, 11, 0.95);
}

#runner-status {
    min-height: 1.4em;
    margin: 1.25rem 0 0;
    color: var(--runner-ink-soft);
    font-size: 0.85rem;
}

.runner-play { margin-top: 0.5rem; }

.runner-scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 1.75rem;
    transform: translateX(-50%);
    color: var(--runner-ink-soft);
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.runner-scroll-cue::after {
    content: "";
    display: block;
    width: 1px;
    height: 2rem;
    margin: 0.6rem auto 0;
    background: linear-gradient(var(--runner-ink-soft), transparent);
}

/* No WebGL: keep the hero readable over a flat wash of the scene's colours. */
.runner-failed #runner-hero {
    background:
        radial-gradient(60% 50% at 50% 60%, rgba(255, 59, 89, 0.16), transparent 70%),
        radial-gradient(50% 40% at 30% 40%, rgba(43, 141, 178, 0.18), transparent 70%);
}

/* ---------------------- Notes ---------------------- */

/* Solid, so that once the hero has left the screen (and the scene has paused)
   the frozen canvas is fully covered. The gradient above it is the hand-off. */
#runner-notes {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 4rem 0 5rem;
    background: var(--runner-bg);
    scroll-margin-top: 80px;
}

#runner-notes::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 22vh;
    background: linear-gradient(transparent, var(--runner-bg));
    pointer-events: none;
}

#runner-notes h2 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.6rem, 3.5vw, 2.25rem);
    letter-spacing: -0.02em;
}

.runner-lede {
    max-width: 44rem;
    margin: 0 0 2.25rem;
    color: var(--runner-ink-soft);
}

.runner-notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.runner-note {
    padding: 1.25rem 1.35rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
}

/* ---------------------- Note diagrams ----------------------
   Shared vocabulary for the six inline SVGs: dim structure lines, a cool and
   a warm accent taken from the scene's palette, and small mono labels. */

.runner-fig {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 0 1rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.025);
}

.runner-fig text {
    fill: var(--runner-ink-soft);
    font: 500 8.5px 'JetBrains Mono', 'Consolas', monospace;
    letter-spacing: 0.03em;
}

.runner-fig .f-dim { fill: none; stroke: rgba(255, 255, 255, 0.18); stroke-width: 1; }
.runner-fig .f-line { fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.runner-fig .f-line.f-dim { stroke-width: 1.75; stroke: rgba(255, 255, 255, 0.3); }
.runner-fig .f-cool { stroke: var(--runner-tint); }
.runner-fig .f-warm { stroke: var(--runner-warm); }
.runner-fig .f-fill-cool { fill: var(--runner-tint); }
.runner-fig .f-fill-warm { fill: var(--runner-warm); }
.runner-fig .f-dash { stroke-dasharray: 3 4; }
.runner-fig .f-glow { stroke-width: 7; }

.runner-fig .f-chip rect {
    fill: rgba(255, 255, 255, 0.05);
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 1;
}

/* The pulse is the strand drawn again in white with all but a short dash
   hidden; pathLength="100" on the path makes the dash pattern a percentage. */
.runner-fig .f-pulse {
    stroke: #fff;
    stroke-width: 2.5;
    stroke-dasharray: 14 86;
    stroke-dashoffset: 60;
}

/* A marker that rides the camera path drawn in the same SVG. */
.runner-fig .f-cam {
    fill: #fff;
    offset-path: path("M150,135C180,135 200,128 212,112C224,96 240,90 238,72C236,42 208,20 176,16");
    offset-distance: 35%;
}

@media (prefers-reduced-motion: no-preference) {
    .runner-fig .f-pulse { animation: runner-fig-pulse 2.4s linear infinite; }
    .runner-fig .f-pulse-late { animation-delay: -1.1s; }
    .runner-fig .f-cam { animation: runner-fig-cam 7s ease-in-out infinite alternate; }
}

@keyframes runner-fig-pulse {
    from { stroke-dashoffset: 100; }
    to { stroke-dashoffset: 0; }
}

@keyframes runner-fig-cam {
    from { offset-distance: 0%; }
    to { offset-distance: 100%; }
}

.runner-note h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.runner-note p {
    margin: 0;
    color: var(--runner-ink-soft);
    font-size: 0.92rem;
}

.runner-credit {
    margin: 2.25rem 0 0;
    color: var(--runner-ink-soft);
    font-size: 0.85rem;
}

.runner-credit a,
.runner-lede a {
    color: var(--runner-ink);
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
    text-underline-offset: 2px;
}

body.runner-page footer {
    position: relative;
    z-index: 1;
}

/* lil-gui (only present with ?debug) sits under the sticky nav by default. */
.lil-gui.root { top: calc(var(--runner-nav-height) + 8px) !important; z-index: 60; }

@media (prefers-reduced-motion: reduce) {
    #runner-canvas { transition: none; }
}
