/* ============================================
   0. CUSTOM PROPERTIES
   ============================================ */
:root {
  /* Warm-memory palette (synced to /logo-workshop: parchment + amber + walnut) */
  --bg-primary: #0b0907;          /* deep walnut card bg */
  --bg-secondary: #15100a;        /* card mid */
  --bg-elevated: #241a10;         /* lit corner of card */
  --bg-surface: #3a2814;          /* walnut surface */

  --text-primary: #f5f0eb;        /* cream */
  --text-secondary: #c8a76e;      /* warm muted (workshop tag color) */
  --text-tertiary: #a08364;       /* deeper warm muted */

  --accent: #f0b563;              /* hero amber (workshop) */
  --accent-hover: #ffd07a;        /* focal hot */
  --accent-subtle: rgba(240, 181, 99, 0.10);
  --accent-glow: rgba(240, 181, 99, 0.22);
  --accent-dim: #c48a3c;          /* hero amber deep */
  --accent-deep: #7a4f1d;         /* walnut-amber */
  --focal: #fff4d6;               /* workshop focal hot center */

  --success: #6b8f71;

  --border: rgba(240, 195, 118, 0.08);
  --border-accent: rgba(240, 195, 118, 0.18);

  --font-display: 'Fraunces', 'Instrument Serif', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', 'Monaco', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
  --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
  --text-5xl: clamp(3rem, 2rem + 5vw, 5.5rem);

  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem;
  --s-5: 1.25rem; --s-6: 1.5rem; --s-8: 2rem; --s-10: 2.5rem;
  --s-12: 3rem; --s-16: 4rem; --s-20: 5rem; --s-24: 6rem;
  --s-32: 8rem; --s-40: 10rem;

  --section-padding-y: var(--s-32);
  --container-max: 68rem;
  --container-padding-x: var(--s-6);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-base: 300ms var(--ease-out);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ============================================
   1. RESET
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  position: relative;
  /* Inter's optical sizing + cv11 (alternate digits) read tighter at body sizes */
  font-feature-settings: "ss01", "cv11", "calt";
  font-optical-sizing: auto;
}

/* Grain texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

img, svg { max-width: 100%; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-hover); }

ul, ol { list-style: none; }

/* ============================================
   2. TYPOGRAPHY
   ============================================ */
h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: 500;
  font-style: italic;
  /* Fraunces: SOFT axis up for warmer terminals, WONK axis on for character, opsz reads display-grade */
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}

h1 {
  font-size: var(--text-5xl);
  line-height: 1.02;
  letter-spacing: -0.035em;       /* Fraunces needs tighter negative tracking at display sizes */
  font-weight: 600;
}
h2 { font-size: var(--text-3xl); line-height: 1.1; letter-spacing: -0.025em; font-weight: 500; }
h3 { font-size: var(--text-xl); line-height: 1.25; letter-spacing: -0.015em; }

h4, h5, h6 { font-family: var(--font-body); font-weight: 600; color: var(--text-primary); }

p { color: var(--text-secondary); }

code, pre { font-family: var(--font-mono); }
code {
  font-size: 0.88em;
  background: var(--bg-surface);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--accent);
}
pre { line-height: 1.7; }

.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;
}

/* ============================================
   3. LAYOUT
   ============================================ */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding-x);
}

section {
  padding-block: var(--section-padding-y);
  position: relative;
}

.section-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.22em;       /* workshop small-caps tracking */
  color: var(--accent);
  margin-bottom: var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-weight: 600;
}
.section-label::before {
  content: '';
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
}

.section-header {
  max-width: 38rem;
  margin-bottom: var(--s-16);
}
.section-header.centered {
  text-align: center;
  max-width: 42rem;
  margin-inline: auto;
}
.section-header.centered .section-label { justify-content: center; }
.section-header.centered .section-label::before { display: none; }
.section-header p {
  margin-top: var(--s-4);
  font-size: var(--text-lg);
  max-width: 36rem;
}
.section-header.centered p { margin-inline: auto; }

/* ============================================
   4. BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform 100ms var(--ease-out), box-shadow var(--transition-fast);
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--bg-primary);
  box-shadow: 0 2px 16px var(--accent-glow);
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-accent);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-group { display: flex; gap: var(--s-3); flex-wrap: wrap; }

/* ============================================
   5. NAVIGATION
   ============================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: var(--s-4) 0;
  background: rgba(17,17,16,0.6);
  border-bottom: 1px solid transparent;
  transition: all var(--transition-base);
}
.nav.scrolled {
  background: rgba(17,17,16,0.95);
  border-bottom-color: var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav-inner {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding-x);
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  display: flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-display); font-style: italic;
  font-size: var(--text-xl); color: var(--text-primary);
}
.nav-logo:hover { color: var(--text-primary); }
.nav-logo-mark {
  width: 28px; height: 28px; flex-shrink: 0;
  display: block;
}
.nav-logo-mark svg { width: 100%; height: 100%; display: block; }
.nav-links { display: flex; align-items: center; gap: var(--s-8); }
.nav-links a {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;       /* workshop tracking */
  font-weight: 500;
  transition: color var(--transition-fast);
}
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); }
.nav-right { display: flex; align-items: center; gap: var(--s-4); }
.nav-github {
  color: var(--text-tertiary); display: flex; align-items: center;
  transition: color var(--transition-fast);
}
.nav-github:hover { color: var(--text-primary); }
.nav-github svg { width: 20px; height: 20px; }

.mobile-toggle {
  display: none; background: none; border: none;
  color: var(--text-primary); cursor: pointer; padding: var(--s-2);
}
.mobile-toggle svg { width: 24px; height: 24px; }

.mobile-nav {
  display: none; position: fixed; inset: 0; z-index: 99;
  background: rgba(17,17,16,0.98);
  flex-direction: column; align-items: center; justify-content: center; gap: var(--s-8);
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  font-family: var(--font-display); font-style: italic;
  font-size: var(--text-3xl); color: var(--text-secondary);
}
.mobile-nav a:hover { color: var(--accent); }

/* ============================================
   6. VISUAL SIGNATURE — dot grid
   ============================================ */
.dot-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(240,181,99,0.10) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 70% 60% at 80% 30%, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 80% 30%, black 0%, transparent 70%);
}

/* ============================================
   7. SECTION STYLES
   ============================================ */

/* --- Hero --- */
.section-hero {
  padding-top: calc(var(--s-32) + var(--s-12));
  padding-bottom: var(--s-20);
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-split {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: var(--s-12);
  align-items: center;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.22em;        /* workshop tracking */
  color: var(--text-tertiary);
  margin-bottom: var(--s-6);
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-weight: 600;
}
.hero-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.hero-headline {
  margin-bottom: var(--s-6);
}
.hero-headline em {
  font-style: normal;
  color: var(--accent);
}

.hero-desc {
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--s-8);
  max-width: 28rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
}

/* Hero visual — capsule lattice (workshop concept 01)
   Memories live in stacked shelves; the active capsule burns hottest. */
.hero-visual { position: relative; }

.memory-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  padding: var(--s-6) 0;
}

/* Atmospheric warm halo behind the active capsule */
.memory-stack::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 88%;
  height: 70%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at 50% 50%,
    var(--accent-glow) 0%,
    transparent 60%);
  pointer-events: none;
  z-index: 0;
  filter: blur(20px);
}

.memory-card {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-secondary));
  border: 1px solid var(--border-accent);
  border-radius: 999px;            /* capsule */
  padding: var(--s-3) var(--s-6);
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 46px;
  z-index: 1;
}

/* Inactive capsules — dimmed walnut, age top→bottom */
.memory-card-3 { opacity: 0.5; }
.memory-card-2 { opacity: 0.68; }
.memory-card-1 { opacity: 0.85; }

.memory-card-type {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 600;
  color: var(--accent-dim);
  margin: 0;
  flex-shrink: 0;
  min-width: 5.5em;
}

.memory-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

/* Active capsule — workshop's "just-captured" mark: amber gradient + glow */
.memory-card-active {
  background: linear-gradient(135deg, #f6c277 0%, #e2a050 55%, #c48a3c 100%);
  border: 1px solid rgba(255, 244, 214, 0.35);
  border-radius: 18px;             /* softer, taller — the focal exception */
  padding: var(--s-5) var(--s-6);
  box-shadow:
    0 0 0 1px rgba(255, 208, 122, 0.18),
    0 16px 48px var(--accent-glow),
    inset 0 1px 0 rgba(255, 244, 214, 0.32);
  display: block;
  min-height: auto;
  animation: capsule-float 4s ease-in-out infinite;
}

@keyframes capsule-float {
  0%, 100% {
    transform: translateY(0);
    box-shadow:
      0 0 0 1px rgba(255, 208, 122, 0.18),
      0 16px 48px var(--accent-glow),
      inset 0 1px 0 rgba(255, 244, 214, 0.32);
  }
  50% {
    transform: translateY(-4px);
    box-shadow:
      0 0 0 1px rgba(255, 208, 122, 0.28),
      0 24px 56px var(--accent-glow),
      inset 0 1px 0 rgba(255, 244, 214, 0.42);
  }
}

.memory-card-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 600;
  color: #4a2e10;
  background: rgba(255, 244, 214, 0.32);
  padding: 4px var(--s-3);
  border-radius: 999px;
  display: inline-block;
  margin-bottom: var(--s-4);
}

.memory-card-content {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.memory-snippet {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--text-sm);
  color: #1a0e04;
  font-weight: 500;
}

.memory-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

/* Workshop tag below the lattice */
.memory-stack-tag {
  margin-top: var(--s-4);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;          /* workshop "RETENIR · MEMORY" tag */
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

/* Light mode — light parchment ground for inactive capsules */
[data-theme="light"] .memory-card {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-secondary));
  border-color: var(--border-accent);
}
[data-theme="light"] .memory-card-active {
  background: linear-gradient(135deg, #e2a050 0%, #c48a3c 55%, #7a4f1d 100%);
  border-color: rgba(255, 244, 214, 0.45);
}
[data-theme="light"] .memory-snippet { color: #fff4d6; }
[data-theme="light"] .memory-card-badge { color: #1a0e04; background: rgba(255, 244, 214, 0.45); }

/* --- How It Works --- */
.section-how {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: var(--s-6);
  align-items: start;
}

.step-card {
  text-align: center;
  padding: var(--s-6) var(--s-4);
}

.step-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--s-4);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-subtle);
  border-radius: 50%;
}

.step-icon svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.step-number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  opacity: 0.5;
  margin-bottom: var(--s-3);
}

.step-card h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-style: normal;
  font-size: var(--text-base);
  margin-bottom: var(--s-3);
}

.step-card p {
  font-size: var(--text-sm);
  line-height: 1.65;
  max-width: 18rem;
  margin-inline: auto;
}

.step-connector {
  display: flex;
  align-items: center;
  padding-top: var(--s-12);
}

.step-connector svg {
  width: 40px;
  height: 24px;
}

/* Terminal — slightly elevated against the deep walnut page bg */
.terminal {
  background: linear-gradient(180deg, #15100a, #0b0907);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4), 0 0 0 1px rgba(240, 195, 118, 0.04);
}
.terminal-header {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.terminal-dot { width: 8px; height: 8px; border-radius: 50%; }
.terminal-dot:first-child { background: #e5534b; }
.terminal-dot:nth-child(2) { background: #d29922; }
.terminal-dot:nth-child(3) { background: #57ab5a; }
.terminal-title {
  flex: 1; text-align: center;
  font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono);
}
.terminal-body {
  padding: var(--s-5);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  overflow-x: auto;
}
.terminal-body .command { color: var(--text-primary); }
.terminal-body .comment { color: var(--text-tertiary); font-style: italic; }
.terminal-body .xml-tag { color: var(--accent); }
.terminal-body .xml-attr { color: #d29922; }
.terminal-body .xml-value { color: var(--success); }
.terminal-body .xml-content { color: var(--text-secondary); }
.terminal-body .output { color: var(--text-secondary); }
.terminal-body .dim { color: var(--text-tertiary); font-style: italic; }

/* --- Trust: live-state telemetry tiles (workshop Atlas Page rows) --- */
.section-trust {
  padding-block: var(--s-10);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(240, 181, 99, 0.02), transparent);
}
.trust-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
}
.trust-tile {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(240, 181, 99, 0.025), transparent);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.trust-tile:hover {
  border-color: var(--border-accent);
  background: linear-gradient(180deg, rgba(240, 181, 99, 0.06), transparent);
}
.trust-tile-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 600;
  color: var(--text-tertiary);
}
.trust-tile-value {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 32px;
}
.trust-tile-num {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: var(--text-2xl);
  line-height: 1;
  color: var(--text-primary);
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  letter-spacing: -0.02em;
}
.trust-tile-foot {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tile 1 — capsule bar fill (Atlas Page row 1) */
.trust-tile-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(240, 195, 118, 0.10);
  overflow: hidden;
  display: block;
  position: relative;
}
.trust-tile-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 999px;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Tile 2 — brain dot cluster (Atlas Page row 2) */
.trust-tile-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.trust-tile-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.trust-tile-dot--on {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}
.trust-tile-dot--dim {
  background: transparent;
  border: 1px solid var(--border-accent);
}

/* Tile 3 — live pip */
.trust-tile-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
  flex-shrink: 0;
}
.trust-tile-pip--live::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--success);
  opacity: 0;
  animation: pip-ping 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes pip-ping {
  0% { transform: scale(0.6); opacity: 0.7; }
  80%, 100% { transform: scale(1.6); opacity: 0; }
}

/* Tile 4 — sync waveform (Atlas Page row 3) */
.trust-tile-wave {
  display: inline-flex;
  align-items: end;
  gap: 2px;
  height: 16px;
}
.trust-tile-wave span {
  width: 2px;
  background: var(--accent-dim);
  border-radius: 1px;
  opacity: 0.6;
}
.trust-tile-wave span:nth-child(1) { height: 30%; }
.trust-tile-wave span:nth-child(2) { height: 60%; }
.trust-tile-wave span:nth-child(3) { height: 40%; }
.trust-tile-wave span:nth-child(4) { height: 80%; opacity: 0.85; }
.trust-tile-wave span:nth-child(5) { height: 50%; }
.trust-tile-wave span:nth-child(6) { height: 70%; }
.trust-tile-wave span:nth-child(7) { height: 30%; }
.trust-tile-wave span:nth-child(8) { height: 90%; opacity: 1; background: var(--accent); }
.trust-tile-wave span:nth-child(9) { height: 60%; }
.trust-tile-wave span:nth-child(10) { height: 40%; }

/* --- Problem --- */
.section-problem { background: var(--bg-primary); }

.problem-list { display: grid; gap: var(--s-1); max-width: 48rem; }

.problem-item {
  display: grid;
  grid-template-columns: var(--s-12) 1fr;
  gap: var(--s-4);
  padding: var(--s-6) 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.problem-number {
  font-family: var(--font-display); font-style: italic;
  font-size: var(--text-2xl); color: var(--accent); opacity: 0.5;
}
.problem-item h3 {
  font-family: var(--font-body); font-weight: 600; font-style: normal;
  font-size: var(--text-base); color: var(--text-primary); margin-bottom: var(--s-2);
}
.problem-item p { font-size: var(--text-sm); line-height: 1.7; }

/* --- Features (bento) --- */
.section-features {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto auto;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.bento-cell {
  background: var(--bg-secondary);
  padding: var(--s-8);
  transition: background var(--transition-base);
}
.bento-cell:hover { background: var(--bg-elevated); }

/* Bento layout: first cell wide, fourth cell wide */
.bento-cell:nth-child(1) { grid-column: 1 / 3; }
.bento-cell:nth-child(4) { grid-column: 2 / 4; }

.bento-number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent);
  opacity: 0.5;
  margin-bottom: var(--s-3);
}
.bento-cell h3 {
  font-family: var(--font-body); font-weight: 600; font-style: normal;
  font-size: var(--text-base); margin-bottom: var(--s-3); color: var(--text-primary);
}
.bento-cell p {
  font-size: var(--text-sm); line-height: 1.65; color: var(--text-secondary);
  max-width: 32rem;
}

/* Wide cells get larger titles */
.bento-cell:nth-child(1) h3,
.bento-cell:nth-child(4) h3 {
  font-size: var(--text-lg);
}

/* --- Install --- */
.section-install { background: var(--bg-primary); }

.install-block { max-width: 48rem; position: relative; }

.copy-btn {
  position: absolute; top: var(--s-3); right: var(--s-3); z-index: 2;
  padding: var(--s-1) var(--s-3);
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  letter-spacing: 0.05em;
}
.copy-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

.install-note {
  margin-top: var(--s-6); font-size: var(--text-sm); color: var(--text-tertiary);
}

/* --- FAQ --- */
.section-faq {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.faq-columns {
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: var(--s-16);
  align-items: start;
}

.faq-aside {
  position: sticky;
  top: 6rem;
}

/* --- Atlas Page (workshop concept 05) — running app, miniaturized --- */
.atlas-page {
  margin-top: var(--s-8);
  padding: var(--s-5);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(240, 181, 99, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-elevated), var(--bg-secondary));
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--s-3);
  align-items: center;
}

/* Subtle parchment grain for the atlas card */
.atlas-page::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0.94  0 0 0 0 0.77  0 0 0 0 0.44  0 0 0 0.10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.06;
  mix-blend-mode: overlay;
}

.atlas-page-head { align-self: start; }
.atlas-head-svg { width: 56px; height: 88px; }

.atlas-page-meta { align-self: start; padding-top: 4px; }
.atlas-page-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: var(--text-xl);
  color: var(--text-primary);
  line-height: 1;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  letter-spacing: -0.02em;
}
.atlas-page-sub {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.atlas-page-rule {
  grid-column: 1 / -1;
  height: 1px;
  background: var(--border-accent);
  opacity: 0.6;
}

.atlas-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: var(--s-3);
}
.atlas-row--wave { grid-template-columns: 48px 1fr; }

.atlas-row-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
}
.atlas-row-value {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--text-secondary);
}

.atlas-bar {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: rgba(240, 195, 118, 0.10);
  overflow: hidden;
  position: relative;
}
.atlas-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 999px;
  border: 1px solid rgba(255, 244, 214, 0.32);
  box-shadow: 0 0 8px var(--accent-glow);
}

.atlas-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.atlas-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.atlas-dot--1 { background: #f6c277; }
.atlas-dot--2 { background: #e2a050; }
.atlas-dot--3 { background: #c48a3c; }
.atlas-dot--4 { background: #a06d2f; opacity: 0.7; }
.atlas-dot--off {
  background: transparent;
  border: 1px solid var(--border-accent);
  width: 7px; height: 7px;
}

.atlas-wave {
  display: inline-flex;
  align-items: end;
  gap: 2px;
  height: 18px;
  width: 100%;
}
.atlas-wave span {
  flex: 1;
  background: var(--accent-dim);
  border-radius: 1px;
  opacity: 0.65;
}
.atlas-wave span:nth-child(1)  { height: 30%; }
.atlas-wave span:nth-child(2)  { height: 70%; }
.atlas-wave span:nth-child(3)  { height: 40%; }
.atlas-wave span:nth-child(4)  { height: 90%; opacity: 1; background: var(--accent); }
.atlas-wave span:nth-child(5)  { height: 55%; }
.atlas-wave span:nth-child(6)  { height: 80%; opacity: 0.85; }
.atlas-wave span:nth-child(7)  { height: 35%; }
.atlas-wave span:nth-child(8)  { height: 60%; }
.atlas-wave span:nth-child(9)  { height: 85%; opacity: 0.9; }
.atlas-wave span:nth-child(10) { height: 45%; }
.atlas-wave span:nth-child(11) { height: 65%; }
.atlas-wave span:nth-child(12) { height: 25%; }
.atlas-wave span:nth-child(13) { height: 75%; }
.atlas-wave span:nth-child(14) { height: 50%; }
.atlas-wave span:nth-child(15) { height: 95%; opacity: 1; background: var(--accent); }
.atlas-wave span:nth-child(16) { height: 30%; }
.atlas-wave span:nth-child(17) { height: 70%; }
.atlas-wave span:nth-child(18) { height: 40%; }
.atlas-wave span:nth-child(19) { height: 60%; }
.atlas-wave span:nth-child(20) { height: 35%; }

.atlas-page-foot {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* Light mode — parchment-warm atlas card */
[data-theme="light"] .atlas-page {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(160, 109, 47, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
}

.faq-list { max-width: 42rem; }
.faq-list details { border-bottom: 1px solid var(--border); }
.faq-list summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-5) 0;
  font-family: var(--font-body); font-size: var(--text-lg); font-weight: 600;
  color: var(--text-primary); cursor: pointer; list-style: none;
  transition: color var(--transition-fast);
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: '+';
  font-family: var(--font-mono); font-size: var(--text-lg);
  font-weight: 400; color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform var(--transition-base);
}
.faq-list details[open] summary::after { content: '\2212'; }
.faq-list summary:hover { color: var(--accent); }
.faq-answer {
  padding-bottom: var(--s-6);
  color: var(--text-secondary); line-height: 1.75; font-size: var(--text-base);
}

/* --- CTA — Recall Bloom backdrop (workshop concept 02) --- */
.section-cta {
  text-align: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
  padding-block: calc(var(--section-padding-y) + var(--s-8));
}
.section-cta::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 40%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
}
.cta-bloom {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(900px, 100%);
  height: auto;
  pointer-events: none;
  opacity: 0.85;
  z-index: 0;
}
.cta-content {
  position: relative;
  z-index: 1;
}
.cta-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.32em;       /* workshop tag tracking */
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--s-4);
}
.cta-content h2 { margin-bottom: var(--s-4); }
.cta-content p {
  font-size: var(--text-lg); margin-bottom: var(--s-10); color: var(--text-secondary);
  max-width: 32rem; margin-inline: auto;
}
.cta-content .btn-group { justify-content: center; }

/* --- Footer --- */
.site-footer {
  padding-block: var(--s-10);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px; color: var(--text-tertiary); letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--s-4);
}
.footer-links { display: flex; gap: var(--s-6); }
.site-footer a { color: var(--text-tertiary); transition: color var(--transition-fast); }
.site-footer a:hover { color: var(--accent); }

/* --- Before/After Demo --- */
.section-demo {
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.demo-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--s-4);
  align-items: start;
  max-width: 58rem;
  margin-inline: auto;
}

.demo-col {
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.demo-col-after {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 8px 32px var(--accent-glow);
}

.demo-col-header {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;       /* workshop tracking */
  font-weight: 600;
  color: var(--text-tertiary);
}

.demo-col-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.demo-col-dot-warn { background: #d29922; }
.demo-col-dot-ok { background: var(--success); }

.demo-thread {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-height: 12rem;
}

.demo-msg {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: 1.55;
  max-width: 92%;
}

.demo-msg-user {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.demo-msg-ai {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-bottom-left-radius: 2px;
  border-left: 2px solid var(--border-accent);
}

.demo-msg-ai-after {
  border-left-color: var(--accent);
  color: var(--text-primary);
}

.demo-msg-muted { opacity: 0.45; font-style: italic; }

.demo-injection {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;       /* workshop tracking */
  font-weight: 600;
  color: var(--accent);
  padding: var(--s-1) var(--s-3);
  background: var(--accent-subtle);
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  align-self: flex-start;
}

.demo-injection-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0;
}

.demo-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: var(--s-12);
  width: 80px;
}
.demo-bridge {
  display: block;
}
.demo-bridge--vertical {
  width: 80px;
  height: 200px;
}
.demo-bridge--horizontal {
  width: 100%;
  max-width: 320px;
  height: 64px;
  display: none;          /* only shown when comparison stacks */
}

/* ============================================
   8. RESPONSIVE
   ============================================ */
@media (max-width: 80rem) {
  :root { --section-padding-y: var(--s-24); }
}

@media (max-width: 63.9375rem) {
  :root { --section-padding-y: var(--s-20); }

  .hero-split {
    grid-template-columns: 1fr;
    gap: var(--s-10);
  }
  .hero-desc { max-width: 100%; }

  .steps-grid {
    grid-template-columns: 1fr;
    gap: var(--s-4);
  }
  .step-connector { display: none; }

  .nav-links { display: none; }
  .mobile-toggle { display: block; }

  .demo-comparison { grid-template-columns: 1fr; }
  .demo-divider {
    padding: 0;
    width: 100%;
    justify-self: center;
    height: auto;
  }
  .demo-bridge--vertical   { display: none; }
  .demo-bridge--horizontal { display: block; margin-inline: auto; }

  .bento-grid { grid-template-columns: 1fr 1fr; }
  .bento-cell:nth-child(1) { grid-column: 1 / 3; }
  .bento-cell:nth-child(4) { grid-column: 1 / 3; }

  .problem-item { grid-template-columns: var(--s-8) 1fr; }

  .faq-columns { grid-template-columns: 1fr; gap: var(--s-8); }
  .faq-aside { position: static; }

  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 47.9375rem) {
  :root { --section-padding-y: var(--s-16); --container-padding-x: var(--s-5); }

  .bento-grid { grid-template-columns: 1fr; }
  .bento-cell:nth-child(1),
  .bento-cell:nth-child(4) { grid-column: auto; }

  .btn-group { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }

  .section-hero { min-height: auto; padding-top: calc(var(--s-24) + var(--s-4)); }

  .trust-grid { grid-template-columns: 1fr 1fr; gap: var(--s-3); }
  .trust-tile { padding: var(--s-3) var(--s-4); }
  .trust-tile-num { font-size: var(--text-xl); }

  .terminal-body { font-size: 11px; padding: var(--s-3) var(--s-4); }

  .problem-item { grid-template-columns: 1fr; }
  .problem-number { font-size: var(--text-lg); }
}

/* ============================================
   9. ANIMATIONS
   ============================================ */
/* Fade up (default) */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Scale in (hero terminal) */
.reveal-scale {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 800ms ease, transform 800ms ease;
}
.reveal-scale.is-visible { opacity: 1; transform: scale(1); }

/* Stagger children (bento grid) */
.stagger > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}
.stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.stagger.is-visible > *:nth-child(2) { transition-delay: 80ms; }
.stagger.is-visible > *:nth-child(3) { transition-delay: 160ms; }
.stagger.is-visible > *:nth-child(4) { transition-delay: 240ms; }
.stagger.is-visible > *:nth-child(5) { transition-delay: 320ms; }
.stagger.is-visible > *:nth-child(6) { transition-delay: 400ms; }
.stagger.is-visible > * { opacity: 1; transform: translateY(0); }

.reveal-delay-1 { transition-delay: 80ms; }
.reveal-delay-2 { transition-delay: 160ms; }
.reveal-delay-3 { transition-delay: 240ms; }

/* ============================================
   10. REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-scale { opacity: 1; transform: none; }
  .stagger > * { opacity: 1; transform: none; }
  .memory-card-active { animation: none; }
}

/* ============================================
   11. ACCESSIBILITY
   ============================================ */
.skip-link {
  position: absolute; top: -100%; left: var(--s-4);
  padding: var(--s-2) var(--s-4);
  background: var(--accent); color: var(--bg-primary);
  border-radius: var(--radius-sm);
  z-index: 200; font-weight: 600; font-size: var(--text-sm);
}
.skip-link:focus { top: var(--s-2); color: var(--bg-primary); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================================
   12. LIGHT MODE
   ============================================ */
[data-theme="light"] {
  /* Parchment side of the workshop palette (concept 05 — Atlas Page) */
  --bg-primary: #f0e6d0;          /* parchment top */
  --bg-secondary: #e6dcc6;        /* parchment mid */
  --bg-elevated: #ddd0b3;         /* aged parchment */
  --bg-surface: #c8b89a;          /* dusty parchment */

  --text-primary: #3a2814;        /* walnut ink */
  --text-secondary: #5c4a2e;      /* secondary ink */
  --text-tertiary: #7a6b56;       /* muted (workshop) */

  --accent: #a06d2f;              /* rust amber */
  --accent-hover: #c48a3c;
  --accent-subtle: rgba(160, 109, 47, 0.10);
  --accent-glow: rgba(160, 109, 47, 0.18);
  --accent-dim: #7a4f1d;
  --accent-deep: #4a2e10;
  --focal: #fff4d6;

  --success: #4a7a50;

  --border: rgba(122, 79, 29, 0.18);
  --border-accent: rgba(122, 79, 29, 0.32);
}

/* Nav adapts to theme */
[data-theme="light"] .nav {
  background: rgba(250, 249, 247, 0.7);
}
[data-theme="light"] .nav.scrolled {
  background: rgba(250, 249, 247, 0.95);
}
[data-theme="light"] .mobile-nav {
  background: rgba(250, 249, 247, 0.98);
}

/* Terminal stays dark in light mode */
[data-theme="light"] .terminal {
  background: #191918;
  border-color: rgba(245, 240, 235, 0.15);
}
[data-theme="light"] .terminal-header {
  border-bottom-color: rgba(245, 240, 235, 0.08);
}
[data-theme="light"] .terminal-title { color: #8a8580; }
[data-theme="light"] .terminal-body .command { color: #f5f0eb; }
[data-theme="light"] .terminal-body .comment { color: #8a8580; }
[data-theme="light"] .terminal-body .xml-tag { color: #e2a050; }
[data-theme="light"] .terminal-body .xml-attr { color: #d29922; }
[data-theme="light"] .terminal-body .xml-value { color: #6b8f71; }
[data-theme="light"] .terminal-body .xml-content { color: #a8a29e; }
[data-theme="light"] .terminal-body .output { color: #a8a29e; }
[data-theme="light"] .terminal-body .dim { color: #8a8580; }
[data-theme="light"] .copy-btn {
  background: #222221;
  color: #8a8580;
  border-color: rgba(245, 240, 235, 0.15);
}
[data-theme="light"] .copy-btn:hover { color: #f5f0eb; }

/* Dot grid adapts */
[data-theme="light"] .dot-grid {
  background-image: radial-gradient(circle, rgba(176,120,48,0.1) 1px, transparent 1px);
}

/* Grain lighter in light mode */
[data-theme="light"] body::after { opacity: 0.015; }

/* Bento cells */
[data-theme="light"] .bento-cell { background: var(--bg-secondary); }
[data-theme="light"] .bento-cell:hover { background: var(--bg-elevated); }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  width: 32px;
  height: 32px;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle svg { width: 16px; height: 16px; }

/* Show/hide sun/moon icons */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
