/* ============================================================================
   styles.css — Identidad visual "El Hilo de Eurasia"
   Estética editorial de museo: tinta nocturna, oro de seda, lapislázuli y papel
   ============================================================================ */

:root {
  --bg: #0c0f15;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(233, 186, 93, 0.2);
  --border-soft: rgba(255, 255, 255, 0.1);
  --text: #f3ece0;
  --text-muted: #b8ae9c;
  --accent: #e9ba5d;
  --accent-2: #5ba4dc;
  --vermilion: #d45b47;
  --terracotta: #c98a5b;

  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --rail-h: 54px;
}

/* Atmósferas que cambian al hacer scroll */
body[data-theme="obsidian"] { --bg: #0c0f15; }
body[data-theme="sand"] { --bg: #17120d; }
body[data-theme="lapis"] { --bg: #0e1824; }
body[data-theme="desert"] { --bg: #1c140d; }
body[data-theme="parchment-dark"] { --bg: #171410; }
body[data-theme="crimson"] { --bg: #180d0f; }
body[data-theme="midnight"] { --bg: #0d121b; }
body[data-theme="paper"] {
  --bg: #f3ecdf;
  --surface: rgba(26, 22, 18, 0.045);
  --surface-strong: rgba(26, 22, 18, 0.08);
  --border: rgba(138, 92, 26, 0.28);
  --border-soft: rgba(26, 22, 18, 0.14);
  --text: #1c1713;
  --text-muted: #574d42;
  --accent: #a66d14;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  font-size: 16px;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  overflow-x: clip;
  transition: background-color 0.85s ease, color 0.65s ease;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

.container {
  width: min(1080px, calc(100% - 2.2rem));
  margin-inline: auto;
}

.container-wide {
  width: min(1280px, calc(100% - 2rem));
  margin-inline: auto;
}

.mono-tag {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ============================================================================
   BARRA SUPERIOR FIJA ("EL HILO")
   ============================================================================ */
.top-rail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--rail-h);
  z-index: 100;
  background: rgba(12, 15, 21, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #f3ece0;
  transition: background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease;
}

body[data-theme="paper"] .top-rail {
  background: rgba(243, 236, 223, 0.9);
  border-bottom-color: rgba(26, 22, 18, 0.14);
  color: #1c1713;
}

body[data-theme="paper"] .rail-telemetry {
  color: #574d42;
}

body[data-theme="paper"] .nav-toggle {
  background: rgba(166, 109, 20, 0.12);
  color: #1c1713;
  border-color: rgba(166, 109, 20, 0.4);
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.rail-inner {
  height: calc(var(--rail-h) - 2px);
  width: min(1280px, calc(100% - 2rem));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.rail-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e9ba5d;
  box-shadow: 0 0 12px rgba(233, 186, 93, 0.8);
}

.rail-telemetry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #cbbda6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-telemetry .sep {
  opacity: 0.45;
}

.nav-toggle {
  background: rgba(233, 186, 93, 0.14);
  color: #f3ece0;
  border: 1px solid rgba(233, 186, 93, 0.35);
  border-radius: 999px;
  padding: 0.36rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease;
}

.nav-toggle:hover {
  background: rgba(233, 186, 93, 0.28);
}

.silk-progress-track {
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  width: 100%;
}

.silk-progress-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #c98a5b, #e9ba5d, #ffe6aa);
}

/* Cajón de capítulos */
.chapter-drawer {
  position: fixed;
  top: var(--rail-h);
  right: 1rem;
  width: min(360px, calc(100vw - 2rem));
  z-index: 99;
  background: rgba(16, 20, 28, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(233, 186, 93, 0.3);
  border-radius: 0 0 14px 14px;
  padding: 1.2rem;
  color: #f3ece0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.drawer-eyebrow {
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #e9ba5d;
}

.drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.drawer-list a {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.2s ease;
}

.drawer-list a:hover {
  background: rgba(233, 186, 93, 0.14);
}

.drawer-list a span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #e9ba5d;
}

/* ============================================================================
   SECCIONES Y CABECERAS EDITORIALES
   ============================================================================ */
.section {
  position: relative;
  padding-block: clamp(4.5rem, 9vw, 7.5rem);
}

.chapter-header {
  max-width: 740px;
  margin-bottom: clamp(2rem, 4.5vw, 3.4rem);
}

.chapter-num {
  display: inline-block;
  margin-bottom: 0.7rem;
}

.chapter-header h2 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.6vw, 3.55rem);
  line-height: 1.07;
  font-weight: 600;
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
}

.chapter-intro {
  font-size: clamp(1.02rem, 1.5vw, 1.16rem);
  color: var(--text-muted);
  margin: 0;
}

.chapter-intro strong {
  color: var(--text);
  font-weight: 600;
}

/* ============================================================================
   PRÓLOGO / HERO CON GLOBO 3D
   ============================================================================ */
.hero-section {
  min-height: 100svh;
  padding-top: calc(var(--rail-h) + 2rem);
  padding-bottom: 4.5rem;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#globe-canvas {
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: grab;
}

#globe-canvas:active {
  cursor: grabbing;
}

.hero-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 70% 45%, transparent 18%, rgba(12, 15, 21, 0.72) 72%),
    linear-gradient(90deg, rgba(12, 15, 21, 0.88) 0%, rgba(12, 15, 21, 0.55) 48%, rgba(12, 15, 21, 0.2) 100%),
    linear-gradient(180deg, transparent 74%, var(--bg) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 620px;
  margin-left: max(1.1rem, calc((100vw - 1080px) / 2));
  margin-right: auto;
  pointer-events: none;
}

.hero-content a,
.hero-content button {
  pointer-events: auto;
}

.hero-eyebrow {
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.85rem, 6.8vw, 5.15rem);
  line-height: 0.98;
  font-weight: 700;
  margin: 0 0 1.35rem;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}

.hero-lead {
  font-size: clamp(1rem, 1.55vw, 1.15rem);
  color: #dad0be;
  margin: 0 0 1.9rem;
  max-width: 54ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.4rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: #16120c;
  font-weight: 700;
  font-size: 0.94rem;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(233, 186, 93, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(233, 186, 93, 0.36);
}

.hint-drag {
  opacity: 0.85;
}

.scroll-cue {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b8ae9c;
  pointer-events: none;
}

.cue-line {
  width: 1px;
  height: 26px;
  background: linear-gradient(180deg, var(--accent), transparent);
}

/* ============================================================================
   CAPÍTULO I: MITOS VS REALIDAD Y BALANZA ROMA-HAN
   ============================================================================ */
.myths-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
  margin-bottom: 3rem;
}

.myth-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 1.35rem 1.45rem;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.myth-card:hover,
.myth-card.is-open {
  border-color: var(--border);
  background: var(--surface-strong);
}

.myth-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
}

.myth-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
}

.myth-false {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(212, 91, 71, 0.75);
}

.strike-label {
  text-decoration: none;
  display: inline-block;
  color: var(--vermilion);
  font-weight: 600;
  margin-right: 0.3rem;
}

.myth-true {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.15;
  margin: 0;
  color: var(--text);
}

.myth-detail {
  margin: 0.8rem 0 0;
  font-size: 0.94rem;
  color: var(--text-muted);
  display: none;
}

.myth-card.is-open .myth-detail {
  display: block;
}

/* Panel Balanza Roma vs Han */
.obsession-panel {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: clamp(1.3rem, 3vw, 2.2rem);
}

.panel-head {
  margin-bottom: 1.6rem;
}

.panel-head h3 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.8vw, 2.25rem);
  margin: 0.35rem 0 0;
  line-height: 1.12;
}

.balance-layout {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
}

.balance-side {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 1.25rem;
}

.side-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--terracotta);
  margin-bottom: 0.4rem;
}

.balance-side h4 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  margin: 0 0 0.55rem;
}

.balance-side p {
  margin: 0 0 1rem;
  font-size: 0.93rem;
  color: var(--text-muted);
}

.metric-bar {
  display: grid;
  gap: 0.35rem;
}

.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: var(--fill, 75%);
  border-radius: 999px;
}

.bar-fill.gold {
  background: linear-gradient(90deg, #b88428, #e9ba5d);
}

.bar-fill.vermilion {
  background: linear-gradient(90deg, #9d3223, #e0614c);
}

.balance-pivot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.pivot-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px dashed var(--accent);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: var(--accent);
}

/* ============================================================================
   CAPÍTULO II: MAPA SCROLLYTELLING D3 + NATURAL EARTH
   ============================================================================ */
.map-scrolly {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 2rem;
  align-items: start;
}

.map-stage {
  position: sticky;
  top: calc(var(--rail-h) + 16px);
  z-index: 10;
}

.map-frame {
  position: relative;
  background: radial-gradient(circle at 50% 45%, #162638 0%, #0d1622 100%);
  border: 1px solid rgba(91, 164, 220, 0.3);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

#silk-map {
  width: 100%;
  height: auto;
  aspect-ratio: 1000 / 580;
}

.map-graticule {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 0.7;
  vector-effect: non-scaling-stroke;
}

.map-land {
  fill: #1f2b38;
  stroke: rgba(233, 186, 93, 0.34);
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}

.geo-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  pointer-events: none;
  paint-order: stroke;
  stroke: #0d1622;
  stroke-width: 2.5px;
}

.geo-label.geo-hazard {
  fill: #e8b87d;
  opacity: 0.92;
}

.geo-label.geo-sea {
  fill: #90c8f2;
  opacity: 0.88;
}

.route-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.22;
  transition: opacity 0.4s ease;
}

.route-line.is-land {
  stroke: #e9ba5d;
  stroke-width: 2.6;
}

.route-line.is-spur {
  stroke: #c98a5b;
  stroke-width: 1.9;
}

.route-line.is-sea {
  stroke: #5ba4dc;
  stroke-width: 2.3;
}

.route-line.is-active {
  opacity: 0.95;
  filter: drop-shadow(0 0 6px rgba(233, 186, 93, 0.45));
}

.city-node {
  cursor: pointer;
}

.city-pulse {
  fill: rgba(233, 186, 93, 0.22);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.city-dot {
  fill: #b8ae9c;
  stroke: #0d1622;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  transition: fill 0.3s ease;
}

.city-label {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 600;
  fill: #f3ece0;
  paint-order: stroke;
  stroke: #0d1622;
  stroke-width: 3px;
  opacity: 0.35;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.city-node.is-highlighted .city-pulse {
  opacity: 1;
}

.city-node.is-highlighted .city-dot {
  fill: #e9ba5d;
}

.city-node.is-highlighted .city-label,
.city-node:hover .city-label {
  opacity: 1;
}

.map-hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: rgba(10, 16, 24, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-step strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.15;
}

.hud-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  color: #b8ae9c;
}

.hud-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.35rem;
}

.dot.land-main { background: #e9ba5d; }
.dot.land-sea { background: #5ba4dc; }

.city-inspector {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 4.1rem;
  background: rgba(12, 16, 24, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 0.95rem 1.1rem;
  z-index: 6;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.city-inspector h4 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0.25rem 0 0.35rem;
}

.city-inspector p {
  margin: 0;
  font-size: 0.88rem;
  color: #d6ccba;
}

.inspector-close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  background: transparent;
  border: 0;
  color: #f3ece0;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.map-steps {
  display: grid;
  gap: 1.6rem;
  padding-bottom: 3rem;
}

.map-step-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 1.35rem 1.4rem;
  cursor: pointer;
  opacity: 0.58;
  transition: opacity 0.35s ease, border-color 0.35s ease, background 0.35s ease;
}

.map-step-card.is-active {
  opacity: 1;
  border-color: var(--accent);
  background: rgba(233, 186, 93, 0.08);
}

.map-step-card h3 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1.15;
  margin: 0.35rem 0 0.6rem;
}

.map-step-card p {
  margin: 0 0 0.7rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.step-hint {
  font-size: 0.66rem;
  opacity: 0.75;
}

/* ============================================================================
   CAPÍTULO III: RELIEVE 3D Y COMPARADOR DE ESCALA
   ============================================================================ */
.relief-stage {
  margin-bottom: 2rem;
}

.relief-canvas-wrap {
  position: relative;
  height: clamp(240px, 34vw, 350px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 30%, #2a2016 0%, #140f0a 100%);
}

#relief-canvas {
  width: 100%;
  height: 100%;
  touch-action: pan-y;
  cursor: grab;
}

.relief-overlay {
  position: absolute;
  left: 1.1rem;
  right: 1.1rem;
  bottom: 0.9rem;
  pointer-events: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem;
}

.relief-pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.relief-pin {
  position: absolute;
  top: 0;
  left: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #f8efd9;
  background: rgba(14, 11, 8, 0.78);
  border: 1px solid rgba(233, 186, 93, 0.45);
  padding: 0.16rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.relief-caption {
  margin: 0;
  font-size: 0.84rem;
  color: #e6dccb;
  background: rgba(15, 11, 8, 0.72);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
}

.metrics-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
  margin-bottom: 2.2rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 1.3rem 1.35rem;
}

.metric-big {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.8vw, 2.85rem);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.metric-big small {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 400;
}

.metric-card h4 {
  margin: 0 0 0.45rem;
  font-size: 1.04rem;
}

.metric-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.comparator-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: clamp(1.25rem, 3vw, 2rem);
}

.comparator-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.comparator-head h3 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  margin: 0.25rem 0 0;
}

.segment-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.seg-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.seg-pill.is-active {
  background: var(--accent);
  color: #16120c;
  border-color: var(--accent);
  font-weight: 700;
}

.comparator-bars {
  display: grid;
  gap: 1.05rem;
}

.comp-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) 1.5fr auto;
  align-items: center;
  gap: 0.9rem 1.2rem;
}

.comp-meta strong {
  display: block;
  font-size: 0.94rem;
}

.comp-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.comp-track {
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.comp-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.comp-fill.camel { background: linear-gradient(90deg, #b87b44, #e9ba5d); }
.comp-fill.train { background: linear-gradient(90deg, #356e9c, #69b7ee); }
.comp-fill.plane { background: #eef2f6; }

.comp-val {
  min-width: 118px;
  text-align: right;
}

.comparator-note {
  margin: 1.2rem 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* ============================================================================
   CAPÍTULO IV: ARTEFACTOS 3D + CUEVA 17
   ============================================================================ */
.artifacts-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2.5rem;
}

.artifact-viewer {
  position: relative;
  background: radial-gradient(circle at 50% 45%, #27211a 0%, #120f0b 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

#artifact-canvas {
  width: 100%;
  height: clamp(250px, 34vw, 330px);
  touch-action: pan-y;
  cursor: grab;
}

.artifact-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.artifact-btn {
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.artifact-btn strong {
  display: block;
  font-size: 0.84rem;
  margin-top: 0.2rem;
}

.artifact-btn.is-active {
  border-color: var(--accent);
  background: rgba(233, 186, 93, 0.14);
}

.artifact-story h3 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.1;
  margin: 0.35rem 0 0.8rem;
}

.artifact-summary {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.artifact-points {
  margin: 0 0 1.1rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.5rem;
  font-size: 0.94rem;
}

.artifact-fact {
  display: inline-block;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.cave-callout {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  gap: 1.6rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: clamp(1.4rem, 3vw, 2.2rem);
}

.cave-text h3 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin: 0.35rem 0 0.7rem;
}

.cave-text p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
}

.cave-quote {
  border-left: 2px solid var(--accent);
  padding-left: 1.2rem;
}

.cave-quote blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.3rem, 2.3vw, 1.68rem);
  line-height: 1.25;
  margin: 0 0 0.7rem;
}

.cave-quote cite {
  font-style: normal;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============================================================================
   CAPÍTULO V: FLUJOS INVISIBLES
   ============================================================================ */
.flow-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.flow-tab {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.flow-tab.is-active {
  background: var(--accent);
  color: #16120c;
  border-color: var(--accent);
  font-weight: 700;
}

.flow-tab.flow-tab-dark.is-active {
  background: #d45b47;
  color: #fff6f4;
  border-color: #d45b47;
}

.flow-stage {
  display: grid;
  gap: 1.5rem;
}

.flow-diagram-wrap {
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 0.75rem;
}

#flow-svg {
  width: 100%;
  height: auto;
}

.flow-axis-line {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-dasharray: 4 4;
}

.flow-col-title {
  fill: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.flow-col-sub {
  fill: var(--text-muted);
  font-size: 10px;
}

.flow-arc {
  fill: none;
  stroke-width: 2.3;
}

.flow-arc.is-ew { stroke: #e9ba5d; }
.flow-arc.is-we { stroke: #5ba4dc; }
.flow-arc.is-both { stroke: #8bd19c; }
.flow-arc.is-plague { stroke: #e05a47; }

.flow-arc-label {
  fill: #f3ece0;
  font-size: 11px;
  font-weight: 600;
}

.flow-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.05rem;
}

.flow-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 1.2rem 1.3rem;
}

.flow-card.is-plague {
  border-color: rgba(212, 91, 71, 0.35);
  background: rgba(212, 91, 71, 0.08);
}

.flow-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.flow-card h4 {
  margin: 0;
  font-size: 1.02rem;
}

.dir-badge {
  white-space: nowrap;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.65rem;
}

.flow-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ============================================================================
   CAPÍTULO VI: LÍNEA TEMPORAL + MEDIDOR TIERRA/MAR
   ============================================================================ */
.era-meter {
  position: sticky;
  top: calc(var(--rail-h) + 12px);
  z-index: 12;
  background: rgba(13, 18, 27, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.95rem 1.2rem;
  margin-bottom: 2rem;
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

#era-balance-label {
  color: #f3ece0;
}

.meter-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e9ba5d 0%, #6d7b8d 50%, #5ba4dc 100%);
}

.meter-marker {
  position: absolute;
  top: 50%;
  left: 15%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #0d121b;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.7);
  transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline-ribbon {
  position: relative;
  display: grid;
  gap: 1.15rem;
  padding-left: 1.5rem;
  border-left: 1px solid rgba(233, 186, 93, 0.28);
}

.time-node {
  position: relative;
  display: grid;
  grid-template-columns: 125px 1fr;
  gap: 0.6rem 1.4rem;
  align-items: start;
  padding: 1.05rem 1.25rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.time-node.is-active {
  border-color: var(--accent);
  background: rgba(233, 186, 93, 0.09);
}

.time-dot {
  position: absolute;
  left: -1.87rem;
  top: 1.35rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #3a424e;
  border: 2px solid var(--bg);
}

.time-node.is-active .time-dot {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(233, 186, 93, 0.8);
}

.time-year {
  font-size: 0.85rem;
  padding-top: 0.15rem;
}

.time-body h4 {
  font-family: var(--font-display);
  font-size: 1.38rem;
  margin: 0 0 0.3rem;
}

.time-body p {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ============================================================================
   CAPÍTULO VII: EPÍLOGO EN PAPEL Y FUENTES
   ============================================================================ */
.epilogue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  margin-bottom: 3.2rem;
}

.epi-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 1.45rem;
}

.epi-card.epi-takeaway {
  border-color: var(--accent);
  background: rgba(166, 109, 20, 0.08);
}

.epi-card h3 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.15;
  margin: 0.4rem 0 0.65rem;
}

.epi-card p {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
}

.sources-block {
  border-top: 1px solid var(--border);
  padding-top: 2.2rem;
}

.sources-header h3 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 0 0 0.4rem;
}

.sources-header p {
  margin: 0 0 1.2rem;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.sources-list {
  margin: 0 0 2rem;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.sources-list strong {
  color: var(--text);
}

.footer-colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.footer-colophon a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* ============================================================================
   RESPONSIVE: MÓVIL Y TABLET
   ============================================================================ */
@media (max-width: 960px) {
  .rail-telemetry {
    display: none;
  }

  .hero-content {
    margin-inline: auto;
    padding-top: 4rem;
  }

  .hero-vignette {
    background:
      linear-gradient(180deg, rgba(12, 15, 21, 0.38) 0%, rgba(12, 15, 21, 0.82) 55%, var(--bg) 100%);
  }

  .myths-grid,
  .balance-layout,
  .artifacts-layout,
  .cave-callout,
  .metrics-trio,
  .flow-cards,
  .epilogue-grid {
    grid-template-columns: 1fr;
  }

  .balance-pivot {
    flex-direction: row;
    justify-content: center;
  }

  /* Mapa sticky compacto arriba en móvil para dejar sitio al relato */
  .map-scrolly {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  .map-stage {
    position: sticky;
    top: calc(var(--rail-h) + 4px);
    z-index: 20;
    background: var(--bg);
    padding-bottom: 0.35rem;
  }

  #silk-map {
    max-height: 205px;
    aspect-ratio: auto;
  }

  .map-hud {
    padding: 0.5rem 0.75rem;
  }

  .hud-step strong {
    font-size: 1rem;
  }

  .city-inspector {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 95;
    max-height: 45vh;
    overflow-y: auto;
  }

  .map-steps {
    position: relative;
    z-index: 5;
  }

  .comp-row {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .comp-val {
    text-align: left;
  }

  .time-node {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .meter-labels {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }
}

@media (max-width: 540px) {
  .artifact-controls {
    grid-template-columns: 1fr;
  }

  .hud-legend {
    display: none;
  }
}

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