/* walgit explainer — visual system */

:root {
  color-scheme: light dark;

  --bg: #0c0f14;
  --bg-2: #11161d;
  --bg-3: #151b25;
  --surface: #1a212c;
  --surface-2: #202a38;
  --surface-3: #263142;

  --text: #e8eef5;
  --text-2: #9fb0c3;
  --text-3: #6d7f94;

  --brand: #39d0a6;
  --brand-2: #25b08a;
  --brand-dim: rgba(57, 208, 166, 0.12);

  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.12);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.12);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);

  --wave-1: #39d0a6;
  --wave-2: #2563eb;

  --border: rgba(159, 176, 195, 0.14);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);

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

  --radius: 14px;
  --radius-sm: 8px;
  --max-width: 1120px;
  --nav-height: 56px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg-2: #f1f5f9;
    --bg-3: #e2e8f0;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --surface-3: #e2e8f0;

    --text: #0f172a;
    --text-2: #475569;
    --text-3: #64748b;

    --border: rgba(15, 23, 42, 0.1);
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  overflow-x: hidden;
}

html, body {
  overflow-x: hidden;
}

pre {
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--brand);
  color: #000;
  padding: 8px 16px;
  z-index: 100;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

a {
  color: var(--brand-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
}

h2 {
  font-size: clamp(2rem, 5vw, 3rem);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
}

p {
  margin: 0 0 1.1em;
}

ul, ol {
  padding-left: 1.4em;
  margin: 0 0 1.1em;
}

li {
  margin-bottom: 0.5em;
}

code, .inline {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 0.12em 0.35em;
  border-radius: 4px;
  color: var(--brand);
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* Navigation */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(12, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

@media (prefers-color-scheme: light) {
  .top-nav {
    background: rgba(248, 250, 252, 0.88);
  }
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
}

.logo {
  font-weight: 800;
  color: var(--brand);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.chapter-progress {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  min-width: 60px;
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
  transition: width 0.15s ease-out;
}

.chapter-dots {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 10px;
}

.chapter-dots a {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: background 0.2s, transform 0.2s;
}

.chapter-dots a.active {
  background: var(--brand);
  transform: scale(1.25);
}

.chapter-dots a:hover {
  background: var(--text-2);
}

/* Hero */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 20px 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-waves {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 840px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.8rem;
  color: var(--text-3);
  margin-bottom: 0.8em;
}

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.8rem);
  margin-bottom: 0.25em;
}

.brand {
  color: var(--brand);
}

.tagline {
  color: var(--text-2);
  font-weight: 500;
}

.lede {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  color: var(--text-2);
  max-width: 680px;
  margin: 0 auto 1.8em;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--brand);
  color: #000;
}

.btn-primary:hover {
  box-shadow: 0 10px 30px var(--brand-dim);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-3);
}

.hero-mini-arch {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-3);
}

.mini-arch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.arch-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-red { background: var(--red); }
.dot-amber { background: var(--amber); }
.dot-green { background: var(--brand); }

/* Sections */
.chapter {
  padding: 90px 20px;
  position: relative;
}

.chapter:nth-child(odd) {
  background: var(--bg-2);
}

.section-header {
  max-width: var(--max-width);
  margin: 0 auto 60px;
  text-align: center;
}

.chapter-label {
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.6em;
}

.chapter-subtitle {
  color: var(--text-2);
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  max-width: 760px;
  margin: 0 auto;
}

/* Narrative */
.narrative {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 48px;
  align-items: start;
}

.narrative.alt {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.copy {
  padding-top: 12px;
}

.copy h3 {
  margin-top: 0.5em;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.steps li {
  position: relative;
  padding-left: 44px;
  margin-bottom: 1.2em;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-dim);
  color: var(--brand);
  font-weight: 800;
  border-radius: 50%;
  font-size: 0.85rem;
}

.mechanisms dt {
  color: var(--text);
  font-weight: 700;
  margin-top: 1.2em;
}

.mechanisms dd {
  color: var(--text-2);
  margin-left: 0;
  margin-bottom: 0.4em;
}

/* Diagrams */
.diagram {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.diagram-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-2);
  margin-bottom: 16px;
  text-align: center;
}

.diagram > svg,
.diagram > div:not(.diagram-title):not(.diagram-controls) {
  flex: 1;
  width: 100%;
  min-height: 220px;
}

.diagram svg {
  width: 100%;
  height: auto;
  display: block;
}

.diagram-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.control {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.control:hover {
  background: var(--surface-3);
}

.control.active {
  background: var(--brand);
  color: #000;
  border-color: var(--brand);
}

.scrub {
  flex: 1;
  min-width: 120px;
  max-width: 220px;
  accent-color: var(--brand);
}

.status {
  font-size: 0.85rem;
  color: var(--text-3);
  min-width: 180px;
  text-align: center;
}

/* Packfile diagram */
.packfile-viz {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-3);
  min-height: 220px;
}

.pack-row {
  height: 24px;
  display: flex;
  gap: 3px;
  margin-bottom: 3px;
  padding: 3px;
}

.pack-chunk {
  flex: 1;
  border-radius: 3px;
  background: var(--surface-2);
  transition: background 0.2s;
  position: relative;
}

.pack-chunk.active {
  background: var(--brand);
  box-shadow: 0 0 10px var(--brand);
}

.read-probe {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--amber);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
}

.read-path {
  position: absolute;
  height: 2px;
  background: rgba(251, 191, 36, 0.5);
  transform-origin: left center;
  pointer-events: none;
}

.local-tag, .nfs-tag {
  position: absolute;
  top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.local-tag { left: 8px; background: var(--brand-dim); color: var(--brand); }
.nfs-tag { right: 8px; background: var(--red-dim); color: var(--red); }

/* Spokes SVG */
.spokes-svg .box {
  stroke: var(--border);
  stroke-width: 1.5;
}

.spokes-svg .replica {
  fill: var(--surface-2);
}

.spokes-svg .coord {
  fill: var(--amber-dim);
  stroke: var(--amber);
}

.spokes-svg .db {
  fill: var(--purple-dim);
  stroke: var(--purple);
}

.spokes-svg .pack {
  fill: var(--bg-3);
  stroke: var(--border);
}

.spokes-svg .link {
  stroke: var(--text-3);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.spokes-svg .label,
.spokes-svg .sublabel {
  fill: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
}

.spokes-svg .sublabel,
.spokes-svg .pack-label,
.spokes-svg .caption {
  fill: var(--text-2);
  font-size: 11px;
  font-weight: 500;
}

.spokes-svg .consensus-ring .label {
  fill: var(--amber);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

/* WAL diagram */
.wal-viz {
  display: flex;
  gap: 24px;
  align-items: stretch;
  min-height: 220px;
}

.wal-stack {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  padding: 16px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  overflow-y: auto;
}

.wal-entry {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(20px);
  animation: popIn 0.4s ease forwards;
}

.wal-entry .seq {
  font-family: var(--font-mono);
  color: var(--text-3);
  font-size: 0.78rem;
}

.wal-entry .kind {
  font-weight: 700;
  color: var(--text);
}

.wal-manifest {
  width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--brand-dim);
  border: 2px solid var(--brand);
  border-radius: var(--radius-sm);
  text-align: center;
}

.manifest-label {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand);
}

.manifest-note {
  font-size: 0.75rem;
  color: var(--text-2);
  line-height: 1.3;
}

@keyframes popIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Push SVG */
.push-svg .box {
  stroke: var(--border);
  stroke-width: 1.5;
}

.push-svg .client { fill: var(--blue-dim); stroke: var(--blue); }
.push-svg .server { fill: var(--amber-dim); stroke: var(--amber); }
.push-svg .bucket { fill: var(--brand-dim); stroke: var(--brand); }

.push-svg .label,
.push-svg .sublabel {
  fill: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
}

.push-svg .sublabel,
.push-svg .caption {
  fill: var(--text-2);
  font-size: 11px;
  font-weight: 500;
}

.push-svg .packet-path {
  stroke: var(--text-3);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.push-svg .packet {
  fill: var(--amber);
}

.push-svg .step-bubble {
  fill: var(--surface-2);
  stroke: var(--brand);
  stroke-width: 2;
}

.push-svg .step-num {
  fill: var(--brand);
  font-weight: 800;
  font-size: 14px;
}

.push-svg .step-label {
  fill: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

/* Read diagram */
.read-viz {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
}

.read-node {
  text-align: center;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 90px;
  font-weight: 700;
  font-size: 0.9rem;
}

.read-arrow {
  flex: 1;
  height: 2px;
  background: var(--text-3);
  margin: 0 12px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.read-arrow::after {
  content: '';
  position: absolute;
  right: 0;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid var(--text-3);
}

.status-code {
  background: var(--surface);
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--amber);
  border: 1px solid var(--border);
}

.status-code.hit { color: var(--brand); }
.status-code.miss { color: var(--red); }

.cache-pill {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 500;
}

/* walgit architecture */
.walgit-arch {
  position: relative;
  min-height: 220px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  padding: 20px;
}

.arch-bucket {
  width: 140px;
  height: 90px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface-3) 100%);
  border: 2px solid var(--brand);
  border-radius: 0 0 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 700;
  color: var(--brand);
}

.arch-bucket span {
  font-size: 0.7rem;
  color: var(--text-2);
  font-weight: 500;
}

.arch-fleet {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  max-width: 260px;
}

.arch-machine {
  width: 70px;
  height: 70px;
  background: var(--surface-2);
  border: 2px solid var(--blue);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  transition: transform 0.3s, opacity 0.3s, border-color 0.3s;
  position: relative;
}

.arch-machine.killed {
  opacity: 0.3;
  border-color: var(--red);
  transform: scale(0.9);
}

.arch-machine.new {
  animation: machineIn 0.4s ease-out;
}

@keyframes machineIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.arch-machine .label {
  font-size: 0.6rem;
  color: var(--text-2);
  font-weight: 500;
}

/* Bundle diagram */
.bundle-viz {
  position: relative;
  min-height: 220px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow: hidden;
}

.bundle-stack {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: flex-end;
  height: 140px;
  margin-bottom: 20px;
}

.bundle-file {
  width: 60px;
  border-radius: 6px 6px 0 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: 3px solid var(--brand);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
  font-size: 0.65rem;
  color: var(--text-2);
  transition: transform 0.2s, background 0.2s;
}

.bundle-file:hover, .bundle-file.active {
  background: var(--surface-3);
  transform: translateY(-4px);
}

.bundle-file .name {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.bundle-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 0.85rem;
  min-height: 50px;
}

.bundle-flow .node {
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.bundle-flow .arrow {
  color: var(--text-3);
  position: relative;
  width: 32px;
  text-align: center;
}

.bundle-packet {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--brand);
  opacity: 0;
  transition: left 0.4s linear, opacity 0.2s ease;
}

.bundle-flow .arrow:nth-of-type(2) .bundle-packet {
  transition-delay: 0s;
}

.packet {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--brand);
  border-radius: 50%;
}

/* Terminal */
.payoff {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 48px;
}

.terminal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: sticky;
  top: calc(var(--nav-height) + 24px);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot.red { background: var(--red); }
.terminal-dot.amber { background: var(--amber); }
.terminal-dot.green { background: var(--brand); }

.terminal-title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-3);
}

.terminal-body, .terminal-instructions pre {
  margin: 0;
  padding: 18px 20px;
  background: #070a0e;
  color: #c7d2e0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-x: auto;
}

.terminal-instructions pre {
  border-top: 1px solid var(--border);
  background: #0b0f14;
}

.terminal-body code, .terminal-instructions code {
  background: transparent;
  color: inherit;
}

/* Comparison table */
.comparison-wrap {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.comparison-wrap h3 {
  margin-bottom: 0;
}

.comparison-table {
  display: grid;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.thead .tr, .tbody .tr {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
}

.thead .th, .tbody .td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 0.9rem;
}

.thead .th {
  background: var(--bg-3);
  font-weight: 800;
  color: var(--text);
}

.tbody .td:first-child {
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-2);
}

.tbody .tr:last-child .td {
  border-bottom: 0;
}

.tbody .td:last-child, .thead .th:last-child {
  border-right: 0;
}

.tbody .tr:hover .td {
  background: var(--surface-2);
}

.tbody .tr:hover .td:first-child {
  background: var(--surface-3);
}

.tbody .tr .td:last-child {
  color: var(--brand);
  font-weight: 600;
}

/* Payoff cards */
.payoff-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.payoff-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
}

.payoff-card strong {
  color: var(--brand);
  font-size: 1.05rem;
}

.payoff-card span {
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Share sheet */
.share-sheet {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.share-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
}

.share-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.share-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 0.95rem;
}

.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand);
  color: #000;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 900px) {
  .narrative,
  .narrative.alt,
  .payoff {
    grid-template-columns: 1fr;
  }

  .wal-viz {
    flex-direction: column;
  }

  .wal-manifest {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
  }

  .terminal-card {
    position: static;
  }

  .thead .tr, .tbody .tr {
    grid-template-columns: 1fr 1fr;
  }

  .thead .th:nth-child(3),
  .thead .th:nth-child(4),
  .tbody .td:nth-child(3),
  .tbody .td:nth-child(4) {
    display: none;
  }

  .comparison-table::before {
    content: 'Continuity and walgit share the same object-store truth; expand for full comparison.';
    display: block;
    padding: 12px 16px;
    color: var(--text-3);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
  }

  .thead .th:nth-child(3),
  .thead .th:nth-child(4) {
    display: none;
  }
}

@media (max-width: 600px) {
  .chapter {
    padding: 60px 16px;
  }

  .hero {
    padding: 80px 16px 60px;
  }

  .diagram {
    padding: 14px;
  }

  .read-viz {
    flex-direction: column;
    gap: 16px;
  }

  .read-arrow {
    width: 2px;
    height: 30px;
    margin: 0;
  }

  .read-arrow::after {
    right: auto;
    bottom: 0;
    border-top: 8px solid var(--text-3);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 0;
  }

  .bundle-stack {
    gap: 6px;
    height: 110px;
  }

  .bundle-file {
    width: 44px;
    font-size: 0.55rem;
  }

  .bundle-flow {
    flex-wrap: wrap;
    gap: 8px;
  }

  .bundle-flow .arrow {
    width: 24px;
  }

  .bundle-flow .node {
    padding: 6px 10px;
  }

  .arch-machine {
    width: 58px;
    height: 58px;
    font-size: 0.65rem;
  }

  .arch-bucket {
    width: 110px;
    height: 70px;
  }

  .chapter-dots a {
    width: 8px;
    height: 8px;
  }

  .hero-mini-arch {
    gap: 10px;
  }

  .comparison-table .thead,
  .comparison-table .tbody .tr {
    grid-template-columns: 1fr;
  }

  .comparison-table .tbody .td {
    border-right: 0;
  }

  .comparison-table .thead {
    display: none;
  }

  .comparison-table .tbody .tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .comparison-table .tbody .td {
    display: flex;
    flex-direction: column;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
  }

  .comparison-table .tbody .tr:last-child .td:last-child {
    border-bottom: 0;
  }

  .comparison-table .tbody .td:nth-child(3),
  .comparison-table .tbody .td:nth-child(4) {
    display: flex;
  }

  .comparison-table .tbody .td::before {
    content: attr(data-col);
    display: block;
    font-size: 0.7rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
  }

  .comparison-table .tbody .td:first-child::before {
    content: 'attribute';
  }

  .comparison-table .tbody .td:first-child {
    background: var(--surface-2);
    font-weight: 800;
  }

  .comparison-table .tbody .td:last-child {
    color: var(--text);
  }

  .share-list {
    grid-template-columns: 1fr;
  }
}

/* Accessibility & utility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
