/* =========================================================
   Tan cabuya fue — v4
   Sistema tipográfico y cromático heredado del sitio en
   producción; estructura de lectura inmersiva por capítulos
   (umbral con zoom, habitaciones con color propio, hilo de
   progreso) — sin dependencias externas, JavaScript nativo.
   ========================================================= */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 0;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--color-primary);
  background: var(--color-surface-light);
  overflow-x: clip;
}

canvas, img, picture, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
ol, ul { list-style: none; }
iframe { border: 0; width: 100%; display: block; }
em { font-style: italic; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Tokens (heredados del sitio en producción) ---------- */
:root {
  --color-primary: #1E2420;
  --color-secondary: #4F5C56;
  --color-text: #6C7A73;
  --color-accent: #2F6960;
  --color-border: #AEBBA8;
  --color-surface-muted: #F1F4EA;
  --color-surface-light: #FBFBF3;
  --color-overlay: rgba(20,26,23,0.55);
  --color-white: #FFFFFF;

  --font-primary: 'Libre Caslon Text', Georgia, serif;
  --font-display: 'Libre Caslon Display', Georgia, serif;
  --font-accent: 'Roboto', sans-serif;

  --container-max: 1180px;
  --content-max: 760px;
  --header-h: 64px;

  --transition-fast: 200ms;
  --transition-normal: 350ms;
  --transition-slow: 500ms;

  /* Paleta por capítulo — misma familia cromática del sitio, variación de atmósfera */
  --room-dolores-bg: #DCE9D6;   --room-dolores-ink: #1E2420;
  --room-esperanza-bg: #FBFBF3; --room-esperanza-ink: #1E2420;
  --room-motorista-bg: #B9C6CC; --room-motorista-ink: #1B2326;
  --room-santiago-bg: #E9E5C8;  --room-santiago-ink: #262316;
  --room-joseluis-bg: #C3D8B0;  --room-joseluis-ink: #1F2617;
  --room-soledad-bg: #FBFBF3;   --room-soledad-ink: #1E2420;
  --room-fernando-bg: #C0E3CC;  --room-fernando-ink: #1A2A20;
  --room-tomasito-bg: #22394D;  --room-tomasito-ink: #FFFFFF;
}

@font-face { font-family: "Libre Caslon Text"; font-style: normal; font-weight: 400; font-display: swap; src: url(../assets/fonts/libre-caslon-text-400.woff2) format("woff2"); }
@font-face { font-family: "Libre Caslon Text"; font-style: italic; font-weight: 400; font-display: swap; src: url(../assets/fonts/libre-caslon-text-400i.woff2) format("woff2"); }
@font-face { font-family: "Libre Caslon Text"; font-style: normal; font-weight: 700; font-display: swap; src: url(../assets/fonts/libre-caslon-text-700.woff2) format("woff2"); }
@font-face { font-family: "Libre Caslon Display"; font-style: normal; font-weight: 400; font-display: swap; src: url(../assets/fonts/libre-caslon-display-400.woff2) format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 400 500; font-display: swap; src: url(../assets/fonts/roboto-400-500.woff2) format("woff2"); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; color: var(--color-primary); }

.eyebrow {
  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 14px;
}

.skip-link {
  position: absolute; top: -100%; left: 20px; z-index: 400;
  padding: 10px 15px; background: var(--color-primary); color: #fff;
  font-family: var(--font-accent); font-size: 14px;
}
.skip-link:focus { top: 10px; }

/* ---------- Encabezado fijo (contraste adaptativo) ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 150;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(20px, 4vw, 40px);
  mix-blend-mode: difference;
  color: #FBFBF3;
  pointer-events: none;
}
.site-header__title {
  pointer-events: auto; font-family: var(--font-display); font-size: 19px; color: inherit;
  padding: 6px 0;
}
.site-header__actions { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); pointer-events: auto; margin-right: clamp(92px, 15vw, 148px); }
.site-header__date {
  font-family: var(--font-accent); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  white-space: nowrap; display: none;
}
.menu-toggle {
  display: flex; align-items: center; gap: 10px; color: inherit;
  font-family: var(--font-accent); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  min-height: 44px; padding: 0;
}
.menu-toggle__bars { display: flex; flex-direction: column; gap: 4px; width: 20px; }
.menu-toggle__bars span { height: 1px; background: currentColor; }
.menu-toggle__bars span:last-child { width: 65%; margin-left: auto; }

@media (min-width: 560px) { .site-header__date { display: inline; } }

/* ---------- Insignia institucional (Presupuesto Participativo) ---------- */
.pp-badge {
  position: fixed; top: clamp(8px,1.6vh,14px); right: clamp(12px,3vw,30px); z-index: 160;
  width: clamp(74px,11.5vw,124px); height: clamp(74px,11.5vw,124px);
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(251,251,243,0.95)) drop-shadow(0 0 11px rgba(251,251,243,0.8)) drop-shadow(0 2px 8px rgba(20,26,23,0.25));
}

/* ---------- Índice a pantalla completa ---------- */
.index-menu {
  position: fixed; inset: 0; z-index: 300; background: var(--color-primary); color: var(--color-surface-light);
  overflow-y: auto; clip-path: inset(0 0 100% 0);
  transition: clip-path 0.85s cubic-bezier(.7,0,.2,1);
}
.index-menu.is-open { clip-path: inset(0 0 0% 0); }
.index-menu[aria-hidden="true"] { pointer-events: none; }
.index-menu__inner { max-width: var(--container-max); margin: 0 auto; padding: 22px clamp(20px,4vw,40px) 64px; min-height: 100%; }
.index-menu__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: clamp(36px,8vh,80px); }
.index-menu__brand { font-family: var(--font-display); font-size: 19px; }
.index-menu__close { color: inherit; font-family: var(--font-accent); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; min-height: 44px; }
.index-menu__label { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--room-fernando-bg); margin-bottom: 18px; }
.index-menu__list { display: flex; flex-direction: column; }
.index-menu__item {
  display: grid; grid-template-columns: clamp(36px,6vw,64px) minmax(0,1fr) auto; align-items: baseline; gap: 12px;
  padding: clamp(10px,1.6vh,16px) 0; border-bottom: 1px solid rgba(251,251,243,0.16);
  color: inherit; transition: color .25s ease, padding-left .35s ease;
}
.index-menu__item:hover, .index-menu__item:focus-visible { color: var(--room-fernando-bg); padding-left: 10px; }
.index-menu__n { font-family: var(--font-display); font-size: 14px; opacity: 0.65; }
.index-menu__titles { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.index-menu__title { font-family: var(--font-display); font-size: clamp(22px,3.4vw,38px); line-height: 1.1; }
.index-menu__voice { font-style: italic; font-size: 14px; opacity: 0.7; }
.index-menu__foot { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 36px; }
.index-menu__foot a { font-style: italic; font-size: 16px; color: inherit; opacity: 0.85; padding: 6px 0; }
.index-menu__foot a:hover, .index-menu__foot a:focus-visible { opacity: 1; color: var(--room-fernando-bg); }

/* ---------- Umbral (portada interactiva) ---------- */
.umbral { position: relative; height: 175vh; background: var(--color-surface-light); }
.umbral__sticky { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.umbral__img-wrap { position: absolute; left: 0; top: 0; will-change: transform; }
.umbral__img-wrap img { display: block; width: 100%; height: 100%; }
.umbral__title {
  position: absolute; left: 7vw; top: 18vh; will-change: transform, opacity;
}
.umbral__eyebrow { margin: 0 0 0.6em; font-size: max(11px,0.11em); letter-spacing: 0.2em; text-transform: uppercase; color: var(--color-secondary); }
.umbral__title h1 { margin: 0; font-size: 1em; line-height: 0.92; letter-spacing: -0.01em; }
.umbral__author { margin: 0.7em 0 0; font-size: max(15px,0.19em); font-style: italic; }
.umbral__hint {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap;
}
.umbral__hint-line { position: relative; width: 1px; height: 40px; overflow: hidden; background: rgba(30,36,32,0.18); }
.umbral__hint-line span { position: absolute; left: 0; top: 0; width: 1px; height: 100%; background: currentColor; animation: umbralDrip 2.2s cubic-bezier(.6,0,.3,1) infinite; }
@keyframes umbralDrip { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }
.umbral__veil { position: absolute; inset: 0; background: var(--color-primary); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .umbral { height: auto; }
  .umbral__sticky { position: relative; height: 62vh; }
  .umbral__hint-line span { animation: none; top: 50%; }
}
@media (max-width: 700px), (max-height: 560px) {
  .umbral { height: 130vh; }
}

/* ---------- Contraportada ---------- */
.contraportada { background: var(--color-primary); color: var(--color-surface-light); padding: 14vh clamp(24px,6vw,80px) 12vh; }
.contraportada__inner { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: clamp(24px,4.5vh,44px); }
.contraportada__p {
  margin: 0; font-family: var(--font-display); font-size: clamp(21px,2.7vw,34px); line-height: 1.34;
  opacity: 0.25; transition: opacity .25s ease;
}
.contraportada__p--pull { font-style: italic; font-size: clamp(26px,3.6vw,46px); line-height: 1.2; color: var(--room-fernando-bg); }
.contraportada__meta {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px;
  border-top: 1px solid rgba(251,251,243,0.22); padding-top: 26px; margin-top: 6px;
}
.contraportada__ed { display: flex; flex-direction: column; gap: 6px; }
.contraportada__ed-label { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--room-fernando-bg); }
.contraportada__ed-date { font-family: var(--font-display); font-size: clamp(22px,2.8vw,30px); }
.contraportada__countdown { font-style: italic; font-size: 15px; color: var(--room-santiago-bg); }
@media (prefers-reduced-motion: reduce) { .contraportada__p { opacity: 1; } }

/* ---------- Front matter: epígrafe ---------- */
.frontmatter { padding: 88px 24px; background: var(--color-surface-light); text-align: center; }
.frontmatter__inner { max-width: 62ch; margin: 0 auto; }
.frontmatter--epigraph p { font-family: var(--font-display); font-size: 20px; line-height: 1.65; color: var(--color-secondary); margin-bottom: 16px; }
.frontmatter--epigraph cite { font-family: var(--font-accent); font-size: 13px; color: var(--color-text); font-style: normal; }
@media (min-width: 700px) {
  .frontmatter--epigraph p { font-size: 23px; }
}

/* ---------- Nota liminar ---------- */
.chapter--liminar { padding: clamp(88px,14vh,150px) 24px; background: var(--color-surface-muted); }
.chapter--liminar .chapter__inner { max-width: 640px; margin: 0 auto; }
.chapter--liminar h2 { font-size: clamp(32px,4.5vw,48px); margin-bottom: clamp(28px,5vh,48px); }
.liminar__body { display: flex; flex-direction: column; gap: 20px; }
.liminar__body p { font-size: 16.5px; line-height: 1.75; color: var(--color-secondary); }

.credits-list { display: flex; flex-direction: column; gap: 18px; }
.credits-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin: 0; }
.credits-role { flex: 0 0 150px; font-family: var(--font-accent); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-accent); }
.credits-name { font-family: var(--font-display); font-size: 20px; color: var(--color-primary); }

/* ---------- Capítulos: habitaciones ---------- */
.rooms { position: relative; background: var(--color-surface-light); }
.rooms__sticky { position: relative; }
.rooms__track { display: flex; flex-direction: column; }

/* Modo escritorio: la sección se fija y las habitaciones se recorren en horizontal.
   Activado por JS (clase .rooms--pinned) solo cuando hay espacio y movimiento no está
   restringido; sin JS o en móvil, .rooms__track sigue apilado en columna arriba. */
.rooms.rooms--pinned {
  height: calc(var(--rooms-n, 8) * 100vh);
}
.rooms.rooms--pinned .rooms__sticky {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.rooms.rooms--pinned .rooms__track {
  flex-direction: row; flex-wrap: nowrap; height: 100%;
  width: calc(var(--rooms-n, 8) * 100vw);
  will-change: transform;
}
.rooms.rooms--pinned .room { min-height: 100vh; width: 100vw; flex: 0 0 100vw; }

.room {
  position: relative; min-height: 100svh; display: flex; align-items: center;
  background: var(--room-bg); color: var(--room-ink);
  padding: clamp(96px,14vh,140px) clamp(24px,6vw,88px) clamp(72px,10vh,110px);
}
.room__text { max-width: 620px; margin: 0 auto; }
.room__kicker { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.room__kicker .room__n { font-family: var(--font-display); font-size: 21px; }
.room__kicker .room__rule { flex: 1; height: 1px; background: currentColor; opacity: 0.35; }
.room__place { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.75; margin-bottom: 10px; }
.room__voice { font-size: clamp(38px,6vw,72px); line-height: 0.97; margin-bottom: 8px; color: var(--room-ink); }
.room__title { font-style: italic; font-size: 18px; opacity: 0.85; margin-bottom: 26px; }
.room__fragment { font-family: var(--font-display); font-size: clamp(20px,2.1vw,27px); line-height: 1.42; }
.room__fragment .ellipsis { opacity: 0.5; padding: 0 4px; }
.room__note { margin-top: 30px; max-width: 44ch; font-style: italic; font-size: 14.5px; opacity: 0.78; }

.room--tomasito { justify-content: center; text-align: center; }
.room--tomasito .room__text { max-width: 780px; }
.room--tomasito .room__kicker { justify-content: center; }
.room--tomasito .room__kicker .room__rule { flex: 0 0 48px; }
.room--tomasito .room__fragment { font-size: clamp(24px,3vw,38px); }

/* Hilo: cápsula de progreso fija con nudos por capítulo.
   Toma el color del capítulo activo (--thread-bg/--thread-ink, vía JS) en vez de
   mix-blend-mode, para no interferir con el texto o los pies de foto que pueda cruzar. */
.thread-bar {
  position: fixed; left: 50%; bottom: clamp(14px,3vh,26px); transform: translateX(-50%);
  width: min(calc(100% - 40px), 460px); height: 30px; z-index: 60;
  opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility .4s ease, background .4s ease, color .4s ease;
  background: var(--thread-bg, rgba(251,251,243,0.9));
  color: var(--thread-ink, var(--color-primary));
  border-radius: 999px; box-shadow: 0 6px 18px rgba(20,26,23,0.12);
  padding: 0 clamp(16px,4vw,26px);
}
.thread-bar.is-visible { opacity: 1; visibility: visible; }
.thread-bar__line { position: absolute; left: clamp(16px,4vw,26px); right: clamp(16px,4vw,26px); top: 50%; height: 1px; background: currentColor; opacity: 0.3; }
.thread-bar__fill { position: absolute; left: clamp(16px,4vw,26px); top: calc(50% - 1px); height: 2px; width: 0%; background: currentColor; }
.thread-bar__dots { position: absolute; left: clamp(16px,4vw,26px); right: clamp(16px,4vw,26px); top: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; }
.thread-bar__dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid currentColor; background: var(--thread-bg, rgba(251,251,243,0.9)); box-sizing: border-box; transition: background .25s ease; }
.thread-bar__dot.is-passed { background: currentColor; }
@media (max-width: 480px) { .thread-bar { width: calc(100% - 32px); } }

/* ---------- Epílogo ---------- */
.epilogue { padding: clamp(88px,14vh,150px) 0 clamp(72px,11vh,120px); background: var(--color-surface-muted); }
.epilogue__head { max-width: var(--container-max); margin: 0 auto clamp(56px,9vh,96px); padding: 0 clamp(24px,6vw,72px); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; }
.epilogue__head h2 { font-size: clamp(36px,5.5vw,64px); line-height: 0.98; }
.epilogue__head p { max-width: 42ch; font-size: 15.5px; line-height: 1.65; color: var(--color-secondary); }
.epilogue__inner { max-width: var(--container-max); margin: 0 auto; padding: 0 clamp(24px,6vw,72px); }
.epilogue__block { margin-top: clamp(72px,11vh,128px); }
.epilogue__block-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 24px; }
.epilogue__block-head h3 { font-size: clamp(24px,3vw,36px); }
.epilogue__block-head p { max-width: 56ch; font-size: 14.5px; font-style: italic; color: var(--color-text); }

/* Carrusel de línea de tiempo */
.tl-head { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 4px; }
.tl-nav-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--color-primary);
  color: var(--color-primary); display: flex; align-items: center; justify-content: center;
  transition: background .25s ease, color .25s ease;
}
.tl-nav-btn:hover, .tl-nav-btn:focus-visible { background: var(--color-primary); color: var(--color-surface-muted); }
.tl-track {
  display: flex; gap: clamp(14px,2vw,24px); overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-padding-left: clamp(24px,6vw,72px);
  max-width: var(--container-max); margin: 0 auto; padding: 4px clamp(24px,6vw,72px) 4px;
  scrollbar-width: none; cursor: grab; user-select: none;
}
.tl-track::-webkit-scrollbar { display: none; }
.tl-card { flex: 0 0 min(78vw, 300px); scroll-snap-align: start; display: flex; flex-direction: column; gap: 12px; }
.tl-card__num {
  aspect-ratio: 4/3; width: 100%; display: flex; align-items: center; justify-content: flex-start;
  border-top: 1px solid var(--color-border); padding-top: 14px;
  font-family: var(--font-display); font-size: clamp(40px,6vw,56px); line-height: 1; color: var(--color-accent); opacity: 0.85;
}
.tl-card__era { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--color-accent); }
.tl-card__title { font-size: 21px; line-height: 1.15; }
.tl-card__text { font-size: 14.5px; line-height: 1.6; color: var(--color-secondary); }
.tl-progress { position: relative; height: 1px; background: var(--color-border); margin-top: 20px; }
.tl-progress__fill { position: absolute; left: 0; top: -1px; height: 3px; width: 10%; background: var(--color-accent); transition: width .2s ease; }

/* Visualizaciones con pestañas */
.viz-tabs { display: flex; flex-wrap: wrap; gap: 4px 26px; border-bottom: 1px solid var(--color-border); }
.viz-tab {
  padding: 13px 0; margin-bottom: -1px; font-size: 15px; color: var(--color-primary);
  border-bottom: 2px solid transparent; opacity: 0.55; transition: opacity .25s ease, border-color .25s ease;
}
.viz-tab.is-active { opacity: 1; border-color: var(--color-accent); }
.viz-body { display: grid; grid-template-columns: 1fr; gap: clamp(24px,4vw,48px); margin-top: 28px; align-items: start; }
.viz-media { background: #fff; border: 1px solid var(--color-border); }
.viz-media iframe { height: 480px; }
.viz-copy h4 { font-size: 23px; margin-bottom: 10px; }
.viz-copy p { font-size: 15px; line-height: 1.65; color: var(--color-secondary); }
@media (min-width: 860px) { .viz-body { grid-template-columns: 2fr 1fr; } }

/* Mapa del carguero */
.epilogue__map-grid { display: grid; grid-template-columns: 1fr; gap: clamp(24px,4vw,56px); align-items: start; }
.epilogue__map-grid .map-embed { background: var(--color-surface-light); border: 1px solid var(--color-border); }
.map-embed iframe { aspect-ratio: 1140/700; }
@media (min-width: 860px) { .epilogue__map-grid { grid-template-columns: 1fr 2fr; } }

/* Herramientas documentadas */
.studies-grid { display: grid; grid-template-columns: 1fr; gap: 26px; margin-top: 4px; }
.studies-item { margin: 0; }
.studies-item-frame { overflow: hidden; aspect-ratio: 4/5; background: var(--color-border); }
.studies-item-frame button { display: block; width: 100%; height: 100%; padding: 0; cursor: zoom-in; }
.studies-item-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s cubic-bezier(.2,.7,.1,1); }
.studies-item-frame:hover img, .studies-item-frame:focus-within img { transform: scale(1.05); }
.studies-item figcaption { margin-top: 14px; }
.studies-item figcaption strong { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 400; }
.studies-item figcaption span { display: block; margin-top: 6px; font-size: 14px; line-height: 1.55; color: var(--color-secondary); }
@media (min-width: 700px) { .studies-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Agradecimientos ---------- */
.thanks { padding: clamp(88px,14vh,150px) 24px; background: var(--color-surface-light); }
.thanks__inner { max-width: var(--container-max); margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: clamp(28px,5vw,72px); }
.thanks__inner h2 { font-size: clamp(34px,5vw,56px); }
.thanks__body { display: flex; flex-direction: column; gap: 18px; max-width: 62ch; }
.thanks__body p { font-size: 17px; line-height: 1.75; color: var(--color-secondary); }
@media (min-width: 800px) { .thanks__inner { grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); } }

/* ---------- Cierre ---------- */
.closing { position: relative; height: min(70vh, 680px); overflow: hidden; background: var(--color-surface-light); }
.closing img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 67% 55%; }
.closing__caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: clamp(24px,5vw,56px);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px;
  background: linear-gradient(to top, rgba(251,251,243,0.96) 32%, rgba(251,251,243,0));
}
.closing__title { font-size: clamp(30px,5vw,58px); }
.closing__meta { font-style: italic; font-size: 15px; }

/* ---------- Pie institucional ---------- */
.footer { background: var(--color-surface-light); padding: 36px 24px 44px; border-top: 1px solid var(--color-border); }
.footer__inner { max-width: var(--container-max); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px 36px; }
.footer__block--text { flex: 1 1 auto; min-width: 0; }
.footer__block--logo { flex: 0 0 auto; }
.footer__text { font-size: 13.5px; line-height: 1.6; color: var(--color-secondary); max-width: 56ch; }
.footer__logo { display: block; height: 80px; width: auto; }
.footer__year { display: block; max-width: var(--container-max); margin: 20px auto 0; font-size: 12.5px; color: var(--color-text); }

@media (max-width: 700px) {
  .footer__inner { flex-direction: column; align-items: stretch; gap: 24px; }
  .footer__block--logo { display: flex; justify-content: flex-end; }
}

/* ---------- Botón volver arriba ---------- */
.scroll-to-top {
  position: fixed; bottom: 20px; right: 20px; z-index: 90; width: 42px; height: 42px;
  border-radius: 50%; background: var(--color-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity var(--transition-slow) ease, visibility var(--transition-slow) ease;
}
.scroll-to-top.is-visible { opacity: 1; visibility: visible; }
.scroll-to-top:hover, .scroll-to-top:focus-visible { opacity: 0.85; }
.scroll-to-top svg { width: 20px; height: 16px; fill: currentColor; }

/* ---------- Visor de imágenes ---------- */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 500; background: rgba(15,20,24,0.94);
  justify-content: center; align-items: center; padding: 64px 20px 32px;
}
.lightbox.is-open { display: flex; }
.lightbox-content { display: flex; flex-direction: column; align-items: center; max-width: 92vw; max-height: 92vh; gap: 18px; }
.lightbox img { max-width: 92vw; max-height: 70vh; object-fit: contain; }
.lightbox-caption { max-width: 640px; text-align: center; color: #fff; font-family: var(--font-primary); font-size: 14px; line-height: 1.5; }
.lightbox-caption strong { display: block; font-family: var(--font-display); font-size: 17px; margin-bottom: 6px; font-weight: 400; }
.lightbox-caption span { opacity: 0.82; }
.lightbox-close {
  position: absolute; top: 18px; right: 20px; width: 44px; height: 44px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}

/* ---------- Revelado en scroll ---------- */
[data-rv] { opacity: 0; transform: translateY(30px); transition: opacity 1s ease, transform 1.1s cubic-bezier(.2,.7,.1,1); }
[data-rv].is-revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-rv] { opacity: 1; transform: none; transition: none; } }

/* ---------- Utilidad: enfoque visible consistente ---------- */
a:focus-visible, button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

/* ---------- Impresión ---------- */
@media print {
  .site-header, .pp-badge, .thread-bar, .index-menu, .scroll-to-top, .lightbox, .map-embed, .viz-media { display: none !important; }
  body { background: #fff; }
}
