/*
 * PDB Digital — the page and its live scenes.
 *
 * Palette: the site's own tokens, kept. Light is the near-white page with
 * ink text and one teal; dark is the deep ink page with near-white text and
 * a lighter teal. The live scenes run on "terminals" drawn from the dark
 * tokens in both themes (deep ink surface, near-white text, the teal as the
 * single accent), so the 3D cards, the session log and the rail keep their
 * contrast whatever the page behind them is.
 *
 * Every text pair passes WCAG AA; ratios in the comments. Two pairings of
 * the first version failed and changed (the tokens did not): white on the
 * light teal button (3.74) is now white on the darker teal (6.04), and the
 * dark theme's button text is the ink, not white, on the light teal (9.99).
 *
 * Theme: the system preference unless the visitor picked one with the
 * header toggle (localStorage "pdb-theme"), applied as <html data-theme>
 * before paint. Every colour of the scenes (3D included) comes from here.
 */

@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
}

/* ---- Light (default) ---- */
:root {
  color-scheme: light;
  --font-sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  --max: 1120px;

  --bg: #fbfbf9;
  --bg-alt: #f2f3ef;
  --card: #ffffff;
  --ink: #15201f;            /* 16.11 on bg */
  --muted: #5b6563;          /* 5.81 on bg, 5.40 on bg-alt */
  --line: #e2e5df;
  --accent: #0d9488;         /* fills and rules, never under small text */
  --accent-ink: #0a6f66;     /* links 5.83 on bg; button fill: white 6.04 */
  --on-accent: #ffffff;
  --accent-soft: #d9f1ee;
  --focus: #0a6f66;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 26px -16px rgba(15, 30, 28, .45), 0 2px 5px -3px rgba(15, 30, 28, .25);
  --hero-bg: radial-gradient(120% 80% at 50% 38%, #eef3f0 0%, var(--bg) 70%);

  /* scene terminals: the dark tokens, on both pages */
  --term-bg: #0f1615;
  --term-panel: #1a2322;     /* text 14.22, muted 7.60 */
  --term-chrome: #151c1b;
  --term-text: #eef2f0;
  --term-muted: #a9b5b2;
  --term-line: #3b4b48;
  --scene-accent: #2dd4bf;   /* 8.63 on panel, 9.84 on term-bg */
  --role-client: #f3d38b;    /* you, the client: 11.09 on panel */
  --role-human: #f4a79b;     /* the lead: 8.30 */
  --role-agent: #b9a7f5;     /* builders and reviewer: 7.58 */
  --role-github: #9cc4f7;    /* your repository: 8.91 */
  --role-core: #8fe3cf;      /* gates and tooling: 10.75 */
}

/* ---- Dark ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1413;
    --bg-alt: #151c1b;
    --card: #1a2322;
    --ink: #eef2f0;            /* 16.46 on bg */
    --muted: #a3aeab;          /* 8.14 on bg, 7.58 on bg-alt */
    --line: #26312f;
    --accent: #2dd4bf;
    --accent-ink: #5eead4;     /* links 12.57 on bg */
    --on-accent: #0f1413;      /* 9.99 on accent */
    --accent-soft: #123b37;
    --focus: #5eead4;
    --shadow-card: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 14px 30px -16px rgba(0, 0, 0, .75), 0 2px 6px -3px rgba(0, 0, 0, .5);
    --hero-bg: radial-gradient(120% 80% at 50% 38%, #142120 0%, var(--bg) 70%);
    --term-bg: #0b100f;
    --term-line: #34433f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1413;
  --bg-alt: #151c1b;
  --card: #1a2322;
  --ink: #eef2f0;
  --muted: #a3aeab;
  --line: #26312f;
  --accent: #2dd4bf;
  --accent-ink: #5eead4;
  --on-accent: #0f1413;
  --accent-soft: #123b37;
  --focus: #5eead4;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 14px 30px -16px rgba(0, 0, 0, .75), 0 2px 6px -3px rgba(0, 0, 0, .5);
  --hero-bg: radial-gradient(120% 80% at 50% 38%, #142120 0%, var(--bg) 70%);
  --term-bg: #0b100f;
  --term-line: #34433f;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.015em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--accent-ink); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; z-index: 50; }

/* ---- Header ---- */
.top {
  position: relative; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; color: var(--ink); }
.wordmark:hover { text-decoration: none; }
.mark {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent-ink); color: var(--on-accent);
  font-size: 12px; font-weight: 800; letter-spacing: .04em;
}
.word { font-size: 1.05rem; }
.nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0 18px; align-items: center; font-size: .95rem; }
.nav a { color: var(--ink); display: inline-flex; align-items: center; min-height: 44px; }
.nav__cta { padding: 0 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink) !important; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--card); }
.lang-switch button {
  font: 600 12px var(--font-mono); letter-spacing: .04em; min-height: 36px; min-width: 40px; padding: 4px 8px;
  background: transparent; color: var(--ink); border: 0; cursor: pointer;
}
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button[aria-pressed="true"] { background: var(--accent-ink); color: var(--on-accent); }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; min-width: 40px; padding: 4px 10px; border-radius: 999px;
  font: inherit; font-size: .85rem; font-weight: 600;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); cursor: pointer;
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle [data-theme-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 12px 20px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn--primary { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--big { font-size: 1.15rem; padding: 16px 26px; }

/* ---- Sections ---- */
.section { padding: 64px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-title, .contact h2, .scard-head h2 { margin: 0 0 18px; font-weight: 800; }

/* ---- Contact and footer ---- */
.contact { text-align: center; background: var(--bg-alt); }
.contact p { max-width: 56ch; margin-left: auto; margin-right: auto; }
.contact .btn { margin: 8px 0 18px; max-width: 100%; overflow-wrap: anywhere; }
.foot {
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center;
  padding: 28px 16px 40px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: .9rem;
}
.foot a { display: inline-flex; align-items: center; min-height: 44px; }
.foot span { display: inline-flex; align-items: center; min-height: 44px; }

@media (max-width: 760px) {
  .nav { display: none; }
  .header-actions { margin-left: auto; }
  .lang-switch button, .theme-toggle { min-height: 44px; min-width: 44px; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---- "How we make sure": the engineering, one layer down, closed by default ---- */
.proof-strip { padding-top: 40px; }
.proof { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: 0 0 10px; }
.case .proof { margin-top: 14px; }
.proof > summary {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; cursor: pointer;
  list-style: none; font-weight: 700;
}
.proof > summary::-webkit-details-marker { display: none; }
.proof > summary::after {
  content: ""; flex: none; width: 9px; height: 9px; margin-left: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px);
  transition: transform .25s ease;
}
.proof[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.proof-n { font: 700 12px var(--font-mono); color: var(--accent-ink); }
.proof-t { flex: 1 1 auto; min-width: 0; }
.proof-k { font: 600 .78rem/1.2 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: right; }
.proof-body { padding: 0 16px 16px; }
.proof-p { max-width: 70ch; color: var(--ink); }
.proof-more { margin: 14px 0 0; font-size: .92rem; }
.proof-more a { display: inline-flex; align-items: center; min-height: 44px; }
.proof-end { margin: 4px 0 0; padding: 0 4px; }
.proof-sub { margin: 18px 0 12px; font-size: 1.15rem; font-weight: 800; }
.proof .scard { margin-top: 8px; }
.proof .scard-head h3 { margin: 0; color: var(--term-text); font: 800 1.4rem/1.2 var(--font-sans); }
.proof-scene { position: relative; margin-top: 8px; padding: 12px; border-radius: 12px; background: var(--bg-alt); border: 1px solid var(--line); }
.level-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.level-head h3 { margin: 0 auto 0 0; font-size: 1.05rem; }
.proof-scene .scene-ctl { position: static; }
.proof-scene .story-stage.is-dom { padding: 4px 0 8px; }
.tl-bottom { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); margin-top: 8px; }
@media (min-width: 900px) { .tl-bottom { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: start; } }
.proof-scene .rail { margin-top: 30px; }
.proof-scene.is-idle .story-stage { opacity: .92; }
@media (max-width: 560px) {
  .proof > summary { flex-wrap: wrap; gap: 2px 10px; }
  .proof-k { flex: 1 1 100%; text-align: left; order: 3; font-size: .7rem; }
}
@media (prefers-reduced-motion: reduce) { .proof > summary::after { transition: none; } }

/* ---- Selected work: a compact row of tiles ---- */
.work-note { color: var(--muted); font-size: .92rem; margin: -8px 0 18px; }
.work-row { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .work-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .work-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.work-tile {
  display: flex; align-items: flex-start; gap: 12px; height: 100%; padding: 14px 16px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
}
a.work-tile:hover { text-decoration: none; border-color: var(--accent); }
a.work-tile:hover strong { text-decoration: underline; }
.work-mark {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  font: 700 12px/1 var(--font-mono); letter-spacing: .04em;
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--line);
}
.work-mark.is-product { background: var(--accent-ink); color: var(--on-accent); border-color: var(--accent-ink); }
.work-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.work-text strong { font-size: .98rem; line-height: 1.3; }
.work-result { color: var(--ink); font-size: .92rem; line-height: 1.4; }
.work-proof { color: var(--muted); font-size: .82rem; line-height: 1.4; }   /* the technical number, only as proof under the outcome */
.work-url { font: 12px/1.4 var(--font-mono); color: var(--accent-ink); overflow-wrap: anywhere; margin-top: 2px; }

/* ==== Live scenes (styles from the studio's product landing, on this palette) ==== */
.r-client { --role: var(--role-client); }
.r-core   { --role: var(--role-core); }
.r-agent  { --role: var(--role-agent); }
.r-github { --role: var(--role-github); }
.r-human  { --role: var(--role-human); }
.eyebrow { margin: 0 0 8px; font: 600 .82rem/1.3 var(--font-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); }

/* ---- the hero is the scene ---- */
.top.is-over { position: absolute; top: 0; left: 0; right: 0; background: transparent; border-bottom: 0; }
.hero {
  position: relative; min-height: 100vh; min-height: 100svh; padding: 0; overflow: hidden;
  isolation: isolate; background: var(--hero-bg);
}
.hero.is-3d .story-stage { position: absolute; inset: 0; z-index: 0; }
.hero-canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.hero-copy {
  position: relative; z-index: 3; pointer-events: none;
  max-width: var(--max); margin: 0 auto; padding: 92px 16px 0; transition: opacity .5s ease;
}
.hero-copy h1 { max-width: 13em; margin: 0 0 6px; font-size: 2.2rem; font-weight: 800; text-wrap: balance; }
.hero.has-sel .hero-copy { opacity: .55; }
.hero-hint { margin: 0; font: 12.5px/1.5 var(--font-mono); color: var(--muted); }
.hero .proxies {
  position: relative; z-index: 4; list-style: none; margin: 8px auto 0; padding: 0 16px;
  max-width: var(--max); display: flex; flex-wrap: wrap; gap: 6px; height: 0; overflow: visible;
}
.proxies { list-style: none; margin: 0; padding: 0; position: relative; z-index: 4; height: 0; overflow: visible; display: flex; flex-wrap: wrap; gap: 6px; }   /* a focused proxy shows without moving the page */
.proxy {
  position: absolute; left: -9999px;
  font: 12px var(--font-mono); padding: 4px 10px; border-radius: 999px; min-height: 32px;
  background: var(--term-panel); color: var(--term-text); border: 1px solid var(--scene-accent);
}
.proxy:focus { position: static; left: auto; }
.scene-ctl {
  position: absolute; z-index: 4; right: 16px; top: 84px;
  font: 12px var(--font-mono); min-height: 32px; padding: 4px 12px; border-radius: 6px;
  color: var(--term-text); background: var(--term-panel); border: 1px solid var(--term-line); cursor: pointer;
}
.scene-ctl:hover { border-color: var(--scene-accent); }

/* satellites: fixed cards outside the 3D carousel, tied by a leader to their anchor */
.satellites {
  position: absolute; z-index: 4; right: 16px; top: 132px; width: 214px;
  display: flex; flex-direction: column; gap: 10px;
}
.satellites .node { font: 11.5px/1.45 var(--font-mono); padding: 7px 10px; }
.satellites .node-title { font-size: 15px; }
.satellites .m-text { white-space: normal; overflow: visible; }
.node.is-satellite.is-sel { transform: none; }
.sat-leaders { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: visible; }
.sat-leader { fill: none; stroke: var(--role); stroke-width: 1.2; stroke-dasharray: 3 4; transition: opacity .4s ease; }
.sat-packet { fill: var(--role); filter: drop-shadow(0 0 5px var(--role)); }

/* bottom dock: session log + progress rail */
.hero-dock {
  position: absolute; z-index: 3; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(var(--max), calc(100% - 32px));
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.25fr); gap: 12px; align-items: end;
}
.story-log {
  font: 11.5px/1.55 var(--font-mono); color: var(--term-text);
  background: var(--term-bg); border: 1px solid var(--term-line); border-radius: 8px;
  padding: 6px 10px 8px; box-shadow: var(--shadow-card); pointer-events: none;
}
.story-log.is-pinned { border-color: var(--scene-accent); }
.log-head { color: var(--term-muted); letter-spacing: .04em; }
.story-log.is-pinned .log-head { color: var(--scene-accent); }
.log-list { list-style: none; margin: 0; padding: 0; min-height: 6.2em; }
.log-list li { display: grid; grid-template-columns: 5.8em 7.6em minmax(0, 1fr); gap: 8px; }
.log-list li.is-new { animation: log-in .45s cubic-bezier(.22, .8, .3, 1); }
.log-empty { color: var(--term-muted); display: block !important; }
.log-t { color: var(--term-muted); }
.log-who { color: var(--role); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-x { overflow-wrap: anywhere; }
@keyframes log-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* progress rail */
.rail {
  position: relative; padding: 10px 14px 8px;
  background: var(--term-bg); border: 1px solid var(--term-line); border-radius: 8px;
  box-shadow: var(--shadow-card); font-family: var(--font-mono);
}
.rail-steps {
  list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr));
  position: relative;
}
.rail-steps::before { content: ""; position: absolute; left: 6%; right: 6%; bottom: 3px; height: 1px; background: var(--term-line); }
.rail-step { display: flex; }   /* every button as tall as the row, so the dots line up */
.rail-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 0;
  width: 100%; height: 100%; min-height: 44px; padding: 2px 2px 10px; cursor: pointer;
  font: 11px/1.3 var(--font-mono); color: var(--term-muted); background: none; border: 0;
}
.rail-btn::after {
  content: ""; position: absolute; bottom: 0; left: 50%; width: 7px; height: 7px; margin-left: -3.5px;
  border-radius: 50%; background: var(--term-bg); border: 1px solid var(--term-line);
  transition: background .4s ease, border-color .4s ease, box-shadow .4s ease;
}
.rail-n { opacity: .8; }
.rail-label {
  max-width: 100%; overflow: hidden; text-align: center; overflow-wrap: break-word;
  font: 700 13px/1.25 var(--font-sans); color: var(--term-text);
}
.rail-btn.is-past::after { background: var(--term-line); }
.rail-btn.is-on .rail-label, .rail-btn.is-on .rail-n { color: var(--scene-accent); }
.rail-btn.is-on::after { background: var(--scene-accent); border-color: var(--scene-accent); box-shadow: 0 0 10px var(--scene-accent); }
.rail-btn[aria-expanded="true"] .rail-label { text-decoration: underline; text-underline-offset: 4px; }
.rail-btn:focus-visible { outline: 2px solid var(--scene-accent); outline-offset: 2px; }

/* the builder bot walking along the rail */
.bot {
  position: absolute; left: 0; top: -26px; width: 26px; height: 28px; opacity: 0;
  transition: transform .9s cubic-bezier(.45, 0, .2, 1), opacity .4s ease; pointer-events: none;
}
.bot.is-shown { opacity: 1; }
.bot svg { display: block; overflow: visible; }
.bot-head { fill: var(--term-panel); stroke: var(--scene-accent); stroke-width: 1.5; }
.bot-face { fill: var(--term-bg); }
.bot-eye, .bot-tip, .bot-leg { fill: var(--scene-accent); }
.bot-ant { stroke: var(--scene-accent); stroke-width: 1.5; }
.bot-body { fill: var(--term-panel); stroke: var(--scene-accent); stroke-width: 1.2; }
.bot.is-walking .bot-leg.l { animation: bot-step .3s ease-in-out 3 alternate; }
.bot.is-walking .bot-leg.r { animation: bot-step .3s ease-in-out 3 alternate-reverse; }
.bot.is-walking svg { animation: bot-bob .3s ease-in-out 3 alternate; }
@keyframes bot-step { from { transform: translateY(0); } to { transform: translateY(-2px); } }
@keyframes bot-bob { from { transform: translateY(0); } to { transform: translateY(-1.5px); } }
.is-paused .bot svg, .is-paused .bot-leg { animation: none; }

/* caption panel: beside the object, docked on wide 3D scenes, a bottom sheet on phones */
.cap {
  position: absolute; z-index: 10; width: min(320px, calc(100% - 32px));
  padding: 12px 34px 12px 14px; border-radius: 10px;
  font: 12.5px/1.55 var(--font-mono); color: var(--term-text);
  background: var(--term-panel); border: 1px solid var(--term-line);
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(0, 0, 0, .08);
  animation: cap-in .3s cubic-bezier(.22, .8, .3, 1);
}
.cap[hidden] { display: none; }
.cap.is-pinned { border-color: var(--scene-accent); }
.cap-kicker { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--term-muted); }
.cap-title { font: 700 18px/1.2 var(--font-sans); color: var(--scene-accent); margin: 2px 0 6px; }
.cap-body p { margin: 0 0 4px; }
.cap-close {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 6px;
  font: 18px/1 var(--font-sans); color: var(--term-text); background: transparent; border: 1px solid transparent; cursor: pointer;
}
.cap:not(.is-pinned) .cap-close { display: none; }
.cap:not(.is-pinned) { pointer-events: none; }   /* a preview never stands between the pointer and an object */
.cap-close:hover { border-color: var(--term-line); }
.cap.is-docked { width: 300px; animation: none; }
.cap-leader { position: absolute; left: 0; top: 0; z-index: 9; pointer-events: none; overflow: visible; }
.cap-leader path { fill: none; stroke: var(--scene-accent); stroke-width: 1; stroke-dasharray: 2 3; }
.cap-leader circle { fill: var(--scene-accent); }
.cap.is-sheet {
  position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; z-index: 40;
  padding-right: 48px; animation: sheet-in .35s cubic-bezier(.22, .8, .3, 1);
}
.cap.is-sheet .cap-close { width: 44px; height: 44px; top: 0; right: 0; }
@keyframes cap-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 960px) {
  .hero-copy { padding-top: 104px; }
  .hero-copy h1 { font-size: 3.2rem; }
}
/* below 1100 px the hero is the compact rendering: title, the scene, satellites, rail, log */
@media (max-width: 1099px) {
  .top.is-over { position: relative; background: color-mix(in srgb, var(--bg) 88%, transparent); border-bottom: 1px solid var(--line); }
  .hero { min-height: 0; display: flex; flex-direction: column; overflow: visible; padding: 0 0 12px; }
  .hero-copy { order: -1; width: 100%; max-width: none; margin: 0; padding: 16px 16px 10px; }
  .hero-copy h1 { font-size: 1.9rem; }
  .hero-hint { font-size: 13px; }
  .hero.is-3d .story-stage {
    position: relative; inset: auto; order: 0; height: min(50vh, 430px); min-height: 330px; margin: 0 8px;
    border-radius: 14px; overflow: hidden; background: var(--bg-alt); border: 1px solid var(--line);
  }
  .hero .scene-ctl { top: 10px; right: 10px; min-height: 44px; padding: 6px 16px; font-size: 14px; }
  .hero .satellites { position: static; order: 2; width: auto; margin: 8px 8px 0; flex-direction: row; gap: 8px; }
  .satellites .node { flex: 1 1 0; min-width: 0; min-height: 44px; font-size: 13px; padding: 6px 10px; }
  .satellites .node-title { font-size: 15px; }
  .satellites .node-status, .satellites .node-sub { display: none; }
  .hero .sat-leaders { display: none; }
  .hero-dock { position: static; order: 3; transform: none; width: auto; align-self: stretch; margin: 30px 8px 0; display: flex; flex-direction: column; gap: 8px; }
  .hero-dock > * { width: 100%; }
  .hero .rail { order: 1; }
  .hero .story-log { order: 2; }
  .story-log { font-size: 13px; padding: 6px 10px 8px; }
  .log-list { min-height: 0; max-height: calc(3 * 1.55em); overflow-y: auto; overscroll-behavior: contain; }
  .log-list li { grid-template-columns: 7.5em minmax(0, 1fr); }
  .log-list li .log-t { display: none; }
  .rail { padding: 8px 4px 6px; }
  .rail-label { font-size: 11px; letter-spacing: 0; text-transform: none; }
  .rail-n { display: none; }
  .hero .proxies { height: 0; }
}
@media (max-width: 560px) {
  /* six journey steps do not fit one row on a phone: two rows of three, the bot walks to the row */
  .rail-steps { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; row-gap: 30px; }
  .rail { padding-top: 30px; }
  .rail-steps::before { display: none; }
  .bot { top: 4px; }
}
@media (max-width: 420px) {
  .rail-label { font-size: 10px; }
}
/* phones: the stage is as tall as the front card needs (the card spans 80 % of the width) plus room for the pause control */
@media (max-width: 440px) {
  .hero.is-3d .story-stage { height: calc(56vw + 76px); min-height: 0; }
}
@media (max-width: 340px) {
  .rail-label { font-size: 9px; }
}
@media (hover: none) { .hint-mouse { display: none; } }
@media (hover: hover) { .hint-touch { display: none; } }

/* ---- flat scene (no WebGL, or reduced motion) ---- */
.story-stage.is-dom { position: relative; z-index: 1; padding: 12px 16px 8px; width: 100%; max-width: var(--max); margin: 0 auto; }
.dom-legend {
  display: flex; flex-wrap: wrap; gap: 2px 16px; justify-content: center;
  font: 12px var(--font-mono); color: var(--muted); margin: 8px 0 14px;
}
.term-key { display: inline-flex; align-items: center; gap: 6px; }
.term-key i { width: 9px; height: 9px; background: var(--role); border-radius: 2px; flex: none; }
.dom-stage {
  position: relative; display: grid; gap: 28px 12px; font: 12px/1.5 var(--font-mono);
  grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 20px 18px 0 4px;
}
.dom-stage.is-wide { gap: 34px 26px; }
.term-edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.edge { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2 3; }
.edge.is-hot, .edge.is-sel { stroke: var(--role, var(--scene-accent)); stroke-dasharray: none; stroke-width: 1.8; }
.edge.is-sel { stroke: var(--accent); }
.edge-hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.edge-head { fill: var(--muted); }
.packet circle { fill: var(--role); }
.packet .trail { opacity: .45; }
.node {
  position: relative; z-index: 1; min-width: 0; cursor: pointer;
  background: var(--term-panel); color: var(--term-text);
  border: 1.5px solid var(--role); border-radius: 8px; padding: 8px 10px;
  box-shadow: var(--shadow-card); transition: box-shadow .4s ease, opacity .4s ease, transform .4s cubic-bezier(.22, .8, .3, 1);
}
.node.is-active, .node.is-pulse, .node.is-hover, .node.is-sel {
  box-shadow: var(--shadow-card), 0 0 0 1px var(--scene-accent), 0 0 22px -4px var(--scene-accent);
}
.node.is-sel { transform: translateY(-3px); }
.dom-stage.has-sel .node:not(.is-sel) { opacity: .35; }
.node-title { color: var(--role); font: 700 15px/1.25 var(--font-sans); }
.node-sub { color: var(--term-muted); }
.m-row { display: flex; align-items: center; gap: 8px; }
.m-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-val { color: var(--role); font-weight: 700; white-space: nowrap; }
.m-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-bar { flex: 0 0 34%; height: 9px; border: 1px solid var(--term-line); border-radius: 2px; background: var(--term-bg); overflow: hidden; }
.m-bar i { display: block; height: 100%; width: 0; background: var(--role); }
.node-status { margin-top: 2px; color: var(--term-muted); }
.node.st-run .node-status, .node.st-done .node-status { color: var(--role); }
.st-glyph { display: inline-block; width: 1.4em; }
.hero:not(.is-3d) { min-height: 0; padding-bottom: 24px; display: flex; flex-direction: column; }
.hero:not(.is-3d) .hero-dock { position: relative; left: auto; bottom: auto; transform: none; margin: 12px auto 0; }
.hero:not(.is-3d) .hero-copy { order: -1; width: 100%; padding-bottom: 8px; }
.hero:not(.is-3d) .scene-ctl { display: none; }
@media (min-width: 1100px) {
  .hero:not(.is-3d) .hero-copy { padding-top: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .log-list li.is-new, .cap, .cap.is-sheet { animation: none; }
  .node, .bot, .rail-btn::after, .hero-copy { transition: none; }
  .bot.is-walking svg, .bot.is-walking .bot-leg { animation: none; }
}

/* ==== Live cards (the product landing's "Como funciona" cards, on this palette) ==== */
.scard {
  position: relative; border-radius: 12px; overflow: visible;
  font: 12.5px/1.5 var(--font-mono); color: var(--term-text);
  background: var(--term-bg); border: 1px solid var(--term-line); box-shadow: var(--shadow-card);
}
.scard-bar {
  display: flex; align-items: center; gap: 12px; padding: 7px 12px;
  border-bottom: 1px solid var(--term-line); background: var(--term-chrome);
  border-radius: 12px 12px 0 0; color: var(--term-muted); font-size: 11.5px;
}
.scard-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .04em; }
.scard-ctl {
  font: inherit; color: var(--term-text); background: var(--term-bg); border: 1px solid var(--term-line);
  border-radius: 6px; min-height: 32px; padding: 2px 10px; cursor: pointer;
}
.scard-ctl:hover { border-color: var(--scene-accent); }
.scard-head { padding: 14px 16px 6px; }
.scard-head h2 { margin: 0; color: var(--term-text); font: 800 clamp(1.5rem, 3vw, 2.1rem)/1.15 var(--font-sans); letter-spacing: -.015em; }
.scard-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 8px 16px 12px; }
.scard-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 16px 10px;
  border-top: 1px dashed var(--term-line); color: var(--term-muted); font-size: 11.5px;
}
.scard-file { color: var(--scene-accent); }
@media (min-width: 1000px) { .scard-body { grid-template-columns: minmax(0, 1fr) 220px; } }

/* objects that explain themselves */
[data-cap] { cursor: pointer; transition: box-shadow .3s ease, opacity .35s ease, outline-color .3s ease; outline: 1px dashed transparent; outline-offset: 3px; }
[data-cap]:hover, [data-cap]:focus-visible { outline-color: var(--scene-accent); }
[data-cap].is-sel { outline: 1.5px solid var(--scene-accent); box-shadow: 0 0 22px -6px var(--scene-accent); }
.scard.has-sel .demo [data-cap]:not(.is-sel) { opacity: .4; }

.mini-head { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--term-muted); margin-bottom: 4px; }
.demo { position: relative; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.demo > *, .demo-col > * { min-width: 0; }
.demo-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.issue, .crit-box, .commits, .prcard, .notes, .validate, .tile-box {
  background: var(--term-panel); border: 1px solid var(--term-line); border-radius: 8px; padding: 8px 10px;
}
.tasklog {
  align-self: start; background: var(--term-panel); border: 1px solid var(--term-line); border-radius: 8px;
  padding: 8px 10px; min-height: 120px;
}
.tasklog ul { list-style: none; margin: 0; padding: 0; }
.tasklog li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-cur { display: none; width: .55em; height: 1.05em; margin-left: 1px; vertical-align: -2px; background: var(--scene-accent); }
.tasklog li[data-cur="1"] .tl-cur { display: inline-block; animation: term-blink 1s steps(1) infinite; }
@keyframes term-blink { 50% { opacity: 0; } }
.scard.is-paused .tl-cur { animation: none; }
.lab {
  display: inline-block; padding: 1px 8px; margin: 0 4px 4px 0; border-radius: 999px;
  border: 1px solid var(--role-github); color: var(--role-github); font-size: 11.5px;
}

/* what you get: a repository at work */
.get { background: var(--bg-alt); }
@media (min-width: 700px) { .demo-repo { grid-template-columns: repeat(2, minmax(0, 1fr)); } .demo-repo .demo-col:last-child { grid-column: 1 / -1; } }
@media (min-width: 1100px) { .demo-repo { grid-template-columns: repeat(3, minmax(0, 1fr)); } .demo-repo .demo-col:last-child { grid-column: auto; } }
.issue { display: flex; flex-direction: column; gap: 8px; }
.is-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.is-state, .pr-state {
  padding: 1px 8px; border-radius: 999px; font-weight: 700; font-size: 11.5px;
  background: var(--role-client); color: var(--term-bg);
}
.is-state.is-closed { background: var(--role-agent); }
.is-n { color: var(--role-github); font-weight: 700; }
.is-title { flex: 1 1 100%; font: 700 15px/1.3 var(--font-sans); color: var(--term-text); min-height: 1.3em; }
.crit { list-style: none; margin: 0; padding: 0; }
.crit li { position: relative; padding-left: 22px; color: var(--term-muted); transition: color .3s ease; }
.crit li::before {
  content: ""; position: absolute; left: 0; top: .3em; width: 12px; height: 12px; border-radius: 3px;
  border: 1px solid var(--term-line); background: var(--term-bg);
}
.crit li.is-on { color: var(--term-text); }
.crit li.is-on::before { content: "✓"; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--term-bg); background: var(--scene-accent); border-color: var(--scene-accent); }
.commit { color: var(--term-text); overflow-wrap: anywhere; padding: 2px 0; border-bottom: 1px dashed var(--term-line); }
.commit:last-child { border-bottom: 0; }
.sha { color: var(--role-github); }
.prcard { display: flex; flex-direction: column; gap: 6px; }
.pr-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.pr-state { background: var(--role-client); }
.pr-state.is-merged { background: var(--role-agent); }
.pr-title { font: 700 14px/1.3 var(--font-sans); color: var(--term-text); }
.pr-branch { color: var(--role-github); overflow-wrap: anywhere; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px; border-radius: 6px; }
.check {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--term-line); color: var(--term-muted); transition: color .3s ease, border-color .3s ease;
}
.check::before { content: "○"; }
.check.is-on { border-color: var(--role-core); color: var(--role-core); }
.check.is-on::before { content: "✓"; font-weight: 700; }
.checks-head { flex: 1 1 100%; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--term-muted); }
.notes { display: flex; flex-direction: column; gap: 4px; }
.note-l { color: var(--term-text); }
.validate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; transition: border-color .3s ease, box-shadow .3s ease; }
.v-btn { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 14px; border-radius: 6px; font-weight: 700; background: var(--role-client); color: var(--term-bg); }
.v-done { color: var(--scene-accent); }
.validate.is-ok { border-color: var(--scene-accent); box-shadow: 0 0 18px -6px var(--scene-accent); }

/* tooling we bring: small live tiles */
.tiles { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; }
.tile-head { padding: 10px 12px 2px; }
.tile-head h3 { margin: 0; font: 700 16px/1.25 var(--font-sans); color: var(--term-text); letter-spacing: 0; }
.tile-demo { padding: 8px 12px 14px; gap: 10px; flex: 1; align-content: start; }

/* the studio's product: a still pointer to its own page, no scene of it here */
.still { gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-alt); }
.still-name { margin: 0; font: 700 .78rem/1.2 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.still-p { margin: 0; max-width: 46ch; font-size: 1.05rem; line-height: 1.5; color: var(--ink); }
.still-more { margin: auto 0 0; }
.still-more a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* offline-first sync */
.devices { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); align-items: center; gap: 6px; padding: 2px; border-radius: 8px; }
.dev { min-height: 112px; }
.dev-st { color: var(--role-human); font-size: 11.5px; }
.dev-st::before { content: "● "; }
.is-online .dev-st { color: var(--scene-accent); }
.edit { color: var(--term-text); font-size: 11.5px; overflow-wrap: anywhere; }
.edit.theirs { color: var(--role-github); }
.link { position: relative; height: 2px; background: var(--term-line); }
.is-online .link { background: var(--scene-accent); }
.link i { position: absolute; top: -4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--scene-accent); box-shadow: 0 0 10px var(--scene-accent); }
.merge { color: var(--scene-accent); }

/* the health case */
.case { background: var(--bg-alt); }
@media (min-width: 700px) { .demo-health { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.h-item { font: 700 14px/1.35 var(--font-sans); color: var(--term-text); }
.h-reason { color: var(--role-human); margin-top: 4px; }
.xcheck { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.xcheck .mini-head { flex: 1 1 100%; }
.evidence { display: flex; flex-direction: column; gap: 4px; }
.ev-l { color: var(--term-text); }
.ev-l.clause { color: var(--scene-accent); font-weight: 700; }
.an-ready { flex: 1 1 100%; color: var(--term-text); }

@media (max-width: 699px) {
  .scard-ctl, .proof-scene .scene-ctl { min-height: 44px; padding: 6px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .tasklog li[data-cur="1"] .tl-cur { animation: none; }
  [data-cap], .crit li, .check, .validate { transition: none; }
}
