/* ============================================================
   CIMA Colombia · RW Platinum · Junio 2026 — v2.1
   Atlas relacional + HOME + indice en header + juego cromatico
   Construido por Nodual sobre brief CDR-002 + iteracion David
   ============================================================ */

/* ===== TOKENS ===== */
:root {
  color-scheme: light;

  /* Paleta OKLCH — neutro frio + acentos cromaticos */
  --paper:     oklch(96.8% 0.004 120);
  --paper-2:   oklch(94.5% 0.005 120);
  --paper-warm:oklch(96.8% 0.012 60);     /* fondo home, calido sin ser crema */
  --ink:       oklch(14.5% 0.018 300);
  --ink-2:     oklch(32%   0.018 300);
  --muted:     oklch(52%   0.018 260);
  --muted-2:   oklch(70%   0.014 260);
  --line:      oklch(82%   0.012 250);
  --line-soft: oklch(88%   0.009 250);

  /* Acentos cromaticos por capitulo */
  --coral:     oklch(66%   0.19  31);
  --coral-soft:oklch(66%   0.19  31 / .14);
  --sea:       oklch(48%   0.11  174);
  --sea-soft:  oklch(48%   0.11  174 / .14);
  --cobalt:    oklch(52%   0.18  260);
  --cobalt-soft:oklch(52%  0.18  260 / .14);
  --gold:      oklch(60%   0.13  82);
  --gold-soft: oklch(60%   0.13  82 / .14);

  --dark:      oklch(14.5% 0.018 300);
  --dark-soft: oklch(20%   0.02  300);
  --dark-mid:  oklch(28%   0.02  300);

  /* Acento activo (cambia segun capitulo) */
  --accent: var(--coral);
  --accent-soft: var(--coral-soft);

  /* Tipografia */
  --font-display: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --font-sans:    "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Escalas fluidas */
  --fs-portada: clamp(38px, 5.4vw, 88px);
  --fs-display: clamp(42px, 6vw, 92px);
  --fs-h1:      clamp(32px, 4vw, 64px);
  --fs-h2:      clamp(24px, 2.6vw, 40px);
  --fs-h3:      clamp(18px, 1.5vw, 22px);
  --fs-lead:    clamp(16px, 1.3vw, 19px);
  --fs-body:    15.5px;
  --fs-small:   13px;
  --fs-micro:   10.5px;

  --lh-display: 1.0;
  --lh-portada: 0.94;
  --lh-title:   1.05;
  --lh-lead:    1.45;
  --lh-body:    1.55;

  /* Layout */
  --gutter: clamp(22px, 3vw, 56px);
  --top-rail-h: 64px;
  --bot-rail-h: 56px;

  /* Animacion */
  --ease-out:      cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out:   cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer:   cubic-bezier(0.32, 0.72, 0, 1);
  --ease-emphasis: cubic-bezier(0.19, 1, 0.22, 1);

  --dur-fast: 180ms;
  --dur-mid:  420ms;
  --dur-scene: 700ms;
  --dur-draw: 900ms;
  --dur-portada: 1200ms;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: inherit;
}
ol, ul { list-style: none; padding: 0; margin: 0; }
figure, blockquote { margin: 0; }
cite { font-style: normal; }

html {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  background: var(--paper);
  overflow: hidden;
  position: relative;
}

/* ===== TYPOGRAFIA UTIL ===== */
.display {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-display);
  letter-spacing: -0.022em;
}
.display em {
  font-style: italic;
  font-weight: 600;
  color: var(--accent);
}
.meta, .mono {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ===== TOP RAIL ===== */
.top-rail {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-rail-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: oklch(96.8% 0.004 120 / 0.92);
  backdrop-filter: blur(10px);
  z-index: 60;
  transition: background var(--dur-mid) var(--ease-out);
}
.top-rail__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.brand:hover { opacity: 0.75; }
.brand .sep { color: var(--muted-2); }
.brand .rw { color: var(--coral); font-weight: 600; }

/* Indice horizontal de capitulos */
.top-rail__chapters {
  display: flex;
  justify-content: center;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-mid) var(--ease-out);
}
body[data-screen="stage"] .top-rail__chapters {
  opacity: 1;
  pointer-events: auto;
}
.top-nav__item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 0;
  position: relative;
  transition: background var(--dur-fast) var(--ease-out);
}
.top-nav__item:hover { background: var(--paper-2); }
.top-nav__item .rn {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out);
}
.top-nav__item .ttl {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink-2);
  transition: color var(--dur-fast) var(--ease-out);
}
.top-nav__item:hover .rn { color: var(--ink); }
.top-nav__item:hover .ttl { color: var(--ink); }
.top-nav__item[aria-current="true"] .rn { color: var(--accent); font-weight: 700; }
.top-nav__item[aria-current="true"] .ttl { color: var(--ink); font-weight: 600; }
.top-nav__item[aria-current="true"]::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--accent);
  transition: background var(--dur-mid) var(--ease-out);
}

.context {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--muted);
  justify-self: end;
}
.context .dim { opacity: 0.7; }

/* Mobile toggle (oculto desktop) */
.index__mobile-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: none;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--ink-2);
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.index__mobile-toggle:hover { border-color: var(--ink); color: var(--ink); }
.index__mobile-toggle:active { transform: scale(0.95); }
.index__mobile-toggle svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; }

/* ===== HOME / PORTADA ===== */
.home {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-top: var(--top-rail-h);
  background:
    radial-gradient(ellipse at 75% 25%, var(--coral-soft) 0%, transparent 55%),
    radial-gradient(ellipse at 18% 78%, var(--sea-soft) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, var(--paper-warm) 0%, var(--paper) 80%);
  z-index: 10;
  opacity: 1;
  transition: opacity var(--dur-portada) var(--ease-out), transform var(--dur-portada) var(--ease-out);
}
body[data-screen="stage"] .home {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
  visibility: hidden;
  transition: opacity var(--dur-portada) var(--ease-out), transform var(--dur-portada) var(--ease-out), visibility 0s linear var(--dur-portada);
}
.home__bg {
  position: absolute;
  inset: var(--top-rail-h) 0 0 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0.10;
  z-index: 0;
}
.home__bg svg {
  width: min(86vw, 1200px);
  height: auto;
  color: var(--sea);
  filter: blur(0.4px);
}
.home__band {
  position: absolute;
  inset: auto 0 0 0;
  height: 6px;
  background: linear-gradient(90deg, var(--coral) 0%, var(--gold) 40%, var(--sea) 75%, var(--cobalt) 100%);
  opacity: 0.85;
  z-index: 1;
}
.home__content {
  position: relative;
  z-index: 2;
  align-self: center;
  padding: 0 var(--gutter);
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.4vw, 36px);
}
.home__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0;
}
.home__title {
  font-family: var(--font-display);
  font-size: var(--fs-portada);
  font-weight: 500;
  line-height: var(--lh-portada);
  letter-spacing: -0.028em;
  color: var(--ink);
  margin: 0;
  max-width: 1100px;
}
.home__title em {
  font-style: italic;
  color: var(--coral);
  font-weight: 600;
}
.home__sub {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(16px, 1.4vw, 22px);
  line-height: 1.42;
  color: var(--ink-2);
  margin: 0;
  max-width: 720px;
}
.home__enter {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 30px 18px 32px;
  border: 1.5px solid var(--coral);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--paper);
  background: var(--coral);
  margin-top: 8px;
  align-self: flex-start;
  box-shadow: 0 12px 32px oklch(66% 0.19 31 / 0.22);
  transition:
    background var(--dur-mid) var(--ease-out),
    color var(--dur-mid) var(--ease-out),
    border-color var(--dur-mid) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-mid) var(--ease-out);
}
.home__enter:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  box-shadow: 0 16px 44px oklch(14.5% 0.018 300 / 0.28);
}
.home__enter:hover svg { transform: translateX(6px); }
.home__enter:active { transform: scale(0.98); }
.home__enter svg {
  width: 20px; height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--dur-mid) var(--ease-out);
}
.home__foot {
  position: relative;
  z-index: 2;
  padding: 22px var(--gutter);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--muted);
  letter-spacing: 0.06em;
}
.home__foot .sep { opacity: 0.5; }

/* ===== STAGE ===== */
.stage {
  position: fixed;
  top: var(--top-rail-h);
  left: 0; right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-portada) var(--ease-out);
}
body[data-screen="stage"] .stage {
  opacity: 1;
  pointer-events: auto;
}

/* ===== ATLAS PERSISTENTE ===== */
.atlas {
  position: relative;
  flex-grow: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.atlas__map {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 4% 6%;
  pointer-events: none;
  z-index: 1;
}
.atlas__map svg {
  width: min(82%, 760px);
  height: auto;
  color: var(--line);
  opacity: 0.85;
  filter: drop-shadow(0 12px 32px oklch(14.5% 0.018 300 / 0.04));
}

/* Halo cromatico que cambia con el capitulo */
.atlas__halo {
  position: absolute;
  left: 50%; top: 50%;
  width: min(54vw, 720px);
  height: min(54vw, 720px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  opacity: 0.65;
  pointer-events: none;
  z-index: 2;
  transition: background var(--dur-scene) var(--ease-out);
}

.atlas::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 38%, var(--paper) 95%);
  pointer-events: none;
  z-index: 3;
}

.atlas__center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 92px;
  transform: translate(-50%, -50%);
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.atlas__center-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--paper), 0 0 0 7px var(--accent-soft);
  transition: background var(--dur-mid) var(--ease-out), box-shadow var(--dur-mid) var(--ease-out);
}
.atlas__center-label {
  position: absolute;
  top: 60%;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--ink);
  white-space: nowrap;
  background: var(--paper);
  padding: 3px 8px;
  border: 1px solid var(--line);
}

/* Nodos satelite */
.atlas__nodes {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}
.atlas__node {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: grid;
  grid-template-columns: 28px auto;
  gap: 10px;
  align-items: center;
  padding: 8px 14px 8px 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    opacity var(--dur-mid) var(--ease-out);
  max-width: 240px;
}
.atlas__node:hover {
  border-color: var(--coral);
  box-shadow: 0 8px 24px oklch(14.5% 0.018 300 / 0.10);
}
.atlas__node:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.atlas__node:active { transform: translate(-50%, -50%) scale(0.97); }
.atlas__node[aria-pressed="true"] {
  border-color: var(--coral);
  box-shadow: 0 14px 44px oklch(14.5% 0.018 300 / 0.16);
  z-index: 8;
}
.atlas__node .node-n {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  font-weight: 600;
  color: var(--coral);
  text-align: center;
  line-height: 1;
}
.atlas__node .node-label {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.atlas[data-active] .atlas__node:not([aria-pressed="true"]) {
  opacity: 0.18;
  transform: translate(-50%, -50%) scale(0.94);
}

/* Rutas SVG */
.atlas__routes {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: visible;
}
.atlas__routes line {
  stroke: var(--coral);
  stroke-width: 1.4;
  fill: none;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.atlas__routes line[data-drawn="true"] {
  opacity: 0.7;
  animation: drawRoute var(--dur-draw) var(--ease-out) forwards;
}
@keyframes drawRoute {
  to { stroke-dashoffset: 0; }
}

/* ===== CHAPTER LAYER (sobre el atlas) ===== */
.chapters {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
.chapter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: clamp(28px, 4vw, 64px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition:
    opacity var(--dur-scene) var(--ease-out),
    transform var(--dur-scene) var(--ease-out),
    visibility 0s linear var(--dur-scene);
  pointer-events: none;
}
.chapter--active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    opacity var(--dur-scene) var(--ease-out),
    transform var(--dur-scene) var(--ease-out),
    visibility 0s linear 0s;
}
.chapter--active .chapter__copy { pointer-events: auto; }

.chapter__copy {
  max-width: 460px;
}
.chapter__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--accent);
  letter-spacing: 0.08em;
  margin: 0 0 18px 0;
  transition: color var(--dur-mid) var(--ease-out);
}
.chapter__title {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: 500;
  line-height: var(--lh-title);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 22px 0;
}
.chapter__title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 600;
  transition: color var(--dur-mid) var(--ease-out);
}
.chapter__lead {
  font-family: var(--font-sans);
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--ink-2);
  margin: 0;
  letter-spacing: -0.005em;
}
.chapter__hint {
  margin-top: 26px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.chapter__placeholder {
  align-self: end;
  padding: 14px 18px;
  border: 1px dashed var(--line);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--muted);
  letter-spacing: 0.06em;
  background: var(--paper);
  margin-top: 22px;
  width: max-content;
  position: absolute;
  bottom: 96px;
  left: clamp(28px, 4vw, 64px);
}
.chapter__placeholder .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transition: background var(--dur-mid) var(--ease-out);
}

/* ===== ACCENT POR CAPITULO =====
   Cuando un capitulo esta activo, sobreescribe --accent en el stage */
body[data-chapter="mirror"]    { --accent: var(--coral);  --accent-soft: var(--coral-soft);  }
body[data-chapter="territory"] { --accent: var(--sea);    --accent-soft: var(--sea-soft);    }
body[data-chapter="market"]    { --accent: var(--cobalt); --accent-soft: var(--cobalt-soft); }
body[data-chapter="network"]   { --accent: var(--coral);  --accent-soft: var(--coral-soft);  }
body[data-chapter="category"]  { --accent: var(--gold);   --accent-soft: var(--gold-soft);   }
body[data-chapter="proof"]     { --accent: var(--cobalt); --accent-soft: var(--cobalt-soft); }
body[data-chapter="road"]      { --accent: var(--sea);    --accent-soft: var(--sea-soft);    }

/* ===== CHAPTER LIMPIO (sin texto vivo) ===== */
.chapter--clean { padding: 0; pointer-events: none; }
.chapter--clean .chapter__anchor {
  position: absolute;
  top: clamp(20px, 2.4vw, 36px);
  left: clamp(28px, 4vw, 56px);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  color: var(--accent);
  letter-spacing: 0.08em;
  margin: 0;
  z-index: 12;
  pointer-events: auto;
  transition: color var(--dur-mid) var(--ease-out);
}

/* ===== ATLAS NODE: pulso activo cromatico ===== */
.atlas__node[aria-pressed="true"] {
  animation: nodePulse 1.6s var(--ease-in-out) infinite;
}
@keyframes nodePulse {
  0%, 100% { box-shadow: 0 14px 44px oklch(14.5% 0.018 300 / 0.16), 0 0 0 0 var(--accent-soft); }
  50%      { box-shadow: 0 14px 44px oklch(14.5% 0.018 300 / 0.16), 0 0 0 18px transparent; }
}

/* Halo cromatico del centro pulsa cuando hay nodo activo */
.atlas[data-active] .atlas__halo {
  animation: haloPulse 3.2s var(--ease-in-out) infinite;
}
@keyframes haloPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);   opacity: 0.55; }
  50%      { transform: translate(-50%, -50%) scale(1.06); opacity: 0.75; }
}

/* Centro vibra sutilmente cuando hay nodo activo */
.atlas[data-active] .atlas__center-dot {
  animation: centerPulse 1.6s var(--ease-in-out) infinite;
}
@keyframes centerPulse {
  0%, 100% { box-shadow: 0 0 0 6px var(--paper), 0 0 0 7px var(--accent-soft); }
  50%      { box-shadow: 0 0 0 6px var(--paper), 0 0 0 14px var(--accent-soft); }
}

/* Rutas con peso editorial mas fuerte */
.atlas__routes line {
  stroke-width: 1.8;
  filter: drop-shadow(0 1px 0 oklch(14.5% 0.018 300 / 0.05));
}

/* Mapa se realza ligeramente cuando hay nodo activo */
.atlas[data-active] .atlas__map svg {
  color: var(--accent-soft);
  opacity: 1;
  transition: color var(--dur-scene) var(--ease-out), opacity var(--dur-scene) var(--ease-out);
}

/* ===== OVERLAY EDITORIAL CENTRADO ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: clamp(40px, 6vw, 96px);
  pointer-events: auto;
}
.overlay[hidden] { display: none !important; }
.overlay__scrim {
  position: absolute;
  inset: 0;
  background: oklch(96.8% 0.004 120 / 0.78);
  backdrop-filter: blur(14px);
  opacity: 0;
  transition: opacity var(--dur-mid) var(--ease-out);
}
.overlay[data-open="true"] .overlay__scrim { opacity: 1; }

.overlay__card {
  position: relative;
  z-index: 2;
  width: min(960px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(40px, 4.6vw, 72px);
  display: grid;
  gap: clamp(28px, 2.6vw, 44px);
  opacity: 0;
  transform: scale(0.94);
  transform-origin: var(--overlay-origin-x, 50%) var(--overlay-origin-y, 50%);
  transition:
    opacity var(--dur-mid) var(--ease-out),
    transform var(--dur-mid) var(--ease-emphasis);
  box-shadow: 0 40px 120px oklch(14.5% 0.018 300 / 0.16);
}
.overlay[data-open="true"] .overlay__card {
  opacity: 1;
  transform: scale(1);
}

.overlay__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}
.overlay__head-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.overlay__n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.22em;
  text-transform: lowercase;
  margin: 0;
}
.overlay__diagnosis {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(16px, 1.4vw, 22px);
  line-height: 1.36;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  margin: 0;
  max-width: 540px;
}
.overlay__min {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 14px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--paper);
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}
.overlay__min:hover { border-color: var(--accent); color: var(--accent); }
.overlay__min:active { transform: scale(0.98); }
.overlay__min svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
}

.overlay__quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(32px, 3.4vw, 56px);
  line-height: 1.14;
  letter-spacing: -0.022em;
  color: var(--ink);
  padding: clamp(20px, 1.8vw, 32px) 0 clamp(12px, 1.2vw, 18px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
  margin: 0;
}
.overlay__attribution {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.12em;
  margin: 0;
}

.overlay__compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 2.6vw, 40px);
}
.overlay__pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(22px, 2.2vw, 32px);
  border-left: 2px solid var(--line);
}
.overlay__pane.before { border-left-color: var(--muted-2); }
.overlay__pane.now {
  background: var(--sea-soft);
  border-left-color: var(--sea);
}
.overlay__pane h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  margin: 0;
  text-transform: uppercase;
  font-weight: 500;
}
.overlay__pane.before h3 { color: var(--muted); }
.overlay__pane.now h3 { color: var(--sea); }
.overlay__pane p {
  font-family: var(--font-sans);
  font-size: clamp(14px, 1.05vw, 16px);
  line-height: 1.58;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.003em;
}

/* Mobile overlay */
@media (max-width: 720px) {
  .overlay { padding: 18px; }
  .overlay__card { padding: 24px 20px; gap: 22px; }
  .overlay__quote { font-size: 24px; line-height: 1.22; padding: 16px 0 10px 0; }
  .overlay__compare { grid-template-columns: 1fr; gap: 14px; }
  .overlay__pane { padding: 16px 18px; }
  .overlay__min span { display: none; }
  .overlay__min { padding: 10px; }
}

/* ===== DRAWER NODO ESPEJO — DEPRECATED (reemplazado por overlay) ===== */
.drawer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: var(--bot-rail-h);
  width: min(640px, 50vw);
  background: var(--paper);
  border-right: 1px solid var(--ink);
  z-index: 30;
  padding: clamp(38px, 4.5vw, 64px) clamp(32px, 4vw, 56px);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--dur-mid) var(--ease-drawer);
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 0;
}
.drawer[data-open="true"] {
  transform: translateX(0);
  box-shadow: 30px 0 80px oklch(14.5% 0.018 300 / 0.12);
}

.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
}
.drawer__head-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drawer__n {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--coral);
  letter-spacing: 0.22em;
  text-transform: lowercase;
  font-weight: 500;
}
.drawer__diagnosis {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}
.drawer__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}
.drawer__close:hover { border-color: var(--coral); color: var(--coral); transform: rotate(90deg); }
.drawer__close:active { transform: rotate(90deg) scale(0.95); }
.drawer__close svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.8; fill: none; }

.drawer__quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(26px, 2.8vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: 36px 0 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 16px;
}
.drawer__attribution {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-bottom: 38px;
}

.drawer__compare {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-self: start;
}
.drawer__pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px;
  background: var(--paper-2);
  border-left: 2px solid var(--line);
}
.drawer__pane.before {
  border-left-color: var(--muted-2);
}
.drawer__pane.now {
  background: var(--sea-soft);
  border-left-color: var(--sea);
}
.drawer__pane h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  margin: 0;
  text-transform: uppercase;
  font-weight: 500;
}
.drawer__pane.before h3 { color: var(--muted); }
.drawer__pane.now h3 { color: var(--sea); }
.drawer__pane p {
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.003em;
}

/* ===== BOTTOM RAIL ===== */
.bottom-rail {
  background: var(--dark);
  color: oklch(94% 0.005 260);
  height: var(--bot-rail-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--gutter);
  z-index: 50;
  flex-shrink: 0;
}
.bottom-rail__nav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: oklch(94% 0.005 260 / 0.8);
}
.bottom-rail__nav button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  padding: 6px 4px;
  transition: color var(--dur-fast) var(--ease-out);
}
.bottom-rail__nav button:hover { color: var(--accent); }
.bottom-rail__nav button:disabled { opacity: 0.3; cursor: not-allowed; }
.bottom-rail__nav button svg {
  width: 12px; height: 12px;
  stroke: currentColor; stroke-width: 1.8; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
.bottom-rail__nav.right { justify-content: flex-end; }
.bottom-rail__progress {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  color: oklch(94% 0.005 260);
}
.bottom-rail__progress .of {
  color: oklch(94% 0.005 260 / 0.5);
  margin: 0 4px;
}

/* ===== HIDDEN UTIL ===== */
[hidden] { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .top-rail__chapters { display: none; }
  .top-rail {
    grid-template-columns: auto 1fr;
  }
  .context { display: none; }
  .index__mobile-toggle { display: grid; }
}

@media (max-width: 720px) {
  :root {
    --gutter: 18px;
    --top-rail-h: 56px;
    --bot-rail-h: 52px;
  }
  .top-rail { padding: 0 14px; }

  /* Home en mobile */
  .home__title {
    font-size: clamp(36px, 11vw, 64px);
  }
  .home__sub { font-size: 16px; }
  .home__enter { padding: 14px 22px; font-size: 13.5px; }
  .home__meta { margin-bottom: 24px; font-size: 10px; }
  .home__content { padding: 18px; }
  .home__bg { opacity: 0.07; }

  /* Stage mobile: chapter copy arriba, atlas en medio, bottom-rail abajo */
  .stage {
    flex-direction: column;
  }
  .chapters {
    position: relative;
    inset: auto;
    height: auto;
    min-height: 200px;
    flex-grow: 1;
    order: 1;
  }
  .atlas {
    flex-grow: 0;
    height: 50dvh;
    flex-shrink: 0;
    order: 2;
    border-top: 1px solid var(--line);
  }
  .bottom-rail {
    order: 3;
  }
  .drawer {
    order: 4;
  }
  .chapter {
    position: absolute;
    inset: 0;
    padding: 18px;
    align-items: flex-start;
  }
  .chapter__copy { max-width: 100%; }
  .chapter__title { font-size: clamp(26px, 7.5vw, 42px); }
  .chapter__lead { font-size: 14.5px; }
  .chapter__placeholder { display: none; }

  .atlas__map svg { width: 96%; max-width: 560px; }
  .atlas__halo { width: 80%; height: 70%; }
  .atlas__center { width: 70px; height: 70px; }
  .atlas__center-label { font-size: 8.5px; padding: 2px 6px; }
  .atlas__node {
    grid-template-columns: 18px auto;
    gap: 5px;
    padding: 4px 7px 4px 4px;
    max-width: 122px;
  }
  .atlas__node .node-n { font-size: 13px; }
  .atlas__node .node-label { font-size: 9.5px; line-height: 1.1; }

  .drawer {
    width: 100%;
    padding: 22px 18px;
    grid-template-rows: auto auto auto auto 1fr;
  }
  .drawer__quote { font-size: 21px; line-height: 1.25; padding: 22px 0 12px 0; }
  .drawer__attribution { margin-bottom: 22px; }
  .drawer__compare { gap: 14px; }
  .drawer__pane { padding: 16px 18px; }

  .bottom-rail { padding: 0 14px; }
  .bottom-rail__nav { font-size: 10px; gap: 8px; }
  .bottom-rail__progress { font-size: 10.5px; }
}

/* ===== SCROLLBAR DISCRETO ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
