/* ==========================================================================
   LA CHINA — hoja de estilos principal
   Tokens: negro cálido, crema de papel, rojo del logo, latón envejecido
   Tipos:  Cinzel (versales de rótulo) + EB Garamond (texto)
   ========================================================================== */

:root {
  --ink: #15110d;
  --cream: #f6f1e7;
  --china-red: #dd040c;
  --brass: #a9803c;
  --paper-white: #fbf9f5;

  --font-display: "Cinzel", "Times New Roman", serif;
  --font-body: "EB Garamond", "Iowan Old Style", Georgia, serif;

  --nav-height: 92px;
  --ease-elegant: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   Cabecera / navegación
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  transition: background-color 0.5s var(--ease-elegant), box-shadow 0.5s var(--ease-elegant);
}

/* Sobre la foto: fondo transparente con velo superior para legibilidad */
body.has-hero .site-header {
  background: transparent;
}

body.has-hero .site-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(10, 8, 6, 0.55) 0%, rgba(10, 8, 6, 0) 100%);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s var(--ease-elegant);
}

body.has-hero .site-header.is-scrolled {
  background: var(--cream);
  box-shadow: 0 1px 0 rgba(21, 17, 13, 0.08);
}

body.has-hero .site-header.is-scrolled::before {
  opacity: 0;
}

body.has-hero .site-header.is-scrolled .nav-link {
  color: var(--ink);
}

body.has-hero .site-header.is-scrolled .nav-toggle span {
  background: var(--ink);
}

/* En páginas sin hero: cabecera sólida, mismo crema que en Historia */
body:not(.has-hero) .site-header {
  background: var(--cream);
  box-shadow: 0 1px 0 rgba(21, 17, 13, 0.08);
}

/* Historia: sin foto de fondo, el menú comparte el mismo crema que el
   resto de la página, igual que en Pedro y Paca al hacer scroll */
body.story-page .site-header {
  background: var(--cream);
}

.nav {
  position: relative;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
}

.nav-logo {
  position: absolute;
  left: clamp(20px, 4vw, 56px);
  top: 50%;
  transform: translateY(-50%);
  height: 32px;
  display: flex;
  align-items: center;
  opacity: 1;
  transition: opacity 0.5s var(--ease-elegant);
  z-index: 5;
}

.nav-logo img {
  height: 100%;
  width: auto;
  display: block;
}

/* Nota: index.html es la única página has-hero sin logo en el menú,
   así que el logo se muestra siempre en el resto de páginas con hero */

.nav-list {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 44px);
  list-style: none;
  margin: 0 auto;
  padding: 0;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding-bottom: 9px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper-white);
  white-space: nowrap;
  transition: color 0.3s ease, letter-spacing 0.4s var(--ease-elegant);
}

body:not(.has-hero) .nav-link {
  color: var(--ink);
}

/* La línea que subraya al pasar el ratón */
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.45s var(--ease-elegant), background-color 0.3s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  letter-spacing: 0.19em;
  outline: none;
}

.nav-link:hover::after,
.nav-link:focus-visible::after {
  transform: scaleX(1);
}

/* Sección activa: raya permanente en latón, distinta de la del hover en rojo */
.nav-link.is-active::after {
  transform: scaleX(1);
  background: var(--brass);
}

.nav-link.is-active:hover::after {
  background: var(--china-red);
}

/* Botón hamburguesa (solo móvil) */
.nav-toggle {
  display: none;
  position: absolute;
  right: clamp(20px, 4vw, 56px);
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 26px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 110;
}

.nav-toggle span {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--paper-white);
  transition: transform 0.35s var(--ease-elegant), opacity 0.25s ease, background-color 0.3s ease;
}

body:not(.has-hero) .nav-toggle span {
  background: var(--ink);
}

.nav-toggle span:nth-child(1) { top: 2px; }
.nav-toggle span:nth-child(2) { top: 12px; }
.nav-toggle span:nth-child(3) { top: 22px; }

.nav-toggle[aria-expanded="true"] span {
  background: var(--paper-white);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  top: 12px;
  transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  top: 12px;
  transform: rotate(-45deg);
}

/* ==========================================================================
   Hero — portada (se contrae al hacer scroll hasta quedar en franja fija)
   ========================================================================== */

.hero-spacer {
  height: 85vh;
}

.hero {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--ink);
  z-index: 50;
  will-change: height;
}

.hero.is-collapsed {
  box-shadow: 0 18px 30px -16px rgba(0, 0, 0, 0.45);
}

.hero-photo {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 30%;
  filter: grayscale(1) contrast(1.08) brightness(1.03);
}

/* Viñeta general para que la cabecera y la marca destaquen sobre la foto */
.hero-scrim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 55% 42% at 50% 52%, rgba(8, 6, 4, 0.55) 0%, rgba(8, 6, 4, 0) 70%),
    linear-gradient(to top, rgba(8, 6, 4, 0.5) 0%, rgba(8, 6, 4, 0) 22%),
    linear-gradient(to bottom, rgba(8, 6, 4, 0.45) 0%, rgba(8, 6, 4, 0) 26%);
  pointer-events: none;
}

/* Aclara progresivamente al hacer scroll, hasta fundirse con el crema de la página */
.hero-tint {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--cream);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.hero-mark {
  position: absolute;
  left: 50%;
  top: 49%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(560px, 78vw);
  animation: mark-in 1.4s var(--ease-elegant) both;
  animation-delay: 0.15s;
  will-change: top, width;
}

@keyframes mark-in {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.hero-logo {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.4));
}

.hero-dates {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin: 22px 0 0;
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: var(--paper-white);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s linear;
  will-change: opacity, transform;
  white-space: nowrap;
}

.hero-dates-rule {
  width: 44px;
  height: 1px;
  background: var(--brass);
}

/* ==========================================================================
   Bienvenida — texto tras la contracción del hero
   ========================================================================== */

.welcome {
  position: relative;
  z-index: 1;
  background: var(--cream);
  padding: calc(var(--hero-min-height, 240px) + 6px) 24px 120px;
}

.welcome-inner {
  max-width: 660px;
  margin: 0 auto;
}

.welcome-eyebrow {
  display: block;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--china-red);
  margin-bottom: 40px;
}

.welcome-text p {
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.85;
  color: rgba(21, 17, 13, 0.82);
  margin: 0 0 28px;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.welcome-text p:first-of-type::first-letter,
.duo-col-text p:first-of-type::first-letter,
.familia-text p:first-of-type::first-letter,
.story-text p:first-of-type::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.6em;
  line-height: 0.82;
  padding: 0.05em 0.1em 0 0;
  color: var(--china-red);
}

.welcome-text .welcome-closing {
  margin-top: 44px;
  text-align: center;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink);
}

.welcome-closing-rule {
  display: block;
  width: 40px;
  height: 1px;
  background: var(--brass);
  margin: 0 auto 26px;
}

/* ==========================================================================
   Páginas placeholder (Historia, Pedro y Paca, Anecdotario, Pasteleros, Archivo)
   ========================================================================== */

.placeholder {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-height) + 40px) 24px 80px;
}

.placeholder-inner {
  max-width: 560px;
  text-align: center;
}

.placeholder-eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--china-red);
  margin-bottom: 18px;
}

.placeholder-title {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  line-height: 1.3;
  margin: 0 0 18px;
  color: var(--ink);
}

.placeholder-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(21, 17, 13, 0.72);
  margin: 0 0 34px;
}

.placeholder-back {
  position: relative;
  display: inline-block;
  padding-bottom: 6px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

.placeholder-back::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-elegant);
}

.placeholder-back:hover::after {
  transform: scaleX(1);
}

/* ==========================================================================
   Menú móvil
   ========================================================================== */

@media (max-width: 860px) {
  .nav-toggle {
    display: block;
  }

  .nav-list {
    position: fixed;
    top: 0;
  left: 0;
  right: 0;
  bottom: 0;
    flex-direction: column;
    justify-content: center;
    gap: 34px;
    background: rgba(15, 12, 9, 0.98);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.4s var(--ease-elegant), transform 0.4s var(--ease-elegant), visibility 0.4s;
  }

  .nav-list.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-list .nav-link {
    font-size: 0.95rem;
    color: var(--paper-white) !important;
  }
}

@media (max-width: 480px) {
  .hero-photo {
    object-position: 68% 26%;
  }
}

/* ==========================================================================
   Pedro y Paca — doble hero (foto de Pedro a la izda., Paca a la dcha.)
   Fase 1: fotos fijas a pantalla completa que se van encogiendo.
   Fase 2: al llegar a su tamaño integrado, dejan de estar fijas y una
   imagen gemela ya colocada dentro del texto toma el relevo (crossfade),
   de modo que a partir de ahí las fotos suben con el resto del scroll.
   ========================================================================== */

.duo-spacer {
  height: 78vh;
}

.duo-photo {
  position: fixed;
  top: 0;
  width: 50vw;
  height: 100vh;
  overflow: hidden;
  background: var(--ink);
  z-index: 40;
  will-change: width, height, left, right, top, opacity;
  transition: opacity 0.3s ease;
}

.duo-photo.is-handed-off {
  opacity: 0;
  pointer-events: none;
}

.duo-photo--left {
  left: 0;
}

.duo-photo--right {
  right: 0;
}

.duo-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.06) brightness(1.02);
}

.duo-photo--left .duo-photo-img {
  object-position: 60% 22%;
}

.duo-photo--right .duo-photo-img {
  object-position: 42% 20%;
}

.duo-scrim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  transition: opacity 0.2s linear;
}

.duo-scrim--left,
.duo-scrim--right {
  background: linear-gradient(to top, rgba(8, 6, 4, 0.55) 0%, rgba(8, 6, 4, 0) 30%),
    linear-gradient(to bottom, rgba(8, 6, 4, 0.45) 0%, rgba(8, 6, 4, 0) 26%);
}

.duo-fade-veil {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--cream);
  opacity: 0;
  pointer-events: none;
}

/* Fecha y nombre sobre cada retrato — aparecen con un fundido suave
   0,5 s después de cargar la página, aprovechando la viñeta oscura que
   ya llevaba el degradado inferior de .duo-scrim */
.duo-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 64px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  opacity: 0;
  transform: translateY(14px);
  animation: duo-caption-in 0.9s var(--ease-elegant) forwards;
  animation-delay: 0.5s;
  pointer-events: none;
}

.duo-caption-name {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  letter-spacing: 0.07em;
  color: var(--paper-white);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.duo-caption-dates {
  font-family: var(--font-display);
  font-size: 0.76rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(251, 249, 245, 0.85);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

@keyframes duo-caption-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.duo-text {
  position: relative;
  z-index: 1;
  background: var(--cream);
  padding: calc(var(--nav-height) + 30px) 0 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: clamp(28px, 5vw, 90px);
  max-width: 1280px;
  margin: 0 auto;
  padding-left: clamp(24px, 5vw, 64px);
  padding-right: clamp(24px, 5vw, 64px);
}

.duo-col-text p {
  font-size: clamp(1rem, 1.4vw, 1.1rem);
  line-height: 1.8;
  color: rgba(21, 17, 13, 0.82);
  margin: 0 0 24px;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.duo-col-text p:first-of-type::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.2em;
  line-height: 0.82;
  padding: 0.05em 0.1em 0 0;
  color: var(--china-red);
}

/* Imagen "gemela", ya colocada en el flujo del texto; aparece cuando la
   versión fija termina su recorrido y a partir de ahí sube con el scroll */
.duo-inline-photo {
  width: 320px;
  height: auto;
  opacity: 0;
  object-fit: cover;
  transition: opacity 0.3s ease;
  filter: grayscale(1) contrast(1.06) brightness(1.02);
}

.duo-inline-photo.is-visible {
  opacity: 1;
}

.duo-col--pedro .duo-inline-photo {
  float: left;
  margin: 4px 24px 16px 0;
  object-position: 60% 22%;
}

.duo-col--paca .duo-inline-photo {
  float: right;
  margin: 4px 0 16px 24px;
  object-position: 42% 20%;
}

/* ==========================================================================
   Familia — foto y texto de cierre (sin título)
   ========================================================================== */

.familia {
  position: relative;
  z-index: 1;
  background: var(--cream);
  padding: 16px 24px 130px;
  border-top: 1px solid rgba(169, 128, 60, 0.28);
}

.familia-figure {
  max-width: 980px;
  margin: 30px auto 40px;
}

.familia-img {
  width: 100%;
  height: auto;
  display: block;
  filter: saturate(1.05) contrast(1.02);
}

.familia-caption {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(21, 17, 13, 0.6);
}

.familia-text {
  max-width: 980px;
  margin: 0 auto;
}

.familia-text p {
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.85;
  color: rgba(21, 17, 13, 0.82);
  margin: 0 0 28px;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

/* ==========================================================================
   Pedro y Paca — versión móvil (sin fijado ni animación, imágenes en flujo)
   ========================================================================== */

@media (max-width: 1100px) and (min-width: 861px) {
  .duo-inline-photo {
    width: 230px;
  }
}

@media (max-width: 860px) {
  .duo-spacer {
    height: 58vh;
  }

  .duo-photo {
    width: 100%;
    height: 50vh;
  }

  .duo-photo--left {
    top: 0;
    left: 0;
  }

  .duo-photo--right {
    top: 50vh;
    right: 0;
  }

  .duo-caption {
    bottom: 28px;
  }

  .duo-caption-name {
    font-size: 1rem;
  }

  .duo-caption-dates {
    font-size: 0.68rem;
  }

  .duo-text {
    grid-template-columns: 1fr;
    padding-top: 50px;
    row-gap: 60px;
  }

  .duo-inline-photo {
    opacity: 1;
    float: none;
    width: 100%;
    margin: 0 0 24px;
  }

  .familia-figure {
    margin-top: 20px;
  }
}

/* ==========================================================================
   Archivo Histórico — cabecera de página, cuadrícula de subsecciones
   ========================================================================== */

.archive-header {
  padding: calc(var(--nav-height) + 64px) 24px 20px;
  text-align: center;
}

.archive-eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--china-red);
  margin-bottom: 18px;
}

.archive-title {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.7rem, 3.8vw, 2.6rem);
  line-height: 1.25;
  margin: 0 auto 20px;
  color: var(--ink);
  max-width: 720px;
}

.archive-intro {
  max-width: 620px;
  margin: 0 auto;
  font-size: 1.08rem;
  line-height: 1.75;
  color: rgba(21, 17, 13, 0.72);
}

.archive-back {
  position: relative;
  display: inline-block;
  padding-bottom: 6px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  margin-bottom: 28px;
}

.archive-back::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-elegant);
}

.archive-back:hover::after {
  transform: scaleX(1);
}

.section-grid {
  max-width: 1180px;
  margin: 30px auto 0;
  padding: 0 24px 110px;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.section-card {
  scroll-margin-top: calc(var(--nav-height) + 24px);
  flex: 1 1 240px;
  max-width: 330px;
  position: relative;
  display: block;
  text-decoration: none;
  border: 1px solid rgba(21, 17, 13, 0.1);
  background: var(--paper-white);
  overflow: hidden;
  transition: box-shadow 0.35s var(--ease-elegant), transform 0.35s var(--ease-elegant);
}

.section-card.is-active:hover {
  box-shadow: 0 18px 34px -20px rgba(21, 17, 13, 0.35);
  transform: translateY(-3px);
}

.section-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--ink);
}

.section-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.05);
  transition: transform 0.6s var(--ease-elegant);
}

.section-card.is-active:hover .section-card-media img {
  transform: scale(1.045);
}

.section-card-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
  padding: 20px 22px 14px;
}

.section-card-media {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--ink);
}

.section-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: contrast(1.05);
  transition: transform 0.6s var(--ease-elegant);
}

.section-card.is-active:hover .section-card-media img {
  transform: scale(1.045);
}

.section-card-tag {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 10px;
  background: rgba(21, 17, 13, 0.85);
  color: var(--paper-white);
  z-index: 2;
}

.section-card.is-active .section-card-tag {
  background: var(--china-red);
}

.section-card:not(.is-active) {
  cursor: default;
}

.section-card:not(.is-active) .section-card-media {
  background: rgba(21, 17, 13, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-card:not(.is-active) .section-card-media .section-card-tag {
  position: static;
  background: none;
  color: rgba(21, 17, 13, 0.4);
  padding: 0;
}

.section-card:not(.is-active) .section-card-media img {
  filter: contrast(1.05) brightness(0.8);
  opacity: 0.55;
}

/* ==========================================================================
   Archivo Histórico — Prensa (galería de documentos)
   ========================================================================== */

.press-grid {
  max-width: 1180px;
  margin: 10px auto 0;
  padding: 0 24px 120px;
  display: flex;
  flex-wrap: wrap;
  gap: 34px;
}

.press-card {
  flex: 1 1 300px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  background: var(--paper-white);
  border: 1px solid rgba(21, 17, 13, 0.1);
}

.press-card-media {
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--ink);
}

.press-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.6s var(--ease-elegant);
}

.press-card:hover .press-card-media img {
  transform: scale(1.04);
}

.press-card-body {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.press-card-source {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--china-red);
  margin-bottom: 10px;
}

.press-card-title {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 8px;
}

.press-card-byline {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: rgba(21, 17, 13, 0.55);
  margin-bottom: 14px;
  font-style: italic;
}

.press-card-desc {
  font-size: 0.96rem;
  line-height: 1.65;
  color: rgba(21, 17, 13, 0.75);
  margin: 0 0 20px;
  flex: 1;
}

.press-card-actions {
  display: flex;
  gap: 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(21, 17, 13, 0.1);
}

.press-card-action {
  position: relative;
  display: inline-block;
  padding-bottom: 5px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

.press-card-action::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-elegant);
}

.press-card-action:hover::after {
  transform: scaleX(1);
}

@media (max-width: 600px) {
  .archive-header {
    padding-top: calc(var(--nav-height) + 40px);
  }
}

/* ==========================================================================
   Historia — experiencia inmersiva a pantalla completa
   ========================================================================== */

body.story-page {
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  overflow: hidden;
  background: var(--cream);
}

.story {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  overflow: hidden;
  background: var(--cream);
}

.story-slides {
  position: relative;
  width: 100%;
  height: 100%;
}

.story-slide {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.9s var(--ease-elegant), visibility 0s linear 0.9s;
}

.story-slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
  transition: opacity 0.9s var(--ease-elegant);
}

.story-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.06) brightness(1.02);
  transform: scale(1.055);
  transition: transform 9s linear;
}

.story-slide.is-active .story-photo {
  transform: scale(1);
}

/* Diapositivas de foto vertical: imagen íntegra a un lado, texto al otro,
   con bruma alrededor que funde la fotografía con el fondo. */

.story-slide--split {
  background:
    radial-gradient(ellipse 70% 80% at 74% 46%, rgba(196, 208, 219, 0.13) 0%, rgba(196, 208, 219, 0) 68%),
    radial-gradient(ellipse 60% 60% at 18% 24%, rgba(169, 128, 60, 0.1) 0%, rgba(169, 128, 60, 0) 66%),
    linear-gradient(115deg, #14181c 0%, #1c2126 46%, #23282d 100%);
}

/* La foto va dentro de un marco ajustado a su tamaño real (lo calcula el JS),
   de modo que la máscara difumina la propia fotografía y no la columna. */
.story-photo-frame {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
  overflow: hidden;
  z-index: 0;
  /* closest-side garantiza que la disolución llega a cero en los cuatro lados:
     no queda ningún borde recto visible */
  -webkit-mask-image: radial-gradient(ellipse closest-side at 50% 48%,
    #000 0%, #000 32%, rgba(0, 0, 0, 0.9) 48%, rgba(0, 0, 0, 0.62) 64%,
    rgba(0, 0, 0, 0.28) 80%, rgba(0, 0, 0, 0.07) 92%, rgba(0, 0, 0, 0) 100%);
  mask-image: radial-gradient(ellipse closest-side at 50% 48%,
    #000 0%, #000 32%, rgba(0, 0, 0, 0.9) 48%, rgba(0, 0, 0, 0.62) 64%,
    rgba(0, 0, 0, 0.28) 80%, rgba(0, 0, 0, 0.07) 92%, rgba(0, 0, 0, 0) 100%);
}

.story-slide--split .story-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  object-fit: cover;
  filter: grayscale(1) contrast(1.14) brightness(0.94);
  transform: scale(1.05);
}

.story-slide--split.is-active .story-photo {
  transform: scale(1);
}

/* Bruma continua: envuelve la foto y se prolonga sobre la zona de texto,
   de manera que las dos mitades pertenezcan a la misma atmósfera */
.story-slide--split::before {
  content: "";
  position: absolute;
  inset: -14%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 32% 30% at 68% 30%, rgba(216, 228, 238, 0.2) 0%, rgba(216, 228, 238, 0) 72%),
    radial-gradient(ellipse 38% 26% at 80% 62%, rgba(198, 212, 226, 0.16) 0%, rgba(198, 212, 226, 0) 74%),
    radial-gradient(ellipse 40% 24% at 46% 52%, rgba(210, 222, 234, 0.13) 0%, rgba(210, 222, 234, 0) 76%),
    radial-gradient(ellipse 30% 32% at 26% 40%, rgba(226, 234, 240, 0.09) 0%, rgba(226, 234, 240, 0) 74%),
    radial-gradient(ellipse 34% 22% at 34% 82%, rgba(190, 204, 218, 0.09) 0%, rgba(190, 204, 218, 0) 74%);
  filter: blur(52px);
  opacity: 0.95;
  animation: story-humo 40s ease-in-out infinite alternate;
}

.story-slide--split-left::before {
  background:
    radial-gradient(ellipse 32% 30% at 32% 30%, rgba(216, 228, 238, 0.2) 0%, rgba(216, 228, 238, 0) 72%),
    radial-gradient(ellipse 38% 26% at 20% 62%, rgba(198, 212, 226, 0.16) 0%, rgba(198, 212, 226, 0) 74%),
    radial-gradient(ellipse 40% 24% at 54% 52%, rgba(210, 222, 234, 0.13) 0%, rgba(210, 222, 234, 0) 76%),
    radial-gradient(ellipse 30% 32% at 74% 40%, rgba(226, 234, 240, 0.09) 0%, rgba(226, 234, 240, 0) 74%),
    radial-gradient(ellipse 34% 22% at 66% 82%, rgba(190, 204, 218, 0.09) 0%, rgba(190, 204, 218, 0) 74%);
}

@keyframes story-humo {
  from { transform: translate3d(-2%, 1.5%, 0) scale(1.02); }
  to   { transform: translate3d(3%, -2%, 0) scale(1.09); }
}

/* Viñeteado: difuminado progresivo hacia negro en todo el perímetro */
.story-slide--split::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse 88% 90% at 50% 50%,
      rgba(0, 0, 0, 0) 30%,
      rgba(0, 0, 0, 0.26) 58%,
      rgba(0, 0, 0, 0.6) 77%,
      rgba(0, 0, 0, 0.88) 91%,
      #000 100%);
  box-shadow: inset 0 0 170px 34px rgba(0, 0, 0, 0.88);
}

/* Variante espejo: fotografía a la izquierda, texto a la derecha */
.story-slide--split-left .story-photo-frame {
  right: auto;
  left: 5%;
}

.story-slide--split-left .story-split-panel {
  left: auto;
  right: clamp(36px, 6.5vw, 118px);
  grid-template-columns: 1fr auto;
}

.story-slide--split-left .story-year {
  order: 2;
  text-align: right;
}

.story-slide--split-left .story-year::after {
  margin-left: auto;
}

.story-slide--split-left .story-text {
  order: 1;
}

.story-slide--split.is-active .story-photo {
  transform: scale(1);
}

/* Bruma general: velo suave sobre la unión de foto y fondo */
.story-slide--split .story-scrim {
  z-index: 1;
  background:
    radial-gradient(ellipse 62% 70% at 76% 48%, rgba(214, 224, 232, 0.09) 0%, rgba(214, 224, 232, 0) 72%),
    linear-gradient(to right, rgba(6, 8, 10, 0.8) 0%, rgba(6, 8, 10, 0.22) 38%, rgba(6, 8, 10, 0) 58%);
}

.story-slide--split-left .story-scrim {
  background:
    radial-gradient(ellipse 62% 70% at 24% 48%, rgba(214, 224, 232, 0.09) 0%, rgba(214, 224, 232, 0) 72%),
    linear-gradient(to left, rgba(6, 8, 10, 0.8) 0%, rgba(6, 8, 10, 0.22) 38%, rgba(6, 8, 10, 0) 58%);
}

.story-split-panel {
  position: absolute;
  top: 50%;
  left: clamp(36px, 6.5vw, 118px);
  transform: translateY(-50%);
  width: min(46vw, 560px);
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: clamp(20px, 3vw, 42px);
  align-items: start;
  z-index: 3;
  pointer-events: none;
}

.story-slide--split .story-year,
.story-slide--montaje .story-year {
  position: static;
  font-size: clamp(1.5rem, 2.3vw, 2.15rem);
  font-weight: 400;
  color: rgba(251, 249, 245, 0.72);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
  padding-top: 0.35em;
}

.story-slide--split .story-year::after,
.story-slide--montaje .story-year::after {
  content: "";
  display: block;
  width: clamp(48px, 6vw, 96px);
  height: 1px;
  background: rgba(251, 249, 245, 0.3);
  margin-top: 16px;
}

.story-slide--split .story-text,
.story-slide--montaje .story-text {
  position: static;
  max-width: none;
  left: auto;
  right: auto;
  bottom: auto;
  max-height: 56vh;
  overflow-y: auto;
  pointer-events: auto;
  padding-right: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(251, 249, 245, 0.4) transparent;
}

.story-slide--split .story-text::-webkit-scrollbar,
.story-slide--montaje .story-text::-webkit-scrollbar {
  width: 5px;
}

.story-slide--split .story-text::-webkit-scrollbar-thumb,
.story-slide--montaje .story-text::-webkit-scrollbar-thumb {
  background: rgba(251, 249, 245, 0.35);
  border-radius: 3px;
}

.story-slide--split .story-text p,
.story-slide--montaje .story-text p {
  font-size: clamp(1rem, 1.35vw, 1.18rem);
  line-height: 1.85;
  color: rgba(251, 249, 245, 0.9);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
}

.story-slide--split .story-text p + p,
.story-slide--montaje .story-text p + p {
  margin-top: 1.4em;
}

@media (max-width: 900px) {
  .story-photo-frame,
  .story-slide--split-left .story-photo-frame {
    top: 30%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
  }

  .story-slide--split .story-scrim {
    background:
      radial-gradient(ellipse 80% 50% at 50% 30%, rgba(214, 224, 232, 0.08) 0%, rgba(214, 224, 232, 0) 72%),
      linear-gradient(to top, rgba(10, 13, 16, 0.86) 0%, rgba(10, 13, 16, 0.3) 42%, rgba(10, 13, 16, 0) 62%);
  }

  .story-split-panel,
  .story-slide--split-left .story-split-panel {
    top: auto;
    bottom: 8%;
    left: 40px;
    right: 24px;
    width: auto;
    transform: none;
    column-gap: 18px;
    grid-template-columns: auto 1fr;
  }

  .story-slide--split-left .story-year {
    order: 0;
    text-align: left;
  }

  .story-slide--split-left .story-year::after {
    margin-left: 0;
  }

  .story-slide--split-left .story-text {
    order: 0;
  }

  .story-slide--split::after {
    background:
      radial-gradient(ellipse 100% 88% at 50% 46%,
        rgba(0, 0, 0, 0) 30%,
        rgba(0, 0, 0, 0.3) 58%,
        rgba(0, 0, 0, 0.68) 80%,
        #000 100%);
    box-shadow: inset 0 0 120px 30px rgba(0, 0, 0, 0.9);
  }

  .story-slide--split .story-year {
    font-size: 1.5rem;
  }

  .story-slide--split .story-year::after {
    width: 40px;
    margin-top: 12px;
  }
}


/* Montaje de estudio recreado por código: la fotografía original se coloca
   sobre un fondo oscuro y recibe una viñeta anclada a la propia imagen, de
   forma que el efecto es idéntico a cualquier tamaño y se adapta en móvil. */

.story-slide--montaje {
  background: radial-gradient(ellipse 160% 150% at 88% 50%,
    #191919 0%, #171718 25%, #101011 50%, #030303 72%, #000 100%);
}

.story-photo-frame--montaje {
  position: absolute;
  top: 50%;
  right: 5%;
  transform: translateY(-50%);
  z-index: 0;
}

/* La fotografía lleva horneado el mapa de luz del montaje (y su propio canal
   alfa), así que aquí no se le añade ningún filtro: solo se escala. */
.story-slide--montaje .story-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  object-fit: contain;
  filter: none;
  transform: none;
}

.story-slide--montaje .story-scrim {
  display: none;
}

.story-slide--montaje .story-split-panel {
  right: auto;
  left: clamp(32px, 6vw, 112px);
  width: min(34vw, 430px);
  grid-template-columns: auto 1fr;
}

@media (max-width: 900px) {
  /* En móvil la fotografía se centra y crece hasta casi llenar la pantalla;
     el año y el texto quedan debajo, sobre el fondo ya apagado */
  .story-photo-frame--montaje {
    top: 43%;
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .story-slide--montaje {
    background: radial-gradient(ellipse 150% 125% at 50% 43%,
      #191919 0%, #171718 25%, #101011 50%, #030303 74%, #000 100%);
  }

  .story-slide--montaje .story-split-panel {
    top: auto;
    bottom: 4%;
    left: 26px;
    right: 20px;
    width: auto;
    transform: none;
    column-gap: 16px;
    grid-template-columns: auto 1fr;
  }
}

.story-slide--no-photo {
  background: var(--cream);
}

.story-slide--no-photo .story-scrim {
  display: none;
}

.story-scrim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(8, 6, 4, 0.78) 0%, rgba(8, 6, 4, 0) 42%),
    linear-gradient(to bottom, rgba(8, 6, 4, 0.5) 0%, rgba(8, 6, 4, 0) 22%),
    linear-gradient(to right, rgba(8, 6, 4, 0.42) 0%, rgba(8, 6, 4, 0) 16%);
}

/* Puntitos: cuántos acontecimientos hay en la década actual y en cuál nos
   encontramos; permiten saltar directamente a cualquiera de ellos. */
.story-dots {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 15;
}

.story-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(21, 17, 13, 0.3);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.story-dot:hover {
  background: rgba(21, 17, 13, 0.55);
}

.story-dot.is-current {
  background: var(--china-red);
  transform: scale(1.3);
}

.story-text {
  position: absolute;
  left: var(--story-left-margin, 56px);
  right: auto;
  width: var(--story-text-width, 460px);
  top: var(--story-text-top, 220px);
  max-height: calc(100vh - var(--story-text-top, 220px) - 60px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 3;
  pointer-events: auto;
  padding-right: 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(21, 17, 13, 0.35) transparent;
}

.story-text::-webkit-scrollbar {
  width: 5px;
}

.story-text::-webkit-scrollbar-thumb {
  background: rgba(21, 17, 13, 0.3);
  border-radius: 3px;
}

/* Estado que se muestra cuando la década seleccionada no tiene ningún
   acontecimiento registrado todavía */
/* Foto de acontecimiento — se sitúa a la derecha, sin invadir nunca el
   texto, el título ni la línea de décadas. Su contorno se difumina con un
   degradado radial asimétrico (no un óvalo perfecto centrado) para que se
   funda con el fondo brumoso de la sección. Usamos un degradado CSS en vez
   de una imagen de máscara externa para evitar cualquier problema de carga. */
.story-event-photo {
  position: absolute;
  top: var(--story-title-top, 116px);
  left: var(--story-photo-left, 790px);
  right: var(--story-title-right, 44px);
  bottom: 48px;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(21, 17, 13, 0.18);
}

/* Marca de agua institucional — logo y fechas, igual que en Inicio — para
   los acontecimientos que todavía no tienen fotografía propia. Ocupa la
   misma zona que ocuparía la foto, con los mismos límites. */
.story-event-mark {
  position: absolute;
  top: var(--story-title-top, 116px);
  left: var(--story-photo-left, 790px);
  right: var(--story-title-right, 44px);
  bottom: 48px;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

/* Línea que separa la mitad del texto de la mitad de la imagen */
.story-divider {
  position: absolute;
  left: var(--story-divider-left, 660px);
  top: var(--story-title-top, 116px);
  bottom: 48px;
  width: 1px;
  background: var(--brass);
  opacity: 0.45;
  z-index: 10;
  pointer-events: none;
}

@media (max-width: 960px) {
  .story-divider {
    display: none;
  }
}

.story-event-mark-logo {
  width: min(300px, 55%);
  height: auto;
  opacity: 0.9;
}

.story-event-mark-dates {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: var(--ink);
  opacity: 0.62;
  white-space: nowrap;
  margin: 0;
}

.story-event-mark-rule {
  width: 44px;
  height: 1px;
  background: var(--brass);
}

.story-event-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  filter: grayscale(12%) contrast(1.04) sepia(0.06);
}

.story-event-photo img.story-photo--centered {
  object-position: 50% 50%;
}

@media (min-width: 761px) and (max-width: 959px) {
  .story-event-photo,
  .story-event-mark {
    display: none;
  }
}

@media (max-width: 760px) {
  .story-event-photo {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    height: 34vh;
    margin: 0 20px 24px 24px;
    box-shadow: 0 10px 30px rgba(21, 17, 13, 0.15);
  }

  .story-event-mark {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    margin: 0 20px 20px 24px;
    padding: 20px 0;
    gap: 16px;
  }

  .story-event-mark-logo {
    width: min(180px, 50%);
  }
}

.story-empty {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
  padding: 0 40px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
  z-index: 3;
}

.story-empty.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease;
}

.story-empty-rule {
  display: block;
  width: 44px;
  height: 1px;
  background: var(--brass);
}

.story-empty p {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: rgba(21, 17, 13, 0.62);
  max-width: 480px;
  margin: 0;
}

/* Recorrido guiado — se muestra una sola vez, oscurece y desenfoca la
   página con un backdrop, mientras el elemento señalado (línea de décadas,
   luego flechas) se eleva por encima, nítido, con un halo de luz. Se
   recuerda en localStorage para no repetirse en visitas posteriores. */
.story-tour {
  position: fixed;
  inset: 0;
  z-index: 250;
}

.story-tour[hidden] {
  display: none;
}

.story-tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 17, 13, 0.66);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.5s var(--ease-elegant);
}

.story-tour.is-open .story-tour-backdrop {
  opacity: 1;
}

/* El elemento real de la página (línea de décadas o flechas) se eleva
   por encima del backdrop y recibe un halo, en vez de recortar un hueco
   en la capa oscura: así permanece perfectamente nítido y, si la persona
   lo toca de verdad, la navegación funciona con normalidad. */
.story-tour-spotlight {
  box-shadow:
    0 0 0 7px rgba(246, 241, 231, 0.9),
    0 0 46px 16px rgba(246, 241, 231, 0.5);
  border-radius: 6px;
  animation: story-tour-pulse 1.8s ease-in-out infinite;
}

.story-arrow.story-tour-spotlight {
  border-radius: 50%;
}

@keyframes story-tour-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 7px rgba(246, 241, 231, 0.9),
      0 0 46px 16px rgba(246, 241, 231, 0.5);
  }
  50% {
    box-shadow:
      0 0 0 7px rgba(246, 241, 231, 0.9),
      0 0 58px 22px rgba(246, 241, 231, 0.72);
  }
}

.story-tour-caption {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 255;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper-white);
  border-radius: 16px;
  box-shadow: 0 18px 46px rgba(21, 17, 13, 0.32);
  padding: 16px 26px 16px 16px;
  opacity: 0;
  transition: opacity 0.4s var(--ease-elegant), transform 0.4s var(--ease-elegant);
  pointer-events: none;
}

.story-tour-caption[hidden] {
  display: flex;
  visibility: hidden;
}

.story-tour.is-open .story-tour-caption:not([hidden]) {
  opacity: 1;
}

.story-tour-caption--decades {
  top: calc(var(--nav-height) + 120px);
  transform: translateX(-50%) translateY(-8px);
}

.story-tour.is-open .story-tour-caption--decades:not([hidden]) {
  transform: translateX(-50%) translateY(0);
}

.story-tour-caption--events {
  top: 50%;
  margin-top: 48px;
  transform: translateX(-50%) translateY(8px);
}

.story-tour.is-open .story-tour-caption--events:not([hidden]) {
  transform: translateX(-50%) translateY(0);
}

.story-tour-num {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper-white);
  font-family: var(--font-display);
  font-size: 0.8rem;
}

.story-tour-caption p {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  white-space: nowrap;
}

.story-tour-caption p strong {
  font-weight: 600;
  color: var(--ink);
}

.story-tour-skip {
  position: absolute;
  top: 22px;
  right: 24px;
  z-index: 255;
  background: none;
  border: 1px solid rgba(246, 241, 231, 0.5);
  color: var(--paper-white);
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 9px 16px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.4s ease, border-color 0.3s ease, background-color 0.3s ease;
}

.story-tour.is-open .story-tour-skip {
  opacity: 1;
}

.story-tour-skip:hover {
  border-color: var(--paper-white);
  background: rgba(246, 241, 231, 0.12);
}

@media (max-width: 700px) {
  .story-tour-caption p {
    white-space: normal;
    max-width: 46vw;
  }

  .story-tour-caption--decades {
    top: calc(var(--nav-height) + 118px);
  }

  .story-tour-caption--events {
    margin-top: 34px;
  }
}

.story-title {
  position: fixed;
  top: var(--story-title-top, 116px);
  left: var(--story-left-margin, 56px);
  right: auto;
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-align: left;
  color: var(--ink);
  margin: 0;
  z-index: 16;
  pointer-events: none;
}

.story-text p {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.75;
  color: var(--ink);
  text-align: justify;
  text-justify: inter-word;
  margin: 0;
}

.story-text p + p {
  margin-top: 20px;
}

/* Flechas de navegación */

.story-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(21, 17, 13, 0.35);
  background: rgba(21, 17, 13, 0.05);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s var(--ease-elegant);
}

.story-arrow svg {
  width: 18px;
  height: 18px;
}

.story-arrow:hover {
  background: rgba(21, 17, 13, 0.12);
  border-color: var(--china-red);
}

.story-arrow--prev {
  left: 40px;
}

.story-arrow--next {
  right: 40px;
}

.story-arrow.is-disabled {
  opacity: 0.25;
  pointer-events: none;
}

/* Línea del tiempo — horizontal, arriba */

.story-timeline {
  position: absolute;
  top: calc(var(--nav-height) + 18px);
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 1240px);
  height: auto;
  max-height: none;
  z-index: 15;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(21, 17, 13, 0.3) transparent;
}

.story-timeline::-webkit-scrollbar {
  height: 5px;
}

.story-timeline::-webkit-scrollbar-thumb {
  background: rgba(21, 17, 13, 0.3);
  border-radius: 3px;
}

.story-tick {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 70px;
  background: none;
  border: none;
  padding: 8px 6px 12px;
  margin: 0;
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s var(--ease-elegant);
}

.story-tick:not(.story-tick--empty):hover,
.story-tick:not(.story-tick--empty):focus-visible {
  outline: none;
  transform: scale(1.16);
  z-index: 2;
}

.story-tick.is-active {
  pointer-events: auto;
  cursor: pointer;
}

.story-tick:not(.is-active) {
  pointer-events: none;
}

.story-tick-label {
  position: relative;
  display: inline-block;
  padding-bottom: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.02rem;
  letter-spacing: 0.03em;
  color: rgba(21, 17, 13, 0.65);
  white-space: nowrap;
  transition: color 0.25s ease, letter-spacing 0.35s var(--ease-elegant);
}

/* La línea que subraya, igual que en el menú principal */
.story-tick-label::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.45s var(--ease-elegant), background-color 0.3s ease;
}

/* Décadas con acontecimientos: texto en tinta oscura, sin raya permanente */
.story-tick.is-active:not(.story-tick--empty) .story-tick-label {
  color: var(--ink);
}

/* Década seleccionada (tenga o no acontecimientos): raya permanente en
   dorado, como la sección activa del menú */
.story-tick.is-current .story-tick-label {
  color: var(--ink);
  font-weight: 600;
}

.story-tick.is-current .story-tick-label::after {
  transform: scaleX(1);
  background: var(--brass);
}

.story-tick:not(.story-tick--empty):hover .story-tick-label,
.story-tick:not(.story-tick--empty):focus-visible .story-tick-label {
  letter-spacing: 0.07em;
}

.story-tick:not(.story-tick--empty):hover .story-tick-label::after,
.story-tick:not(.story-tick--empty):focus-visible .story-tick-label::after {
  transform: scaleX(1);
  background: var(--china-red);
}

.story-tick--empty .story-tick-label {
  color: rgba(21, 17, 13, 0.3);
  font-weight: 400;
}

.story-tick--empty.is-current .story-tick-label {
  color: rgba(21, 17, 13, 0.8);
}

@media (max-width: 760px) {
  body.story-page {
    height: auto;
    overflow: visible;
  }

  .story {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  .story-slides {
    height: auto;
  }

  .story-slide {
    display: none;
    position: static;
    opacity: 1;
    visibility: visible;
  }

  .story-slide.is-active {
    display: block;
    padding-bottom: 90px;
  }

  .story-timeline {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    margin: 0;
    background: var(--cream);
    box-shadow: 0 1px 0 rgba(21, 17, 13, 0.08);
    padding: 14px 3vw 14px;
    gap: 6px;
  }

  .story-tick {
    min-width: 54px;
    padding: 9px 4px;
  }

  .story-tick-label {
    font-size: 0.85rem;
  }

  .story-arrow {
    position: fixed;
    width: 42px;
    height: 42px;
  }

  .story-arrow--prev {
    left: 20px;
  }

  .story-arrow--next {
    right: 14px;
  }

  .story-dots-label {
    display: none;
  }

  .story-dots {
    position: fixed;
  }

  .story-empty {
    position: fixed;
  }

  .story-title {
    position: static;
    margin: calc(var(--nav-height) + 66px) 20px 16px;
    font-size: 1.4rem;
  }

  .story-text {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    transform: none;
    width: auto;
    margin: 0 20px 24px;
    max-width: none;
    max-height: none;
    overflow-y: visible;
    overflow-x: hidden;
  }

  /* Las diapositivas --split y --montaje además reafirman su propio
     ancho de escritorio con selectores más específicos (dos clases),
     así que necesitan el mismo reset repetido aquí para que gane por
     especificidad igual y no solo por la regla genérica de arriba. */
  .story-slide--split .story-text,
  .story-slide--montaje .story-text {
    width: auto;
    max-width: none;
    max-height: none;
    overflow-y: visible;
    margin: 0 20px 24px;
  }
}

/* ==========================================================================
   Archivo Histórico — Cartas (galería + lector ampliado)
   ========================================================================== */

.letters-grid {
  max-width: 1180px;
  margin: 10px auto 0;
  padding: 0 24px 120px;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
}

.letter-card {
  flex: 1 1 230px;
  max-width: 280px;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.letter-card-media {
  display: block;
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--paper-white);
  box-shadow:
    0 1px 0 var(--paper-white),
    6px 8px 0 -2px var(--cream),
    6px 8px 0 -1px rgba(21, 17, 13, 0.14),
    11px 15px 0 -4px var(--cream),
    11px 15px 2px -3px rgba(21, 17, 13, 0.12);
  transition: transform 0.4s var(--ease-elegant), box-shadow 0.4s var(--ease-elegant);
}

.letter-card:hover .letter-card-media {
  transform: translate(-3px, -4px);
  box-shadow:
    0 1px 0 var(--paper-white),
    8px 11px 0 -2px var(--cream),
    8px 11px 0 -1px rgba(21, 17, 13, 0.16),
    15px 20px 0 -4px var(--cream),
    15px 20px 3px -3px rgba(21, 17, 13, 0.14);
}

.letter-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  filter: sepia(0.1) contrast(1.03);
}

.letter-card-body {
  display: block;
  padding: 22px 4px 0;
}

.letter-card-title {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  font-size: 1.12rem;
  color: var(--ink);
  margin: 0 0 6px;
}

.letter-card-meta {
  display: block;
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--china-red);
}

/* Lector ampliado */

.letter-reader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.letter-reader.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.4s ease;
}

.letter-reader-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 8, 6, 0.9);
}

.letter-reader-scroll {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.letter-reader-panel {
  position: relative;
  max-width: 720px;
  width: 92%;
  margin: 70px auto 90px;
  background: var(--cream);
  padding: 44px clamp(20px, 4vw, 60px) 70px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  transform: scale(0.94) translateY(10px);
  opacity: 0;
  transition: transform 0.45s var(--ease-elegant), opacity 0.45s var(--ease-elegant);
}

.letter-reader.is-open .letter-reader-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.letter-reader-head {
  text-align: center;
  margin-bottom: 40px;
}

.letter-reader-eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: 0.64rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--china-red);
  margin-bottom: 14px;
}

.letter-reader-title {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  color: var(--ink);
  margin: 0 0 10px;
}

.letter-reader-note {
  font-size: 0.92rem;
  color: rgba(21, 17, 13, 0.6);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.6;
}

.letter-reader-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 46px;
}

.letter-reader-pages img {
  width: 100%;
  max-width: 560px;
  height: auto;
  display: block;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(21, 17, 13, 0.08);
}

.letter-reader-actions {
  display: flex;
  justify-content: center;
  margin-top: 50px;
}

.letter-reader-download {
  position: relative;
  display: inline-block;
  padding-bottom: 6px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

.letter-reader-download::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-elegant);
}

.letter-reader-download:hover::after {
  transform: scaleX(1);
}

.letter-reader-close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(251, 249, 245, 0.4);
  background: rgba(251, 249, 245, 0.06);
  color: var(--paper-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.letter-reader-close:hover {
  background: rgba(251, 249, 245, 0.16);
  border-color: var(--china-red);
  transform: rotate(90deg);
}

.letter-reader-close svg {
  width: 18px;
  height: 18px;
}

body.reader-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .letter-reader-panel {
    width: 100%;
    margin: 0;
    min-height: 100%;
    padding: 90px 20px 60px;
  }

  .letter-reader-close {
    top: 16px;
    right: 16px;
  }
}

/* ==========================================================================
   Archivo Histórico — Recetas (cuartillas con volteo y descarga)
   ========================================================================== */

.recipes-grid {
  max-width: 1180px;
  margin: 10px auto 0;
  padding: 0 24px 120px;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
}

.recipe-card {
  flex: 1 1 230px;
  max-width: 280px;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.recipe-card-media {
  display: block;
  position: relative;
  aspect-ratio: 1287 / 1999;
  overflow: hidden;
  box-shadow: 0 18px 34px -14px rgba(21, 17, 13, 0.55);
  transition: transform 0.4s var(--ease-elegant), box-shadow 0.4s var(--ease-elegant);
}

.recipe-card:hover .recipe-card-media {
  transform: translateY(-4px);
  box-shadow: 0 24px 42px -14px rgba(21, 17, 13, 0.6);
}

.recipe-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  filter: sepia(0.1) contrast(1.03);
}

.recipe-card-body {
  display: block;
  padding: 14px 4px 0;
}

.recipe-card-meta {
  display: block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--china-red);
}

/* Lector ampliado — sin panel: la cuartilla flota directamente sobre
   el fondo oscuro, con una caja traslúcida debajo para la fecha,
   el aviso de volteo y la descarga. */

.recipe-reader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.recipe-reader.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.4s ease;
}

.recipe-reader-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 8, 6, 0.9);
}

.recipe-reader-scroll {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.recipe-reader-stage {
  position: relative;
  min-height: 100%;
  width: 100%;
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: scale(0.94) translateY(10px);
  opacity: 0;
  transition: transform 0.45s var(--ease-elegant), opacity 0.45s var(--ease-elegant);
}

.recipe-reader.is-open .recipe-reader-stage {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.recipe-reader-close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(251, 249, 245, 0.4);
  background: rgba(251, 249, 245, 0.06);
  color: var(--paper-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.recipe-reader-close:hover {
  background: rgba(251, 249, 245, 0.16);
  border-color: var(--china-red);
  transform: rotate(90deg);
}

.recipe-reader-close svg {
  width: 18px;
  height: 18px;
}

.recipe-reader-caption {
  margin-top: 26px;
  padding: 18px 26px;
  max-width: 380px;
  text-align: center;
  background: rgba(251, 249, 245, 0.08);
  border: 1px solid rgba(251, 249, 245, 0.16);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.recipe-reader-date {
  display: block;
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass);
}

.recipe-reader-note {
  margin: 8px 0 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: rgba(251, 249, 245, 0.75);
}

.recipe-reader-note:empty {
  display: none;
  margin: 0;
}

.recipe-reader-download {
  position: relative;
  display: inline-block;
  margin-top: 14px;
  padding-bottom: 5px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper-white);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.recipe-reader-download::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-elegant);
}

.recipe-reader-download:hover::after {
  transform: scaleX(1);
}

body.reader-open {
  overflow: hidden;
}

.recipe-flip-scene {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1287 / 1999;
  margin: 0 auto;
  -webkit-perspective: 1800px;
  perspective: 1800px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.recipe-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-transition: -webkit-transform 0.8s var(--ease-elegant);
  transition: transform 0.8s var(--ease-elegant);
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}

.recipe-flip-scene.is-flipped .recipe-flip-inner {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

.recipe-flip-front,
.recipe-flip-back {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
}

.recipe-flip-back {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

.recipe-flip-front img,
.recipe-flip-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(0.08) contrast(1.03);
}

.recipe-flip-face-label {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-white);
  background: rgba(21, 17, 13, 0.62);
  padding: 5px 10px;
  z-index: 2;
}

.recipe-flip-hint {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(251, 249, 245, 0.55);
  margin: 10px 0 0;
}

@media (max-width: 600px) {
  .recipe-flip-scene {
    max-width: 300px;
  }

  .recipe-reader-close {
    top: 16px;
    right: 16px;
  }

  .recipe-reader-caption {
    max-width: 300px;
    padding: 16px 20px;
  }
}

/* ==========================================================================
   Árbol Genealógico
   ========================================================================== */

.tree {
  max-width: 1000px;
  margin: 30px auto 0;
  padding: 0 24px 140px;
}

.tree-couple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin: 0 auto;
}

.tree-card--pedro,
.tree-card--paca {
  transition: transform 0.65s var(--ease-elegant), opacity 0.45s ease;
}

.tree-couple > .tree-couple-link {
  transition: opacity 0.35s ease;
}

.tree-couple .is-focus-hidden {
  opacity: 0;
  pointer-events: none;
}

.tree-couple-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--brass);
  padding-bottom: 46px;
}

.tree-couple-link svg {
  width: 20px;
  height: 20px;
}

.tree-couple-link--roto {
  color: rgba(21, 17, 13, 0.38);
}

.tree-couple-date {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(21, 17, 13, 0.5);
  white-space: nowrap;
}

.tree-descendants-collapse {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.55s var(--ease-elegant), opacity 0.4s ease;
  opacity: 1;
}

.tree-descendants-collapse.is-collapsed {
  grid-template-rows: 0fr;
  opacity: 0;
}

.tree-descendants-inner {
  overflow: hidden;
  min-height: 0;
}

.tree-stem {
  width: 1px;
  height: 56px;
  background: rgba(169, 128, 60, 0.4);
  margin: 0 auto;
}

.tree-children {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 46px 30px;
  flex-wrap: wrap;
  padding-top: 40px;
}

.tree-couple--small {
  gap: 12px;
}

.tree-couple--small .tree-card {
  width: 140px;
}

.tree-couple--small .tree-couple-link {
  padding-bottom: 24px;
}

.tree-couple--small .tree-couple-link svg {
  width: 15px;
  height: 15px;
}

.tree-children::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 40px;
  background: rgba(169, 128, 60, 0.4);
  transform: translateX(-50%);
}

/* Tarjeta con volteo */

.tree-card {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 190px;
  font-family: inherit;
}

.tree-card-scene {
  width: 100%;
  aspect-ratio: 3 / 4;
  perspective: 1400px;
}

.tree-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s var(--ease-elegant);
  transform-style: preserve-3d;
}

.tree-card.is-flipped .tree-card-inner {
  transform: rotateY(180deg);
}

.tree-card-front,
.tree-card-back {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid rgba(21, 17, 13, 0.12);
  background: var(--paper-white);
  overflow: hidden;
  box-shadow: 0 14px 30px -18px rgba(21, 17, 13, 0.4);
}

.tree-card-front {
  display: flex;
  flex-direction: column;
}

.tree-card-photo {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: rgba(21, 17, 13, 0.06);
}

.tree-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
}

.tree-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tree-card-placeholder span {
  font-family: var(--font-display);
  font-size: 2.6rem;
  color: rgba(21, 17, 13, 0.22);
}

.tree-card-caption {
  padding: 12px 10px;
  text-align: center;
  border-top: 1px solid rgba(21, 17, 13, 0.1);
}

.tree-card-name {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink);
}

.tree-card-role {
  display: block;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--china-red);
  margin-top: 3px;
}

.tree-card-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px 18px;
  background: var(--cream);
  text-align: center;
}

.tree-card-back .tree-card-name {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.tree-card-years {
  display: block;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--brass);
  margin-bottom: 12px;
}

.tree-card-bio {
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(21, 17, 13, 0.78);
  margin: 0;
}

.tree-card-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(21, 17, 13, 0.32);
}

@media (max-width: 700px) {
  .tree-couple {
    gap: 14px;
  }

  .tree-card {
    width: 130px;
  }

  .tree-couple-link {
    padding-bottom: 30px;
  }

  .tree-children {
    gap: 30px 16px;
  }

  .tree-couple--small .tree-card {
    width: 100px;
  }

  .tree-couple--small {
    gap: 8px;
  }

  .tree-couple--small .tree-couple-link {
    padding-bottom: 18px;
  }
}

/* Ascendientes (acordeón sobre Pedro y Paca) */

.tree-ancestors-toggles {
  display: flex;
  justify-content: center;
  gap: 220px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.tree-ancestors-toggle {
  background: none;
  border: 1px solid var(--brass);
  color: var(--brass);
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.tree-ancestors-toggle:hover,
.tree-ancestors-toggle[aria-expanded="true"] {
  background: var(--brass);
  color: var(--paper-white);
}

.tree-ancestors-wrap {
  display: block;
  max-width: 900px;
  margin: 0 auto;
  transition: margin-bottom 0.5s var(--ease-elegant);
}

.tree-ancestors-wrap.has-open {
  margin-bottom: 30px;
}

.tree-ancestors-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s var(--ease-elegant);
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.tree-ancestors-collapse.is-open {
  grid-template-rows: 1fr;
}

.tree-ancestors-inner {
  overflow: hidden;
  min-height: 0;
}

.tree-ancestors-title {
  display: block;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(21, 17, 13, 0.45);
  margin: 28px 0 20px;
}

.tree-ancestors-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 36px;
  row-gap: 8px;
  align-items: end;
  justify-items: center;
  margin-bottom: 22px;
}

.tree-ancestors-columns > .tree-ancestors-card {
  align-self: start;
}

.tree-ancestors-parent-link {
  grid-column: 1 / -1;
  position: relative;
  width: 60%;
  max-width: 260px;
  height: 32px;
  margin: 2px auto 0;
}

.tree-ancestors-parent-link-h,
.tree-ancestors-parent-link-v {
  position: absolute;
  background: rgba(169, 128, 60, 0.5);
}

.tree-ancestors-parent-link-h {
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.6s var(--ease-elegant);
}

.tree-ancestors-parent-link-v {
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  transform: translateX(-50%) scaleY(0);
  transform-origin: top;
  transition: transform 0.5s var(--ease-elegant) 0.45s;
}

.tree-ancestors-collapse.is-open .tree-ancestors-parent-link-h {
  transform: scaleX(1);
}

.tree-ancestors-collapse.is-open .tree-ancestors-parent-link-v {
  transform: translateX(-50%) scaleY(1);
}

.tree-ancestors-connector {
  width: 1px;
  height: 24px;
  background: rgba(169, 128, 60, 0.4);
}

.tree-ancestors-siblings {
  text-align: center;
  margin-bottom: 8px;
}

.tree-ancestors-siblings-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(21, 17, 13, 0.4);
  margin: 0 0 10px;
}

.tree-ancestors-chips {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tree-ancestors-chip {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.76rem;
  color: var(--ink);
  border: 1px solid rgba(21, 17, 13, 0.15);
  background: var(--cream);
  padding: 5px 12px;
}

.tree-ancestors-pair {
  display: flex;
  gap: 8px;
}

.tree-ancestors-card {
  border: 1px solid rgba(21, 17, 13, 0.15);
  background: var(--paper-white);
  padding: 11px 12px;
  min-width: 132px;
  text-align: center;
  box-shadow: 0 8px 18px -14px rgba(21, 17, 13, 0.4);
}

.tree-ancestors-card--small {
  min-width: 112px;
  padding: 9px 8px;
}

.tree-ancestors-card .name {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.25;
}

.tree-ancestors-card--small .name {
  font-size: 0.72rem;
}

.tree-ancestors-card .role {
  display: block;
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--china-red);
  margin-top: 4px;
}

.tree-ancestors-card .dates {
  display: block;
  font-family: var(--font-display);
  font-size: 0.52rem;
  color: rgba(21, 17, 13, 0.45);
  margin-top: 3px;
}

@media (max-width: 700px) {
  .tree-ancestors-toggles {
    gap: 16px;
  }

  .tree-ancestors-wrap {
    gap: 30px;
  }

  .tree-ancestors-card {
    min-width: 112px;
  }

  .tree-ancestors-card--small {
    min-width: 96px;
  }
}

@media (max-width: 480px) {
  .tree-ancestors-columns {
    column-gap: 14px;
  }

  .tree-ancestors-pair {
    flex-direction: column;
    gap: 4px;
  }

  .tree-ancestors-card {
    min-width: 0;
    width: 100%;
  }

  .tree-ancestors-card--small {
    min-width: 0;
    width: 100%;
  }
}

/* Descendencia — nietos, bisnietos y tataranietos (desplegable bajo cada hijo) */

.tree-branch-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tree-branch-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.tree-branch-toggle {
  background: none;
  border: 1px solid var(--brass);
  color: var(--brass);
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
  white-space: nowrap;
}

.tree-branch-toggle:hover,
.tree-branch-toggle[aria-expanded="true"] {
  background: var(--brass);
  color: var(--paper-white);
}

.tree-branch-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s var(--ease-elegant);
  width: 100%;
}

.tree-branch-collapse.is-open {
  grid-template-rows: 1fr;
}

.tree-branch-inner {
  overflow: hidden;
  min-height: 0;
  width: 340px;
  max-width: 80vw;
  padding-top: 18px;
}

.tree-lineage-generation {
  margin-bottom: 22px;
}

.tree-lineage-generation:last-child {
  margin-bottom: 0;
}

.tree-lineage-gen-label {
  display: block;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(21, 17, 13, 0.45);
  margin-bottom: 10px;
}

.tree-lineage-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tree-lineage-note {
  display: block;
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.72rem;
  color: rgba(21, 17, 13, 0.55);
  margin-bottom: 14px;
  line-height: 1.4;
}


/* Explorador de ramas — pantalla completa, un matrimonio con sus hijos cada vez */

body.has-tree-explorer {
  overflow: hidden;
}

.tree-explorer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: row;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(169, 128, 60, 0.1) 0%, rgba(169, 128, 60, 0) 55%),
    var(--cream);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 0.4s var(--ease-elegant), transform 0.4s var(--ease-elegant);
}

/* Imprescindible: sin esto el panel oculto seguiría cubriendo la página */
.tree-explorer[hidden] {
  display: none;
}

.tree-explorer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* --- Barra lateral: ruta del árbol, siempre visible, permite subir de nivel --- */
.tree-explorer-nav {
  flex: none;
  width: 268px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(21, 17, 13, 0.12);
  background: rgba(251, 249, 245, 0.94);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tree-explorer-nav-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px 22px;
  border-bottom: 1px solid rgba(21, 17, 13, 0.1);
}

.tree-explorer-nav-title {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
}

.tree-explorer-back,
.tree-explorer-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid rgba(21, 17, 13, 0.18);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.56rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}

.tree-explorer-back svg,
.tree-explorer-close svg {
  width: 14px;
  height: 14px;
}

.tree-explorer-back:hover:not(:disabled),
.tree-explorer-close:hover {
  border-color: var(--brass);
  color: var(--brass);
}

.tree-explorer-back:disabled {
  opacity: 0.32;
  cursor: default;
}

.tree-explorer-close {
  padding: 8px;
}

/* Lista vertical de la ruta, con línea de "raíl" y marcadores conectados */
.tree-explorer-crumbs {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 24px 26px;
  gap: 1px;
}

.tree-explorer-crumbs::before {
  content: "";
  position: absolute;
  top: 26px;
  bottom: 26px;
  left: 30px;
  width: 1px;
  background: rgba(169, 128, 60, 0.32);
}

.tree-explorer-crumb {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  background: none;
  border: none;
  padding: 11px 10px;
  text-align: left;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.25;
  color: rgba(21, 17, 13, 0.55);
  cursor: pointer;
  transition: color 0.3s ease, background 0.3s ease;
}

button.tree-explorer-crumb:hover {
  color: var(--china-red);
  background: rgba(169, 128, 60, 0.08);
}

.tree-explorer-crumb.is-current {
  color: var(--ink);
  font-style: normal;
  font-weight: 600;
  cursor: default;
}

.tree-explorer-crumb-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cream);
  border: 1.3px solid var(--brass);
  transition: background 0.3s ease, border-color 0.3s ease;
}

button.tree-explorer-crumb:hover .tree-explorer-crumb-dot {
  border-color: var(--china-red);
}

.tree-explorer-crumb.is-current .tree-explorer-crumb-dot {
  background: var(--china-red);
  border-color: var(--china-red);
}

.tree-explorer-crumb-label {
  min-width: 0;
}

/* --- Columna principal: barra con «Volver», escenario y ayuda --- */
.tree-explorer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tree-explorer-bar {
  flex: none;
  display: flex;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(21, 17, 13, 0.12);
  background: rgba(251, 249, 245, 0.9);
  backdrop-filter: blur(6px);
}

.tree-explorer-stage {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 42px 24px 20px;
}

.tree-explorer-level {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 1;
  transform: none;
  transition: opacity 0.45s var(--ease-elegant), transform 0.45s var(--ease-elegant);
}

.tree-explorer-level.is-entering {
  opacity: 0;
  transform: translateY(18px);
}

.tree-explorer-gen {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(21, 17, 13, 0.4);
  margin-bottom: 18px;
}

.tree-couple--explorer {
  gap: 22px;
}

.tree-couple--explorer .tree-card {
  width: 172px;
}

.tree-couple--explorer .tree-couple-link {
  padding-bottom: 34px;
}

.tree-explorer-level .tree-stem {
  height: 44px;
  margin-top: 26px;
}

.tree-explorer-level .tree-lineage-gen-label {
  margin: 16px 0 20px;
}

.tree-explorer-level .tree-lineage-note {
  max-width: 520px;
  margin-top: 18px;
  margin-bottom: 0;
}

.tree-explorer-children {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 30px 26px;
  width: 100%;
}

.tree-explorer-child {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 138px;
}

.tree-explorer-child .tree-card {
  width: 138px;
}

.tree-explorer-child .tree-card-back {
  padding: 14px 11px;
}

.tree-explorer-child .tree-card-bio {
  font-size: 0.72rem;
  line-height: 1.45;
}

.tree-explorer-child-dates {
  display: block;
  font-family: var(--font-display);
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  color: var(--brass);
  margin-top: 9px;
  text-align: center;
}

.tree-explorer-child-spouse {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.8rem;
  color: rgba(21, 17, 13, 0.55);
  margin-top: 3px;
  text-align: center;
}

.tree-explorer-drill {
  margin-top: 10px;
  background: none;
  border: 1px solid var(--brass);
  color: var(--brass);
  font-family: var(--font-display);
  font-size: 0.5rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 6px 9px;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.tree-explorer-drill:hover {
  background: var(--brass);
  color: var(--paper-white);
}

.tree-explorer-hint {
  flex: none;
  margin: 0;
  padding: 14px 24px 22px;
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  color: rgba(21, 17, 13, 0.5);
}

@media (max-width: 880px) {
  .tree-explorer {
    flex-direction: column;
  }

  .tree-explorer-nav {
    width: auto;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid rgba(21, 17, 13, 0.12);
  }

  .tree-explorer-nav-head {
    padding: 14px 16px 12px 18px;
  }

  .tree-explorer-crumbs {
    padding: 8px 14px 16px 22px;
  }

  .tree-explorer-crumbs::before {
    left: 26px;
  }

  .tree-explorer-crumb {
    padding: 9px 8px;
    font-size: 0.85rem;
  }
}

@media (max-width: 700px) {
  .tree-explorer-stage {
    padding: 26px 16px 12px;
  }

  .tree-couple--explorer .tree-card {
    width: 124px;
  }

  .tree-couple--explorer {
    gap: 12px;
  }

  .tree-explorer-children {
    gap: 22px 14px;
  }

  .tree-explorer-child,
  .tree-explorer-child .tree-card {
    width: 116px;
  }

  .tree-explorer-back span {
    display: none;
  }
}

/* ==========================================================================
   Archivo Histórico — Fotografías (fototeca con filtros y visor ampliado)
   ========================================================================== */

.photo-filters {
  position: sticky;
  top: var(--nav-height);
  z-index: 40;
  background: rgba(246, 241, 231, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(21, 17, 13, 0.1);
  padding: 16px 24px;
}

.photo-filters-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 26px;
}

.photo-decadas {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  flex: 1 1 auto;
  scrollbar-width: none;
}

.photo-decadas::-webkit-scrollbar {
  display: none;
}

.photo-decada-btn {
  position: relative;
  display: inline-block;
  padding-bottom: 7px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(21, 17, 13, 0.55);
  white-space: nowrap;
  transition: color 0.3s ease, letter-spacing 0.4s var(--ease-elegant);
}

.photo-decada-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.45s var(--ease-elegant);
}

.photo-decada-btn:hover {
  color: var(--ink);
  letter-spacing: 0.19em;
}

.photo-decada-btn:hover::after {
  transform: scaleX(1);
}

.photo-decada-btn.is-active {
  color: var(--ink);
}

.photo-decada-btn.is-active::after {
  transform: scaleX(1);
  background: var(--brass);
}

.photo-select,
.photo-buscar {
  font-family: var(--font-body);
  font-size: 0.92rem;
  background: transparent;
  color: var(--ink);
  border: none;
  border-bottom: 1px solid rgba(21, 17, 13, 0.25);
  padding: 4px 2px 7px;
  border-radius: 0;
}

.photo-buscar {
  min-width: 160px;
}

.photo-select:focus,
.photo-buscar:focus {
  outline: none;
  border-bottom-color: var(--china-red);
}

.photo-seleccionar {
  position: relative;
  display: inline-block;
  padding-bottom: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

.photo-seleccionar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-elegant);
}

.photo-seleccionar:hover::after,
.photo-seleccionar.is-active::after {
  transform: scaleX(1);
}

.photo-seleccionar.is-active {
  color: var(--china-red);
}

.photo-contador {
  max-width: 1180px;
  margin: 22px auto 0;
  padding: 0 24px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(21, 17, 13, 0.45);
}

.photo-decada-seccion {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 24px 6px;
}

.photo-decada-cabecera {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(21, 17, 13, 0.12);
  padding-bottom: 16px;
}

.photo-decada-numero {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  color: var(--china-red);
  min-width: 90px;
}

.photo-decada-linea {
  flex: 1;
  height: 1px;
  background: rgba(21, 17, 13, 0.12);
}

.photo-decada-descargar {
  position: relative;
  display: inline-block;
  padding-bottom: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  white-space: nowrap;
}

.photo-decada-descargar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-elegant);
}

.photo-decada-descargar:hover::after {
  transform: scaleX(1);
}

.photo-grid {
  columns: 4 220px;
  column-gap: 34px;
  padding-bottom: 10px;
}

@media (max-width: 900px) {
  .photo-grid {
    columns: 2 180px;
    column-gap: 26px;
  }
}

.photo-card {
  break-inside: avoid;
  margin-bottom: 46px;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  display: block;
  width: 100%;
  position: relative;
}

.photo-card-media {
  position: relative;
  overflow: hidden;
  background: var(--paper-white);
  box-shadow:
    0 1px 0 var(--paper-white),
    6px 8px 0 -2px var(--cream),
    6px 8px 0 -1px rgba(21, 17, 13, 0.14),
    11px 15px 0 -4px var(--cream),
    11px 15px 2px -3px rgba(21, 17, 13, 0.12);
  transition: transform 0.4s var(--ease-elegant), box-shadow 0.4s var(--ease-elegant);
}

.photo-card:hover .photo-card-media {
  transform: translate(-3px, -4px);
  box-shadow:
    0 1px 0 var(--paper-white),
    8px 11px 0 -2px var(--cream),
    8px 11px 0 -1px rgba(21, 17, 13, 0.16),
    15px 20px 0 -4px var(--cream),
    15px 20px 3px -3px rgba(21, 17, 13, 0.14);
}

.photo-card-media img {
  display: block;
  width: 100%;
  height: auto;
  filter: sepia(0.08) contrast(1.03);
}

.photo-card-body {
  padding: 16px 4px 0;
}

.photo-card-decada {
  display: block;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--china-red);
  margin-bottom: 4px;
}

.photo-card-titulo {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  font-size: 1rem;
  color: var(--ink);
}

.photo-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--paper-white);
  background: rgba(21, 17, 13, 0.4);
  color: var(--paper-white);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 3;
}

.is-modo-seleccion .photo-card-check {
  display: flex;
}

.photo-card.is-seleccionada .photo-card-check {
  background: var(--china-red);
  border-color: var(--china-red);
}

.photo-card.is-seleccionada .photo-card-media {
  outline: 2px solid var(--china-red);
  outline-offset: 3px;
}

.photo-vacio {
  padding: 60px 20px;
  text-align: center;
  font-style: italic;
  color: rgba(21, 17, 13, 0.5);
}

/* Barra flotante de selección múltiple */

.photo-barra-seleccion {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 160%);
  background: var(--ink);
  color: var(--paper-white);
  padding: 16px 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  z-index: 250;
  transition: transform 0.4s var(--ease-elegant);
  font-size: 0.92rem;
}

.photo-barra-seleccion.is-visible {
  transform: translate(-50%, 0);
}

.photo-barra-seleccion button {
  position: relative;
  padding-bottom: 5px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--paper-white);
}

.photo-barra-seleccion button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-elegant);
}

.photo-barra-seleccion button:hover::after {
  transform: scaleX(1);
}

/* Aviso cuando se abre con doble clic (file://), sin servidor local */

.photo-aviso {
  position: relative;
  background: var(--china-red);
  color: var(--paper-white);
  font-size: 0.9rem;
  line-height: 1.55;
  text-align: center;
  padding: 14px 52px 14px 20px;
}

.photo-aviso em {
  font-style: italic;
  color: var(--paper-white);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.photo-aviso button {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--paper-white);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

/* Visor ampliado (mismo patrón que letter-reader) */

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.photo-viewer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.4s ease;
}

.photo-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 6, 0.94);
}

.photo-viewer-scroll {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
}

.photo-viewer-panel {
  position: relative;
  max-width: 1000px;
  width: 92%;
  margin: 70px auto;
  transform: scale(0.94) translateY(10px);
  opacity: 0;
  transition: transform 0.45s var(--ease-elegant), opacity 0.45s var(--ease-elegant);
  text-align: center;
}

.photo-viewer.is-open .photo-viewer-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.photo-viewer-img {
  max-width: 100%;
  max-height: 66vh;
  width: auto;
  height: auto;
  display: inline-block;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  border: 6px solid var(--paper-white);
}

.photo-viewer-titulo {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  color: var(--paper-white);
  margin: 28px 0 8px;
}

.photo-viewer-meta {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}

.photo-viewer-download {
  position: relative;
  display: inline-block;
  margin-top: 26px;
  padding-bottom: 6px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper-white);
}

.photo-viewer-download::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--china-red);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s var(--ease-elegant);
}

.photo-viewer-download:hover::after {
  transform: scaleX(1);
}

.photo-viewer-close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(251, 249, 245, 0.4);
  background: rgba(251, 249, 245, 0.06);
  color: var(--paper-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.photo-viewer-close:hover {
  background: rgba(251, 249, 245, 0.16);
  border-color: var(--china-red);
  transform: rotate(90deg);
}

.photo-viewer-close svg {
  width: 18px;
  height: 18px;
}

.photo-viewer-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(251, 249, 245, 0.4);
  background: rgba(251, 249, 245, 0.06);
  color: var(--paper-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.photo-viewer-arrow:hover {
  background: rgba(251, 249, 245, 0.16);
  border-color: var(--china-red);
}

.photo-viewer-arrow svg {
  width: 18px;
  height: 18px;
}

.photo-viewer-arrow--prev {
  left: 24px;
}

.photo-viewer-arrow--next {
  right: 24px;
}

body.photo-viewer-open {
  overflow: hidden;
}

@media (max-width: 700px) {
  .photo-decada-numero {
    min-width: 70px;
  }

  .photo-viewer-arrow {
    width: 42px;
    height: 42px;
  }

  .photo-viewer-arrow--prev {
    left: 8px;
  }

  .photo-viewer-arrow--next {
    right: 8px;
  }

  .photo-viewer-close {
    top: 16px;
    right: 16px;
  }
}

/* ==========================================================================
   Scroll hint — flecha invitando a bajar (Inicio y Pedro y Paca)
   ========================================================================== */

.scroll-hint {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  background: rgba(8, 6, 4, 0.32);
  border: 1.5px solid rgba(251, 249, 245, 0.85);
  border-radius: 50%;
  color: var(--paper-white);
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, 0);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: opacity 0.7s ease, border-color 0.3s ease, background 0.3s ease;
  pointer-events: none;
}

.scroll-hint.is-visible {
  opacity: 1;
  pointer-events: auto;
  animation:
    scroll-hint-in 1.3s var(--ease-elegant) both,
    scroll-hint-breathe 2.2s ease-in-out 1.3s infinite;
}

.scroll-hint:hover {
  border-color: var(--brass);
  background: rgba(8, 6, 4, 0.48);
}

.scroll-hint svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke-width: 2;
}

@keyframes scroll-hint-in {
  from {
    opacity: 0;
    transform: translate(-50%, 14px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes scroll-hint-breathe {
  0%, 100% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, 9px);
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint {
    animation: none;
  }
}

@media (max-width: 480px) {
  .scroll-hint {
    bottom: 22px;
    width: 46px;
    height: 46px;
  }

  .scroll-hint svg {
    width: 19px;
    height: 19px;
  }
}
