/* =============================================================
   PLANTILLA ARTÍCULO INTERACTIVO — Estilos Base
   Periodismo de datos con scrollytelling y visualizaciones D3
   =============================================================

   ÍNDICE
   ------
   1.  Variables globales (Design Tokens)
   2.  Reset y base
   3.  Tipografía
   4.  Layout y contenedor
   5.  Hero
   6.  Scrollytelling
   7.  Secciones de contenido
   8.  Componentes de texto (citas, destacados, contadores)
   9.  Contenedores de gráficos
   10. Tooltip
   11. Footer
   12. Utilidades y animaciones
   13. Responsive
   ============================================================= */


/* ──────────────────────────────────────────────────────────────
   1. VARIABLES GLOBALES
   Los temas en css/themes/ sobreescriben estas variables.
   ────────────────────────────────────────────────────────────── */
:root {
  /* ── Tipografía ── */
  --font-serif:   'Source Serif 4', Georgia, serif;
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Escala tipográfica (base 16px) */
  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */
  --text-5xl:  3rem;       /* 48px */
  --text-6xl:  3.75rem;    /* 60px */
  --text-7xl:  4.5rem;     /* 72px */

  /* Interlineado */
  --leading-tight:  1.15;
  --leading-snug:   1.375;
  --leading-normal: 1.6;
  --leading-relaxed:1.8;

  /* ── Colores ── (tema por defecto: Datos Claros) */
  --color-bg:         #ffffff;
  --color-bg-alt:     #f7f8fa;
  --color-bg-card:    #ffffff;
  --color-bg-dark:    #0f1923;

  --color-text:       #1a1f2e;
  --color-text-muted: #5a6478;
  --color-text-light: #8b95a8;
  --color-text-inv:   #ffffff;

  --color-accent:     #1a56db;
  --color-accent-2:   #e3342f;
  --color-accent-3:   #10b981;

  --color-border:     #e2e6ef;
  --color-divider:    #cbd5e1;

  /* Paleta de datos (para gráficas) */
  --data-1: #1a56db;
  --data-2: #e3342f;
  --data-3: #10b981;
  --data-4: #f59e0b;
  --data-5: #8b5cf6;
  --data-6: #06b6d4;
  --data-7: #f97316;
  --data-8: #64748b;

  /* ── Espaciado ── */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* ── Bordes y sombras ── */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow:     0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.05);
  --shadow-xl:  0 24px 48px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.06);

  /* ── Transiciones ── */
  --ease-fast:   0.15s ease-in-out;
  --ease-normal: 0.3s ease-in-out;
  --ease-slow:   0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: 0.8s cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Layout ── */
  --max-w-text:  680px;
  --max-w-wide:  900px;
  --max-w-full:  1280px;
  --col-gap:     var(--space-8);
}


/* ──────────────────────────────────────────────────────────────
   2. RESET Y BASE
   ────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--ease-fast);
}

a:hover { color: var(--color-accent-2); }


/* ──────────────────────────────────────────────────────────────
   3. TIPOGRAFÍA
   ────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  line-height: var(--leading-tight);
  color: var(--color-text);
  font-weight: 700;
}

.article-title {
  font-size: clamp(var(--text-4xl), 5vw, var(--text-7xl));
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.article-subtitle {
  font-size: clamp(var(--text-xl), 2.5vw, var(--text-3xl));
  font-weight: 400;
  font-family: var(--font-serif);
  line-height: var(--leading-snug);
  color: var(--color-text-muted);
}

.section-title {
  font-size: clamp(var(--text-3xl), 3vw, var(--text-5xl));
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-title .accent {
  color: var(--color-accent);
}

.section-title .accent-2 {
  color: var(--color-accent-2);
}

.body-text {
  font-family: var(--font-serif);
  font-size: clamp(var(--text-base), 1.5vw, var(--text-lg));
  line-height: var(--leading-relaxed);
  color: var(--color-text);
}

.body-text + .body-text {
  margin-top: var(--space-5);
}

.lead-text {
  font-size: clamp(var(--text-lg), 2vw, var(--text-2xl));
  font-family: var(--font-serif);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

.label-text {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-light);
}

.number-display {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(var(--text-4xl), 5vw, var(--text-7xl));
  line-height: 1;
  color: var(--color-accent);
  letter-spacing: -0.02em;
}

/* Texto inline destacado */
.highlight {
  color: var(--color-accent);
  font-weight: 600;
}

.highlight-2 {
  color: var(--color-accent-2);
  font-weight: 600;
}

.highlight-3 {
  color: var(--color-accent-3);
  font-weight: 600;
}

.underline-accent {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}


/* ──────────────────────────────────────────────────────────────
   4. LAYOUT Y CONTENEDOR
   ────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w-full);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--text {
  max-width: var(--max-w-text);
}

.container--wide {
  max-width: var(--max-w-wide);
}

.section {
  padding-block: var(--space-24);
}

.section--alt {
  background-color: var(--color-bg-alt);
}

.section--dark {
  background-color: var(--color-bg-dark);
  color: var(--color-text-inv);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4 {
  color: var(--color-text-inv);
}


/* ──────────────────────────────────────────────────────────────
   5. HERO
   ────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding-block: var(--space-20);
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Gradiente por defecto (el tema puede sobreescribirlo) */
.hero__bg--gradient {
  background: linear-gradient(135deg, var(--color-bg-dark) 0%, #1e3a5f 100%);
}

/* Para hero con imagen */
.hero__bg--image {
  background-size: cover;
  background-position: center;
}

.hero__bg--image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.7) 100%);
}

.hero__content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-w-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.hero--light .hero__content { color: var(--color-text); }
.hero--dark  .hero__content { color: var(--color-text-inv); }
.hero--dark  .hero__content h1,
.hero--dark  .hero__content h2 { color: var(--color-text-inv); }

.hero__meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.hero__tag {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--color-accent);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
}

.hero__date {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  font-family: var(--font-mono);
}

.hero__title {
  margin-bottom: var(--space-6);
}

.hero__subtitle {
  margin-bottom: var(--space-10);
  max-width: 640px;
}

.hero__authors {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.hero__author {
  font-size: var(--text-sm);
  font-weight: 500;
}

.hero__scroll-hint {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-light);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: bounceDown 2s ease-in-out infinite;
}

.hero__scroll-hint svg {
  width: 20px;
  height: 20px;
}

@keyframes bounceDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(8px); }
}


/* ──────────────────────────────────────────────────────────────
   6. SCROLLYTELLING
   ────────────────────────────────────────────────────────────── */
.scrolly {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
  align-items: start;
  padding-block: var(--space-12);
}

/* Versión con texto a la derecha */
.scrolly--reversed {
  grid-template-columns: 1fr 1fr;
  direction: rtl;
}

.scrolly--reversed > * {
  direction: ltr;
}

/* Versión texto ancho (60/40) */
.scrolly--wide-text {
  grid-template-columns: 3fr 2fr;
}

/* Versión gráfico ancho */
.scrolly--wide-chart {
  grid-template-columns: 2fr 3fr;
}

/* ── Pasos de texto ── */
.scrolly__steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 50vh;
}

.scrolly__step {
  min-height: 50vh;
  display: flex;
  align-items: center;
  padding-block: var(--space-12);
  opacity: 0.35;
  transform: translateY(12px);
  transition: opacity var(--ease-slow), transform var(--ease-slow);
}

.scrolly__step.is-active {
  opacity: 1;
  transform: translateY(0);
}

.scrolly__step-inner {
  padding: var(--space-8);
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
  transition: border-color var(--ease-normal);
}

.scrolly__step.is-active .scrolly__step-inner {
  border-left-color: var(--color-accent);
}

.scrolly__step-number {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.scrolly__step h3 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}

.scrolly__step p {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

/* ── Gráfico sticky ── */
.scrolly__figure {
  position: sticky;
  top: 5vh;
  height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scrolly__chart-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.scrolly__chart-wrap svg {
  width: 100%;
  height: 100%;
}


/* ──────────────────────────────────────────────────────────────
   7. SECCIONES DE CONTENIDO
   ────────────────────────────────────────────────────────────── */
.section-header {
  margin-bottom: var(--space-16);
  max-width: var(--max-w-wide);
  margin-inline: auto;
}

.section-eyebrow {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

.section-intro {
  margin-top: var(--space-6);
  font-family: var(--font-serif);
  font-size: clamp(var(--text-base), 1.5vw, var(--text-lg));
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
  max-width: 680px;
}

/* Grid de contenido */
.content-grid {
  display: grid;
  gap: var(--space-16);
  max-width: var(--max-w-wide);
  margin-inline: auto;
}

.content-grid--two {
  grid-template-columns: repeat(2, 1fr);
}

.content-grid--three {
  grid-template-columns: repeat(3, 1fr);
}

.content-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* Texto artículo centrado */
.article-body {
  max-width: var(--max-w-text);
  margin-inline: auto;
}

.article-body h2 {
  font-size: clamp(var(--text-2xl), 2.5vw, var(--text-4xl));
  margin-block: var(--space-10) var(--space-4);
}

.article-body h3 {
  font-size: clamp(var(--text-xl), 2vw, var(--text-3xl));
  margin-block: var(--space-8) var(--space-3);
}

.article-body p {
  font-family: var(--font-serif);
  font-size: clamp(var(--text-base), 1.2vw, var(--text-lg));
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-5);
}


/* ──────────────────────────────────────────────────────────────
   8. COMPONENTES DE TEXTO
   ────────────────────────────────────────────────────────────── */

/* ── Cita / Pullquote ── */
.pullquote {
  position: relative;
  margin-block: var(--space-16);
  padding: var(--space-10) var(--space-12);
  background: var(--color-bg-alt);
  border-radius: var(--radius-xl);
  text-align: center;
}

.pullquote::before {
  content: '\201C';
  position: absolute;
  top: -0.1em;
  left: var(--space-8);
  font-size: 8rem;
  line-height: 1;
  font-family: var(--font-serif);
  color: var(--color-accent);
  opacity: 0.2;
  pointer-events: none;
}

.pullquote__text {
  font-family: var(--font-serif);
  font-size: clamp(var(--text-xl), 2.5vw, var(--text-3xl));
  font-style: italic;
  font-weight: 400;
  line-height: var(--leading-snug);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.pullquote__attribution {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-light);
}

/* ── Tarjetas de estadísticas ── */
.stats-grid {
  display: grid;
  gap: var(--space-4);
}

.stats-grid--2 { grid-template-columns: repeat(2, 1fr); }
.stats-grid--3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid--4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow);
  text-align: center;
  border-top: 4px solid var(--color-accent);
  transition: transform var(--ease-normal), box-shadow var(--ease-normal);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card--accent-2 { border-top-color: var(--color-accent-2); }
.stat-card--accent-3 { border-top-color: var(--color-accent-3); }

.stat-card__number {
  font-family: var(--font-mono);
  font-size: clamp(var(--text-4xl), 4vw, var(--text-6xl));
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: var(--space-2);
}

.stat-card--accent-2 .stat-card__number { color: var(--color-accent-2); }
.stat-card--accent-3 .stat-card__number { color: var(--color-accent-3); }

.stat-card__suffix {
  font-size: 0.5em;
  vertical-align: super;
  font-weight: 400;
}

.stat-card__label {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.stat-card__description {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  line-height: var(--leading-normal);
}

/* ── Contador animado ── */
.counter-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.counter-display__value {
  font-family: var(--font-mono);
  font-size: clamp(var(--text-5xl), 8vw, 7rem);
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
  letter-spacing: -0.04em;
  opacity: 0;
  transition: opacity var(--ease-normal);
}

.counter-display.is-visible .counter-display__value {
  opacity: 1;
}

.counter-display__label {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
}

/* ── Bloque de nota/contexto ── */
.callout {
  margin-block: var(--space-8);
  padding: var(--space-6) var(--space-8);
  border-left: 4px solid var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 6%, var(--color-bg));
  border-radius: 0 var(--radius) var(--radius) 0;
}

.callout--warning {
  border-left-color: var(--color-accent-2);
  background: color-mix(in srgb, var(--color-accent-2) 6%, var(--color-bg));
}

.callout--success {
  border-left-color: var(--color-accent-3);
  background: color-mix(in srgb, var(--color-accent-3) 6%, var(--color-bg));
}

.callout__label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.callout--warning .callout__label { color: var(--color-accent-2); }
.callout--success .callout__label { color: var(--color-accent-3); }

.callout p {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

/* ── Imagen con caption ── */
.figure {
  margin-block: var(--space-12);
}

.figure img {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.figure--wide {
  margin-inline: calc(-1 * var(--space-8));
}

.figure--full-bleed {
  margin-inline: calc(-50vw + 50%);
}

.figure__caption {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-light);
  line-height: var(--leading-normal);
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
}

.figure__caption::before {
  content: '▲';
  font-size: 0.6em;
  color: var(--color-accent);
  flex-shrink: 0;
}


/* ──────────────────────────────────────────────────────────────
   9. CONTENEDORES DE GRÁFICOS
   ────────────────────────────────────────────────────────────── */
.chart-section {
  padding-block: var(--space-16);
}

.chart-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chart-card__header {
  padding: var(--space-8) var(--space-8) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.chart-card__eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.chart-card__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.chart-card__subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
}

.chart-card__body {
  padding: var(--space-6) var(--space-8) var(--space-8);
}

.chart-card__footer {
  padding: var(--space-4) var(--space-8);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  color: var(--color-text-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* SVG inside chart */
.chart-card__body svg {
  width: 100%;
  overflow: visible;
}

/* Leyenda */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.chart-legend__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.chart-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* Estilos D3 */
.d3-axis text {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  fill: var(--color-text-light);
}

.d3-axis line,
.d3-axis path {
  stroke: var(--color-border);
}

.d3-grid line {
  stroke: var(--color-border);
  stroke-dasharray: 4 4;
  opacity: 0.6;
}


/* ──────────────────────────────────────────────────────────────
   10. TOOLTIP
   ────────────────────────────────────────────────────────────── */
.chart-tooltip {
  position: absolute;
  z-index: 100;
  pointer-events: none;
  background: var(--color-bg-dark);
  color: var(--color-text-inv);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  box-shadow: var(--shadow-xl);
  max-width: 220px;
  opacity: 0;
  transition: opacity var(--ease-fast);
}

.chart-tooltip strong {
  display: block;
  font-weight: 700;
  margin-bottom: var(--space-1);
  color: #fff;
}

.chart-tooltip span {
  color: rgba(255,255,255,0.7);
}


/* ──────────────────────────────────────────────────────────────
   11. FOOTER
   ────────────────────────────────────────────────────────────── */
.footer {
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-16);
}

.footer__inner {
  max-width: var(--max-w-full);
  margin-inline: auto;
  padding-inline: var(--space-6);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: var(--space-8);
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer__logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.footer__brand-desc {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  line-height: var(--leading-normal);
  max-width: 280px;
}

.footer__center {
  text-align: center;
}

.footer__partners {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}

.footer__partner-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  opacity: 0.7;
  transition: opacity var(--ease-fast);
}

.footer__partner-logo:hover {
  opacity: 1;
}

.footer__copy {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.footer__credits {
  font-size: var(--text-xs);
  color: var(--color-text-light);
  line-height: var(--leading-normal);
}

.footer__credits a {
  color: var(--color-accent);
}

.footer__methodology {
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-light);
}


/* ──────────────────────────────────────────────────────────────
   12. UTILIDADES Y ANIMACIONES
   ────────────────────────────────────────────────────────────── */

/* ── Visibilidad en scroll ── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.reveal--left {
  transform: translateX(-24px);
}

.reveal--left.is-visible {
  transform: translateX(0);
}

.reveal--right {
  transform: translateX(24px);
}

.reveal--right.is-visible {
  transform: translateX(0);
}

/* ── Keyframes ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1);   }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: translateX(0);     }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0;    }
}

/* ── Divisor decorativo ── */
.divider {
  width: 60px;
  height: 3px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  margin-block: var(--space-6);
}

.divider--center { margin-inline: auto; }
.divider--full   { width: 100%; height: 1px; background: var(--color-border); }

/* ── Separador de sección ── */
.section-sep {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-block: var(--space-16);
  max-width: var(--max-w-full);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section-sep::before,
.section-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.section-sep span {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-light);
  white-space: nowrap;
}

/* ── Progress bar de lectura ── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-border);
  z-index: 1000;
}

.reading-progress__bar {
  height: 100%;
  background: linear-gradient(to right, var(--color-accent), var(--color-accent-2));
  width: 0%;
  transition: width 0.1s linear;
}

/* ── Skip link (accesibilidad) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-accent);
  color: white;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 700;
  z-index: 9999;
  transition: top var(--ease-fast);
}

.skip-link:focus {
  top: var(--space-4);
}


/* ──────────────────────────────────────────────────────────────
   13. RESPONSIVE
   ────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .scrolly {
    grid-template-columns: 1fr;
  }

  .scrolly__figure {
    position: relative;
    top: auto;
    height: 60vw;
    min-height: 300px;
    max-height: 500px;
    margin-bottom: var(--space-8);
  }

  .scrolly--reversed {
    direction: ltr;
  }

  .content-grid--three {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer__inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer__partners {
    justify-content: center;
  }

  .footer__brand-desc {
    max-width: 100%;
  }

  .stats-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --space-24: 4rem;
    --space-20: 3.5rem;
    --space-16: 3rem;
  }

  .container {
    padding-inline: var(--space-3);
  }

  .scrolly {
    padding-block: var(--space-8);
  }

  .scrolly__step {
    min-height: auto;
    padding-block: var(--space-6);
  }

  .scrolly__steps {
    padding-bottom: 20vh;
  }

  .content-grid--two,
  .content-grid--three {
    grid-template-columns: 1fr;
  }

  .stats-grid--3,
  .stats-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .pullquote {
    padding: var(--space-8) var(--space-6);
  }

  .pullquote::before {
    font-size: 5rem;
  }

  .figure--wide {
    margin-inline: calc(-1 * var(--space-6));
  }

  .article-body p {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .stats-grid--2,
  .stats-grid--3,
  .stats-grid--4 {
    grid-template-columns: 1fr;
  }

  .hero__meta {
    gap: var(--space-2);
  }

  .chart-card__header,
  .chart-card__body {
    padding-inline: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  .scrolly__step {
    opacity: 1;
    transform: none;
  }
}
