/* ============================================
   SCALING USE CASES — Design Tokens
   ============================================ */
:root {
  /* Colors — Dark (default) */
  --bg: #1A1816;
  --surface: #22201D;
  --surface-hover: #2D2A26;
  --border: #3D3630;
  --border-subtle: rgba(255,255,255,0.06);
  --text-primary: #E8E2DA;
  --text-secondary: #A69985;
  --text-muted: #73676D;
  --accent: #C8A064;
  --success: #7EC896;
  --error: #D4756A;
  --warning: #D4A054;
  --info: #6BA3BE;
  --purple: #9B7DB8;
  --teal: #6BA3BE;
  --deep-tan: #856B4E;

  /* Typography */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Spacing (4pt grid) */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;
  --sp-3xl: 64px;
  --sp-4xl: 96px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light mode */
html[data-theme="light"] {
  --bg: #F5F2EE;
  --surface: #EBE7E1;
  --surface-hover: #E2DDD6;
  --border: #D1C9BE;
  --border-subtle: rgba(0,0,0,0.06);
  --text-primary: #3D3630;
  --text-secondary: #736B5F;
  --text-muted: #A09790;
  --accent: #A07830;
  --success: #3D8A5A;
  --error: #B8483E;
  --warning: #B08030;
  --info: #3D7A8F;
  --purple: #7B5D9E;
  --teal: #3D7A8F;
  --deep-tan: #A68860;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #F5F2EE;
    --surface: #EBE7E1;
    --surface-hover: #E2DDD6;
    --border: #D1C9BE;
    --border-subtle: rgba(0,0,0,0.06);
    --text-primary: #3D3630;
    --text-secondary: #736B5F;
    --text-muted: #A09790;
    --accent: #A07830;
    --success: #3D8A5A;
    --error: #B8483E;
    --warning: #B08030;
    --info: #3D7A8F;
    --purple: #7B5D9E;
    --teal: #3D7A8F;
    --deep-tan: #A68860;
  }
}


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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

::selection {
  background: rgba(200, 160, 100, 0.3);
  color: var(--text-primary);
}

html[data-theme="light"] ::selection {
  background: rgba(160, 120, 48, 0.25);
}

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

strong {
  color: var(--text-primary);
  font-weight: 500;
}

em {
  font-style: italic;
  color: var(--text-primary);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  border: 1px solid var(--border-subtle);
}

/* ---- Custom scrollbar ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(61, 54, 48, 0.6) transparent;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(61, 54, 48, 0.6); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(166, 153, 133, 0.5); }
::-webkit-scrollbar-thumb:active { background: rgba(200, 160, 100, 0.4); }
::-webkit-scrollbar-corner { background: transparent; }

html[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(209, 201, 190, 0.7); }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(160, 120, 48, 0.4); }
html[data-theme="light"] ::-webkit-scrollbar-thumb:active { background: rgba(160, 120, 48, 0.5); }
html[data-theme="light"] * { scrollbar-color: rgba(209, 201, 190, 0.7) transparent; }


/* ============================================
   SHELL LAYOUT
   ============================================ */
.shell {
  position: relative;
  min-height: 100vh;
}


/* ============================================
   TIMELINE FULL VIEW
   ============================================ */
.timeline-full {
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

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

.tl-hero canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tl-hero__content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  padding: 0 var(--sp-xl);
}

.tl-hero__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-lg);
  opacity: 0;
  transform: translateY(20px);
  animation: tl-fadeUp 1s 0.3s var(--ease-out) forwards;
}

.tl-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.05;
  letter-spacing: -0.03em;
  opacity: 0;
  transform: translateY(30px);
  animation: tl-fadeUp 1.2s 0.5s var(--ease-out) forwards;
}

.tl-hero__title em {
  color: var(--accent);
  font-style: italic;
}

.tl-hero__subtitle {
  margin-top: var(--sp-xl);
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0;
  transform: translateY(20px);
  animation: tl-fadeUp 1s 1s var(--ease-out) forwards;
}

.tl-hero__subtitle strong {
  color: var(--text-secondary);
}

.tl-hero__scroll-hint {
  margin-top: var(--sp-3xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  opacity: 0;
  animation: tl-fadeUp 0.8s 1.8s var(--ease-out) forwards;
}

.tl-hero__scroll-dot {
  animation: tl-scrollBob 2s ease-in-out infinite;
}

@keyframes tl-scrollBob {
  0%, 100% { cy: 8; }
  50% { cy: 16; }
}

@keyframes tl-fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ---- Chapter grid ---- */
.tl-chapters {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--sp-4xl) var(--sp-xl);
}

.tl-chapters__title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: var(--sp-2xl);
}

.tl-chapters__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-lg);
}

.tl-chapter-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-xl);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.3s, transform 0.3s var(--ease-spring);
  opacity: 0;
  transform: translateY(20px);
}

.tl-chapter-card.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out), border-color 0.3s;
}

.tl-chapter-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.tl-chapter-card__num {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.tl-chapter-card__title {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
}

.tl-chapter-card__desc {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-muted);
}


/* ============================================
   FLOATING CHAPTER NAV — Dot navigation
   ============================================ */
.chapter-nav {
  position: fixed;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}

.shell.is-chapter .chapter-nav {
  opacity: 1;
  pointer-events: auto;
}

/* Pill background */
.chapter-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(26, 24, 22, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  pointer-events: none;
  z-index: -1;
}

html[data-theme="light"] .chapter-nav::before {
  background: rgba(245, 242, 238, 0.7);
}

.chapter-nav.is-horizontal::before {
  opacity: 1;
}

.chapter-nav--pill-hidden::before {
  opacity: 0 !important;
}

/* Vertical (left sidebar) */
.chapter-nav.is-vertical {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: column;
}

/* Horizontal (bottom bar) */
.chapter-nav.is-horizontal {
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row;
  border-radius: 999px;
  padding: 6px 12px;
}

/* Back / Timeline button */
.chapter-nav__back {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.chapter-nav__back:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200,160,100,0.06);
}

.chapter-nav__back.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(200,160,100,0.1);
}

/* Divider */
.chapter-nav__divider {
  flex-shrink: 0;
}

.chapter-nav.is-vertical .chapter-nav__divider {
  width: 16px;
  height: 1px;
  background: var(--border-subtle);
  margin: 2px 0;
}

.chapter-nav.is-horizontal .chapter-nav__divider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin: 0 2px;
}

/* Arrow buttons */
.chapter-nav__arrow {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.2s;
  flex-shrink: 0;
}

.chapter-nav__arrow:hover { color: var(--accent); }
.chapter-nav__arrow:hover svg { transform: scale(1.15); transition: transform 0.2s; }
.chapter-nav__arrow.is-hidden { opacity: 0; pointer-events: none; }

/* Dots container */
.chapter-nav__dots {
  display: flex;
  align-items: center;
  position: relative;
}

.chapter-nav.is-vertical .chapter-nav__dots { flex-direction: column; gap: 8px; }
.chapter-nav.is-horizontal .chapter-nav__dots { flex-direction: row; gap: 8px; }

/* Individual dot */
.chapter-nav__dot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.chapter-nav__circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s, transform 0.3s var(--ease-spring), box-shadow 0.3s;
  position: relative;
}

.chapter-nav__dot.is-current .chapter-nav__circle {
  background: var(--accent);
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(200,160,100,0.4);
}

.chapter-nav__dot:hover .chapter-nav__circle {
  background: var(--text-secondary);
  transform: scale(1.2);
}

.chapter-nav__dot.is-current:hover .chapter-nav__circle {
  background: var(--accent);
}

/* Hover labels */
.chapter-nav__label {
  position: absolute;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}

.chapter-nav.is-vertical .chapter-nav__label {
  left: 36px;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
}

.chapter-nav.is-vertical .chapter-nav__dot:hover .chapter-nav__label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.chapter-nav.is-horizontal .chapter-nav__label {
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}

.chapter-nav.is-horizontal .chapter-nav__dot:hover .chapter-nav__label {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Progress bar */
.chapter-nav__progress {
  position: absolute;
  background: var(--accent);
  opacity: 0.25;
  border-radius: 1px;
  transition: width 0.15s linear, height 0.15s linear;
  pointer-events: none;
}

.chapter-nav.is-vertical .chapter-nav__progress { left: -4px; top: 0; width: 2px; }
.chapter-nav.is-horizontal .chapter-nav__progress { bottom: -4px; left: 0; height: 2px; }

/* Layout toggle */
.chapter-nav__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  flex-shrink: 0;
}

.chapter-nav__toggle:hover { color: var(--text-secondary); }


/* ============================================
   TIMELINE PANEL — Slide-out overlay
   ============================================ */
.timeline-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out);
}

.shell.is-panel-open .timeline-panel-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Panel overlay for timeline-full in chapter mode */
.shell.is-chapter .timeline-full {
  position: fixed;
  z-index: 160;
  overflow-y: auto;
  background: var(--bg);
  transition: transform 0.6s var(--ease-out), opacity 0.5s var(--ease-out);
}

/* Vertical panel: slides from left */
.shell.is-chapter.layout-vertical .timeline-full {
  top: 0;
  left: 0;
  bottom: 0;
  width: 400px;
  max-width: 85vw;
  padding-left: 56px;
  border-right: 1px solid var(--border-subtle);
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  height: auto;
}

.shell.is-chapter.layout-vertical.is-panel-open .timeline-full {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* Horizontal panel: slides from bottom */
.shell.is-chapter.layout-horizontal .timeline-full {
  left: 0;
  right: 0;
  bottom: 0;
  height: 50vh;
  padding-bottom: 56px;
  border-top: 1px solid var(--border-subtle);
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  position: fixed;
  top: auto;
}

.shell.is-chapter.layout-horizontal.is-panel-open .timeline-full {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Panel header */
.tl-panel-header {
  display: none;
  text-decoration: none;
}

.shell.is-chapter .timeline-full .tl-panel-header {
  display: block;
  position: relative;
  padding: var(--sp-2xl) var(--sp-xl) var(--sp-xl);
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  overflow: hidden;
}

.tl-panel-header::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 160, 100, 0.12) 0%, rgba(200, 160, 100, 0.04) 40%, transparent 70%);
  transition: transform 0.5s var(--ease-out), opacity 0.5s;
  opacity: 0;
  pointer-events: none;
}

.shell.is-chapter .timeline-full .tl-panel-header:hover::after {
  transform: translate(-50%, -50%) scale(2);
  opacity: 1;
}

.shell.is-chapter .timeline-full .tl-panel-header:hover .tl-panel-header__title {
  color: var(--text-primary);
}

.tl-panel-header__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-md);
  position: relative;
  transition: color 0.3s;
}

.tl-panel-header__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1.1;
  position: relative;
  transition: color 0.3s;
}

.tl-panel-header__title em {
  color: var(--accent);
  font-style: italic;
}

.tl-panel-header__subtitle {
  margin-top: var(--sp-lg);
  font-size: 0.8125rem;
  line-height: 2;
  color: var(--text-muted);
  position: relative;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.4s var(--ease-out), max-height 0.4s var(--ease-out), margin-top 0.4s var(--ease-out);
  margin-top: 0;
}

.shell.is-chapter .timeline-full .tl-panel-header:hover .tl-panel-header__subtitle {
  opacity: 1;
  max-height: 6em;
  margin-top: var(--sp-lg);
}

/* Hide hero in panel */
.shell.is-chapter .timeline-full .tl-hero { display: none; }


/* ============================================
   CHAPTER VIEWPORT
   ============================================ */
.chapter-viewport {
  position: relative;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
  min-height: 100vh;
}

.shell.is-chapter .chapter-viewport {
  opacity: 1;
  pointer-events: auto;
}

.chapter-viewport__content {
  min-height: 100vh;
}

.chapter-viewport__loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 50;
}

.chapter-viewport__loading.is-active {
  opacity: 1;
  pointer-events: auto;
}

.chapter-viewport__spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ============================================
   SHARED CHAPTER STYLES — Hero, sections, etc.
   ============================================ */
.ch-hero {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.ch-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(200,160,100,0.04) 0%, transparent 70%);
  pointer-events: none;
}

html[data-theme="light"] .ch-hero::before {
  background: radial-gradient(ellipse at center, rgba(160,120,48,0.04) 0%, transparent 70%);
}

.ch-hero__content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  padding: 0 var(--sp-xl);
}

.ch-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-lg);
}

.ch-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.ch-hero__title em {
  color: var(--accent);
  font-style: italic;
}

.ch-hero__subtitle {
  margin-top: var(--sp-xl);
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.ch-hero__subtitle strong { color: var(--text-secondary); }

/* Scroll-reveal base */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Section */
.ch-section {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--sp-4xl) var(--sp-xl);
}

.ch-section__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-sm);
}

.ch-section__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--sp-lg);
}

.ch-section__body {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 60ch;
}

.ch-section__body strong { color: var(--text-primary); }

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-lg);
  margin-top: var(--sp-2xl);
}

.card {
  padding: var(--sp-xl);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color 0.3s, transform 0.3s var(--ease-spring);
}

.card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
}

.card__icon {
  width: 40px;
  height: 40px;
  margin-bottom: var(--sp-md);
  color: var(--accent);
}

.card__title {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: var(--sp-sm);
}

.card__text {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-muted);
}

/* Interactive container */
.interactive {
  margin: var(--sp-2xl) 0;
  padding: var(--sp-xl);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.interactive__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-md);
}

.interactive__title {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: var(--sp-lg);
}

/* Slider */
.slider-group {
  margin-bottom: var(--sp-lg);
}

.slider-group__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.slider-group__value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(200,160,100,0.3);
  transition: transform 0.2s var(--ease-spring);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(200,160,100,0.3);
}

/* Preview panel */
.preview-panel {
  margin-top: var(--sp-lg);
  padding: var(--sp-lg);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-secondary);
  min-height: 120px;
  transition: all 0.3s var(--ease-out);
}

.preview-panel__label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-sm);
}

/* Comparison panels */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
  margin: var(--sp-2xl) 0;
}

.comparison__panel {
  padding: var(--sp-xl);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.comparison__panel--accent { border-color: var(--accent); }

.comparison__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-md);
}

.comparison__panel--accent .comparison__label { color: var(--accent); }

.comparison__text {
  font-size: 0.9375rem;
  line-height: 1.7;
}

/* Flow diagram */
.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  margin: var(--sp-2xl) 0;
  flex-wrap: wrap;
}

.flow-node {
  padding: var(--sp-md) var(--sp-lg);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-primary);
  text-align: center;
  min-width: 100px;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.flow-node--active {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(200,160,100,0.15);
}

.flow-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-xl) 0;
  font-size: 0.875rem;
}

.data-table th {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.data-table td strong {
  color: var(--text-primary);
}

/* Callout */
.callout {
  margin: var(--sp-2xl) 0;
  padding: var(--sp-lg) var(--sp-xl);
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent);
}

.callout__title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-sm);
}

.callout__text {
  font-size: 0.9375rem;
  line-height: 1.7;
}

/* Chapter end nav */
.ch-nav {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: var(--sp-2xl) var(--sp-xl) var(--sp-3xl);
}

.ch-nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.25s, transform 0.25s;
}

.ch-nav__link:hover { color: var(--accent); transform: translateY(-2px); }
.ch-nav__link svg { opacity: 0.6; transition: opacity 0.25s; }
.ch-nav__link:hover svg { opacity: 1; }

.ch-nav__title {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Footer */
.site-footer {
  padding: var(--sp-3xl) var(--sp-xl);
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.site-footer__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-style: italic;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.site-footer__credit {
  margin-top: var(--sp-sm);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.7;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* Domain color accents */
.domain-legal { --domain-color: var(--info); }
.domain-medical { --domain-color: var(--success); }
.domain-sales { --domain-color: var(--accent); }
.domain-marketing { --domain-color: var(--purple); }
.domain-service { --domain-color: var(--warning); }
.domain-education { --domain-color: var(--teal); }

.domain-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--domain-color, var(--accent));
  padding: 4px 12px;
  border: 1px solid var(--domain-color, var(--accent));
  border-radius: 999px;
  background: transparent;
}

.domain-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--domain-color, var(--accent));
}


/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .tl-chapters__grid { grid-template-columns: 1fr; }
  .chapter-nav.is-vertical { left: 8px; }
  .chapter-nav.is-horizontal { bottom: 8px; }
  .chapter-nav__label { display: none; }
  .shell.is-chapter.layout-vertical .timeline-full { width: 85vw; }
  .comparison { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .flow-diagram { flex-direction: column; }
  .flow-arrow { transform: rotate(90deg); }
}

/* Essay Navigation */
.essay-nav {
  max-width: 800px;
  margin: 0 auto;
  padding: 64px 32px 48px;
  display: flex;
  gap: 16px;
}
.essay-nav__link {
  display: block;
  flex: 1;
  padding: 24px 48px;
  background: var(--surface, #22201D);
  border: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
  border-radius: 16px;
  text-decoration: none;
  text-align: right;
  transition: border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.essay-nav__link--prev { text-align: left; }
.essay-nav__link:hover {
  border-color: var(--accent, #C8A064);
  transform: translateY(-2px);
}
.essay-nav__direction {
  display: block;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent, #C8A064);
  margin-bottom: 4px;
}
.essay-nav__title {
  display: block;
  font-family: var(--font-display, 'Playfair Display', Georgia, serif);
  font-size: 1.25rem;
  color: var(--text-primary, #E8E2DA);
  margin-bottom: 4px;
}
.essay-nav__desc {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted, #73676D);
  line-height: 1.5;
}
@media (max-width: 640px) {
  .essay-nav { flex-direction: column; padding: 48px 16px 32px; }
  .essay-nav__link { text-align: left; padding: 20px 24px; }
}
