/* Umbra project website — Direction A, light editorial.
 *
 * No build step, no framework, no web fonts: the page is one stylesheet, one
 * small script, and a system font stack. The repository keeps its dependencies
 * deliberately few, and a marketing page is a poor place to break that rule.
 *
 * Design tokens follow docs/website-design.md: warm off-white ground, ink text,
 * indigo for action and state, cyan for event flow, lavender as a restrained
 * glow only. One-pixel lines, an 8px spacing rhythm, 8-12px radii.
 */

/* ── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  --ground: #f7f7f3;
  --surface: #ffffff;
  --surface-sunken: #f1f1ec;
  --ink: #0c1424;
  --ink-muted: #4a5468;
  --ink-faint: #6b7488;
  --line: #dedfd8;
  --line-strong: #c6c8be;

  --indigo: #3157f6;
  --indigo-deep: #1f3ec9;
  --indigo-wash: #eaefff;
  --cyan: #19bde1;
  --cyan-ink: #0d6d84;
  --cyan-wash: #e6f7fb;
  --lavender: #8b7cf0;
  --lavender-wash: #f0edfe;
  --amber-ink: #7a4a05;
  --amber-wash: #fdf3e2;
  --amber-line: #e9c98d;

  --panel: #0c1424;
  --panel-line: #1e2a41;
  --panel-ink: #d6dcea;
  --panel-faint: #8a94ab;

  --tok-comment: #7b879f;
  --tok-string: #7fd7a5;
  --tok-key: #9db4ff;
  --tok-fn: #79d8ef;
  --tok-num: #e0b86a;
  --tok-out: #cdd4e3;

  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 48px;
  --s6: 64px;
  --s7: 96px;

  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 12px;

  --shell: 1180px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

/* The dark direction is offered, never imposed: it rides on prefers-color-scheme
 * and inverts to ink rather than pure black. Same layout, same content. */
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #080c15;
    --surface: #0e1524;
    --surface-sunken: #0b111d;
    --ink: #eef1f7;
    --ink-muted: #a3adc2;
    --ink-faint: #8790a4;
    --line: #1e2a41;
    --line-strong: #2b3a56;

    --indigo: #7d93ff;
    --indigo-deep: #9dafff;
    --indigo-wash: #131c33;
    --cyan: #3fcfef;
    --cyan-ink: #6adcf6;
    --cyan-wash: #0d1f27;
    --lavender: #a394ff;
    --lavender-wash: #171633;
    --amber-ink: #efc07a;
    --amber-wash: #241a0c;
    --amber-line: #5b431d;

    --panel: #05090f;
    --panel-line: #1a2437;
  }
}

/* ── Reset and base ─────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.12; letter-spacing: -0.022em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.05rem, 5.6vw, 3.9rem); font-weight: 700; }
/* Each sentence takes its own line once there is room for it to. */
h1 span { display: inline; }
@media (min-width: 620px) { h1 span { display: block; } }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); font-weight: 650; }
h3 { font-size: 1.14rem; font-weight: 650; letter-spacing: -0.012em; }
p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }

a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--indigo-deep); }

code {
  font-family: var(--mono);
  font-size: 0.885em;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08em 0.36em;
  white-space: nowrap;
}

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

.skip-link {
  position: absolute;
  left: var(--s2);
  top: -100px;
  z-index: 100;
  background: var(--indigo);
  color: #fff;
  padding: 10px var(--s2);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top 120ms ease;
}
.skip-link:focus { top: var(--s2); color: #fff; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--s3);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.965rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-deep); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink-muted); color: var(--ink); }
.btn-quiet { color: var(--ink-muted); padding: 8px 12px; }
.btn-quiet:hover { color: var(--ink); background: var(--surface-sunken); }

/* ── Header ─────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ground); /* fallback: a translucent header must never fail open */
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 68px;
}
.wordmark {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.nav {
  display: flex;
  gap: var(--s3);
  margin-inline: auto;
  font-size: 0.95rem;
}
.nav a {
  color: var(--ink-muted);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a.is-current { color: var(--indigo); border-bottom-color: var(--indigo); }

.header-actions { display: flex; align-items: center; gap: var(--s1); margin-left: auto; }
.btn-icon svg { flex: none; }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  content: "";
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before { position: absolute; top: -5px; }
.nav-toggle-bars::after { position: absolute; top: 5px; }

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  padding-block: clamp(var(--s5), 8vw, var(--s7)) clamp(var(--s5), 7vw, 88px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
/* Faint dot-grid: the recurring texture behind the cell motif. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.4;
  mask-image: radial-gradient(120% 90% at 60% 10%, #000 15%, transparent 72%);
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: var(--s5);
}
.eyebrow {
  color: var(--indigo);
  font-size: 0.775rem;
  font-weight: 650;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  margin-bottom: var(--s3);
}
.lede {
  margin-top: var(--s3);
  font-size: clamp(1.05rem, 1.9vw, 1.28rem);
  color: var(--ink-muted);
  max-width: 40ch;
  text-wrap: pretty;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }

.hero-art { position: relative; display: grid; place-items: center; min-height: 300px; }
.hero-cube { width: min(100%, 340px); color: var(--ink); opacity: 0.5; }
.hero-glow {
  position: absolute;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--lavender) 0%, transparent 68%);
  opacity: 0.28;
  filter: blur(26px);
  transform: translateY(28%);
}

/* ── Section scaffolding ────────────────────────────────────────────────── */

.section { padding-block: clamp(var(--s5), 7vw, 88px); border-bottom: 1px solid var(--line); }
.section-alt { background: var(--surface-sunken); }

.section-kicker {
  color: var(--indigo);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  margin-bottom: var(--s2);
}
.section-head { max-width: 62ch; margin-bottom: var(--s5); }
.section-head code { white-space: nowrap; }
.section-sub {
  margin-top: var(--s2);
  color: var(--ink-muted);
  font-size: 1.055rem;
  text-wrap: pretty;
}
.footnote {
  margin-top: var(--s4);
  max-width: 76ch;
  color: var(--ink-faint);
  font-size: 0.93rem;
  text-wrap: pretty;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s3);
}

/* ── Feature grid ───────────────────────────────────────────────────────── */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: var(--s3);
}
.feature-card {
  position: relative;
  padding-bottom: var(--s4);
  overflow: hidden;
}
/* The 2px underline is the only chromatic flourish per card. */
.feature-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: currentColor;
}
.accent-indigo { color: var(--indigo); }
.accent-lavender { color: var(--lavender); }
.accent-cyan { color: var(--cyan); }

.card-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  margin-bottom: var(--s3);
}
.card-icon svg { width: 26px; height: 26px; }
.feature-card h3 { color: var(--ink); margin-bottom: var(--s1); }
.feature-card p { color: var(--ink-muted); font-size: 0.955rem; }

/* ── Architecture diagram ───────────────────────────────────────────────── */

.diagram-figure { margin: 0; }
.diagram {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(var(--s3), 4vw, var(--s5));
}
.diagram-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1.15fr auto 1fr;
  align-items: stretch;
  gap: var(--s1);
}

.node {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--s2);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.node-role {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.node-title { font-weight: 650; font-size: 1.02rem; letter-spacing: -0.01em; }
.node-note { font-size: 0.83rem; color: var(--ink-muted); }
.node-note code { font-size: 0.95em; background: none; border: none; padding: 0; }

/* The cell is the recurring brand motif: dashed outline, its guest nested inside. */
.node-cell {
  border-style: dashed;
  border-color: var(--indigo);
  background: var(--indigo-wash);
}
.node-inner {
  margin-top: var(--s1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px var(--s2);
}

.connector {
  position: relative;
  align-self: center;
  /* Wide enough that the label above it clears the nodes on either side. */
  min-width: 72px;
  height: 40px;
}
.connector::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 7px;
  border-top: 1px dashed var(--line-strong);
}
.connector::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  transform: translateY(-50%) rotate(45deg);
}
.connector-label {
  position: absolute;
  left: 50%;
  bottom: calc(50% + 7px);
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* The return path: the receiver hands the stream back to the orchestrator. */
.return-lane {
  position: relative;
  margin-top: var(--s3);
  height: 46px;
  border: 1px dashed var(--cyan);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
/* The chevron sits on the lane's top-left corner and points up, into the
 * orchestrator: a top+left border pair rotated 45deg is an upward arrowhead. */
.return-lane::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 7px;
  height: 7px;
  border-top: 1px solid var(--cyan);
  border-left: 1px solid var(--cyan);
  transform: translate(-50%, -50%) rotate(45deg);
}
.return-label {
  position: absolute;
  left: 50%;
  bottom: -0.75em;
  transform: translateX(-50%);
  background: var(--surface);
  padding-inline: var(--s2);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--cyan-ink);
  white-space: nowrap;
}

.diagram-alt {
  margin-top: var(--s3);
  max-width: 78ch;
  color: var(--ink-faint);
  font-size: 0.93rem;
  text-wrap: pretty;
}

.tier-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s3);
  margin-top: var(--s5);
}
.tier-list li {
  border-top: 2px solid var(--ink);
  padding-top: var(--s2);
  color: var(--ink-muted);
  font-size: 0.95rem;
}
.tier-name {
  color: var(--ink);
  font-weight: 650;
  font-size: 1.05rem;
  margin-bottom: 2px;
}
.tier-meta { margin-top: var(--s1); font-size: 0.86rem; }
.tier-meta span {
  display: inline-block;
  min-width: 56px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* ── Backends ───────────────────────────────────────────────────────────── */

/* A strip: all five backends sit in one row at full width, so they read as a
 * set of choices rather than a ranked list. */
.backend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(206px, 1fr));
  gap: var(--s2);
}
.backend-card { padding: var(--s2); }
.backend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s1);
  padding-bottom: var(--s2);
  margin-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}
.backend-name { font-family: var(--mono); font-weight: 650; font-size: 1.02rem; }
.tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--cyan-wash);
  color: var(--cyan-ink);
  border: 1px solid color-mix(in srgb, var(--cyan) 34%, transparent);
  white-space: nowrap;
}
.tag-warn { background: var(--amber-wash); color: var(--amber-ink); border-color: var(--amber-line); }
.backend-card.is-unisolated { border-color: var(--amber-line); }

.backend-card dt {
  font-family: var(--mono);
  font-size: 0.67rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: var(--s2);
}
.backend-card dt:first-of-type { margin-top: 0; }
.backend-card dd { font-size: 0.925rem; color: var(--ink-muted); margin-top: 2px; }

/* ── Callouts ───────────────────────────────────────────────────────────── */

.callout {
  margin-top: var(--s4);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: var(--s3);
  font-size: 0.955rem;
  color: var(--ink-muted);
  max-width: 88ch;
}
.callout p + p { margin-top: var(--s2); }
.callout-title {
  display: flex;
  align-items: center;
  gap: var(--s1);
  font-weight: 650;
  color: var(--ink);
  margin-bottom: var(--s1);
}
.callout-warn { background: var(--amber-wash); border-color: var(--amber-line); }
.callout-warn .callout-title { color: var(--amber-ink); }
.callout-info { background: var(--indigo-wash); border-color: color-mix(in srgb, var(--indigo) 30%, transparent); }

/* ── Example switcher ───────────────────────────────────────────────────── */

.switcher {
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  overflow: hidden;
}
.switcher-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: 0 var(--s1) 0 var(--s1);
  border-bottom: 1px solid var(--panel-line);
  background: color-mix(in srgb, var(--panel) 82%, #ffffff);
}
.switcher-title {
  padding: 12px var(--s2);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--panel-faint);
}
/* Shown only when the page has no script, where the tabs cannot switch and each
   panel has to name itself — see the <noscript> block in index.html. */
.panel-label {
  display: none;
  margin: 0;
  padding: 12px var(--s3);
  border-bottom: 1px solid var(--panel-line);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--panel-faint);
}

.tablist { display: flex; overflow-x: auto; }
.tablist button {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 13px var(--s2) 11px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--panel-faint);
  cursor: pointer;
  white-space: nowrap;
}
.tablist button:hover { color: var(--panel-ink); }
.tablist button[aria-selected="true"] { color: #fff; border-bottom-color: var(--cyan); }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: var(--s1);
  padding: 7px 11px;
  background: none;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm);
  color: var(--panel-faint);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  flex: none;
}
.copy-btn:hover { color: #fff; border-color: var(--panel-faint); }
.copy-btn[data-copied] { color: var(--tok-string); border-color: var(--tok-string); }

.switcher pre {
  margin: 0;
  padding: var(--s3);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.815rem;
  line-height: 1.72;
  color: var(--panel-ink);
  tab-size: 4;
}
.switcher pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}
.switcher .c { color: var(--tok-comment); font-style: italic; }
.switcher .s { color: var(--tok-string); }
.switcher .k { color: var(--tok-key); }
.switcher .f { color: var(--tok-fn); }
.switcher .n { color: var(--tok-num); }
.switcher .o { color: var(--tok-out); }

/* ── Protocol timeline ──────────────────────────────────────────────────── */

.timeline {
  display: grid;
  gap: var(--s2);
  counter-reset: step;
  max-width: 92ch;
}
.timeline li {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--s3) var(--s3) var(--s3) var(--s6);
  color: var(--ink-muted);
  font-size: 0.95rem;
}
.timeline li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: var(--s3);
  top: var(--s3);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--indigo);
}
/* The rail that makes four cards read as one sequence. */
.timeline li::after {
  content: "";
  position: absolute;
  left: calc(var(--s3) + 11px);
  top: calc(var(--s3) + 28px);
  bottom: -9px;
  border-left: 1px dashed var(--line-strong);
}
.timeline li:last-child::after { display: none; }

.step-dir {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan-ink);
}
.step-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1);
  margin: 2px 0 6px;
}
.step-verb {
  font-family: var(--mono);
  font-weight: 650;
  font-size: 1.02rem;
  color: var(--ink);
}
.step-name code { font-size: 0.8rem; color: var(--ink-muted); }

/* ── What Umbra is not ──────────────────────────────────────────────────── */

/* Six items, so the track floor is chosen to give 3 x 2 rather than 5 + 1. */
.not-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--s1);
}
.not-grid li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 14px var(--s2);
  font-weight: 550;
}
.not-grid span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.85rem;
  line-height: 1;
}

/* ── Quickstart ─────────────────────────────────────────────────────────── */

.quickstart {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: var(--s5);
  align-items: center;
}
.quickstart .section-head { margin-bottom: 0; }
.quickstart-code { min-width: 0; }
.code-warning {
  margin-top: var(--s2);
  color: var(--amber-ink);
  font-size: 0.87rem;
}
.code-warning strong { font-weight: 650; }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer { padding-block: var(--s5) var(--s4); }
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--line);
}
.footer-brand p:last-child {
  margin-top: var(--s1);
  color: var(--ink-muted);
  font-size: 0.93rem;
  max-width: 34ch;
}
.footer-brand .wordmark { display: block; }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); font-size: 0.93rem; }
.footer-nav a { color: var(--ink-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--ink); text-decoration: underline; }
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  justify-content: space-between;
  padding-top: var(--s3);
  color: var(--ink-faint);
  font-size: 0.85rem;
}

/* ── Motion ─────────────────────────────────────────────────────────────── */

/* The diagram traces itself once as it enters view, then stops. It is never
 * required in order to read the diagram — the nodes are plain text either way. */
/* A transition rather than a keyframe animation, deliberately. An animation's
 * end state is a fill mode: if it is throttled, interrupted, or never enters its
 * active phase, the node keeps the *from* state and the diagram stays blank. A
 * transition's end state is the declared value, so the worst case here is that
 * the nodes appear without sliding — which is the correct thing to degrade to. */
.diagram.will-trace [data-flow] { opacity: 0; transform: translateY(8px); }
.diagram.is-tracing [data-flow] {
  opacity: 1;
  transform: none;
  transition: opacity 460ms ease-out, transform 460ms ease-out;
}
.diagram.is-tracing [data-flow="1"] { transition-delay: 0ms; }
.diagram.is-tracing [data-flow="2"] { transition-delay: 130ms; }
.diagram.is-tracing [data-flow="3"] { transition-delay: 260ms; }
.diagram.is-tracing [data-flow="4"] { transition-delay: 390ms; }
.diagram.is-tracing [data-flow="5"] { transition-delay: 520ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .diagram.will-trace [data-flow] { opacity: 1; transform: none; }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  /* The diagram folds to two rows before it folds to one: the Guest → Receiver
   * relationship survives every width. Children are Orchestrator, connector,
   * Factory, connector, Cell, connector, Receiver — dropping the fourth lets the
   * remaining six flow as 3 + 3. */
  .diagram-row { grid-template-columns: 1fr auto 1fr; }
  .diagram-row > :nth-child(4) { display: none; }
  .diagram-row > :nth-child(n + 5) { margin-top: var(--s3); }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s4); }
  .hero-art { order: -1; min-height: 190px; }
  .hero-cube { width: min(58%, 220px); }
  .lede { max-width: 46ch; }
  .quickstart { grid-template-columns: 1fr; gap: var(--s4); }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: var(--s1) var(--s3) var(--s3);
    background: var(--ground);
    border-bottom: 1px solid var(--line);
  }
  .nav:not(.is-open) { display: none; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav a.is-current { border-bottom-color: var(--line); }
  .nav-toggle { display: flex; }
  .header-inner { position: relative; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  /* One column: every node keeps its place in the sequence, none disappears. */
  .diagram-row { grid-template-columns: 1fr; }
  .diagram-row > :nth-child(n + 5) { margin-top: 0; }
  /* Connectors rotate to point down the vertical sequence. */
  .diagram-row > .connector { display: block; height: 34px; min-width: 0; }
  .connector::before { top: 0; bottom: 8px; left: 50%; right: auto; border-top: none; border-left: 1px dashed var(--line-strong); }
  .connector::after { top: auto; bottom: 0; right: auto; left: 50%; transform: translateX(-50%) rotate(135deg); }
  .connector-label {
    left: calc(50% + 14px);
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
  }
  .return-lane { height: auto; border: none; margin-top: var(--s2); }
  .return-lane::after { display: none; }
  .return-label {
    position: static;
    display: block;
    transform: none;
    padding: 10px var(--s2);
    border: 1px dashed var(--cyan);
    border-radius: var(--radius-sm);
    white-space: normal;
    text-align: center;
  }
  .timeline li { padding-left: var(--s3); padding-top: var(--s5); }
  .timeline li::before { top: var(--s3); }
  .timeline li::after { display: none; }
  .header-actions .btn-quiet:not(.btn-icon) { display: none; }
}

@media (max-width: 400px) {
  .shell { padding-inline: var(--s2); }
  .header-actions .btn-icon span { display: none; }
}
