/* ============================================================
   Web educativa: Piura ante El Niño costero 2017 y 2023 — v3
   Fuentes más grandes, colores combinados, tablas dinámicas
   ============================================================ */

:root {
  --bg: #f7f4ee;
  --bg-alt: #efe9de;
  --surface: #ffffff;
  --text: #33383d;
  --text-soft: #5f665c;
  --line: #ddd5c7;
  --blue: #2b6ca8;          /* azul más vivo */
  --blue-dark: #1c4568;
  --celeste: #9ed4f5;       /* números 2017 sobre fondo oscuro */
  --plomo: #e8e4da;         /* números 2023 sobre fondo oscuro */
  --ochre: #c98843;
  --alert: #c0452f;
  --y2017: #2b6ca8;
  --y2023: #c98843;
  --shadow: 0 8px 26px rgba(60, 56, 48, 0.10);
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 17.5px;                 /* fuente base más grande */
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); }
.container { max-width: 1240px; margin: 0 auto; padding: 0 28px; }
.container.narrow { max-width: 960px; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: var(--blue-dark);
  box-shadow: 0 2px 14px rgba(0,0,0,0.18);
}
.nav-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand-logo {
  height: 46px; width: auto;             /* logo blanco sobre el azul del menú */
}
.brand-text { color: #fff; font-weight: 600; font-size: 1.05rem; }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none; color: #eef3f8;
  font-size: 1rem; padding: 9px 13px; border-radius: 9px;
  transition: background 0.2s, color 0.2s;
}
.nav-links a:hover { background: rgba(255,255,255,0.16); color: #fff; }
.nav-toggle {
  display: none; background: rgba(255,255,255,0.14); color: #fff;
  border: none; border-radius: 9px; font-size: 1.3rem; padding: 5px 12px; cursor: pointer;
}

/* ---------- Hero limpio ---------- */
.hero {
  background:
    radial-gradient(1000px 420px at 85% -10%, rgba(43, 108, 168, 0.14), transparent 60%),
    radial-gradient(900px 400px at 8% 110%, rgba(201, 136, 67, 0.14), transparent 60%),
    var(--bg);
  padding: 64px 28px 60px;
  text-align: center;
}
.hero-logo { height: 110px; width: auto; margin: 0 auto 26px; }   /* logo grande */
.hero-kicker {
  text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 0.95rem; color: var(--text-soft); margin-bottom: 16px; font-weight: 600;
}
.hero h1 {
  font-size: clamp(1.9rem, 3.8vw, 3rem);
  line-height: 1.22; max-width: 1000px; margin: 0 auto 20px;
  color: var(--blue-dark);
}
.hero h1 .hl { color: var(--ochre); }
.hero-sub { max-width: 760px; margin: 0 auto 30px; color: var(--text-soft); font-size: 1.2rem; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block; text-decoration: none; font-weight: 700;
  padding: 14px 26px; border-radius: 12px; border: 2px solid transparent;
  cursor: pointer; font-size: 1.05rem; transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--blue-dark); border-color: var(--blue); }
.btn-ghost:hover { background: rgba(43, 108, 168, 0.10); }
.btn-light { background: #fff; color: var(--blue-dark); }
.btn-light:hover { box-shadow: 0 8px 22px rgba(0,0,0,0.25); }
.btn-sm { padding: 10px 18px; font-size: 0.98rem; }
.btn-excel {
  background: #1d7a4f; color: #fff; font-size: 0.95rem; padding: 10px 18px;
  flex: 0 0 auto;
}
.btn-excel:hover { background: #15603d; box-shadow: var(--shadow); }

/* ---------- Banda de alerta (clara, texto legible) ---------- */
.alert-band {
  background: #fdf1dc;                    /* arena cálida */
  border-top: 3px solid var(--ochre);
  border-bottom: 3px solid var(--ochre);
  color: #4a3520;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 18px 28px; text-align: center;
}
.alert-band p { font-size: 1.1rem; max-width: 1000px; margin: 0; }
.alert-dot {
  flex: 0 0 auto; width: 14px; height: 14px; border-radius: 50%;
  background: var(--alert); animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(192, 69, 47, 0.55); }
  70% { box-shadow: 0 0 0 14px rgba(192, 69, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 69, 47, 0); }
}

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section-dark {
  background:
    radial-gradient(900px 400px at 90% 0%, rgba(201, 136, 67, 0.20), transparent 60%),
    var(--blue-dark);
  color: #f0f4f8;
}
.section h2 { font-size: 2.3rem; color: var(--blue-dark); margin-bottom: 14px; }
.section-dark h2 { color: #fff; }
.section-lead { color: var(--text-soft); max-width: 860px; margin-bottom: 34px; font-size: 1.12rem; }
.section-lead.light { color: rgba(240,244,248,0.85); }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.9rem;
  font-weight: 800; color: var(--ochre); margin-bottom: 8px;
}
.eyebrow.light { color: #f2c17e; }
.footnote { font-size: 1rem; color: var(--text-soft); margin-top: 24px; }
.footnote.light { color: rgba(240,244,248,0.75); }

/* ---------- Mapa ---------- */
.map-card {
  display: grid; grid-template-columns: 1.6fr 1fr;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
#map { min-height: 460px; z-index: 1; }
.map-side { padding: 28px; display: flex; flex-direction: column; gap: 20px; justify-content: center; }
.map-point { display: flex; gap: 14px; align-items: flex-start; }
.map-point strong { font-size: 1.15rem; color: var(--blue-dark); }
.map-point p { font-size: 1rem; color: var(--text-soft); margin-top: 3px; }
.mp-num {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  color: #fff; font-weight: 800; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.leaflet-popup-content { font-family: inherit; font-size: 1rem; }
.pulse-marker {
  width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 0 rgba(192, 69, 47, 0.55);
  animation: pulse 1.6s infinite;
}

/* ---------- Versus cards (números celeste y plomo) ---------- */
.versus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.versus-card {
  background: #ffffff;
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow);
  border-top: 6px solid var(--ochre);
  color: var(--text);
  transition: transform 0.2s;
}
.versus-card:hover { transform: translateY(-4px); }
.versus-card h3 { font-size: 1.12rem; margin-bottom: 16px; color: var(--blue-dark); }
.versus-row {
  display: flex; align-items: center; gap: 14px; margin-bottom: 10px;
  border-radius: 12px; padding: 8px 12px;
}
.versus-row:has(.y2017) { background: #e8f3fc; }   /* celeste suave */
.versus-row:has(.y2023) { background: #f4f1ea; }   /* plomo cálido */
.v-year {
  font-size: 0.9rem; font-weight: 800; color: #fff;
  padding: 4px 12px; border-radius: 999px; min-width: 56px; text-align: center;
}
.v-year.y2017 { background: var(--y2017); }
.v-year.y2023 { background: var(--y2023); }
.v-num { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.v-num.n2017 { color: #1a5d96; }                    /* azul-celeste intenso */
.v-num.n2023 { color: #6e675a; }                    /* plomo */
.v-src { font-size: 0.92rem; color: var(--text-soft); margin-top: 12px; font-style: italic; }

/* ---------- Charts ---------- */
.chart-controls { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.chip {
  border: 2px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 10px 22px; font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { border-color: var(--blue); }
.chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 24px; }
.chart-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.chart-card h3 { font-size: 1.2rem; color: var(--blue-dark); margin-bottom: 16px; }
.chart-wrap { position: relative; height: 300px; }
.chart-wrap.small { height: 210px; }
.chart-caption { font-size: 0.95rem; color: var(--text-soft); margin-top: 16px; margin-bottom: 0; }

/* ---------- Featured study ---------- */
.featured {
  margin-top: 38px; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
  background: linear-gradient(120deg, #1c4568, #2b6ca8);
  color: #eef3f8;
}
.featured-body { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; padding: 34px 30px; align-items: center; }
.featured-badge {
  display: inline-block; background: #f2c17e; color: #1c4568;
  font-weight: 800; font-size: 0.9rem; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 6px 14px; border-radius: 999px; margin-bottom: 16px;
}
.featured-text h3 { font-size: 1.55rem; margin-bottom: 10px; }
.featured-ref { font-size: 1rem; opacity: 0.85; margin-bottom: 20px; }
.featured-stats { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.fstat { display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,0.10); border-radius: 12px; padding: 14px 18px; }
.fstat strong { font-size: 1.4rem; color: #f2c17e; min-width: 96px; }
.fstat span { font-size: 1rem; }
.featured-img img { border-radius: 12px; width: 100%; height: 260px; object-fit: cover; }
.featured-img .chart-caption { color: rgba(238,243,248,0.75); }
.featured-img .chart-caption a { color: #f2c17e; }

/* ---------- Topic cards ---------- */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; }
.topic-card {
  position: relative; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 26px 24px; box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.25s;
}
.topic-card:hover { transform: translateY(-5px); box-shadow: 0 14px 34px rgba(60,56,48,0.16); }
.topic-num {
  position: absolute; top: -16px; left: 22px;
  background: var(--blue); color: #fff; font-weight: 800;
  font-size: 1rem; padding: 7px 14px; border-radius: 11px;
  box-shadow: var(--shadow);
}
.topic-card h3 { color: var(--blue-dark); margin: 10px 0 14px; font-size: 1.3rem; }
.topic-card ul { margin-left: 20px; }
.topic-card li { margin-bottom: 10px; font-size: 1.03rem; }
.topic-note {
  margin-top: 16px; font-size: 0.98rem; color: var(--text-soft);
  border-top: 2px dashed var(--line); padding-top: 14px; font-style: italic;
}
.topic-card .mini-chart-box { margin-top: 16px; border-top: 2px dashed var(--line); padding-top: 16px; }
.topic-conclusion { background: linear-gradient(135deg, #fff, #f9f0e0); border: 2px solid var(--ochre); }
.topic-conclusion .topic-num { background: var(--ochre); }
.topic-conclusion p { font-size: 1.05rem; }
.topic-question { margin-top: 16px; font-weight: 800; color: var(--ochre); font-size: 1.1rem; }

/* ---------- Tables (más color + exportar) ---------- */
.table-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.table-head-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.table-card h3 { font-size: 1.2rem; color: var(--blue-dark); }
.table-scroll { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 1.03rem; }
th, td { padding: 14px 18px; text-align: left; vertical-align: top; }
thead th {
  background: linear-gradient(90deg, var(--blue-dark), var(--blue));
  color: #fff; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em;
}
tbody tr:nth-child(odd) { background: #fbf9f4; }
tbody tr:nth-child(even) { background: #f1ece2; }
tbody tr:hover { background: #e4eef8; }
tbody td { border-bottom: 1px solid var(--line); }

/* Columnas de año coloreadas en Tabla 1 */
#tabla1 thead th.col-2017 { background: #1a5d96; }
#tabla1 thead th.col-2023 { background: #a86a2c; }
#tabla1 td.col-2017 { background: #e2f0fc; font-weight: 700; color: #174e80; }
#tabla1 td.col-2023 { background: #f7ecdc; font-weight: 700; color: #7d5018; }
#tabla1 tbody tr:hover td.col-2017 { background: #cfe6fa; }
#tabla1 tbody tr:hover td.col-2023 { background: #f3e2c8; }

/* Tipos de vulnerabilidad en Tabla 2 */
#tabla2 td.tipo-fisica {
  background: #e2f0fc; color: #174e80; font-weight: 800; white-space: nowrap;
}
#tabla2 td.tipo-socio {
  background: #f7ecdc; color: #7d5018; font-weight: 800; white-space: nowrap;
}

/* ---------- Gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 24px; }
.gallery figure {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.gallery figure:hover { transform: translateY(-4px); }
.gallery img { width: 100%; height: 280px; object-fit: cover; }
.gallery figcaption { padding: 16px 20px; font-size: 0.98rem; color: var(--text); }
.gallery figcaption em { color: var(--text-soft); font-size: 0.9rem; }

/* ---------- Opinions ---------- */
.opinion-form {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-size: 1.02rem; font-weight: 700; margin-bottom: 8px; color: var(--blue-dark); }
.form-row input, .form-row textarea {
  width: 100%; border: 2px solid var(--line); border-radius: 12px;
  padding: 13px 16px; font-size: 1.05rem; font-family: inherit;
  background: var(--bg); color: var(--text); resize: vertical;
}
.form-row input:focus, .form-row textarea:focus {
  outline: 3px solid rgba(43, 108, 168, 0.3); border-color: var(--blue);
}
.op-count { margin-left: 16px; font-size: 0.98rem; color: var(--text-soft); }
.opinion-list { display: flex; flex-direction: column; gap: 16px; }
.opinion-item {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 6px solid var(--ochre);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 22px; box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease;
}
.opinion-item .op-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.opinion-item .op-name { font-weight: 800; color: var(--blue-dark); font-size: 1.05rem; }
.opinion-item .op-date { font-size: 0.9rem; color: var(--text-soft); }
.opinion-item .op-text { font-size: 1.03rem; }
.opinion-item .op-del {
  background: none; border: none; color: var(--text-soft); cursor: pointer;
  font-size: 0.9rem; text-decoration: underline; padding: 0;
}
.opinion-item .op-del:hover { color: #a33; }
.opinion-empty { color: var(--text-soft); font-size: 1rem; font-style: italic; }

/* ---------- References ---------- */
.refs { margin-left: 24px; }
.refs li { margin-bottom: 14px; font-size: 1rem; overflow-wrap: anywhere; }
.refs li.ref-hl {
  background: #f7ecdc;
  border: 2px solid var(--ochre);
  border-radius: 12px; padding: 14px 18px; list-style-position: inside; margin-left: -24px;
}

/* ---------- Footer ---------- */
.footer { background: var(--blue-dark); color: #e3eaf1; padding: 44px 0; }
.footer-inner { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.footer-logo { height: 58px; width: auto; }
.footer p { font-size: 1rem; margin-bottom: 5px; }
.footer-note { opacity: 0.75; font-size: 0.9rem; }

/* ---------- Animations ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  body { font-size: 16.5px; }
  .map-card { grid-template-columns: 1fr; }
  #map { min-height: 340px; }
  .featured-body { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .brand-text { display: none; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; background: var(--blue-dark); padding: 10px 18px;
  }
  .nav-links.open { display: flex; }
  .section { padding: 48px 0; }
  .chart-wrap { height: 260px; }
  .hero-logo { height: 84px; }
  .v-num { font-size: 1.7rem; }
}

/* ============================================================
   CARRUSEL DE LA PORTADA (imágenes con transición y movimiento)
   ============================================================ */
.hero-slider {
  position: relative; overflow: hidden;
  min-height: 680px; padding: 56px 28px 170px;   /* espacio inferior reservado para el pie de foto */
  display: flex; align-items: center; justify-content: center;
  background: #0f2236;
}
.slides { position: absolute; inset: 0; }
.slide {
  position: absolute; inset: 0; margin: 0;
  opacity: 0; transition: opacity 1.4s ease-in-out;
}
.slide.active { opacity: 1; z-index: 1; }
/* Fondo difuminado de la misma imagen (rellena los bordes de los mapas) */
.slide-bg {
  position: absolute; inset: -40px;
  background-position: center; background-size: cover; background-repeat: no-repeat;
  filter: blur(26px) brightness(0.55); transform: scale(1.1);
}
.slide img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scale(1);
}
.slide.fit-contain img { object-fit: contain; padding: 20px 0 120px; }
/* Movimiento lento tipo "Ken Burns" mientras la imagen está activa */
.slide.active img { animation: kenburns 7.5s ease-out forwards; }
.slide.fit-contain.active img { animation: kenburns-soft 7.5s ease-out forwards; }
@keyframes kenburns {
  from { transform: scale(1.0) translate(0, 0); }
  to   { transform: scale(1.05) translate(-1%, -0.6%); }
}
@keyframes kenburns-soft {
  from { transform: scale(1.0); }
  to   { transform: scale(1.03); }
}
.hero-shade { display: none; }
/* Velo oscuro dentro de cada imagen (deja la foto visible y el texto legible) */
.slide::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 50% 48%, rgba(12, 30, 48, 0.62), rgba(12, 30, 48, 0.25) 75%),
    linear-gradient(180deg, rgba(12, 30, 48, 0.35) 0%, rgba(12, 30, 48, 0.15) 45%, rgba(12, 30, 48, 0.75) 100%);
}
.hero-slider .hero-content { position: relative; z-index: 3; }
.hero-slider .hero-kicker { color: #f2c17e; }
.hero-slider h1 { color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.5), 0 4px 24px rgba(0,0,0,0.55); }
.hero-slider .hero-kicker, .hero-slider .hero-sub { text-shadow: 0 1px 8px rgba(0,0,0,0.6); }
.hero-slider h1 .hl { color: #f2c17e; }
.hero-slider .hero-sub { color: rgba(255,255,255,0.9); }
.hero-slider .btn-ghost { color: #fff; border-color: #fff; }
.hero-slider .btn-ghost:hover { background: rgba(255,255,255,0.15); }

/* Pie de foto con cita (abajo a la izquierda) */
.slide figcaption {
  position: absolute; z-index: 2; left: 28px; bottom: 30px;
  max-width: min(560px, calc(100% - 260px));
  background: rgba(10, 24, 38, 0.72); backdrop-filter: blur(4px);
  color: #fff; border-left: 4px solid var(--ochre);
  padding: 10px 16px; border-radius: 0 10px 10px 0;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.7s ease 0.6s, transform 0.7s ease 0.6s;
}
.slide.active figcaption { opacity: 1; transform: none; }
.slide-cap { display: block; font-size: 0.95rem; line-height: 1.45; }
.slide-src { display: block; font-size: 0.82rem; color: #f2c17e; margin-top: 4px; font-style: italic; }
.slide-src em { font-style: normal; }

/* Flechas, puntos y barra de progreso */
.slide-arrow {
  position: absolute; z-index: 5; top: 50%; transform: translateY(-50%);
  width: 50px; height: 50px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.7);
  background: rgba(10, 24, 38, 0.35); color: #fff; font-size: 2rem; line-height: 1;
  cursor: pointer; transition: background 0.2s;
}
.slide-arrow:hover { background: rgba(10, 24, 38, 0.7); }
.slide-arrow.prev { left: 18px; }
.slide-arrow.next { right: 18px; }
.slide-dots {
  position: absolute; z-index: 5; right: 28px; bottom: 36px;
  display: flex; gap: 9px;
}
.slide-dots button {
  width: 12px; height: 12px; border-radius: 999px; border: 2px solid #fff;
  background: transparent; cursor: pointer; padding: 0; transition: all 0.3s;
}
.slide-dots button.active { background: #f2c17e; border-color: #f2c17e; width: 30px; }
.slide-progress { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,0.15); }
.slide-progress span { display: block; height: 100%; width: 0; background: var(--ochre); }

@media (max-width: 900px) {
  .hero-slider { min-height: 620px; padding: 44px 22px 200px; }
  .slide-arrow { display: none; }
  .slide figcaption { left: 14px; right: 14px; max-width: none; bottom: 46px; }
  .slide-dots { right: auto; left: 50%; transform: translateX(-50%); bottom: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .slide.active img { animation: none; }
}

/* ============================================================
   GRÁFICOS Y TABLAS: ajustes
   ============================================================ */
.indicator-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.indicator-tabs button {
  border: 2px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: 6px 14px; font-size: 0.92rem; font-weight: 600; cursor: pointer;
}
.indicator-tabs button.active { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.chart-delta { font-size: 0.98rem; margin-top: 10px; font-weight: 700; }
.chart-delta .up { color: #b03a26; }
.chart-delta .down { color: #1d7a4f; }
td.var-up { color: #b03a26; font-weight: 800; white-space: nowrap; }
td.var-down { color: #1d7a4f; font-weight: 800; white-space: nowrap; }
td.var-na { color: var(--text-soft); }
.table-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.table-filter button {
  border: 2px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 16px; font-size: 0.95rem; font-weight: 600; cursor: pointer; color: var(--text);
}
.table-filter button.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.table-filter button[data-tipo="Física"].active { background: #1a5d96; border-color: #1a5d96; }
.table-filter button[data-tipo="Socioeconómica"].active { background: #a86a2c; border-color: #a86a2c; }

/* ============================================================
   v8 — ESTILO SOBRIO INSTITUCIONAL
   Blanco · azul de la universidad · marino · arena suave
   Tipografía: Libre Franklin (títulos) + DM Sans (texto)
   ============================================================ */
:root {
  --navy: #073b6f;
  --navy-deep: #061f35;
  --ink: #102b3f;
  --blue: #0d578d;          /* azul institucional */
  --sky: #6aaee0;           /* celeste (datos 2023) */
  --sky-light: #9fd0f5;     /* acentos sobre fondo oscuro */
  --mist: #eef3f7;
  --sand: #f4f0e8;
  --line: #d8e0e5;
  --text: #2c3e4f;
  --text-soft: #5b6b78;
  --y2017: #0d578d;
  --y2023: #6aaee0;
  --ochre: #0d578d;         /* antiguo acento ocre → azul */
  --shadow: 0 10px 30px rgba(7, 59, 111, 0.08);
  --radius: 14px;
}

body {
  font-family: "DM Sans", "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  background: #ffffff;
  color: var(--text);
}
h1, h2, h3, .brand-text, .v-num, .fstat strong, .topic-num {
  font-family: "Libre Franklin", "Segoe UI", Arial, sans-serif;
}
h1, h2 { letter-spacing: -0.02em; }
a { color: var(--blue); }

/* ---------- Menú ---------- */
.navbar { background: var(--navy); box-shadow: 0 2px 16px rgba(6, 31, 53, 0.25); }
.nav-links a { font-weight: 500; }
.nav-links a:hover { background: rgba(255,255,255,0.12); }

/* ---------- Portada ---------- */
.slide img { filter: saturate(1.15) contrast(1.04); }
.slide::after {
  background:
    linear-gradient(90deg, rgba(6, 31, 53, 0.55), rgba(6, 31, 53, 0.25) 50%, rgba(6, 31, 53, 0.55)),
    linear-gradient(180deg, rgba(7, 59, 111, 0.35) 0%, rgba(7, 59, 111, 0.15) 45%, rgba(6, 31, 53, 0.80) 100%);
}
.hero-slider { min-height: 640px; padding-top: 40px; }
.hero-slider h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.5rem); font-weight: 800; line-height: 1.1;
  margin-bottom: 34px; text-shadow: 0 2px 18px rgba(0,0,0,0.35);
}
.hero-slider h1 .hl { color: var(--sky-light); }
.hero-slider .btn-primary { background: #fff; color: var(--navy); }
.hero-slider .btn-primary:hover { background: var(--mist); box-shadow: 0 10px 26px rgba(0,0,0,0.25); }
.hero-slider .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.85); }
.slide figcaption { border-left-color: var(--sky-light); background: rgba(6, 31, 53, 0.72); }
.slide-src { color: var(--sky-light); }
.slide-dots button.active { background: #fff; border-color: #fff; }
.slide-progress span { background: var(--sky-light); }

/* ---------- Botones ---------- */
.btn { font-family: "DM Sans", sans-serif; border-radius: 10px; }
.btn-primary { background: var(--blue); }
.btn-primary:hover { background: var(--navy); }
.btn-ghost { color: var(--navy); border-color: var(--navy); }
.btn-excel { background: #fff; color: var(--blue); border: 2px solid var(--blue); }
.btn-excel:hover { background: var(--blue); color: #fff; }
.chip { border-color: var(--line); }
.chip:hover { border-color: var(--blue); }
.chip.active { background: var(--navy); border-color: var(--navy); }

/* ---------- Banda de alerta ---------- */
.alert-band {
  background: var(--mist); color: var(--ink);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.alert-band strong { color: var(--navy); }

/* ---------- Secciones ---------- */
.section-alt { background: var(--sand); }
.section h2 { color: var(--navy); font-weight: 800; font-size: clamp(1.9rem, 3.4vw, 2.6rem); line-height: 1.12; }
.eyebrow { color: var(--blue); font-weight: 700; letter-spacing: 0.16em; font-size: 0.8rem; }
.eyebrow::before {
  content: ""; display: block; width: 44px; height: 3px; background: currentColor;
  margin-bottom: 12px; border-radius: 2px;
}
.section-lead { color: var(--text-soft); }

/* Sección oscura (cifras): marino con foto muy difuminada detrás, letras blancas */
.section-dark {
  position: relative;
  background:
    linear-gradient(rgba(7, 59, 111, 0.92), rgba(6, 31, 53, 0.94)),
    url("../assets/fondo-difuminado.jpg") center / cover no-repeat;
  color: #fff;
}
.section-dark h2 { color: #fff; }
.eyebrow.light { color: var(--sky-light); }
.section-lead.light, .footnote.light { color: rgba(255,255,255,0.82); }

/* ---------- Tarjetas (todas iguales: blancas con línea azul arriba) ---------- */
.map-card, .chart-card, .table-card, .opinion-form, .topic-card, .gallery figure, .versus-card {
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.chart-card, .table-card, .opinion-form, .topic-card, .gallery figure, .map-card { border-top: 4px solid var(--blue); }
.versus-card { border-top: 4px solid var(--sky-light); }
.versus-card h3 { color: var(--navy); }
.versus-row:has(.y2017) { background: #e7f0f8; }
.versus-row:has(.y2023) { background: #f1f7fc; }
.v-num.n2017 { color: var(--blue); }
.v-num.n2023 { color: #3f86bf; }
.v-year.y2023 { background: var(--sky); }

.map-point strong, .chart-card h3, .table-card h3, .topic-card h3 { color: var(--navy); }
.mp-num { font-family: "Libre Franklin", sans-serif; }

/* Subtemas */
.topic-num { background: var(--navy); border-radius: 8px; }
.topic-note { border-top-color: var(--line); }
.topic-card .mini-chart-box { border-top-color: var(--line); }
.topic-conclusion {
  background: var(--navy); border: 1px solid var(--navy); border-top: 4px solid var(--sky-light); color: #fff;
}
.topic-conclusion h3 { color: #fff; }
.topic-conclusion .topic-num { background: var(--sky-light); color: var(--navy); }
.topic-conclusion p { color: rgba(255,255,255,0.9); }
.topic-question { color: var(--sky-light); }

/* Estudio destacado */
.featured { background: var(--navy); }
.featured-badge { background: var(--sky-light); color: var(--navy); }
.fstat strong { color: var(--sky-light); }
.featured-img .chart-caption a { color: var(--sky-light); }

/* Gráficos: pestañas */
.indicator-tabs button { background: #fff; border-color: var(--line); }
.indicator-tabs button.active { background: var(--navy); border-color: var(--navy); }
.chart-delta .up { color: #b03a26; }
.chart-delta .down { color: var(--blue); }

/* Tablas */
thead th { background: var(--navy); font-family: "DM Sans", sans-serif; font-weight: 700; }
tbody tr:nth-child(odd) { background: #ffffff; }
tbody tr:nth-child(even) { background: #f6f8fa; }
tbody tr:hover { background: var(--mist); }
#tabla1 thead th.col-2017 { background: var(--blue); }
#tabla1 thead th.col-2023 { background: #3f86bf; }
#tabla1 td.col-2017 { background: #e7f0f8; color: var(--navy); }
#tabla1 td.col-2023 { background: #f1f7fc; color: #2f6f9f; }
#tabla1 tbody tr:hover td.col-2017 { background: #d9e8f4; }
#tabla1 tbody tr:hover td.col-2023 { background: #e4f0fa; }
td.var-up { color: #b03a26; }
td.var-down { color: var(--blue); }
#tabla2 td.tipo-fisica { background: #e7f0f8; color: var(--navy); }
#tabla2 td.tipo-socio { background: var(--sand); color: #5b4a33; }
.table-filter button { border-color: var(--line); }
.table-filter button.active,
.table-filter button[data-tipo="Física"].active,
.table-filter button[data-tipo="Socioeconómica"].active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Galería, opiniones, referencias */
.gallery figcaption em { color: var(--text-soft); }
.opinion-item { border-left-color: var(--blue); }
.form-row label { color: var(--navy); }
.refs li.ref-hl { background: var(--mist); border-color: var(--blue); }

/* Pie de página */
.footer { background: var(--navy-deep); }

/* ============================================================
   v9 — Encabezado y portada estilo "Charter", alerta animada,
   imágenes por sección y carrusel de figuras
   ============================================================ */
:root {
  --y2017: #e0612f;          /* naranja rojizo: destaca 2017 */
  --y2023: #0d578d;          /* azul institucional: 2023 */
  --plomo: #e9eef3;
  --alert-red: #d7261e;
}
html { scroll-padding-top: 86px; }

/* ---------- Encabezado transparente sobre la portada ---------- */
.navbar.overlay {
  position: fixed; left: 0; right: 0; top: 0;
  background: linear-gradient(180deg, rgba(4, 20, 38, 0.75), rgba(4, 20, 38, 0));
  box-shadow: none; transition: background 0.35s, box-shadow 0.35s, padding 0.35s;
}
.navbar.overlay .nav-inner { max-width: 1320px; padding: 22px 32px; transition: padding 0.35s; }
.navbar.overlay .brand-logo { height: 62px; transition: height 0.35s; }
.navbar.overlay .nav-links { gap: 6px; }
.navbar.overlay .nav-links a {
  font-family: "Roboto", "DM Sans", sans-serif; font-size: 1.08rem; font-weight: 400;
  color: #fff; background: none; border-radius: 0; padding: 8px 12px; position: relative;
}
.navbar.overlay .nav-links a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
  background: #fff; transform: scaleX(0); transform-origin: left; transition: transform 0.25s;
}
.navbar.overlay .nav-links a:hover { background: none; box-shadow: none; }
.navbar.overlay .nav-links a:hover::after, .navbar.overlay .nav-links a.active::after { transform: scaleX(1); }
.navbar.overlay.scrolled { background: rgba(7, 59, 111, 0.97); box-shadow: 0 2px 18px rgba(6, 31, 53, 0.3); }
.navbar.overlay.scrolled .nav-inner { padding-top: 10px; padding-bottom: 10px; }
.navbar.overlay.scrolled .brand-logo { height: 42px; }

/* ---------- Portada ---------- */
.hero-slider {
  min-height: 100vh; padding: 150px 32px 150px;
  justify-content: flex-start; align-items: center; text-align: left;
}
.hero-slider .hero-content {
  max-width: 1020px; width: 100%;
  margin-left: max(0px, calc((100vw - 1320px) / 2));
}
.hero-rule { display: block; width: 4px; height: 54px; background: #fff; margin-bottom: 22px; border-radius: 2px; opacity: 0.9; }
.hero-slider h1 {
  font-family: "Roboto", "DM Sans", sans-serif; font-weight: 400;
  font-size: clamp(2.3rem, 4.8vw, 4.1rem); line-height: 1.16; letter-spacing: -0.005em;
  margin: 0 0 34px; max-width: 1000px; text-shadow: 0 2px 22px rgba(0,0,0,0.35);
}
.hero-slider h1 .hl { color: #fff; font-weight: 700; }
.hero-slider .hero-actions { justify-content: flex-start; }
.slide::after {
  background:
    linear-gradient(90deg, rgba(4, 20, 38, 0.86) 0%, rgba(4, 20, 38, 0.60) 42%, rgba(4, 20, 38, 0.18) 100%),
    linear-gradient(180deg, rgba(4, 20, 38, 0.10) 60%, rgba(4, 20, 38, 0.65) 100%);
}
/* Pie de foto (fuente): gris translúcido, a la derecha */
.slide figcaption {
  left: auto; right: 32px; bottom: 34px; text-align: right;
  max-width: min(520px, calc(100% - 64px));
  background: linear-gradient(90deg, rgba(60, 64, 70, 0.25), rgba(60, 64, 70, 0.72));
  backdrop-filter: blur(6px);
  border-left: none; border-right: 3px solid rgba(255,255,255,0.55);
  border-radius: 10px 0 0 10px; color: #eceef0;
}
.slide-src { color: #c3c9cf; }
.slide-dots { right: auto; left: max(32px, calc((100vw - 1320px) / 2 + 32px)); bottom: 46px; }
.slide-arrow { border-color: rgba(255,255,255,0.45); background: rgba(255,255,255,0.08); }
@media (max-width: 900px) {
  .navbar.overlay .nav-inner { padding: 14px 18px; }
  .navbar.overlay .brand-logo { height: 46px; }
  .navbar.overlay .nav-links { background: rgba(7, 59, 111, 0.98); }
  .navbar.overlay .nav-links a::after { display: none; }
  .hero-slider { padding: 120px 22px 190px; min-height: 92vh; }
  .slide figcaption { right: 14px; left: 14px; max-width: none; bottom: 54px; text-align: left; }
  .slide-dots { left: 50%; transform: translateX(-50%); bottom: 22px; }
}

/* ---------- Alerta en el mapa ---------- */
.alert-title { display: flex; align-items: center; gap: 16px; }
.alert-chip { position: relative; width: 22px; height: 22px; flex: 0 0 auto; }
.alert-chip .ac-dot { position: absolute; inset: 3px; border-radius: 50%; background: var(--alert-red); }
.alert-chip::before, .alert-chip::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--alert-red); animation: ripple 1.8s ease-out infinite;
}
.alert-chip::after { animation-delay: 0.9s; }
@keyframes ripple { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(2.6); opacity: 0; } }

.map-wrap { position: relative; min-height: 460px; }
.map-wrap #map { position: absolute; inset: 0; min-height: 0; }
.alert-overlay {
  position: absolute; inset: 0; z-index: 650; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle at 50% 48%, rgba(215, 38, 30, 0.18), rgba(6, 31, 53, 0.62) 70%);
  opacity: 0;
}
.map-card.alerting .alert-overlay { animation: alertShow 3.4s ease forwards; }
@keyframes alertShow { 0% { opacity: 0; } 10% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; } }
.alert-burst { position: relative; width: 150px; height: 150px; display: grid; place-items: center; }
.alert-svg { width: 150px; height: 150px; position: relative; z-index: 2; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.35)); }
.map-card.alerting .alert-svg { animation: pop 0.7s cubic-bezier(.2,1.6,.4,1) both, shake 0.5s 0.8s ease-in-out 2; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.alert-svg .wv { animation: blink 0.9s ease-in-out infinite; }
.alert-svg .w2 { animation-delay: 0.3s; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
.alert-burst .ring {
  position: absolute; inset: 20px; border-radius: 50%;
  border: 4px solid rgba(255, 96, 48, 0.85); opacity: 0;
}
.map-card.alerting .alert-burst .ring { animation: wave 1.6s ease-out infinite; }
.map-card.alerting .alert-burst .r2 { animation-delay: 0.5s; }
.map-card.alerting .alert-burst .r3 { animation-delay: 1s; }
@keyframes wave { from { transform: scale(0.5); opacity: 0.95; } to { transform: scale(3.2); opacity: 0; } }
.alert-label {
  background: var(--alert-red); color: #fff; font-weight: 800; letter-spacing: 0.08em;
  font-size: 0.95rem; padding: 8px 18px; border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}
/* Insignia que queda después de la alerta */
.map-wrap::before {
  content: "● ALERTA"; position: absolute; z-index: 640; top: 14px; right: 14px;
  background: var(--alert-red); color: #fff; font: 800 0.8rem "DM Sans", sans-serif; letter-spacing: 0.08em;
  padding: 6px 12px; border-radius: 999px; opacity: 0; transition: opacity 0.6s;
  box-shadow: 0 0 0 0 rgba(215, 38, 30, 0.6);
}
.map-card.alerted .map-wrap::before { opacity: 1; animation: badgePulse 1.8s infinite; }
@keyframes badgePulse { 0% { box-shadow: 0 0 0 0 rgba(215,38,30,0.55); } 70% { box-shadow: 0 0 0 14px rgba(215,38,30,0); } 100% { box-shadow: 0 0 0 0 rgba(215,38,30,0); } }

/* Franja de fotos bajo el mapa */
.photo-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; margin-top: 26px; }
.photo { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.photo img { width: 100%; height: 210px; object-fit: cover; transition: transform 0.5s; }
.photo:hover img { transform: scale(1.04); }
.photo figcaption { padding: 12px 16px 14px; font-size: 0.92rem; color: var(--text); }
.credit, .vc-img figcaption, .cc-img figcaption, .topic-img figcaption { display: block; font-size: 0.78rem; color: #7a8792; margin-top: 4px; }
.credit a, .vc-img figcaption a, .cc-img figcaption a, .topic-img figcaption a { color: #5b6b78; }

/* ---------- Cifras: 2017 en naranja, tarjetas alternas plomo/blanco ---------- */
.v-year.y2017 { background: var(--y2017); }
.v-year.y2023 { background: var(--y2023); }
.v-num.n2017 { color: #c94d1f; }
.v-num.n2023 { color: var(--y2023); }
.versus-row:has(.y2017) { background: #fdeee6; }
.versus-row:has(.y2023) { background: #e6eff7; }
.versus-card { padding: 0 0 20px; overflow: hidden; border-top: none; }
.versus-card > h3, .versus-card > .versus-row, .versus-card > .v-src { margin-left: 20px; margin-right: 20px; }
.versus-card:nth-child(odd) { background: #ffffff; }
.versus-card:nth-child(even) { background: var(--plomo); }
.versus-card:nth-child(even) .versus-row:has(.y2017) { background: #fff4ee; }
.versus-card:nth-child(even) .versus-row:has(.y2023) { background: #f4f8fb; }
.vc-img { margin: 0 0 14px; position: relative; }
.vc-img img { width: 100%; height: 150px; object-fit: cover; }
.vc-img figcaption { padding: 6px 20px 0; }
.versus-card h3 { margin-top: 4px; }

/* ---------- Imágenes en tarjetas de gráficos y subtemas ---------- */
.cc-img { margin: 0 0 16px; }
.cc-img img { width: 100%; height: 150px; object-fit: cover; border-radius: 10px; }
.topic-img { margin: 16px 0 0; }
.topic-img img { width: 100%; height: 190px; object-fit: cover; border-radius: 10px; }

/* Datos: tabla 1 con 2017 naranja */
#tabla1 thead th.col-2017 { background: #c94d1f; }
#tabla1 thead th.col-2023 { background: var(--y2023); }
#tabla1 td.col-2017 { background: #fdeee6; color: #9e3b14; }
#tabla1 td.col-2023 { background: #e6eff7; color: var(--navy); }
#tabla1 tbody tr:hover td.col-2017 { background: #fbe0d2; }
#tabla1 tbody tr:hover td.col-2023 { background: #d9e8f4; }

/* ---------- Carrusel de figuras del estudio ---------- */
.section-figs { background: #f4f6f8; }
.fig-carousel { position: relative; }
.fig-track {
  display: flex; gap: 24px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 6px 4px 18px; scrollbar-width: thin;
}
.fig-card {
  flex: 0 0 min(360px, 86%); scroll-snap-align: start;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.fig-thumb { position: relative; display: block; background: #fff; border-bottom: 1px solid var(--line); }
.fig-thumb img { width: 100%; height: 220px; object-fit: contain; padding: 10px; transition: transform 0.4s; }
.fig-thumb:hover img { transform: scale(1.03); }
.fig-badge {
  position: absolute; left: 12px; top: 12px; background: var(--navy); color: #fff;
  font: 700 0.78rem "DM Sans", sans-serif; letter-spacing: 0.06em; padding: 5px 10px; border-radius: 6px;
}
.fig-body { padding: 18px 20px 20px; }
.fig-body h3 { font-family: "Roboto", "DM Sans", sans-serif; font-weight: 500; font-size: 1.2rem; color: var(--ink); margin-bottom: 8px; line-height: 1.3; }
.fig-body p { font-size: 0.96rem; color: var(--text); }
.fig-src { margin-top: 12px; font-size: 0.82rem !important; color: #7a8792 !important; }
.fig-nav {
  position: absolute; top: 110px; z-index: 3; width: 56px; height: 56px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.95); color: var(--navy); font-size: 2rem; line-height: 1;
  box-shadow: 0 6px 20px rgba(6,31,53,0.2); cursor: pointer;
}
.fig-nav:hover { background: var(--navy); color: #fff; }
.fig-nav.prev { left: -14px; }
.fig-nav.next { right: -14px; }
@media (max-width: 900px) { .fig-nav { display: none; } }

/* Referencias: subtítulo */
.refs-sub { margin: 34px 0 14px; color: var(--navy); font-size: 1.25rem; }

@media (prefers-reduced-motion: reduce) {
  .map-card.alerting .alert-overlay, .alert-svg, .alert-burst .ring, .alert-chip::before, .alert-chip::after { animation: none !important; }
}
@media (max-width: 900px) { .map-wrap { min-height: 340px; } }
/* Ajustes v9.1: flechas junto a los puntos y menú compacto */
.hero-slider .slide-arrow {
  top: auto; bottom: 34px; transform: none; width: 42px; height: 42px; font-size: 1.6rem;
}
.hero-slider .slide-arrow.prev { left: calc(max(32px, (100vw - 1320px) / 2 + 32px) + 70px); }
.hero-slider .slide-arrow.next { left: calc(max(32px, (100vw - 1320px) / 2 + 32px) + 120px); right: auto; }
.slide-dots { bottom: 48px; }
@media (max-width: 1200px) {
  .navbar.overlay .nav-links a { font-size: 0.98rem; padding: 8px 8px; }
  .navbar.overlay .nav-links a::after { left: 8px; right: 8px; }
  .navbar.overlay .brand-logo { height: 52px; }
  .navbar.overlay .nav-links { flex-wrap: nowrap; }
}
@media (max-width: 900px) {
  .navbar.overlay .nav-links { flex-wrap: wrap; }
  .hero-slider .slide-arrow { display: none; }
}
@media (max-width: 1080px) {
  .navbar.overlay .nav-toggle { display: block; }
  .navbar.overlay .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; flex-wrap: nowrap; background: rgba(7, 59, 111, 0.98); padding: 10px 18px;
  }
  .navbar.overlay .nav-links.open { display: flex; }
  .navbar.overlay .nav-links a::after { display: none; }
}

/* ============================================================
   v10 — Máquina de escribir, cintas de seguridad, triángulo de
   alerta, estudio destacado y guía ilustrada en subtemas
   ============================================================ */

/* Título que se escribe solo */
.type-caret {
  display: inline-block; width: 3px; height: 0.95em; margin-left: 4px; vertical-align: -0.1em;
  background: #fff; animation: caret 0.8s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.hero-slider .hero-actions { transition: opacity 0.6s ease, transform 0.6s ease; }
.hero-slider .hero-actions.waiting { opacity: 0; transform: translateY(10px); }

/* Cintas de seguridad negro/amarillo (animadas e interactivas) */
.hazard-tape {
  position: relative; overflow: hidden; height: 38px;
  background: repeating-linear-gradient(-45deg, #ffc20e 0 22px, #1b1b1b 22px 44px);
  background-size: 62.2px 62.2px; animation: tapeSlide 1.6s linear infinite;
  box-shadow: inset 0 3px 6px rgba(0,0,0,0.25), inset 0 -3px 6px rgba(0,0,0,0.25);
  cursor: default;
}
@keyframes tapeSlide { to { background-position: 62.2px 0; } }
.hazard-track {
  position: absolute; top: 50%; left: 0; transform: translateY(-50%);
  display: flex; white-space: nowrap; animation: tapeText 26s linear infinite;
}
.hazard-track span {
  font: 800 0.92rem "DM Sans", sans-serif; letter-spacing: 0.14em; color: #1b1b1b;
  background: #ffc20e; padding: 4px 14px; margin-right: 0; border-top: 2px solid #1b1b1b; border-bottom: 2px solid #1b1b1b;
}
@keyframes tapeText { to { transform: translate(-50%, -50%); } }
.hazard-tape:hover, .hazard-tape:hover .hazard-track { animation-play-state: paused; }
#subtemas > .hazard-tape { margin: -64px 0 52px; }
@media (max-width: 900px) { #subtemas > .hazard-tape { margin: -48px 0 40px; } }

/* Triángulo de alerta en movimiento (esquina del recuadro del mapa) */
.map-side { position: relative; }
.warn-tri {
  position: absolute; top: 14px; right: 16px; width: 58px; height: 52px; z-index: 2;
  transform-origin: 50% 90%; animation: triSwing 2.2s ease-in-out infinite;
  filter: drop-shadow(0 0 0 rgba(255,194,14,0.0));
}
.warn-tri svg { width: 100%; height: 100%; animation: triGlow 1.1s ease-in-out infinite alternate; }
@keyframes triSwing { 0%,100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
@keyframes triGlow { from { filter: drop-shadow(0 0 2px rgba(255,194,14,0.5)); } to { filter: drop-shadow(0 0 14px rgba(255,170,0,0.95)); } }
.map-side .map-point:first-of-type { padding-right: 64px; }

/* Estudio destacado: etiqueta naranja y recuadros blancos */
.featured-badge { background: #e0612f; color: #fff; }
.fstat {
  background: rgba(255, 255, 255, 0.94); color: var(--ink);
  border-left: 4px solid #e0612f; box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.fstat strong { color: #c94d1f; }
.fstat span { color: #2c3e4f; }

/* Subtemas: guía ilustrada + tarjetas */
.subtemas-layout { display: grid; grid-template-columns: 270px 1fr; gap: 34px; align-items: start; }
.guide { position: sticky; top: 96px; }
.guide-bubble {
  position: relative; background: #fff; border: 2px solid var(--navy); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--shadow); min-height: 92px;
  transition: transform 0.25s;
}
.guide-bubble.bump { transform: scale(1.04); }
.guide-bubble::after {
  content: ""; position: absolute; left: 60%; bottom: -12px; width: 20px; height: 20px;
  background: #fff; border-right: 2px solid var(--navy); border-bottom: 2px solid var(--navy); transform: rotate(45deg);
}
.guide-bubble strong { display: block; color: var(--navy); font-family: "Libre Franklin", sans-serif; font-size: 1.02rem; margin-bottom: 4px; }
.guide-bubble span { font-size: 0.92rem; color: var(--text); }
.guide-figure { position: relative; padding: 10px 0 0; }
.guide-svg { width: 100%; height: auto; display: block; }
.guide-arm { transform-origin: 156px 168px; animation: point 1.6s ease-in-out infinite; }
@keyframes point { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-7deg); } }
.g-icon {
  position: absolute; width: 46px; height: 46px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(6,31,53,0.18);
  animation: bob 2.6s ease-in-out infinite;
}
.g-icon svg { width: 28px; height: 28px; }
.gi-alert { left: -6px; top: 40px; }
.gi-bell { right: -4px; top: 150px; animation-delay: 0.5s; }
.gi-bell svg { animation: ring 1.4s ease-in-out infinite; transform-origin: 50% 10%; }
.gi-siren { left: -8px; top: 190px; animation-delay: 1s; }
.gi-siren svg { animation: blink 0.8s ease-in-out infinite; }
.gi-shield { right: 10px; top: 300px; animation-delay: 1.4s; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes ring { 0%,60%,100% { transform: rotate(0); } 10% { transform: rotate(14deg); } 20% { transform: rotate(-12deg); } 30% { transform: rotate(8deg); } 40% { transform: rotate(-6deg); } }
.guide-note { font-size: 0.75rem; color: #7a8792; text-align: center; margin-top: 4px; }
.topic-card { cursor: pointer; transition: transform 0.25s, box-shadow 0.25s, outline-color 0.25s; outline: 3px solid transparent; outline-offset: 3px; }
.topic-card.spot { outline-color: #ffc20e; box-shadow: 0 16px 36px rgba(6,31,53,0.18); transform: translateY(-4px); }
.topic-card.spot .topic-num { background: #ffc20e; color: #1b1b1b; }
@media (max-width: 1100px) {
  .subtemas-layout { grid-template-columns: 1fr; }
  .guide { position: relative; top: 0; display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; max-width: 560px; }
  .guide-bubble { order: 2; margin: 0; }
  .guide-bubble::after { left: -11px; top: 40%; bottom: auto; transform: rotate(135deg); }
  .guide-figure { order: 1; }
  .g-icon { width: 34px; height: 34px; } .g-icon svg { width: 20px; height: 20px; }
  .guide-note { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hazard-tape, .hazard-track, .warn-tri, .warn-tri svg, .guide-arm, .g-icon, .g-icon svg, .type-caret { animation: none !important; }
}
/* v10.1: cinta más alta para que se vean las franjas y guía más grande en pantallas medianas */
.hazard-tape { height: 48px; }
.hazard-track span { padding: 3px 16px; font-size: 0.88rem; }
@media (max-width: 1100px) { .guide { grid-template-columns: 210px 1fr; max-width: 640px; } }
@media (max-width: 560px) { .guide { grid-template-columns: 130px 1fr; } }

/* ============================================================
   v11 — FODA del equipo y rueda de integrantes
   ============================================================ */

/* ---------- FODA ---------- */
.foda { background: #f7f4ee; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.foda-head {
  background: #344a63; color: #fff; text-align: center; letter-spacing: 0.08em;
  font: 400 clamp(1.3rem, 2.4vw, 1.8rem) "Roboto", "DM Sans", sans-serif; padding: 22px 16px;
}
.foda-board {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto;
  gap: 0; padding: 30px 34px 40px; min-height: 560px;
}
.foda-line { position: absolute; background: #344a63; border-radius: 4px; z-index: 0; }
.foda-line.h { left: 9%; right: 9%; top: calc(50% + 2px); height: 8px; transform: translateY(-50%); }
.foda-line.v { top: 18px; bottom: 18px; left: 50%; width: 8px; transform: translateX(-50%); }
.foda-q {
  position: relative; z-index: 1; padding: 26px 30px; margin: 10px; border-radius: 14px;
  transition: background 0.25s, box-shadow 0.25s, transform 0.25s; outline: none;
}
.foda-q:nth-of-type(1), .foda-q:nth-of-type(3) { padding-right: 120px; }
.foda-q:nth-of-type(2), .foda-q:nth-of-type(4) { padding-left: 120px; }
.foda-q:nth-of-type(3), .foda-q:nth-of-type(4) { padding-top: 120px; }
.foda-q:nth-of-type(1), .foda-q:nth-of-type(2) { padding-bottom: 110px; }
.foda-letter {
  position: absolute; font: 800 9rem/1 "Libre Franklin", sans-serif; color: rgba(52, 74, 99, 0.06);
  top: 6px; right: 26px; pointer-events: none;
}
.foda-q h3 { font-family: "DM Sans", sans-serif; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 1.15rem; color: #344a63; margin-bottom: 4px; }
.foda-ask { font-size: 0.9rem; color: #7a8792; font-style: italic; margin-bottom: 10px; }
.foda-q ul { margin-left: 18px; }
.foda-q li { font-size: 0.98rem; color: #3c4a57; margin-bottom: 7px; }
.q-fortalezas { --qc: #b5432f; } .q-oportunidades { --qc: #6f7d6a; }
.q-debilidades { --qc: #6a86a3; } .q-amenazas { --qc: #b8952f; }
.foda-q h3::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--qc); margin-right: 8px; vertical-align: 1px; }
.foda-q:hover, .foda-q:focus, .foda-q.on { background: #fff; box-shadow: 0 12px 30px rgba(52,74,99,0.16); transform: translateY(-3px); }
.foda-q:hover h3, .foda-q.on h3 { color: var(--qc); }

.foda-ring {
  position: absolute; left: 50%; top: calc(50% + 2px); transform: translate(-50%, -50%);
  width: 220px; height: 220px; z-index: 2; display: grid; place-items: center;
}
.foda-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.foda-ring::before { content: ""; position: absolute; inset: 30px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 6px #eef0f2, 0 8px 24px rgba(52,74,99,0.18); }
.seg { fill: none; stroke-width: 28; transition: stroke-width 0.3s, opacity 0.3s; transform-origin: 100px 100px; }
.s-fortalezas { stroke: #b5432f; } .s-oportunidades { stroke: #6f7d6a; }
.s-debilidades { stroke: #6a86a3; } .s-amenazas { stroke: #b8952f; }
.foda-ring.dim .seg { opacity: 0.35; }
.foda-ring.dim .seg.on { opacity: 1; stroke-width: 36; }
.foda-word { position: relative; font: 800 2.4rem "Roboto", "DM Sans", sans-serif; color: #344a63; letter-spacing: 0.02em; }
.foda.reveal.visible .foda-ring svg { animation: ringSpin 1.2s cubic-bezier(.2,.8,.2,1) both; }
@keyframes ringSpin { from { transform: rotate(-120deg) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 860px) {
  .foda-board { grid-template-columns: 1fr; padding: 150px 14px 20px; min-height: 0; }
  .foda-line { display: none; }
  .foda-ring { top: 20px; transform: translateX(-50%); width: 160px; height: 160px; }
  .foda-word { font-size: 1.7rem; }
  .foda-q, .foda-q:nth-of-type(n) { padding: 18px 18px; margin: 6px 0; background: #fff; border-left: 5px solid var(--qc); }
  .foda-letter { font-size: 5rem; }
}

/* ---------- Equipo: rueda 3D ---------- */
.section-team {
  position: relative; color: #fff; overflow: hidden;
  background:
    linear-gradient(rgba(7, 59, 111, 0.93), rgba(6, 31, 53, 0.95)),
    url("../assets/fondo-difuminado-2.jpg") center / cover no-repeat;
}
.section-team h2 { color: #fff; }
.team-wheel { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.tw-stage { perspective: 1400px; width: 100%; max-width: 900px; height: 520px; display: grid; place-items: center; }
.tw-ring { position: relative; width: 290px; height: 470px; transform-style: preserve-3d; transition: transform 0.9s cubic-bezier(.2,.8,.2,1); }
.member {
  position: absolute; inset: 0; backface-visibility: hidden;
  background: #fff; color: var(--ink); border-radius: 18px; padding: 26px 22px 22px; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35); cursor: pointer;
  transition: opacity 0.6s, filter 0.6s, box-shadow 0.3s; outline: none;
  display: flex; flex-direction: column; align-items: center;
}
.member:not(.front) { opacity: 0.55; filter: saturate(0.6); }
.member.front { box-shadow: 0 24px 60px rgba(0,0,0,0.45), 0 0 0 4px #e0612f; }
.member-photo {
  position: relative; width: 132px; height: 132px; border-radius: 50%; margin-bottom: 16px;
  background: linear-gradient(135deg, #e7f0f8, #cfdfec); overflow: hidden;
  border: 4px solid #fff; box-shadow: 0 0 0 3px #0d578d;
  display: grid; place-items: center;
}
.member-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.member-ph { display: grid; place-items: center; color: #7d97ad; gap: 2px; }
.member-ph svg { width: 54px; height: 54px; }
.member-ph small { font: 600 0.72rem "DM Sans", sans-serif; letter-spacing: 0.04em; }
.member-initials { position: absolute; right: 8px; bottom: 6px; font: 800 0.8rem "Libre Franklin", sans-serif; color: #0d578d; opacity: 0.55; }
.member h3 { font-family: "Libre Franklin", sans-serif; font-size: 1.25rem; color: var(--navy); line-height: 1.2; margin-bottom: 6px; }
.member h3 span { font-weight: 600; font-size: 1rem; color: #5b6b78; }
.member-role { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #e0612f; margin-bottom: 12px; }
.member-desc { font-size: 0.95rem; color: #3c4a57; margin-bottom: 18px; }
.placeholder { border: 2px dashed #b9c6d1; border-radius: 10px; padding: 10px 12px; color: #6f7f8c !important; background: #f6f8fa; font-style: italic; }
.member-in {
  margin-top: auto; display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font-weight: 700; font-size: 0.9rem; color: #0a66c2;
}
.member-in svg { width: 20px; height: 20px; flex: 0 0 auto; }
.member-in.placeholder { font-style: normal; }
.tw-nav {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.08); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; z-index: 5;
  transition: background 0.2s, transform 0.2s;
}
.tw-nav:hover { background: #e0612f; border-color: #e0612f; transform: scale(1.06); }
.tw-dots { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.tw-dots button {
  border: 2px solid rgba(255,255,255,0.5); background: transparent; color: #fff; border-radius: 999px;
  padding: 7px 16px; font: 600 0.92rem "DM Sans", sans-serif; cursor: pointer; transition: all 0.2s;
}
.tw-dots button.active, .tw-dots button:hover { background: #fff; color: var(--navy); border-color: #fff; }
@media (max-width: 700px) {
  .tw-stage { height: 480px; perspective: 900px; }
  .tw-ring { width: 240px; height: 440px; }
  .tw-nav { position: absolute; top: 45%; width: 42px; height: 42px; font-size: 1.6rem; }
  .tw-nav.prev { left: 0; } .tw-nav.next { right: 0; }
}
/* v11.1: rueda tipo carrusel con integrantes a los lados */
.tw-ring { transform: none !important; }
.member { backface-visibility: visible; transition: transform 0.8s cubic-bezier(.2,.8,.2,1), opacity 0.6s, filter 0.6s, box-shadow 0.3s; }
.member:not(.front) { filter: saturate(0.7) brightness(0.92); }
.member:not(.front):hover { filter: none; }
.tw-stage { overflow: visible; }
@media (max-width: 700px) { .member:not(.front) { pointer-events: auto; } }
@media (max-width: 860px) { .foda-board { padding-top: 200px; } }

/* v12: "El Niño costero" en naranja en el título de la portada */
.hero-slider h1 .hl { color: #ff8a3d; font-weight: 700; text-shadow: 0 2px 16px rgba(0,0,0,0.45); }

/* ============================================================
   v13 — Portada con degradado de color, ventanas del mapa, indicaciones
   ============================================================ */
/* Portada: degradado azul → rojo que se mueve lentamente sobre las fotos */
.slide::after {
  background:
    linear-gradient(90deg, rgba(4, 20, 38, 0.82) 0%, rgba(4, 20, 38, 0.45) 45%, rgba(4, 20, 38, 0.05) 100%),
    linear-gradient(120deg, rgba(13, 87, 141, 0.55) 0%, rgba(13, 87, 141, 0.0) 40%, rgba(215, 38, 30, 0.0) 60%, rgba(215, 38, 30, 0.42) 100%),
    linear-gradient(180deg, rgba(4, 20, 38, 0.0) 60%, rgba(4, 20, 38, 0.6) 100%);
  background-size: 100% 100%, 220% 220%, 100% 100%;
  animation: tint 14s ease-in-out infinite alternate;
}
@keyframes tint { from { background-position: 0 0, 0% 50%, 0 0; } to { background-position: 0 0, 100% 50%, 0 0; } }
/* Línea de color animada bajo el encabezado y degradado del menú */
.navbar.overlay { background: linear-gradient(180deg, rgba(4, 20, 38, 0.8), rgba(4, 20, 38, 0)); }
.navbar.overlay::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, #0d578d, #e0612f, #d7261e, #0d578d);
  background-size: 300% 100%; animation: lineFlow 8s linear infinite; opacity: 0.95;
}
@keyframes lineFlow { to { background-position: 300% 0; } }
.navbar.overlay.scrolled { background: linear-gradient(90deg, rgba(7, 59, 111, 0.98), rgba(10, 42, 80, 0.98) 60%, rgba(90, 30, 40, 0.96)); }

/* Ventanas emergentes del mapa con datos */
.leaflet-popup-content { margin: 14px 16px; line-height: 1.45; }
.pp-title { display: block; font: 800 1.05rem "Libre Franklin", sans-serif; color: var(--navy); margin-bottom: 6px; }
ul.pp { margin: 0 0 0 16px; padding: 0; }
ul.pp li { font-size: 0.88rem; margin-bottom: 6px; color: #2c3e4f; }
ul.pp b { color: #c94d1f; }

/* Indicaciones en punto aparte */
.hint { font-size: 0.98rem; font-weight: 600; color: var(--blue); margin: -18px 0 28px; }
.hint.light { color: #ffd2b8; margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .slide::after, .navbar.overlay::after { animation: none; } }
.slide::after {
  background:
    linear-gradient(90deg, rgba(4, 20, 38, 0.80) 0%, rgba(4, 20, 38, 0.40) 45%, rgba(4, 20, 38, 0.0) 100%),
    linear-gradient(120deg, rgba(13, 87, 141, 0.70) 0%, rgba(13, 87, 141, 0.10) 40%, rgba(215, 38, 30, 0.10) 60%, rgba(215, 38, 30, 0.58) 100%),
    linear-gradient(180deg, rgba(4, 20, 38, 0.0) 60%, rgba(4, 20, 38, 0.6) 100%);
  background-size: 100% 100%, 220% 220%, 100% 100%;
}

/* ============================================================
   v15 — Revisión responsive
   ============================================================ */
/* Evita que una columna "1fr" se ensanche por el contenido */
.subtemas-layout > *, .chart-grid > *, .topic-grid > *, .versus-grid > *, .gallery > *, .photo-strip > * { min-width: 0; }
@media (max-width: 1100px) {
  .subtemas-layout { grid-template-columns: minmax(0, 1fr); }
  .guide { grid-template-columns: 210px minmax(0, 1fr); }
}
@media (max-width: 560px) { .guide { grid-template-columns: 110px minmax(0, 1fr); gap: 10px; } }
/* Celulares pequeños: márgenes más finos y textos que no empujan el ancho */
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .navbar.overlay .nav-inner { padding: 12px 16px; }
  .navbar.overlay .brand-logo { height: 40px; }
  .hero-slider { padding-left: 16px; padding-right: 16px; }
  .hero-slider h1 { font-size: 1.85rem; }
  .hero-slider .hero-actions .btn { padding: 12px 18px; font-size: 0.98rem; }
  .section h2 { font-size: 1.7rem; }
  .alert-title { gap: 12px; }
  .chart-card, .table-card, .topic-card, .opinion-form { padding-left: 16px; padding-right: 16px; }
  .map-side { padding: 20px 16px; }
  .warn-tri { width: 44px; height: 40px; top: 10px; right: 10px; }
  .versus-card > h3, .versus-card > .versus-row, .versus-card > .v-src { margin-left: 14px; margin-right: 14px; }
  .v-num { font-size: 1.55rem; }
  .featured-body { padding: 24px 16px; }
  .fstat { flex-direction: column; align-items: flex-start; gap: 4px; }
  .guide-bubble { padding: 10px 12px; }
  .guide-bubble strong { font-size: 0.95rem; }
  .g-icon { width: 30px; height: 30px; } .g-icon svg { width: 18px; height: 18px; }
  .foda-q, .foda-q:nth-of-type(n) { padding: 16px 14px; }
  .foda-q h3 { font-size: 1rem; }
  .fig-card { flex-basis: 88%; }
  .tw-ring { width: 220px; }
  .member { padding: 20px 14px 16px; }
  .member-photo { width: 104px; height: 104px; }
  .slide figcaption { font-size: 0.85rem; }
  .footer-inner { gap: 16px; }
  h1, h2, h3, p, li, figcaption { overflow-wrap: break-word; }
}
/* Rejillas: el mínimo nunca supera el ancho disponible */
.topic-grid { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.versus-grid { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.chart-grid { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }
.gallery { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }

/* Tablas en pantallas pequeñas: ancho normal y desplazamiento lateral */
@media (max-width: 900px) {
  .table-scroll { -webkit-overflow-scrolling: touch; position: relative; }
  #tabla1 { min-width: 680px; }
  #tabla2 { min-width: 640px; }
  .table-scroll table { font-size: 0.95rem; }
  .table-scroll th, .table-scroll td { padding: 12px 14px; }
  .table-card .table-scroll::before {
    content: "Desliza la tabla →"; position: sticky; left: 0; display: block;
    font: 700 0.8rem "DM Sans", sans-serif; color: var(--blue); background: #f4f8fb;
    padding: 6px 12px; border-bottom: 1px solid var(--line);
  }
  .table-head-row { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   v16 — Botón "volver al inicio"
   ============================================================ */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 1200;
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--navy); color: #fff; display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(6, 31, 53, 0.35);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(0.9);
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s, background 0.2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: #e0612f; transform: translateY(-3px); }
.to-top:focus-visible { outline: 3px solid #ffb27a; outline-offset: 3px; }
.to-top > svg:first-child { width: 22px; height: 22px; position: relative; z-index: 1; }
/* Anillo que muestra cuánto has avanzado en la página */
.to-top-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.to-top-ring circle { fill: none; stroke: #ff8a3d; stroke-width: 3; stroke-dasharray: 100; stroke-dashoffset: 100; stroke-linecap: round; }
@media (max-width: 480px) { .to-top { right: 14px; bottom: 14px; width: 46px; height: 46px; } }

/* ============================================================
   v17 — Visor de figuras (lightbox)
   ============================================================ */
body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 3000;
  display: grid; grid-template-columns: 72px 1fr 72px; grid-template-rows: auto 1fr auto;
  background: rgba(4, 14, 26, 0.94); backdrop-filter: blur(4px); color: #fff;
  opacity: 0; transition: opacity 0.25s;
}
.lightbox[hidden] { display: none; }
.lightbox.on { opacity: 1; }
.lb-top { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; }
.lb-count { font: 700 0.95rem "DM Sans", sans-serif; color: #c9d4de; letter-spacing: 0.05em; }
.lb-tools { display: flex; gap: 8px; }
.lb-btn {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08); color: #fff; display: grid; place-items: center; cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.lb-btn svg { width: 22px; height: 22px; }
.lb-btn:hover, .lb-btn.active { background: #e0612f; border-color: #e0612f; }
.lb-close:hover { background: #d7261e; border-color: #d7261e; }
.lb-nav {
  align-self: center; justify-self: center; width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3); background: rgba(255,255,255,0.08); color: #fff;
  font-size: 2.2rem; line-height: 1; cursor: pointer; transition: background 0.2s;
}
.lb-nav:hover { background: #e0612f; border-color: #e0612f; }
.lb-stage {
  position: relative; overflow: hidden; display: grid; place-items: center;
  background: #fff; border-radius: 10px; margin: 4px 0; cursor: zoom-in; touch-action: none;
}
.lb-stage.zoomed { cursor: grab; }
.lb-stage.dragging { cursor: grabbing; }
.lb-stage img {
  max-width: 100%; max-height: 100%; object-fit: contain; user-select: none;
  transform-origin: 0 0; transition: transform 0.2s ease, opacity 0.25s;
}
.lb-stage.dragging img { transition: none; }
.lb-stage.loading img { opacity: 0; }
.lb-loader {
  position: absolute; width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid #d8e0e5; border-top-color: #e0612f; animation: lbspin 0.8s linear infinite; display: none;
}
.lb-stage.loading .lb-loader { display: block; }
@keyframes lbspin { to { transform: rotate(360deg); } }
.lb-caption { grid-column: 1 / -1; padding: 12px 22px 16px; max-width: 980px; justify-self: center; text-align: center; }
.lb-caption h3 { font: 500 1.2rem "Roboto", "DM Sans", sans-serif; margin-bottom: 4px; color: #fff; }
.lb-caption p { font-size: 0.94rem; color: #d5dde4; margin: 0 0 4px; }
.lb-caption .lb-src { font-size: 0.82rem; color: #9fb0bf; }
.lb-tip { font-size: 0.78rem !important; color: #7f93a5 !important; margin-top: 6px !important; }
/* Pantalla completa: solo la imagen */
.lightbox:fullscreen { background: #050d17; }
.lightbox:fullscreen .lb-caption { display: none; }
@media (max-width: 700px) {
  .lightbox { grid-template-columns: 0 1fr 0; }
  .lb-nav { position: absolute; top: 50%; z-index: 2; width: 42px; height: 42px; font-size: 1.7rem; background: rgba(4,14,26,0.65); }
  .lb-nav.prev { left: 8px; } .lb-nav.next { right: 8px; }
  .lb-btn { width: 40px; height: 40px; }
  .lb-caption p:not(.lb-src) { display: none; }
  .lb-tip { display: none; }
}
/* El cursor indica que la figura se puede ampliar */
.fig-thumb { cursor: zoom-in; }
.fig-thumb::after {
  content: "⤢ Ampliar"; position: absolute; right: 10px; bottom: 10px;
  background: rgba(7,59,111,0.88); color: #fff; font: 700 0.75rem "DM Sans", sans-serif;
  padding: 5px 10px; border-radius: 6px; opacity: 0; transition: opacity 0.2s;
}
.fig-thumb:hover::after, .fig-thumb:focus-visible::after { opacity: 1; }
@media (hover: none) { .fig-thumb::after { opacity: 1; } }
/* Posiciones fijas en la rejilla del visor (evita que la imagen se desplace en móvil) */
.lb-top { grid-row: 1; }
.lb-nav.prev { grid-column: 1; grid-row: 2; }
.lb-stage { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; }
.lb-nav.next { grid-column: 3; grid-row: 2; }
.lb-caption { grid-row: 3; }
@media (max-width: 700px) { .lb-stage { margin: 4px 8px; } }
/* La figura siempre cabe completa dentro del visor */
.lb-stage img {
  position: absolute; inset: 0; margin: auto;
  width: auto; height: auto; max-width: calc(100% - 16px); max-height: calc(100% - 16px);
}

/* ============================================================
   v18 — Carrusel de figuras con tarjetas completas
   ============================================================ */
.fig-carousel { --per: 3; --gap: 24px; }
@media (max-width: 1100px) { .fig-carousel { --per: 2; } }
@media (max-width: 700px)  { .fig-carousel { --per: 1; --gap: 16px; } }
.fig-track {
  gap: var(--gap); padding: 6px 0 18px; scroll-padding: 0;
  scrollbar-width: none;
}
.fig-track::-webkit-scrollbar { display: none; }
.fig-card, .fig-card:nth-child(n) {
  flex: 0 0 calc((100% - (var(--per) - 1) * var(--gap)) / var(--per));
  max-width: none; scroll-snap-align: start;
}
.fig-nav:disabled { opacity: 0.35; cursor: default; pointer-events: none; }
@media (max-width: 480px) { .fig-card, .fig-card:nth-child(n) { flex-basis: 100%; } }

/* v19: tarjetas del equipo más altas para descripciones completas */
.tw-stage { height: 600px; }
.tw-ring { width: 300px; height: 545px; }
.member-desc { font-size: 0.9rem; line-height: 1.5; }
@media (max-width: 700px) {
  .tw-stage { height: 680px; }
  .tw-ring { width: 250px; height: 630px; }
}
@media (max-width: 480px) { .tw-ring { width: 236px; } }
