/* ============================================================
   ANATOMIA DA FOME — Interactive Website
   Visual Identity: Editorial dissection metaphor
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Backgrounds */
  --bg-cream: #F0EBE3;
  --bg-sand: #E8E0D4;
  --bg-paper: #FAF7F2;
  --bg-dark: #1E2632;

  /* Text */
  --text-primary: #1E2632;
  --text-secondary: #5A6472;
  --text-muted: #8E95A0;
  --text-on-dark: #F0EBE3;

  /* Accent */
  --accent-indigo: #2B4066;
  --green: #3D6B5E;
  --green-light: #5a9e8f;
  --yellow: #C49234;
  --orange: #B87332;
  --red: #C2593D;
  --red-deep: #8B3525;

  /* EBIA scale colors */
  --ebia-sa: #3D6B5E;
  --ebia-leve: #C49234;
  --ebia-moderada: #B87332;
  --ebia-grave: #C2593D;
  --ebia-grave-deep: #8B3525;

  /* Spacing */
  --section-gap: clamp(80px, 10vw, 140px);
  --content-max: 860px;
  --wide-max: 1100px;

  /* Typography scale */
  --fs-hero: clamp(3rem, 6vw, 6rem);
  --fs-h1: clamp(2rem, 4vw, 3.2rem);
  --fs-h2: clamp(1.5rem, 3vw, 2.2rem);
  --fs-h3: clamp(1.2rem, 2vw, 1.6rem);
  --fs-body: clamp(1rem, 1.1vw, 1.15rem);
  --fs-small: 0.875rem;
  --fs-mono: 0.85rem;

  /* Animation */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration: 0.8s;
  --duration-long: 1.2s;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--bg-cream);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: var(--accent-indigo); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Typography --- */
h1, h2, h3, .chapter-title {
  font-family: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-primary);
}

.mono, .stat-value, .data-label {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-weight: 400;
}

/* --- Navigation --- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(240, 235, 227, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(30, 38, 50, 0.08);
  transform: translateY(-100%);
  transition: transform 0.4s var(--ease-out);
  padding: 0 24px;
}

.site-nav.visible {
  transform: translateY(0);
}

.nav-inner {
  max-width: var(--wide-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  font-family: 'Instrument Serif', serif;
  font-size: 1.1rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.nav-chapters {
  display: flex;
  gap: 4px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-chapters::-webkit-scrollbar { display: none; }

.nav-chapters a {
  display: block;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-radius: 4px;
  transition: color 0.3s, background 0.3s;
  white-space: nowrap;
}
.nav-chapters a:hover,
.nav-chapters a.active {
  color: var(--text-primary);
  background: rgba(30, 38, 50, 0.06);
  text-decoration: none;
}

.nav-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent-indigo);
  width: 0%;
  transition: width 0.15s linear;
}

/* --- Hero Section --- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 80px 24px 60px;
  position: relative;
}

.hero-title {
  font-family: 'Instrument Serif', serif;
  font-size: var(--fs-hero);
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(40px);
  animation: fadeUp 1s var(--ease-out) 0.2s forwards;
}

.hero-subtitle {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: var(--text-secondary);
  margin-bottom: 32px;
  opacity: 0;
  transform: translateY(30px);
  animation: fadeUp 1s var(--ease-out) 0.5s forwards;
}

.hero-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-mono);
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 1s var(--ease-out) 0.8s forwards;
}

.hero-meta span {
  margin: 0 8px;
  opacity: 0.4;
}

.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: fadeUp 1s var(--ease-out) 1.2s forwards;
}

.scroll-hint-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.scroll-hint-line {
  width: 1px;
  height: 40px;
  background: var(--text-muted);
  animation: pulse-line 2s ease-in-out infinite;
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-line {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* --- Section Base --- */
.chapter {
  padding: var(--section-gap) 24px;
  position: relative;
}

.chapter-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.chapter-wide {
  max-width: var(--wide-max);
  margin: 0 auto;
}

/* Alternating backgrounds */
.chapter--sand { background: var(--bg-sand); }
.chapter--dark {
  background: var(--bg-dark);
  color: var(--text-on-dark);
}
.chapter--dark h1,
.chapter--dark h2,
.chapter--dark h3,
.chapter--dark .chapter-title {
  color: var(--text-on-dark);
}
.chapter--dark .text-secondary { color: rgba(240, 235, 227, 0.7); }
.chapter--dark .text-muted { color: rgba(240, 235, 227, 0.5); }

/* Chapter header */
.chapter-header {
  margin-bottom: 48px;
}

.chapter-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: block;
}

.chapter--dark .chapter-number { color: rgba(240, 235, 227, 0.4); }

.chapter-question {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: var(--fs-h2);
  color: var(--accent-indigo);
  margin-bottom: 16px;
}

.chapter--dark .chapter-question { color: var(--yellow); }

.chapter-title {
  font-size: var(--fs-h1);
  margin-bottom: 16px;
}

/* --- Hero Stat --- */
.hero-stat {
  text-align: center;
  padding: 48px 0;
}

.hero-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 400;
  line-height: 1;
  color: var(--accent-indigo);
  margin-bottom: 12px;
}

.hero-stat-value.color-red { color: var(--red); }
.hero-stat-value.color-red-deep { color: var(--red-deep); }
.hero-stat-value.color-green { color: var(--green); }
.hero-stat-value.color-yellow { color: var(--yellow); }

.chapter--dark .hero-stat-value { color: var(--text-on-dark); }

.hero-stat-label {
  font-size: var(--fs-body);
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

.chapter--dark .hero-stat-label { color: rgba(240, 235, 227, 0.7); }

/* --- Callout / Insight Box --- */
.callout {
  background: var(--bg-paper);
  border-left: 3px solid var(--accent-indigo);
  padding: 24px 28px;
  margin: 40px 0;
  border-radius: 0 8px 8px 0;
  font-size: var(--fs-body);
}

.callout strong { color: var(--accent-indigo); }

.callout--red { border-left-color: var(--red); }
.callout--red strong { color: var(--red); }

.callout--green { border-left-color: var(--green); }
.callout--green strong { color: var(--green); }

.callout--yellow { border-left-color: var(--yellow); }
.callout--yellow strong { color: var(--yellow); }

.chapter--dark .callout {
  background: rgba(255, 255, 255, 0.06);
  border-left-color: var(--yellow);
}
.chapter--dark .callout strong { color: var(--yellow); }

/* --- Bar Chart (CSS-based) --- */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 32px 0;
}

.bar-row {
  display: grid;
  grid-template-columns: 220px 1fr 60px;
  align-items: center;
  gap: 12px;
  cursor: default;
}

.bar-label {
  font-size: var(--fs-small);
  font-weight: 500;
  text-align: right;
  color: var(--text-secondary);
  line-height: 1.3;
  white-space: nowrap;
  position: relative;
  cursor: help;
}

.bar-label[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  background: var(--bg-dark, #1E2632);
  color: var(--bg-cream, #F0EBE3);
  font-size: 0.78rem;
  font-weight: 400;
  font-family: 'DM Sans', sans-serif;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: normal;
  width: max-content;
  max-width: 280px;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: tooltipFade 0.15s ease-out;
}

@keyframes tooltipFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.bar-label-id {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 0.82em;
}

.bar-label-sep {
  color: var(--text-muted);
  margin: 0 2px;
}

.bar-label-desc {
  font-weight: 400;
  color: var(--text-muted);
}

.bar-track {
  height: 28px;
  background: rgba(30, 38, 50, 0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  width: 0;
  transition: width 1.2s var(--ease-out);
  background: var(--accent-indigo);
}

.bar-fill.fill-red { background: var(--red); }
.bar-fill.fill-red-deep { background: var(--red-deep); }
.bar-fill.fill-orange { background: var(--orange); }
.bar-fill.fill-yellow { background: var(--yellow); }
.bar-fill.fill-green { background: var(--green); }
.bar-fill.fill-indigo { background: var(--accent-indigo); }

.bar-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-mono);
  color: var(--text-secondary);
  text-align: left;
}

/* Light variant for dark sections */
.chapter--dark .bar-track { background: rgba(255, 255, 255, 0.08); }
.chapter--dark .bar-label { color: rgba(240, 235, 227, 0.7); }
.chapter--dark .bar-value { color: rgba(240, 235, 227, 0.7); }

/* --- Carousel (14 Perguntas) — Borderless Editorial --- */
.carousel { position: relative; }

.carousel-rail {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.carousel-rail-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-right: 4px;
}

.carousel-rail-sep {
  width: 1px;
  height: 20px;
  background: var(--text-muted);
  opacity: 0.3;
  margin: 0 8px;
  flex-shrink: 0;
}

/* Pills — color-coded by severity via --pill-color */
.carousel-pill {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--pill-color, var(--accent-indigo)) 40%, transparent);
  background: transparent;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.carousel-pill:hover {
  border-color: var(--pill-color, var(--accent-indigo));
  color: var(--pill-color, var(--accent-indigo));
}

.carousel-pill.is-active {
  background: var(--pill-color, var(--accent-indigo));
  border-color: var(--pill-color, var(--accent-indigo));
  color: white;
}

.carousel-pill.is-visited {
  border-color: var(--pill-color, var(--accent-indigo));
  background: color-mix(in srgb, var(--pill-color, var(--accent-indigo)) 12%, transparent);
  color: var(--pill-color, var(--accent-indigo));
}

/* Viewport & track — no border-radius, no card container */
.carousel-viewport {
  overflow: hidden;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
}

/* Card — borderless, transparent, full content-width */
.carousel-card {
  background: transparent;
  border-radius: 0;
  padding: 0;
  border: none;
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Meta line — replaces old header with dim badge + universo pill */
.carousel-card-meta {
  font-size: 0.7rem;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.carousel-card-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.carousel-card-label {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 24px;
  line-height: 1.4;
}

.carousel-stat {
  text-align: center;
  padding: 20px 0;
}

/* Stat value — hero-sized, color from --stat-color */
.carousel-stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 400;
  color: var(--stat-color, var(--accent-indigo));
  line-height: 1;
  margin-bottom: 6px;
}

.carousel-stat-desc {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.carousel-stat-human {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 16px;
}

/* Bar — 28px thick, matching site bar-track */
.carousel-stat-bar-track {
  height: 28px;
  background: rgba(30, 38, 50, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 auto;
}

.carousel-stat-bar-fill {
  height: 100%;
  background: var(--stat-color, var(--accent-indigo));
  border-radius: 4px;
  width: 0;
  transition: width 0.8s var(--ease-out);
}

/* Meaning — editorial callout with colored left border */
.carousel-card-meaning {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 24px;
  padding-left: 16px;
  border-left: 3px solid var(--stat-color, var(--accent-indigo));
  font-style: italic;
}

/* Nav — arrows, counter */
.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
}

/* Arrows — transparent, editorial, no border/bg */
.carousel-arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.carousel-arrow:hover:not(:disabled) {
  color: var(--accent-indigo);
}

.carousel-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

.carousel-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 60px;
  text-align: center;
}

.card-dim {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.dim-cognitiva { background: #e8dff5; color: #634175; }
.dim-material { background: #daeaf5; color: #2B4066; }
.dim-comportamental { background: #ffecd2; color: #8B5E3C; }
.dim-somatica { background: #fde2dc; color: #8B3525; }

/* --- Region Grid --- */
.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 32px 0;
}

.region-card {
  background: var(--bg-paper);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  border: 1px solid rgba(30, 38, 50, 0.06);
}

.region-name {
  font-weight: 600;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.region-stat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.8rem;
  color: var(--accent-indigo);
  line-height: 1;
}

.region-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Data Table --- */
.data-table-wrap {
  overflow-x: auto;
  margin: 32px 0;
  border-radius: 8px;
  border: 1px solid rgba(30, 38, 50, 0.08);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}

.data-table th {
  background: var(--bg-sand);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid rgba(30, 38, 50, 0.1);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(30, 38, 50, 0.05);
  color: var(--text-primary);
}

.data-table tbody tr:hover {
  background: rgba(43, 64, 102, 0.03);
}

.data-table .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-mono);
}

.chapter--dark .data-table th {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(240, 235, 227, 0.6);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}
.chapter--dark .data-table td {
  color: var(--text-on-dark);
  border-bottom-color: rgba(255, 255, 255, 0.05);
}
.chapter--dark .data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* --- Map Container --- */
.map-container {
  width: 100%;
  max-width: 700px;
  margin: 32px auto;
  position: relative;
}

.map-svg {
  width: 100%;
  height: auto;
}

.map-svg path {
  stroke: var(--bg-cream);
  stroke-width: 0.5;
  cursor: pointer;
  transition: opacity 0.2s, stroke-width 0.2s;
}

.map-svg path:hover {
  opacity: 0.85;
  stroke-width: 1.5;
  stroke: var(--text-primary);
}

.map-svg path.highlighted {
  stroke-width: 2;
  stroke: var(--text-primary);
}

.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-paper);
  border: 1px solid rgba(30, 38, 50, 0.12);
  border-radius: 6px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(30, 38, 50, 0.12);
  font-size: var(--fs-small);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s;
  max-width: 220px;
}

.map-tooltip.visible { opacity: 1; }

.map-tooltip-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.map-tooltip-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  color: var(--accent-indigo);
}

.map-tooltip-cv {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.map-selector {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.map-selector button {
  padding: 6px 14px;
  border: 1px solid rgba(30, 38, 50, 0.15);
  background: transparent;
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.map-selector button:hover {
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
}

.map-selector button.active {
  background: var(--accent-indigo);
  color: white;
  border-color: var(--accent-indigo);
}

.map-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.map-legend-gradient {
  width: 200px;
  height: 8px;
  border-radius: 4px;
}

/* --- Stepper (Scrollama) --- */
.stepper-section {
  position: relative;
}

.stepper-container {
  display: flex;
  gap: 48px;
}

.stepper-chart {
  flex: 1;
  position: sticky;
  top: 80px;
  height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper-chart-inner {
  width: 100%;
  max-width: 500px;
}

.stepper-steps {
  flex: 1;
  padding: 40vh 0;
}

.step {
  min-height: 60vh;
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
}

.step-content {
  background: var(--bg-paper);
  border-radius: 8px;
  padding: 32px;
  border: 1px solid rgba(30, 38, 50, 0.06);
  opacity: 0.3;
  transition: opacity 0.4s var(--ease-out);
}

.step.is-active .step-content {
  opacity: 1;
}

.step-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--accent-indigo);
}

.step-text {
  font-size: var(--fs-body);
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- Dot Plot --- */
.dot-container {
  width: 100%;
  max-width: 600px;
  margin: 40px auto;
  aspect-ratio: 1.5;
}

.dot-container svg {
  width: 100%;
  height: 100%;
}

.dot-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.dot-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.dot-legend-circle {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* --- Simulador --- */
.simulador {
  background: var(--bg-paper);
  border-radius: 12px;
  padding: 40px;
  border: 1px solid rgba(30, 38, 50, 0.08);
  margin: 40px 0;
}

.simulador-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.simulador-controls {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.control-group label {
  display: block;
  font-weight: 600;
  font-size: var(--fs-small);
  margin-bottom: 8px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.control-group .btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-option {
  padding: 8px 16px;
  border: 1px solid rgba(30, 38, 50, 0.15);
  background: transparent;
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-option:hover {
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
}

.btn-option.active {
  background: var(--accent-indigo);
  color: white;
  border-color: var(--accent-indigo);
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toggle-track {
  width: 44px;
  height: 24px;
  background: rgba(30, 38, 50, 0.15);
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
}

.toggle-track.active { background: var(--accent-indigo); }

.toggle-thumb {
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-track.active .toggle-thumb { transform: translateX(20px); }

.simulador-output {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sim-result-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sim-result-label {
  width: 100px;
  font-size: var(--fs-small);
  font-weight: 500;
  text-align: right;
}

.sim-result-track {
  flex: 1;
  height: 32px;
  background: rgba(30, 38, 50, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.sim-result-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s var(--ease-out);
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.sim-result-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: white;
  font-weight: 500;
}

.sim-population {
  text-align: center;
  padding: 20px;
  font-size: var(--fs-body);
  color: var(--text-secondary);
}

.sim-population strong {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-indigo);
  font-size: 1.2rem;
}

/* --- Share Button --- */
.share-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(30, 38, 50, 0.06);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s, background 0.2s;
  z-index: 10;
}

.share-btn svg {
  width: 16px;
  height: 16px;
  fill: var(--text-muted);
}

*:hover > .share-btn,
.share-btn:focus { opacity: 1; }
.share-btn:hover { background: rgba(30, 38, 50, 0.12); }

.share-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: var(--fs-small);
  z-index: 9999;
  transition: transform 0.4s var(--ease-spring);
  pointer-events: none;
}

.share-toast.visible { transform: translateX(-50%) translateY(0); }

/* --- Comparison (side by side) --- */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 32px 0;
}

.comparison-col {
  background: var(--bg-paper);
  border-radius: 8px;
  padding: 24px;
  border: 1px solid rgba(30, 38, 50, 0.06);
}

.comparison-col-title {
  font-weight: 600;
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(30, 38, 50, 0.06);
}

/* --- Policy Cards --- */
.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin: 40px 0;
}

.policy-card {
  background: var(--bg-paper);
  border-radius: 8px;
  padding: 28px;
  border: 1px solid rgba(30, 38, 50, 0.06);
  border-top: 3px solid var(--accent-indigo);
}

.policy-card-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.policy-card-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

.policy-card-text {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Footnotes / Footer --- */
.site-footer {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding: 80px 24px 40px;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

.footer-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.5rem;
  margin-bottom: 24px;
}

.footer-text {
  font-size: var(--fs-small);
  color: rgba(240, 235, 227, 0.6);
  line-height: 1.7;
  margin-bottom: 16px;
}

.footer-divider {
  height: 1px;
  background: rgba(240, 235, 227, 0.1);
  margin: 32px 0;
}

.footer-credits {
  font-size: 0.75rem;
  color: rgba(240, 235, 227, 0.4);
}

/* --- Reveal Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-chapters { display: none; }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .bar-label { text-align: left; font-size: 0.8rem; }

  .stepper-container {
    flex-direction: column;
  }
  .stepper-chart {
    position: sticky;
    top: 56px;
    height: auto;
    min-height: 280px;
    max-height: 45vh;
    z-index: 5;
    background: var(--bg-cream);
    padding: 12px 0 8px;
    border-bottom: 1px solid rgba(30, 38, 50, 0.08);
    box-shadow: 0 4px 12px rgba(30, 38, 50, 0.06);
  }
  .dark-section .stepper-chart {
    background: var(--bg-dark);
  }
  .stepper-steps { padding: 20px 0; }
  .step { min-height: 50vh; }

  .simulador-grid {
    grid-template-columns: 1fr;
  }

  .comparison {
    grid-template-columns: 1fr;
  }

  .carousel-pill {
    width: 22px;
    height: 22px;
    font-size: 0;
  }
  .carousel-pill.is-active {
    font-size: 0.6rem;
  }
  .carousel-rail {
    gap: 4px;
  }
  .carousel-rail-sep {
    margin: 0 4px;
  }
  .carousel-stat-bar-track {
    height: 20px;
  }

  .region-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-title {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }
}

@media (max-width: 480px) {
  .carousel-rail-label {
    display: none;
  }
  .carousel-pill {
    width: 20px;
    height: 20px;
  }

  .region-grid {
    grid-template-columns: 1fr;
  }

  .map-selector { gap: 4px; }
  .map-selector button { padding: 5px 10px; font-size: 0.75rem; }
}

/* --- Accessibility: reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-title, .hero-subtitle, .hero-meta, .scroll-hint {
    opacity: 1;
    transform: none;
  }
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 16px; }
.mt-4 { margin-top: 32px; }
.mt-6 { margin-top: 48px; }
.mb-2 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 32px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
