/* philipp.henning-buss.de
   Native CSS, no framework. Geist + Geist Mono, self-hosted.
   One accent, one radius, one theme per visit (auto light/dark). */

@font-face {
  font-family: "Geist";
  src: url("../fonts/Geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark light;
  --bg: #0f1012;
  --panel: #151619;
  --panel-2: #1b1d21;
  --ink: #ecedee;
  --muted: #9097a0;
  --line: #2a2d32;
  --accent: #ff5a2c;
  --on-accent: #120a07;
  --r: 6px;
  --nav-h: 64px;
  --gutter: clamp(18px, 4vw, 56px);
  --max: 1440px;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* z scale */
  --z-nav: 20;
  --z-overlay: 40;
  --z-terminal: 50;
  --z-toast: 60;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eceeef;
    --panel: #f6f7f8;
    --panel-2: #e2e5e7;
    --ink: #121316;
    --muted: #565c64;
    --line: #c8ccd1;
    --accent: #e8431f;
    --on-accent: #fff7f4;
  }
}
:root[data-theme="light"] {
  --bg: #eceeef;
  --panel: #f6f7f8;
  --panel-2: #e2e5e7;
  --ink: #121316;
  --muted: #565c64;
  --line: #c8ccd1;
  --accent: #e8431f;
  --on-accent: #fff7f4;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- tone (SDR / HDR / washed-out Windows default) ---------- */
/* The tone switch grades the whole page, canvases and navigation included. */
html { transition: filter 0.6s var(--ease); }
html[data-tone="hdr"] { filter: contrast(1.1) saturate(1.3) brightness(1.07); }
body[data-tone="hdr"] { --accent: #ff4a1a; }
@supports (color: color(display-p3 1 0 0)) {
  body[data-tone="hdr"] { --accent: color(display-p3 1 0.27 0.09); }
}
html[data-tone="washed"] { filter: contrast(0.74) brightness(1.14) saturate(0.68); }

/* ---------- progress line (scroll-driven, CSS only) ---------- */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: var(--z-nav);
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root block); }
  @keyframes grow { to { transform: scaleX(1); } }
}

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-nav);
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand small { font: 400 12px var(--mono); color: var(--muted); letter-spacing: 0; }
.nav-links { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 32px); font-size: 15px; white-space: nowrap; }
.nav-links a { color: var(--muted); transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }
.tone {
  display: inline-flex; align-items: center; gap: 0; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  font: 500 12px var(--mono); letter-spacing: 0.04em;
}
.tone button {
  border: 0; background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 3px;
  transition: background 0.25s var(--ease), color 0.25s;
}
.tone button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
@media (max-width: 760px) { .nav-links a:not(.keep) { display: none; } .brand small { display: none; } }

/* ---------- layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
section { position: relative; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  padding: 14px 22px; border-radius: var(--r); font-weight: 600; letter-spacing: -0.01em;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  transition: transform 0.25s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.arrow { display: inline-block; transition: transform 0.3s var(--ease); }
.btn:hover .arrow, .link:hover .arrow { transform: translate(3px, -3px); }
.link { border-bottom: 1px solid var(--line); transition: border-color 0.2s, color 0.2s; padding-bottom: 1px; }
.link:hover { border-color: var(--accent); color: var(--accent); }

/* reveal on scroll */
.js .rv { opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); transition-delay: calc(var(--d, 0) * 70ms); }
.js .rv.in { opacity: 1; transform: none; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: clip; min-height: 100dvh; padding-top: calc(var(--nav-h) + 40px); padding-bottom: 56px; display: flex; align-items: center; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 64px); align-items: center; width: 100%; }
.hero h1 {
  font-size: clamp(3.1rem, 7.1vw, 7rem); line-height: 0.92; letter-spacing: -0.055em; font-weight: 680;
  position: relative; z-index: 2;
}
.hero h1 .l2 { display: block; white-space: nowrap; }
.hero .wrap { position: relative; z-index: 1; }
.hero h1 .w { display: inline-block; white-space: nowrap; }
.hero h1 .ch { display: inline-block; }
.hero p.lede { margin-top: 28px; font-size: clamp(1.05rem, 1.5vw, 1.3rem); color: var(--muted); max-width: 34ch; line-height: 1.45; }
.hero .cta { margin-top: 34px; display: flex; gap: 12px; flex-wrap: wrap; }

.stack { position: relative; aspect-ratio: 1 / 1.02; --mx: 0; --my: 0; }
.stack figure { position: absolute; margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); box-shadow: 0 24px 50px -30px rgb(0 0 0 / 0.5); z-index: var(--z, 1);
  transition: scale 0.45s var(--ease), box-shadow 0.45s var(--ease), transform 0.3s var(--ease); will-change: transform; }
.stack figure::after { content: ""; position: absolute; inset: 0; background: #0f1012; opacity: 0.22; pointer-events: none; transition: opacity 0.35s var(--ease); }
.stack figure.front::after { opacity: 0; }
.stack img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.stack .s1 { width: 86%; aspect-ratio: 2560/1250; top: 2%; right: 0; transform: translate(calc(var(--mx) * -10px), calc(var(--my) * -8px)) rotate(1.2deg); }
.stack .s2 { width: 74%; aspect-ratio: 16/10; top: 30%; left: 0; transform: translate(calc(var(--mx) * 14px), calc(var(--my) * 10px)) rotate(-2deg); }
.stack .s3 { width: 66%; aspect-ratio: 16/9; bottom: 0; right: 4%; transform: translate(calc(var(--mx) * 26px), calc(var(--my) * 18px)) rotate(1.8deg); }
.stack figure.front { scale: 1.045; box-shadow: 0 44px 80px -30px rgb(0 0 0 / 0.75); }
.stack figure a { display: block; width: 100%; height: 100%; position: relative; cursor: pointer; }
.stack figcaption { position: absolute; left: 12px; bottom: 12px; background: #ecedee; color: #0f1012; font: 600 12px/1 var(--mono); padding: 7px 9px; border-radius: 4px; opacity: 0; transform: translateY(6px); transition: opacity 0.3s var(--ease) 0.12s, transform 0.4s var(--ease) 0.12s; }
.stack figure.front figcaption { opacity: 1; transform: none; }
@media (max-width: 900px) {
  .hero { min-height: auto; align-items: flex-start; }
  .hero-grid { grid-template-columns: 1fr; }
  .stack { aspect-ratio: 1 / 0.9; max-width: 560px; }
}

/* ---------- work: sticky stack ---------- */
.work { padding: clamp(80px, 12vw, 160px) 0 40px; }
.sec-title { font-size: clamp(2.2rem, 5vw, 4.4rem); line-height: 0.98; letter-spacing: -0.045em; font-weight: 650; max-width: 16ch; }
.sec-sub { margin-top: 18px; color: var(--muted); max-width: 52ch; }
.cases { margin-top: clamp(40px, 6vw, 80px); display: grid; gap: 28px; }
.case {
  position: sticky; top: calc(var(--nav-h) + 20px + var(--i) * 16px);
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(20px, 3vw, 48px);
  padding: clamp(18px, 2.4vw, 36px); min-height: min(76dvh, 720px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 -18px 40px -24px rgb(0 0 0 / 0.5);
}
.case h3 { font-size: clamp(2.2rem, 4.4vw, 4rem); line-height: 0.95; letter-spacing: -0.05em; font-weight: 680; }
.case .tag { margin-top: 14px; font-size: clamp(1.05rem, 1.4vw, 1.25rem); line-height: 1.4; max-width: 30ch; }
.case ul { margin-top: 26px; display: grid; gap: 12px; color: var(--muted); font-size: 15.5px; }
.case li { padding-left: 18px; position: relative; }
.case li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 8px; height: 1px; background: var(--accent); }
.case .meta { margin-top: auto; padding-top: 28px; display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; font-size: 15px; }
.case .stat { font: 400 12.5px var(--mono); color: var(--muted); }
.case .copy { display: flex; flex-direction: column; }
.case .shot { position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); align-self: center; }
.case .shot img { width: 100%; height: auto; }
.case .shot.contain { display: grid; place-items: center; background:
  radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%), var(--panel-2); }
.case .shot.contain img { width: auto; height: 100%; max-height: 560px; object-fit: contain; padding: 18px; }
@media (max-width: 900px) {
  .case { position: relative; top: auto; grid-template-columns: 1fr; min-height: 0; }
  .case .shot { order: -1; }
  .case .shot.contain { aspect-ratio: 1; }
}

/* ---------- principles ---------- */
.principles { padding: clamp(90px, 14vw, 200px) 0; }
.pr-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 90px); align-items: start; }
.no-lines em { font-style: normal; }
.no-lines { font-size: clamp(2.6rem, 7.4vw, 7.6rem); line-height: 0.9; letter-spacing: -0.06em; font-weight: 700; }
.no-lines span { display: block; color: color-mix(in srgb, var(--ink) 20%, var(--bg)); transition: color 0.7s var(--ease); }
.no-lines span.lit { color: var(--ink); }
.no-lines span.lit em { color: var(--accent); font-style: normal; }
.receipts { display: grid; gap: 0; position: sticky; top: calc(var(--nav-h) + 40px); }
.receipts div { padding: 18px 0; }
.receipts div + div { border-top: 1px solid var(--line); }
.receipts dt { font-weight: 600; letter-spacing: -0.02em; }
.receipts dd { color: var(--muted); font-size: 15.5px; margin-top: 4px; }
@media (max-width: 900px) { .pr-grid { grid-template-columns: 1fr; } .receipts { position: static; } }

/* ---------- rack: bento ---------- */
.rack { padding: clamp(40px, 6vw, 80px) 0 clamp(80px, 10vw, 140px); }
.bento { margin-top: clamp(32px, 5vw, 64px); display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.cell {
  position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel); padding: clamp(18px, 2vw, 28px); display: flex; flex-direction: column;
  --px: 50%; --py: 50%; isolation: isolate;
}
.cell::after { /* spotlight edge that follows the pointer */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(420px circle at var(--px) var(--py), color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%);
}
.cell:hover::after { opacity: 1; }
.cell h3 { font-size: clamp(1.6rem, 2.6vw, 2.4rem); letter-spacing: -0.04em; line-height: 1; font-weight: 650; }
.cell p { margin-top: 10px; color: var(--muted); font-size: 15.5px; max-width: 42ch; }
.cell .go { margin-top: auto; padding-top: 22px; font-size: 14.5px; }
.cell img { border-radius: 4px; border: 1px solid var(--line); margin-top: 22px; width: 100%; object-fit: cover; object-position: top left; }
.c-home { grid-column: span 4; grid-row: span 2; }
.c-home img { flex: 1; min-height: 240px; }
.c-patch { grid-column: span 2; }
.c-patch img { height: 170px; }
.c-voice { grid-column: span 3; min-height: 250px; background:
  repeating-linear-gradient(135deg, transparent 0 11px, color-mix(in srgb, var(--ink) 6%, transparent) 11px 12px), var(--panel); }
.c-desk { grid-column: span 3; min-height: 250px; background:
  radial-gradient(color-mix(in srgb, var(--ink) 16%, transparent) 1px, transparent 1.4px) 0 0 / 16px 16px, var(--panel); }
.cell .fork { font: 400 12px var(--mono); color: var(--muted); margin-bottom: 12px; }
@media (max-width: 900px) {
  .bento { grid-template-columns: 1fr; }
  .c-home, .c-patch, .c-voice, .c-desk { grid-column: auto; grid-row: auto; }
  .c-home img { min-height: 0; aspect-ratio: 16/10; flex: none; }
}

/* ---------- smaller things: scroll-snap row ---------- */
.small { padding: clamp(40px, 6vw, 80px) 0 clamp(80px, 10vw, 140px); }
.small-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.arrows { display: flex; gap: 8px; }
.arrows button { width: 46px; height: 46px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); font-size: 18px; transition: border-color 0.2s, transform 0.2s var(--ease); }
.arrows button:hover { border-color: var(--ink); }
.arrows button:active { transform: scale(0.95); }
.rail { margin-top: 40px; overflow: hidden; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  position: relative; }
.rail::before, .rail::after { content: ""; position: absolute; top: 0; bottom: 0; width: 7%; z-index: 2; pointer-events: none; }
.rail::before { left: 0; background: linear-gradient(90deg, var(--bg), transparent); }
.rail::after { right: 0; background: linear-gradient(270deg, var(--bg), transparent); }
.rail.drag { cursor: grabbing; }
.reel { display: flex; gap: 14px; width: max-content; padding: 4px 0 22px; will-change: transform; }
.reel > * { flex: 0 0 min(320px, 80vw); }
.tile { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); overflow: hidden; display: flex; flex-direction: column; min-height: 400px; transition: border-color 0.25s, transform 0.4s var(--ease); user-select: none; }
.tile:hover { border-color: var(--ink); transform: translateY(-4px); }
.tile .top { height: 170px; position: relative; border-bottom: 1px solid var(--line); background: var(--panel-2); overflow: hidden; }
.tile .top img { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }
.tile .glyph { height: 100%; display: grid; place-items: center; font: 600 clamp(2.4rem, 4vw, 3.2rem) var(--mono); letter-spacing: -0.06em; color: var(--accent); }
.tile .body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.tile h3 { font-size: 1.5rem; letter-spacing: -0.035em; line-height: 1.05; font-weight: 650; }
.tile p { margin-top: 10px; color: var(--muted); font-size: 15px; }
.tile .foot { margin-top: auto; padding-top: 20px; display: flex; justify-content: space-between; align-items: baseline; font: 400 12.5px var(--mono); color: var(--muted); }
.tile a.stretch::after { content: ""; position: absolute; inset: 0; }
.tile { position: relative; }

/* ---------- written in ---------- */
.langs { padding: clamp(40px, 6vw, 80px) 0 clamp(90px, 12vw, 180px); }
.cloud { margin-top: clamp(28px, 4vw, 56px); display: flex; flex-direction: column; align-items: flex-start; gap: 0.06em; font-size: clamp(2.6rem, 6.2vw, 6rem); font-weight: 680; letter-spacing: -0.05em; line-height: 1; }
.cloud button { background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; color: var(--muted); transition: color 0.25s, transform 0.4s var(--ease); position: relative; }
.cloud button:hover, .cloud button:focus-visible, .cloud button.on { color: var(--ink); transform: translateY(-3px); }
.cloud sup { font: 400 0.9rem var(--mono); letter-spacing: 0; color: var(--accent); margin-left: 4px; vertical-align: super; }
.lang-out { margin-top: 28px; min-height: 3.2em; font: 400 14px var(--mono); color: var(--muted); max-width: 70ch; }

/* repo grid: filtered by the language cloud */
.repos { margin-top: 28px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.repo {
  display: flex; flex-direction: column; gap: 6px; padding: 18px; min-height: 148px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease), border-color 0.3s, background 0.3s, filter 0.5s;
  transition-delay: calc(var(--k, 0) * 22ms);
}
.repo b { font-size: 1.1rem; letter-spacing: -0.03em; font-weight: 650; overflow-wrap: anywhere; }
.repo span { color: var(--muted); font-size: 14.5px; line-height: 1.4; }
.repo i { margin-top: auto; padding-top: 14px; font: 400 12.5px var(--mono); font-style: normal; color: var(--muted); }
.repo:hover { border-color: var(--ink); }
.repos:not(.orb-on)[data-f] .repo { opacity: 0.16; transform: scale(0.96); filter: grayscale(1); pointer-events: none; }
.repos:not(.orb-on)[data-f] .repo.match { opacity: 1; transform: translateY(-4px); filter: none; pointer-events: auto; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.repos[data-f] .repo.match i { color: var(--accent); }
.cloud button[aria-pressed="true"] { color: var(--accent); transform: translateY(-3px); }
@media (max-width: 1000px) { .repos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .repos { grid-template-columns: 1fr; } .repo { min-height: 0; } }

/* ---------- footer ---------- */
.foot-big { padding: clamp(60px, 9vw, 120px) 0 28px; border-top: 1px solid var(--line); }
.foot-big a.huge { display: block; font-size: clamp(1.5rem, 6.2vw, 7rem); line-height: 1; letter-spacing: -0.06em; font-weight: 700; white-space: nowrap; transition: color 0.3s; }
.foot-big a.huge:hover { color: var(--accent); }
.foot-meta { margin-top: clamp(40px, 6vw, 80px); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 28px; color: var(--muted); font-size: 14.5px; }
.foot-meta button { background: none; border: 0; padding: 0; color: var(--muted); font: 400 13px var(--mono); border-bottom: 1px dashed var(--line); }
.foot-meta button:hover { color: var(--accent); border-color: var(--accent); }
kbd { font: 500 12px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; background: var(--panel); color: var(--ink); }

/* ---------- overlays: terminal, toast, detect, replay, terminator ---------- */
.terminal {
  position: fixed; inset: auto 0 0 0; z-index: var(--z-terminal);
  height: min(46dvh, 420px); background: color-mix(in srgb, var(--bg) 94%, #000);
  border-top: 1px solid var(--accent);
  font: 400 14px/1.6 var(--mono);
  display: flex; flex-direction: column; transform: translateY(102%); transition: transform 0.45s var(--ease); visibility: hidden;
}
.terminal.open { transform: none; visibility: visible; }
.t-out { flex: 1; overflow-y: auto; padding: 16px var(--gutter) 8px; white-space: pre-wrap; word-break: break-word; }
.t-out .dim { color: var(--muted); }
.t-out .hi { color: var(--accent); }
.t-row { display: flex; gap: 10px; padding: 8px var(--gutter) 16px; align-items: center; }
.t-row label { color: var(--accent); white-space: nowrap; }
.t-row input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--ink); font: inherit; caret-color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: var(--z-toast); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--r); font: 500 13.5px var(--mono);
  transition: opacity 0.3s, transform 0.4s var(--ease); max-width: calc(100vw - 32px); display: flex; gap: 14px; align-items: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: 0; border-bottom: 1px solid currentColor; padding: 0; font: inherit; color: inherit; }

.det-layer { position: fixed; inset: 0; z-index: var(--z-overlay); pointer-events: none; }
.det { position: fixed; border: 1.5px solid var(--accent); border-radius: 2px; }
.det span { position: absolute; left: -1.5px; top: -1.5px; transform: translateY(-100%); background: var(--accent); color: var(--on-accent); font: 500 11px/1 var(--mono); padding: 3px 5px; white-space: nowrap; }
.det.low { top: auto; }
.det-hud { position: fixed; top: calc(var(--nav-h) + 12px); right: var(--gutter); z-index: var(--z-overlay); background: var(--ink); color: var(--bg); font: 500 12px var(--mono); padding: 8px 12px; border-radius: var(--r); pointer-events: none; }

.replay { position: fixed; inset: 0; z-index: var(--z-overlay); background: rgb(0 0 0 / 0.72); display: none; }
.replay.on { display: block; }
.replay canvas { width: 100%; height: 100%; display: block; }
.replay .hud { position: absolute; top: 20px; left: var(--gutter); font: 500 13px var(--mono); color: #fff; display: flex; gap: 14px; align-items: center; }
.replay .rec { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: blink 1s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: 0.15; } }

.modal { position: fixed; inset: 0; z-index: var(--z-overlay); background: rgb(0 0 0 / 0.55); display: none; place-items: center; padding: 20px; }
.modal.on { display: grid; }
.dialog { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: 0 40px 80px -30px #000; }
.dialog h2 { font-size: 1.25rem; letter-spacing: -0.02em; }
.dialog p { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.dialog ul { margin: 18px 0; border: 1px solid var(--line); border-radius: var(--r); }
.dialog li + li { border-top: 1px solid var(--line); }
.dialog label { display: flex; gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; font-size: 15px; }
.dialog input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.dialog .row { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.dialog .row .btn { padding: 10px 16px; font-size: 15px; }
.dialog .linkish { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 0; border-bottom: 1px solid var(--line); }

.gone { display: none !important; }
.quitting { animation: quit 0.5s var(--ease) forwards; }
@keyframes quit { to { opacity: 0; transform: scale(0.96) translateY(10px); } }
.fell { transition: transform 1.1s cubic-bezier(0.55, 0, 1, 0.45) !important; z-index: 5; }
.nothing { padding: 40vh var(--gutter); text-align: center; color: var(--muted); font: 400 14px var(--mono); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rv { opacity: 1; transform: none; transition: none; }
  .progress { display: none; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media print { .nav, .terminal, .progress { display: none; } }


/* ---------- WebGL contour fields ---------- */
.gl { position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; }
.hero::after { content: ""; position: absolute; inset: auto 0 0 0; height: 42%; background: linear-gradient(transparent, var(--bg)); z-index: 0; pointer-events: none; }
.foot-big { position: relative; overflow: clip; }
.foot-big .wrap { position: relative; z-index: 1; }

/* ---------- languages: the globe ---------- */
.lang-stage { margin-top: clamp(28px, 4vw, 56px); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(20px, 3vw, 48px); align-items: center; }
.lang-side .cloud { margin-top: 0; }
.lang-out { margin-top: 28px; min-height: 4.6em; font: 400 14px/1.6 var(--mono); color: var(--muted); max-width: 40ch; }
.repos.orb-on { display: block; position: relative; height: min(76dvh, 700px); min-height: 440px; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.repos.orb-on.grab { cursor: grabbing; }
.orb-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.repos.orb-on .repo {
  position: absolute; left: 0; top: 0; min-height: 0; padding: 5px 10px; gap: 0; border-radius: var(--r);
  background: color-mix(in srgb, var(--panel) 92%, transparent); will-change: transform, opacity;
  transition: border-color 0.3s, background 0.3s; transition-delay: 0s; white-space: nowrap;
  -webkit-user-drag: none;
}
.repos.orb-on .repo b { font-size: 14px; letter-spacing: -0.02em; }
.repos.orb-on .repo span { display: none; }
.repos.orb-on .repo i { padding-top: 0; margin: 0; font-size: 11px; }
.repos.orb-on .repo.match { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.repos.orb-on .repo.match i { color: var(--accent); }
@media (max-width: 900px) { .lang-stage { grid-template-columns: 1fr; } .cloud { flex-direction: row; flex-wrap: wrap; gap: 0.1em 0.5em; } .repos.orb-on { height: 460px; } }

/* ---------- scroll-driven depth (CSS only, progressive) ---------- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .case h3 { animation: head-in linear both; animation-timeline: view(); animation-range: entry 10% entry 60%; }
    .sec-title { animation: head-in linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
    .stack .s1 { animation: drift-a linear both; animation-timeline: scroll(root block); animation-range: 0 100vh; }
    .stack .s2 { animation: drift-b linear both; animation-timeline: scroll(root block); animation-range: 0 100vh; }
    .stack .s3 { animation: drift-c linear both; animation-timeline: scroll(root block); animation-range: 0 100vh; }
    .cell img { animation: shot-pan linear both; animation-timeline: view(); animation-range: cover; }
    @keyframes shot-pan { from { transform: translateY(-5%) scale(1.14); } to { transform: translateY(5%) scale(1.14); } }
    @keyframes head-in { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
    @keyframes drift-a { to { translate: 0 -90px; } }
    @keyframes drift-b { to { translate: 0 -40px; } }
    @keyframes drift-c { to { translate: 0 60px; } }
  }
}
.case .shot, .cell { overflow: hidden; }

/* ---------- legal pages ---------- */
.legal-top { position: sticky; top: 0; z-index: var(--z-nav); display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 var(--gutter); height: var(--nav-h); background: color-mix(in srgb, var(--bg) 94%, transparent); border-bottom: 1px solid var(--line); }
.backlink { font: 500 13px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); transition: color 0.2s; }
.backlink:hover { color: var(--accent); }
.lang-sw { display: flex; gap: 6px; font: 500 12px var(--mono); }
.lang-sw a { padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r); color: var(--muted); }
.lang-sw a:hover { color: var(--ink); border-color: var(--ink); }
.legal { max-width: 78ch; margin: 0 auto; padding: clamp(48px, 8vw, 110px) var(--gutter) 120px; }
.legal h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 0.98; letter-spacing: -0.05em; font-weight: 680; }
.legal .sub { margin-top: 12px; color: var(--muted); font-size: 1.05rem; }
.legal h2 { margin-top: 2.4em; font-size: 1.35rem; letter-spacing: -0.025em; font-weight: 650; line-height: 1.2; }
.legal h3 { margin-top: 1.6em; font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; }
.legal p, .legal li { margin-top: 0.8em; color: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.legal ul { list-style: disc; padding-left: 1.3em; }
.legal address { font-style: normal; margin-top: 0.8em; line-height: 1.6; }
.legal a:not(.backlink) { border-bottom: 1px solid var(--line); transition: border-color 0.2s, color 0.2s; }
.legal a:not(.backlink):hover { color: var(--accent); border-color: var(--accent); }
.legal hr { border: 0; border-top: 1px solid var(--line); margin: 5em 0 0; }
.legal .stand { margin-top: 3em; font: 400 13px var(--mono); color: var(--muted); }


/* ---------- license section ---------- */
.lic { padding: clamp(70px, 10vw, 150px) 0; }
.lic-lede { margin-top: 20px; font-size: clamp(1.15rem, 1.8vw, 1.6rem); line-height: 1.35; letter-spacing: -0.02em; max-width: 40ch; }
.yesno { margin-top: clamp(40px, 6vw, 80px); display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.yn h3 { font-size: clamp(2.6rem, 6vw, 5.4rem); line-height: 0.92; letter-spacing: -0.055em; font-weight: 700; }
.yn.no h3 { color: var(--muted); }
.verbs { margin-top: 26px; display: grid; }
.verbs li { display: grid; grid-template-columns: minmax(0, 12.5rem) minmax(0, 1fr); gap: 4px 20px; align-items: baseline; padding: 14px 0; }
.verbs li + li { border-top: 1px solid var(--line); }
.verbs b { font-size: clamp(1.3rem, 2vw, 1.7rem); letter-spacing: -0.035em; font-weight: 650; line-height: 1.1; position: relative; padding-left: 20px; }
.verbs span { color: var(--muted); font-size: 15.5px; }
.yes .verbs b::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 9px; height: 9px; background: var(--accent); }
.no .verbs li { grid-template-columns: 1fr; }
.no .verbs b { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--accent); }
.no .verbs b::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 9px; height: 9px; border: 1.5px solid var(--muted); }
.ask { margin-top: 22px; color: var(--muted); font-size: 15.5px; max-width: 38ch; }
.conds { margin-top: clamp(56px, 8vw, 110px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 4vw, 64px); border-top: 2px solid var(--ink); padding-top: 28px; }
.cond h3 { font-size: clamp(1.8rem, 3.4vw, 3rem); line-height: 1; letter-spacing: -0.05em; font-weight: 680; }
.cond p { margin-top: 12px; color: var(--muted); max-width: 40ch; }
.lic-only { margin-top: 28px; font: 500 14px var(--mono); color: var(--accent); }
.critique { margin: clamp(56px, 8vw, 110px) 0 0; display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(20px, 4vw, 64px); align-items: start; }
.critique h3 { font-size: clamp(1.8rem, 3.4vw, 3rem); line-height: 1; letter-spacing: -0.05em; font-weight: 680; }
.critique blockquote { margin: 0; padding-left: clamp(18px, 2.6vw, 36px); border-left: 3px solid var(--accent); display: grid; gap: 1em; }
.critique blockquote p { font-size: clamp(1.1rem, 1.7vw, 1.5rem); line-height: 1.4; letter-spacing: -0.015em; max-width: 46ch; }
.lic-map { margin-top: clamp(56px, 8vw, 110px); }
.lic-map h3 { font-size: 1.1rem; letter-spacing: -0.02em; font-weight: 650; }
.lic-row { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lic-tag { font: 600 12px var(--mono); letter-spacing: 0.04em; padding: 8px 10px; background: var(--ink); color: var(--bg); border-radius: var(--r); margin-right: 6px; }
.lic-row a { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r); font-size: 15px; transition: border-color 0.2s, color 0.2s; }
.lic-row a:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 900px) {
  .yesno, .conds, .critique { grid-template-columns: minmax(0, 1fr); }
  .verbs li { grid-template-columns: minmax(0, 1fr); }
}
