/* =========================================================
   Revista digital #LaVuceLee 2026
   Escuela de Policía Juan Vucetich · Instituto Universitario Juan Vucetich
   ========================================================= */

:root {
  /* Paleta tomada del afiche original del proyecto */
  --celeste: #1a99d6;
  --celeste-oscuro: #0f6fa3;
  --celeste-claro: #d7eefb;
  --violeta: #9282be;
  --violeta-oscuro: #6b5a9c;
  --lavanda: #e2deee;
  --tinta: #16213a;
  --tinta-suave: #4a5570;
  --papel: #fffdf8;
  --papel-sombra: #efe9db;
  --blanco: #ffffff;
  --fondo-1: #0b2a40;
  --fondo-2: #123f61;

  --fuente-ui: "Encode Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --fuente-editorial: "Fraunces", "Georgia", "Times New Roman", serif;

  --radio: 14px;
  --sombra-libro: 0 30px 60px -20px rgba(0, 0, 0, .55), 0 10px 25px -10px rgba(0, 0, 0, .35);
  --duracion-vuelta: .95s;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--fuente-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--blanco);
  background: radial-gradient(120% 90% at 50% 0%, var(--fondo-2) 0%, var(--fondo-1) 70%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 2px;
}

.visualmente-oculto {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Estructura general ---------- */

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.barra {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(8, 30, 48, .55);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.barra__marca {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.barra__marca strong {
  font-weight: 800;
  letter-spacing: .01em;
  white-space: nowrap;
}

.barra__marca small {
  display: block;
  font-size: 12px;
  opacity: .75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.barra__sello {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--violeta);
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 18px;
  flex: none;
}

.barra__acciones {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.boton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  color: var(--blanco);
  cursor: pointer;
  transition: background .2s, transform .15s;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.boton:hover { background: rgba(255, 255, 255, .16); }
.boton:active { transform: scale(.97); }
.boton svg { width: 20px; height: 20px; flex: none; }
.boton--icono { padding: 0; width: 44px; justify-content: center; }
.boton--primario { background: var(--violeta); border-color: var(--violeta); }
.boton--primario:hover { background: var(--violeta-oscuro); }

@media (max-width: 720px) {
  .barra { padding: 8px 10px; gap: 8px; }
  .barra__sello, .barra__marca small { display: none; }
  .barra__marca strong { font-size: 15px; }
  .boton span { display: none; }
  .boton { padding: 0; width: 42px; min-width: 42px; justify-content: center; }
  .barra__acciones { flex-wrap: nowrap; gap: 4px; }
}

/* ---------- Escenario y libro ---------- */

.escenario {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  min-height: 0;
}

.nav {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .1);
  color: var(--blanco);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s, opacity .2s;
  z-index: 20;
}

.nav:hover { background: rgba(255, 255, 255, .22); }
.nav[disabled] { opacity: .25; cursor: default; }
.nav svg { width: 24px; height: 24px; }

@media (max-width: 720px) {
  .escenario { grid-template-columns: 1fr; padding: 8px 8px 0; }
  .nav { display: none; }
}

/* El contenedor de consulta es el hueco real entre las flechas, no todo el escenario */
.libro-contenedor {
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: grid;
  place-items: center;
  container-type: size;
}

/* Al abrir un enlace directo las hojas se ubican sin animación */
.libro.sin-transicion .hoja { transition: none !important; }

.libro {
  position: relative;
  perspective: 3200px;
  /* Sin preserve-3d acá: cada hoja arma su propio contexto 3D y el orden lo decide z-index */
  user-select: none;
  touch-action: pan-y;
}

/* Proporción de cada página: 3:4 (un poco más ancha que A4 para ganar tamaño en pantalla) */
.libro[data-modo="doble"] {
  aspect-ratio: 1.5;
  height: min(100cqh, calc(100cqw / 1.5));
}

.libro[data-modo="simple"] {
  aspect-ratio: 0.68;
  height: min(100cqh, calc(100cqw / 0.68));
}

/* La sombra del lomo solo en modo doble */
.libro[data-modo="doble"]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radio);
  box-shadow: var(--sombra-libro);
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
}

.libro[data-modo="doble"].abierto::before { opacity: 1; }

.hoja {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform var(--duracion-vuelta) cubic-bezier(.45, .05, .2, 1);
  will-change: transform;
}

.hoja.volteada { transform: rotateY(-180deg); }

.pagina {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--papel);
  color: var(--tinta);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  container-type: size;
  box-shadow: var(--sombra-libro);
}

/* Las unidades cqw se resuelven contra el contenedor ancestro, por eso el tamaño
   de letra va en un envoltorio interior y no en .pagina */
.pagina__interior {
  position: absolute;
  inset: 0;
  font-size: max(11px, 2.45cqw);
  line-height: 1.45;
}

.pagina--frente { border-radius: 0 var(--radio) var(--radio) 0; }
.pagina--dorso  { border-radius: var(--radio) 0 0 var(--radio); transform: rotateY(180deg); }

/* Sombra del pliegue */
.pagina--frente::after,
.pagina--dorso::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 7%;
  pointer-events: none;
  z-index: 3;
}
.pagina--frente::after { left: 0; background: linear-gradient(90deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, 0)); }
.pagina--dorso::after  { right: 0; background: linear-gradient(270deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, 0)); }

/* Modo simple (celular): una página por vez, sin 3D */
.libro[data-modo="simple"] .hoja {
  left: 0;
  width: 100%;
  transform: none !important;
  transition: none;
  pointer-events: none;
}

.libro[data-modo="simple"] .pagina {
  transform: none;
  border-radius: var(--radio);
  opacity: 0;
  transition: opacity .35s ease, translate .35s ease;
  translate: 14px 0;
  pointer-events: none;
}

.libro[data-modo="simple"] .pagina::after { display: none; }

.libro[data-modo="simple"] .hoja.activa { pointer-events: auto; z-index: 60; }
.libro[data-modo="simple"] .pagina.activa {
  opacity: 1;
  translate: 0 0;
  pointer-events: auto;
  z-index: 2;
}

/* Arrastre táctil: la hoja actual sigue al dedo y la siguiente asoma debajo */
.libro[data-modo="simple"] .pagina { transition: opacity .35s ease, translate .35s ease, transform .3s ease, box-shadow .3s ease; }
.libro[data-modo="simple"].arrastrando .pagina { transition: none; }
.libro[data-modo="simple"] .hoja.hoja-vecina { z-index: 59; }
.libro[data-modo="simple"] .pagina.vecina { opacity: 1; translate: 0 0; z-index: 1; }

/* El texto se puede desplazar en vertical; el gesto horizontal queda para pasar hojas */
.pagina, .pag { touch-action: pan-y; }

@media (prefers-reduced-motion: reduce) {
  .hoja { transition: none; }
  .libro[data-modo="simple"] .pagina { transition: none; translate: 0 0; }
}

/* ---------- Pie: progreso ---------- */

.pie {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 8px 16px 12px;
  background: rgba(8, 30, 48, .55);
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 13px;
}

.pie__texto { white-space: nowrap; opacity: .85; min-width: 11ch; }
.pie__seccion { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }

.pie__rango {
  width: 100%;
  accent-color: var(--violeta);
  height: 44px;
  margin: 0;
  cursor: pointer;
}

@media (max-width: 720px) {
  .pie { grid-template-columns: auto 1fr; }
  .pie__seccion { display: none; }
  .pie__ayuda { display: none; }
}

/* ---------- Contenido de las páginas ---------- */

.pag {
  position: absolute;
  inset: 0;
  padding: 7% 8% 9%;
  display: flex;
  flex-direction: column;
  gap: 1.2em;
  overflow: auto;
  scrollbar-width: thin;
}

.pag--sin-padding { padding: 0; overflow: hidden; }

.folio {
  position: absolute;
  bottom: 3.2%;
  font-size: .72em;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tinta-suave);
  z-index: 4;
}
.pagina--frente .folio { right: 8%; }
.pagina--dorso .folio { left: 8%; }
.folio--claro { color: rgba(255, 255, 255, .75); }

.pag h1, .pag h2, .pag h3 { margin: 0; line-height: 1.12; }
.pag h2 {
  font-family: var(--fuente-editorial);
  font-weight: 600;
  font-size: 1.85em;
  letter-spacing: -.01em;
  color: var(--tinta);
}
.pag h3 {
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  color: var(--celeste-oscuro);
}
.pag p { margin: 0; }
.pag p + p { margin-top: .7em; }

.antetitulo {
  font-size: .78em;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-weight: 700;
  color: var(--violeta-oscuro);
}

.texto-editorial {
  font-family: var(--fuente-editorial);
  font-size: 1.04em;
  line-height: 1.5;
  color: #222a44;
}

.texto-editorial p:first-child::first-letter {
  float: left;
  font-size: 3.4em;
  line-height: .85;
  padding: .08em .12em 0 0;
  color: var(--celeste);
  font-weight: 700;
}

.hashtag {
  display: inline-block;
  font-weight: 800;
  color: var(--celeste-oscuro);
  letter-spacing: -.01em;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  padding: .35em .8em;
  border-radius: 999px;
  background: var(--celeste-claro);
  color: var(--celeste-oscuro);
  font-weight: 700;
  font-size: .82em;
  line-height: 1.2;
}

.chip--violeta { background: var(--lavanda); color: var(--violeta-oscuro); }

.lista-limpia { list-style: none; margin: 0; padding: 0; }

.regla { height: 2px; background: linear-gradient(90deg, var(--celeste), var(--violeta)); border: 0; margin: 0; width: 22%; }

/* Portada */

.portada {
  background: var(--celeste);
  color: var(--blanco);
  overflow: hidden;
}

.portada__huella {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .14;
  mix-blend-mode: multiply;
}

.portada__logos {
  position: relative;
  z-index: 2;
  width: 92%;
  margin: 6% auto 0;
}

.portada__cuerpo {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .6em;
  padding: 0 0 12%;
}

.portada__banda {
  background: var(--violeta);
  padding: .5em 8% .55em;
  font-weight: 800;
  font-size: 1.75em;
  line-height: 1.15;
  letter-spacing: -.01em;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .35);
}

.portada__banda span { font-weight: 500; opacity: .92; }

.portada__bajada {
  padding: 0 8%;
  font-size: .95em;
  max-width: 34ch;
  opacity: .95;
}

.portada__revista {
  position: absolute;
  top: 24%;
  right: 8%;
  z-index: 2;
  text-align: right;
  font-family: var(--fuente-editorial);
  font-style: italic;
  font-size: 1.05em;
  opacity: .95;
}

.portada__esquina {
  position: absolute;
  right: 0; bottom: 0;
  width: 60%;
  height: 9%;
  background: var(--violeta);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

.portada__pie {
  position: absolute;
  left: 8%; bottom: 3.5%;
  z-index: 3;
  font-size: .75em;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .9;
}

/* Contratapa */

.contratapa {
  background: linear-gradient(160deg, var(--violeta) 0%, var(--violeta-oscuro) 100%);
  color: var(--blanco);
}

.contratapa .pag { justify-content: space-between; }
.contratapa h2 { color: var(--blanco); }
.contratapa__logos { width: 100%; margin-top: 1em; }
.contratapa__creditos { font-size: .88em; opacity: .95; }
.contratapa__creditos dt { font-weight: 700; margin-top: .6em; font-size: .8em; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.contratapa__creditos dd { margin: 0; }
.contratapa a { color: var(--blanco); }

.enlace-boton {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  padding: .55em 1em;
  border-radius: 999px;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .35);
  text-decoration: none;
  font-weight: 700;
  font-size: .85em;
  min-height: 2.6em;
}
.enlace-boton:hover { background: rgba(255, 255, 255, .25); }
.enlace-boton svg { width: 1.2em; height: 1.2em; }

/* Ejes y actividades */

.tarjetas {
  display: grid;
  gap: .7em;
  grid-template-columns: 1fr 1fr;
}

.tarjeta {
  border-radius: .6em;
  padding: .85em .9em;
  background: var(--celeste-claro);
  color: var(--tinta);
  display: flex;
  flex-direction: column;
  gap: .3em;
}

.tarjeta--violeta { background: var(--lavanda); }
.tarjeta__num { font-family: var(--fuente-editorial); font-size: 1.9em; line-height: 1; color: var(--celeste); font-weight: 700; }
.tarjeta--violeta .tarjeta__num { color: var(--violeta); }
.tarjeta h4 { margin: 0; font-size: .95em; line-height: 1.2; }
.tarjeta p { font-size: .82em; color: var(--tinta-suave); }

/* Mapa de sedes */

.sedes-grilla {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .45em .9em;
  font-size: .88em;
}

.sede-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .6em;
  align-items: start;
  padding: .45em 0;
  border-bottom: 1px solid var(--papel-sombra);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: .3em;
}
.sede-item:hover { background: #f6f3ea; }
.sede-item__punto {
  width: 1.9em; height: 1.9em;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--celeste);
  color: var(--blanco);
  font-weight: 800;
  font-size: .72em;
}
.sede-item--interior .sede-item__punto { background: var(--violeta); }
.sede-item strong { display: block; line-height: 1.15; }
.sede-item small { display: block; color: var(--tinta-suave); font-size: .85em; line-height: 1.2; }

.leyenda { display: flex; gap: 1.2em; font-size: .78em; color: var(--tinta-suave); }
.leyenda span::before {
  content: "";
  display: inline-block;
  width: .9em; height: .9em;
  border-radius: 50%;
  margin-right: .4em;
  vertical-align: -.1em;
  background: var(--celeste);
}
.leyenda span:last-child::before { background: var(--violeta); }

/* Página foto de sede */

.foto-sede {
  background: #0b2a40;
  color: var(--blanco);
}

.foto-sede__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.foto-sede--sin-foto {
  background: linear-gradient(160deg, var(--celeste) 0%, var(--celeste-oscuro) 55%, var(--violeta-oscuro) 100%);
}

.foto-sede__huella {
  position: absolute;
  inset: -10% -20% 0 0;
  width: 120%;
  height: 110%;
  opacity: .22;
  mix-blend-mode: multiply;
}

.foto-sede--sin-foto .foto-sede__velo { display: none; }
.foto-sede--sin-foto .foto-sede__relato { text-shadow: none; }

.foto-sede__velo {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(11, 42, 64, .55) 0%, rgba(11, 42, 64, 0) 30%, rgba(11, 42, 64, 0) 45%, rgba(11, 42, 64, .92) 100%);
}

.foto-sede__cab {
  position: absolute;
  top: 6%;
  left: 8%;
  right: 8%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1em;
  font-size: .8em;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}

.foto-sede__texto {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 9%;
  display: flex;
  flex-direction: column;
  gap: .55em;
}

.foto-sede__nombre {
  font-family: var(--fuente-editorial);
  font-size: 2.6em;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.01em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .45);
}

.foto-sede__hashtag {
  display: inline-block;
  align-self: flex-start;
  background: var(--violeta);
  padding: .3em .7em;
  font-weight: 800;
  font-size: 1.15em;
  border-radius: .25em;
  letter-spacing: -.01em;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.foto-sede__relato {
  font-size: .86em;
  line-height: 1.4;
  opacity: .95;
  max-width: 44ch;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
}

.foto-sede__relato--caja {
  background: rgba(11, 42, 64, .62);
  backdrop-filter: blur(4px);
  padding: .8em .9em;
  border-radius: .4em;
  text-shadow: none;
  border-left: 3px solid var(--celeste);
}

/* Página texto de sede */

.sede-cab {
  display: flex;
  flex-direction: column;
  gap: .4em;
}

.sede-cab__fila {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
}

.sede-cab__nombre {
  font-family: var(--fuente-editorial);
  font-size: 1.9em;
  font-weight: 600;
  line-height: 1.05;
}

.sede-cab__num {
  font-family: var(--fuente-editorial);
  font-size: 2.6em;
  line-height: 1;
  color: var(--lavanda);
  font-weight: 700;
}

.sede-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25em .9em;
  font-size: .82em;
  color: var(--tinta-suave);
}
.sede-meta dt { font-weight: 700; color: var(--tinta); }
.sede-meta dd { margin: 0; }

.fundamentacion {
  font-family: var(--fuente-editorial);
  font-size: .98em;
  line-height: 1.5;
  color: #222a44;
  hanging-punctuation: first;
}

.fundamentacion p:first-child::first-letter {
  float: left;
  font-size: 3.1em;
  line-height: .85;
  padding: .08em .12em 0 0;
  color: var(--violeta);
  font-weight: 700;
}

.firma {
  font-size: .82em;
  color: var(--tinta-suave);
  border-left: 3px solid var(--celeste);
  padding-left: .8em;
}
.firma strong { color: var(--tinta); display: block; }

/* Producciones (media) */

.producciones {
  display: grid;
  gap: .6em;
}

.produccion {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .8em;
  align-items: center;
  padding: .7em .8em;
  border-radius: .6em;
  background: #f4f1e8;
  border: 1px solid var(--papel-sombra);
}

.produccion__icono {
  width: 2.6em; height: 2.6em;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--celeste);
  color: var(--blanco);
  flex: none;
}
.produccion__icono svg { width: 1.3em; height: 1.3em; }
.produccion--video .produccion__icono { background: var(--violeta); }
.produccion--carta .produccion__icono { background: #c98a2e; }
.produccion--imagen .produccion__icono { background: #2f8f6b; }

.produccion__cuerpo { min-width: 0; display: flex; flex-direction: column; gap: .3em; }
.produccion__titulo { font-weight: 700; line-height: 1.2; }
.produccion__detalle { font-size: .8em; color: var(--tinta-suave); }
.produccion audio { width: 100%; height: 2.4em; }
.produccion__acciones { display: flex; gap: .5em; flex-wrap: wrap; }

.enlace-chico {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  font-size: .78em;
  font-weight: 700;
  color: var(--celeste-oscuro);
  text-decoration: none;
  min-height: 2.2em;
  padding: 0 .2em;
}
.enlace-chico:hover { text-decoration: underline; }
.enlace-chico svg { width: 1.1em; height: 1.1em; }

.video-marco {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: .5em;
  overflow: hidden;
  background: #000;
}
.video-marco img { width: 100%; height: 100%; object-fit: cover; opacity: .75; }
.video-marco iframe,
.video-marco video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.video-marco__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.video-marco__play span {
  width: 3.2em; height: 3.2em;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--violeta-oscuro);
  display: grid; place-items: center;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .6);
  transition: transform .2s;
}
.video-marco__play:hover span { transform: scale(1.06); }
.video-marco__play svg { width: 1.5em; height: 1.5em; margin-left: .15em; }

/* Página carta */

.carta {
  background:
    radial-gradient(130% 80% at 100% 0%, rgba(146, 130, 190, .12), transparent 50%),
    repeating-linear-gradient(0deg, transparent 0 2.1em, rgba(26, 153, 214, .07) 2.1em calc(2.1em + 1px)),
    #fdfaf1;
}

.carta .pag { gap: .9em; }

.carta__destinatario {
  font-family: var(--fuente-editorial);
  font-size: 1.6em;
  font-weight: 600;
  line-height: 1.1;
}

.carta__cuerpo {
  font-family: var(--fuente-editorial);
  font-size: .98em;
  line-height: 1.5;
  color: #2a2f45;
}

.carta__cuerpo p + p { margin-top: .6em; }

.carta__firma {
  font-family: var(--fuente-editorial);
  font-style: italic;
  font-size: .95em;
  color: var(--tinta-suave);
  text-align: right;
}

.cita-destacada {
  font-family: var(--fuente-editorial);
  font-size: 1.25em;
  line-height: 1.3;
  color: var(--celeste-oscuro);
  border-left: 4px solid var(--violeta);
  padding: .2em 0 .2em .8em;
  font-weight: 500;
}

/* Galería */

.galeria {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* minmax(0, 1fr): las filas reparten el alto disponible y no crecen con la foto */
  grid-auto-rows: minmax(0, 1fr);
  gap: .4em;
  flex: 1 1 0;
  min-height: 0;
}

.galeria img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  border-radius: .35em;
}

.galeria .grande { grid-column: span 2; grid-row: span 2; }

.promo-bucle {
  background: linear-gradient(160deg, var(--celeste) 0%, var(--celeste-oscuro) 100%);
  color: var(--blanco);
}

.promo-bucle .pag { justify-content: center; align-items: flex-start; gap: 1em; }
.promo-bucle h2 { color: var(--blanco); font-size: 2.3em; }
.promo-bucle p { max-width: 36ch; opacity: .95; }
.promo-bucle .antetitulo { color: var(--lavanda); }

.sedes-lista-compacta {
  display: flex;
  flex-wrap: wrap;
  gap: .4em;
  font-size: .78em;
}
.sedes-lista-compacta span {
  padding: .3em .7em;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25);
}

/* ---------- Índice (dialog) ---------- */

.indice {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(92vw, 560px);
  max-height: min(86vh, 720px);
  background: var(--papel);
  color: var(--tinta);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .6);
}
.indice::backdrop { background: rgba(5, 20, 35, .6); backdrop-filter: blur(4px); }

.indice__cab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 10px;
  border-bottom: 1px solid var(--papel-sombra);
}
.indice__cab h2 { margin: 0; font-family: var(--fuente-editorial); font-size: 26px; font-weight: 600; }
.indice__cerrar { color: var(--tinta); border-color: var(--papel-sombra); background: #f4f1e8; }

.indice__lista {
  list-style: none;
  margin: 0;
  padding: 10px 10px 16px;
  overflow: auto;
  max-height: calc(86vh - 80px);
}

.indice__item button {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  min-height: 44px;
}
.indice__item button:hover { background: #f1ede2; }
.indice__item strong { display: block; }
.indice__item small { color: var(--tinta-suave); }
.indice__item .num { font-family: var(--fuente-editorial); color: var(--violeta); font-weight: 700; font-size: 18px; }
.indice__item--sede button { padding-left: 24px; }

/* ---------- Modo bucle (pantalla completa) ---------- */

.bucle {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #061a2a;
  color: var(--blanco);
  display: none;
}
.bucle[aria-hidden="false"] { display: block; }

.bucle__capa {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s ease;
  overflow: hidden;
}
.bucle__capa.visible { opacity: 1; }

.bucle__capa img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
}

.bucle__capa.visible img { animation: kenburns 9s ease-in-out forwards; }

@keyframes kenburns {
  from { transform: scale(1.02) translate(0, 0); }
  to   { transform: scale(1.12) translate(-1.5%, 1%); }
}

.bucle__capa--titulo {
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(150deg, var(--celeste) 0%, var(--celeste-oscuro) 55%, var(--violeta-oscuro) 100%);
}

.bucle__titulo-caja { display: flex; flex-direction: column; align-items: center; gap: .3em; padding: 24px; }
.bucle__titulo-caja .antetitulo { color: var(--lavanda); font-size: clamp(14px, 1.6vw, 22px); }
.bucle__titulo-caja h2 {
  margin: 0;
  font-family: var(--fuente-editorial);
  font-weight: 600;
  font-size: clamp(40px, 7vw, 110px);
  line-height: 1;
  letter-spacing: -.01em;
}
.bucle__titulo-caja .hashtag-grande {
  display: inline-block;
  background: var(--violeta);
  padding: .25em .6em;
  font-weight: 800;
  font-size: clamp(22px, 3.4vw, 56px);
  border-radius: .2em;
  margin-top: .3em;
}
.bucle__titulo-caja .temas {
  margin-top: 1.2em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5em;
  max-width: 900px;
  font-size: clamp(13px, 1.3vw, 20px);
}
.bucle__titulo-caja .temas span {
  padding: .35em .9em;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
}

.bucle__velo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 26, 42, .55) 0%, transparent 25%, transparent 60%, rgba(6, 26, 42, .85) 100%);
}

.bucle__logos {
  position: absolute;
  top: 24px;
  left: 50%;
  translate: -50% 0;
  width: min(92vw, 1100px);
  pointer-events: none;
}

.bucle__pie {
  position: absolute;
  left: 4vw;
  right: 4vw;
  bottom: 5vh;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.bucle__caption { display: flex; flex-direction: column; gap: 6px; max-width: 70vw; }
.bucle__caption .sede {
  font-family: var(--fuente-editorial);
  font-size: clamp(28px, 4.5vw, 72px);
  line-height: 1;
  font-weight: 600;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .5);
}
.bucle__caption .tag {
  align-self: flex-start;
  background: var(--violeta);
  padding: .2em .6em;
  font-weight: 800;
  font-size: clamp(16px, 2vw, 32px);
  border-radius: .2em;
}
.bucle__caption .tema { font-size: clamp(13px, 1.3vw, 20px); opacity: .9; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }

.bucle__marca {
  text-align: right;
  font-weight: 800;
  font-size: clamp(16px, 2vw, 30px);
  text-shadow: 0 2px 16px rgba(0, 0, 0, .5);
}
.bucle__marca small { display: block; font-weight: 500; font-size: .55em; opacity: .85; }

.bucle__controles {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity .3s;
}
.bucle:hover .bucle__controles,
.bucle:focus-within .bucle__controles,
.bucle.mostrar-controles .bucle__controles { opacity: 1; }

.bucle__barra {
  position: absolute;
  left: 0; bottom: 0;
  height: 4px;
  background: var(--violeta);
  width: 0;
}
.bucle__barra.animar { animation: avance var(--bucle-duracion, 8s) linear forwards; }
@keyframes avance { from { width: 0; } to { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .bucle__capa.visible img { animation: none; }
}

/* ---------- Ayuda flotante inicial ---------- */

.ayuda {
  position: absolute;
  left: 50%;
  bottom: 12px;
  translate: -50% 0;
  background: rgba(8, 30, 48, .85);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
  z-index: 30;
  text-align: center;
  max-width: calc(100% - 24px);
}
.ayuda.visible { opacity: 1; }

@media (max-width: 720px) {
  .ayuda { font-size: 12px; padding: 6px 12px; border-radius: 14px; }
  .bucle__logos { width: 58vw; left: 4vw; translate: 0 0; top: 14px; }
  .bucle__controles { top: 10px; right: 10px; }
  .bucle__controles .boton span { display: none; }
  .bucle__controles .boton { padding: 0; width: 42px; justify-content: center; }
}

/* ---------- Impresión ---------- */

@media print {
  @page { size: A4 portrait; margin: 0; }

  html, body { height: auto; overflow: visible; background: #fff; }
  .barra, .pie, .nav, .ayuda, .bucle, .indice { display: none !important; }
  .app { display: block; }
  .escenario { display: block; padding: 0; container-type: normal; }
  .libro-contenedor { display: block; container-type: normal; height: auto; }
  .libro, .libro[data-modo] {
    height: auto !important;
    aspect-ratio: auto;
    perspective: none;
    width: 210mm;
    margin: 0 auto;
  }
  .hoja, .libro[data-modo] .hoja {
    position: static;
    width: 210mm;
    height: auto;
    transform: none !important;
    transition: none;
  }
  .pagina, .libro[data-modo] .pagina {
    position: relative;
    width: 210mm;
    height: 297mm;
    transform: none !important;
    opacity: 1 !important;
    translate: 0 0 !important;
    border-radius: 0;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
  }
  .pagina__interior { font-size: 11.5pt; }
  .pagina::after { display: none; }
  .pag { overflow: hidden; padding: 6% 8% 8%; gap: 1em; }
  /* En papel no hay reproductores: queda el título y el enlace (clickeable en el PDF) */
  .video-marco, .produccion audio { display: none; }
}
