/* OP_FLYBRAIN site.
   Theme: a signal on a dark screen. Deep blue-black page, one accent: the cyan of a live trace.
   The same dark theme is used for every visitor.
   Shape rule: panels 10px, buttons and inputs 8px, pixels square. */

:root {
  --bg: #060911;
  --surface: #0D1422;
  --ink: #E9EEF8;
  --muted: #8E9BB3;
  --line: #1D2739;
  --accent: #38D6FF;
  --accent-ink: #03131C;
  --dot-off: #131C2D;
  --series-2: #93A1B8;
  --code-bg: #03060C;
  --code-ink: #E9EEF8;
  --code-op: #38D6FF;
  --r-panel: 10px;
  --r-control: 8px;
  --sans: "Schibsted Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --page: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
code, pre, kbd { font-family: var(--mono); }
p code, dd code, li code { font-size: 0.84em; font-weight: 600; letter-spacing: -0.01em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: var(--gutter); top: -60px; z-index: 30;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r-control);
}
.skip:focus { top: 10px; }

.wrap { max-width: var(--page); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- navigation (z-index scale: nav 20, skip link 30) ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-in { display: flex; align-items: center; gap: 28px; height: 68px; }
.mark { font-family: var(--mono); font-weight: 700; font-size: 0.95rem; letter-spacing: -0.01em; text-decoration: none; }
.nav-links { display: flex; gap: 26px; margin-left: auto; font-size: 0.95rem; }
.nav-links a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.nav-links a:hover { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 20px; border-radius: var(--r-control);
  font: inherit; font-size: 1rem; font-weight: 700; white-space: nowrap; text-decoration: none;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 0.92rem; }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn[disabled]:hover { background: transparent; color: var(--ink); }
.btn-primary[disabled]:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- shared section rhythm ---------- */
.band { padding-block: clamp(72px, 9vw, 132px); border-top: 1px solid var(--line); }
.band h2 {
  font-size: clamp(1.9rem, 3.5vw, 3.1rem); font-weight: 800; line-height: 1.06;
  letter-spacing: -0.028em; max-width: 21ch; text-wrap: balance;
}
.lede { margin-top: 20px; max-width: 62ch; color: var(--muted); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(28px, 5vw, 64px) clamp(48px, 6vw, 88px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(28px, 4.5vw, 72px); align-items: center;
}
.status { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); font-weight: 600; }
.hero h1 {
  margin-top: 18px;
  font-size: clamp(2.4rem, 4vw, 3.25rem); font-weight: 800; line-height: 1.02;
  letter-spacing: -0.035em; text-wrap: balance;
}
.hero-sub { margin-top: 24px; max-width: 34ch; font-size: 1.25rem; line-height: 1.45; color: var(--muted); }
.hero-cta { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }

.scope { min-width: 0; }
.scope-frame { background: var(--surface); border-radius: var(--r-panel); padding: clamp(10px, 1.4vw, 18px); }
#wave { display: block; width: 100%; aspect-ratio: 480 / 330; image-rendering: pixelated; }
.hops { display: flex; margin-top: 8px; height: 22px; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); }
.hops span { display: flex; align-items: center; justify-content: center; border-left: 1px solid var(--muted); min-width: 0; }
.hops span:last-child {
  border-right: 1px solid var(--muted);
  background: repeating-linear-gradient(135deg, transparent 0 4px, var(--line) 4px 5px);
}
.scope-controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.scope-controls label { font-size: 0.9rem; color: var(--muted); }
.scope-controls input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; }
.readout { margin-top: 12px; font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; min-height: 2.4em; }
.scope figcaption { margin-top: 10px; font-size: 0.92rem; line-height: 1.5; color: var(--muted); max-width: 64ch; }

/* ---------- why: large reading text, pushed off the left edge ---------- */
.why-body { margin-top: 44px; margin-left: clamp(0px, 16vw, 260px); max-width: 38ch; font-size: clamp(1.3rem, 2.1vw, 1.75rem); line-height: 1.38; letter-spacing: -0.012em; }
.why-body p + p { margin-top: 1.1em; }
/* each paragraph comes into focus as it is read; browsers without scroll timelines show it plain */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .why-body p { animation: read-in linear both; animation-timeline: view(); animation-range: entry 5% cover 38%; }
    @keyframes read-in { from { opacity: 0.18; } to { opacity: 1; } }
  }
}

/* ---------- how: a scroll film. Scrolling plays the real computation: Load, Mix, Read.
   Without .film-live (no script, reduced motion, short screens) it is a plain static layout. */
.film { margin-top: 52px; }
.film-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr); gap: clamp(28px, 4.5vw, 72px); align-items: center; }
.film-steps { display: none; }
.chapter + .chapter { margin-top: 40px; }
.chapter h3 { font-size: clamp(2rem, 3.6vw, 3.25rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.chapter .count { margin-top: 12px; font-family: var(--mono); font-size: 0.82rem; color: var(--accent); font-weight: 600; }
.chapter p { margin-top: 16px; max-width: 40ch; }
.chapter .film-note { font-family: var(--mono); font-size: 0.78rem; line-height: 1.6; color: var(--muted); }
.film-view { position: relative; margin: 0; background: var(--surface); border-radius: var(--r-panel); padding: clamp(10px, 1.4vw, 18px); }
.film-clip { overflow: hidden; border-radius: 4px; }
.film-cam { transform-origin: 0 100%; background: var(--surface); }
.film-scale { overflow: hidden; }   /* the hop ruler stretches sideways with the camera, text stays its own size */
#film-canvas { display: block; width: 100%; aspect-ratio: 480 / 330; image-rendering: pixelated; }
.film-out { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; pointer-events: none; }
.film-out .bits { width: min(48%, 320px); gap: 3px; }
.film-after { margin-top: 52px; }

.film-live { height: 500vh; }
.film-live .film-stage { position: sticky; top: 69px; height: calc(100dvh - 69px); display: grid; align-items: center; }
.film-live .film-steps { display: flex; gap: 14px; margin-bottom: 30px; font-size: 0.95rem; font-weight: 700; color: var(--muted); }
.film-live .film-steps li { flex: 1; padding-top: 10px; border-top: 2px solid var(--line); transition: color 0.35s ease, border-color 0.35s ease; }
.film-live .film-steps li.is-on { color: var(--ink); border-top-color: var(--accent); }
.film-live .chapters { display: grid; }
.film-live .chapter { grid-area: 1 / 1; margin: 0; opacity: 0; transform: translateY(18px); visibility: hidden; }
.film-live .chapter.is-on { opacity: 1; transform: none; visibility: visible; }
/* the crossfade is switched on one frame after the film starts, so the first state appears with no fade */
.film-anim .chapter { transition: opacity 0.28s cubic-bezier(0.3, 0, 1, 1), transform 0.28s cubic-bezier(0.3, 0, 1, 1), visibility 0s linear 0.28s; }
.film-anim .chapter.is-on { transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.14s, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.14s, visibility 0s; }
.film-live .film-cam, .film-live .film-clip, .film-live .film-out { will-change: transform, opacity; }
.film-live .hops span { overflow: hidden; white-space: nowrap; }

.rule { margin-top: 0; padding: 22px clamp(18px, 2vw, 30px); background: var(--surface); border-radius: var(--r-panel); overflow-x: auto; }
.rule code { font-size: clamp(0.72rem, 1.15vw, 0.92rem); white-space: nowrap; }
.rule .op { color: var(--accent); font-weight: 700; }
.fineprint { margin-top: 40px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 4vw, 64px); }
.fineprint h3 { font-size: 1.1rem; font-weight: 700; }
.fineprint p { margin-top: 8px; color: var(--muted); font-size: 1rem; max-width: 52ch; }

/* ---------- the instruction ---------- */
.script-grid { margin-top: 52px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 80px); align-items: start; }
.script { margin: 0; background: var(--code-bg); color: var(--code-ink); border-radius: var(--r-panel); padding: 22px 24px; overflow-x: auto; }
.script code { font-size: clamp(0.7rem, 1.05vw, 0.88rem); line-height: 2; white-space: pre; }
.script .op { color: var(--code-op); font-weight: 700; }
.script-note { margin: 14px 0 34px; color: var(--muted); font-size: 1rem; max-width: 56ch; }
.script-note:last-child { margin-bottom: 0; }
.agree h3 { font-size: 1.1rem; font-weight: 700; }
.agree dl { margin-top: 18px; }
.agree dt { font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; }
.agree dd { margin-top: 6px; color: var(--muted); font-size: 1rem; }
.agree dd + dt { margin-top: 26px; }

/* ---------- live demo ---------- */
.demo { margin-top: 44px; background: var(--surface); border-radius: var(--r-panel); padding: clamp(20px, 3vw, 40px); }
.demo-load { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; }
.demo-load p { color: var(--muted); font-size: 1rem; max-width: 52ch; }
.meter { margin-top: 18px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }
.demo-msg { margin-top: 14px; font-size: 1rem; }
.demo-msg.bad { color: var(--accent); font-weight: 700; }
.demo-run { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(24px, 4vw, 56px); align-items: start; }
.field label { display: block; font-weight: 700; font-size: 1rem; }
.field-row { margin-top: 8px; display: flex; gap: 10px; }
.field input {
  flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border-radius: var(--r-control);
  border: 1.5px solid var(--muted); background: var(--bg); color: var(--ink); font: inherit; font-size: 1rem;
}
.field .help { margin-top: 8px; font-size: 0.9rem; color: var(--muted); max-width: 62ch; }
.field .error { margin-top: 8px; font-size: 0.95rem; color: var(--accent); font-weight: 700; }
.out { margin-top: 26px; }
.out h3 { font-size: 1rem; font-weight: 700; }
.hex { margin-top: 8px; font-family: var(--mono); font-size: clamp(0.72rem, 1.2vw, 0.95rem); line-height: 1.7; word-break: break-all; }
.out-facts { margin-top: 12px; font-size: 0.95rem; color: var(--muted); }
.bits { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; width: min(240px, 60vw); aspect-ratio: 1; }
.bits i { background: var(--dot-off); }
.bits i.on { background: var(--ink); }
.bits i.changed { box-shadow: inset 0 0 0 2px var(--accent); }
.bits-cap { margin-top: 8px; font-size: 0.85rem; color: var(--muted); max-width: 240px; }
[hidden] { display: none !important; }

/* ---------- results ---------- */
.results-grid { margin-top: 52px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 88px); align-items: start; }
.chart h3 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.015em; max-width: 30ch; }
.legend { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 0.92rem; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend svg { flex: none; }
.plot { position: relative; margin-top: 10px; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.plot text { font-family: var(--sans); font-size: 13px; fill: var(--muted); }
.plot text.val { fill: var(--ink); font-weight: 700; }
.plot .grid { stroke: var(--line); stroke-width: 1; }
.plot .ideal, .legend .ideal { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
.plot .hit { fill: transparent; cursor: crosshair; }
.plot .hit:focus-visible { outline: none; fill: color-mix(in srgb, var(--ink) 7%, transparent); }
.plot .cross { stroke: var(--ink); stroke-width: 1; }
.tip {
  position: absolute; top: 0; left: 0; pointer-events: none; min-width: 190px;
  background: var(--ink); color: var(--bg); border-radius: var(--r-control); padding: 10px 12px;
  font-size: 0.85rem; line-height: 1.5;
}
.tip b { display: block; }
.tip span { display: flex; justify-content: space-between; gap: 16px; }
.chart-note { margin-top: 14px; font-size: 1rem; color: var(--muted); max-width: 60ch; }
.chart details { margin-top: 14px; font-size: 0.95rem; }
.chart summary { cursor: pointer; color: var(--muted); width: fit-content; }
.chart table { margin-top: 10px; border-collapse: collapse; font-size: 0.9rem; }
.chart th, .chart td { text-align: right; padding: 4px 14px 4px 0; font-weight: 400; }
.chart th { color: var(--muted); }
.chart th:first-child, .chart td:first-child { text-align: left; }
.figures li + li { margin-top: 34px; }
.figures .big { display: block; font-size: clamp(2rem, 3.2vw, 2.9rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.figures .big small { font-size: 0.42em; font-weight: 700; letter-spacing: 0; color: var(--muted); }
.figures p { margin-top: 10px; color: var(--muted); font-size: 1rem; max-width: 40ch; }

/* ---------- straight answers ---------- */
.answers { margin-top: 44px; }
.answers li { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); gap: 8px clamp(20px, 4vw, 64px); padding-block: 26px; align-items: baseline; }
.answers li + li { border-top: 1px solid var(--line); }
.answers .verdict { font-size: clamp(1.5rem, 2.6vw, 2.3rem); font-weight: 800; letter-spacing: -0.028em; line-height: 1.05; }
.answers .verdict.no { color: var(--accent); }
.answers h3 { font-size: 1.15rem; font-weight: 700; }
.answers p { margin-top: 6px; color: var(--muted); font-size: 1rem; max-width: 60ch; }

/* ---------- open for attack ---------- */
.attack-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.attack-list details { border-bottom: 1px solid var(--line); }
.attack-list summary { cursor: pointer; padding: 18px 34px 18px 0; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.012em; list-style: none; position: relative; }
.attack-list summary::-webkit-details-marker { display: none; }
.attack-list summary::after { content: "+"; position: absolute; right: 4px; top: 14px; font-size: 1.5rem; font-weight: 400; color: var(--muted); }
.attack-list details[open] summary::after { content: "\2212"; }
.attack-list details p { padding: 0 34px 22px 0; color: var(--muted); font-size: 1rem; max-width: 58ch; }

/* ---------- what's coming ---------- */
.track { margin-top: 56px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.track li { position: relative; padding: 30px 18px 0 0; border-top: 2px solid var(--line); }
.track li::before { content: ""; position: absolute; top: -8px; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--muted); }
.track li.done { border-top-color: var(--accent); }
.track li.done::before { background: var(--accent); border-color: var(--accent); }
.track h3 { font-size: 1.08rem; font-weight: 800; letter-spacing: -0.012em; line-height: 1.2; }
.track p { margin-top: 8px; font-size: 0.93rem; line-height: 1.5; color: var(--muted); }
.track .when { color: var(--accent); font-weight: 700; }
.closing { margin-top: 64px; display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; }
.closing p { max-width: 46ch; font-size: 1.2rem; line-height: 1.45; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding-block: 48px 64px; font-size: 0.92rem; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 80px); }
.foot strong { color: var(--ink); }
.foot-credit { margin-top: 10px; max-width: 46ch; }
.foot-credit a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.foot-credit a:hover, .foot-credit a:focus-visible { color: var(--ink); }
.foot li + li { margin-top: 4px; }
.foot h2 { font-size: 0.92rem; font-weight: 700; color: var(--ink); margin-bottom: 8px; }

/* ---------- proposal document page ---------- */
.doc { max-width: 820px; margin-inline: auto; padding: 48px var(--gutter) 96px; }
.doc h1 { font-family: var(--mono); font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.03em; line-height: 1.1; }
.doc h2 { margin-top: 56px; font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.doc h3 { margin-top: 34px; font-size: 1.2rem; font-weight: 800; }
.doc p, .doc ul, .doc ol { margin-top: 16px; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc ul { list-style: disc; }
.doc ol { list-style: decimal; }
.doc li + li { margin-top: 6px; }
.doc li ul { margin-top: 6px; }
.doc hr { margin: 44px 0 0; border: 0; border-top: 1px solid var(--line); }
.doc a { color: var(--accent); }
.doc code { font-weight: 400; letter-spacing: 0; font-size: 0.82em; background: var(--surface); padding: 2px 5px; border-radius: 4px; word-break: break-word; }
.doc pre { margin-top: 16px; background: var(--code-bg); color: var(--code-ink); padding: 16px 18px; border-radius: var(--r-panel); overflow-x: auto; }
.doc pre code { background: none; padding: 0; font-size: 0.8rem; word-break: normal; }
.doc .table-scroll { margin-top: 18px; overflow-x: auto; }
.doc table { border-collapse: collapse; width: 100%; font-size: 0.97rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 9px 16px 9px 0; border-bottom: 1px solid var(--line); }
.doc th { font-weight: 700; }

/* ---------- small screens: every multi-column layout becomes one column ---------- */
@media (max-width: 1020px) {
  .nav-links { display: none; }
  .nav-in .btn { margin-left: auto; }
  .hero-grid, .script-grid, .results-grid, .attack-grid, .foot-grid, .fineprint { grid-template-columns: minmax(0, 1fr); }
  .hero-sub { max-width: 46ch; }
  .why-body { margin-left: 0; }
  .film-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .film-view { order: -1; }
  .film-live .film-stage { align-items: start; padding-top: 14px; }
  .track { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
}
@media (max-width: 767px) {
  body { font-size: 1.0625rem; }
  .status { font-size: 0.72rem; }
  .hops span:nth-last-child(2) { font-size: 0; }
  .chapter h3 { font-size: 1.9rem; }
  .chapter p { margin-top: 10px; font-size: 1rem; line-height: 1.5; }
  .film-live .film-steps { margin-bottom: 16px; }
  .demo-run { grid-template-columns: minmax(0, 1fr); }
  .answers li { grid-template-columns: minmax(0, 1fr); }
  .field-row { flex-direction: column; }
  .track { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .track li { border-top: 0; border-left: 2px solid var(--line); padding: 0 0 30px 26px; }
  .track li.done { border-left-color: var(--accent); }
  .track li::before { top: 2px; left: -8px; }
  .track li:last-child { padding-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .meter i, .film-steps li, .chapter { transition: none; }
}
