/* ============================================================
   RIOFRÍO · 700 AÑOS DE HISTORIA — hoja de estilos
   Paleta: granate profundo, pergamino, oro viejo, tinta sepia
   ============================================================ */

:root {
  --granate: #4a1216;
  --granate-osc: #2e0a0d;
  --granate-neg: #1d0608;
  --granate-claro: #6b1f24;
  --pergamino: #efe1c2;
  --pergamino-claro: #f5ecd6;
  --pergamino-osc: #e3cfa6;
  --oro: #c9a13b;
  --oro-claro: #e6cc7d;
  --oro-osc: #9a7526;
  --tinta: #3b2317;
  --crema: #f3e7cd;
  --f-display: "Cinzel", serif;
  --f-cuerpo: "Cormorant Garamond", serif;
  --f-firma: "Great Vibes", cursive;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--f-cuerpo);
  font-size: 18px;
  color: var(--tinta);
  background-color: var(--pergamino);
  background-image: url("assets/img/parchment.jpg");
  background-size: 900px auto;
  min-height: 100vh;
}

body.bloqueada { overflow: hidden; }

/* Marco de cuero que encuadra toda la página, como lámina de libro antiguo */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 5px rgba(46, 10, 13, 0.92),
    inset 0 0 0 6px rgba(201, 161, 59, 0.55),
    inset 0 0 90px rgba(30, 8, 6, 0.35);
}

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

a { color: inherit; }

:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }

/* ============ PUERTA DE ACCESO ============ */

.puerta {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(120, 40, 30, 0.25), transparent 65%),
    radial-gradient(ellipse at 50% 50%, #35090c 0%, var(--granate-neg) 70%, #120304 100%);
  opacity: 1;
  transition: opacity 0.9s ease, visibility 0.9s;
}

body:not(.bloqueada) .puerta {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.1);
  filter: blur(5px);
}

.puerta { transition: opacity 0.9s ease, visibility 0.9s, transform 0.9s ease, filter 0.9s ease; }

.puerta-libro {
  perspective: 1200px;
}

.puerta-marco {
  position: relative;
  width: min(460px, 94vw);
  padding: 48px 40px 96px;
  text-align: center;
  color: var(--oro-claro);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 161, 59, 0.08), transparent 55%),
    linear-gradient(160deg, #3a0e12 0%, var(--granate-osc) 55%, #240709 100%);
  border: 3px double var(--oro-osc);
  animation: respiracion 6s ease-in-out infinite;
}

@keyframes respiracion {
  0%, 100% {
    box-shadow:
      inset 0 0 0 6px rgba(0, 0, 0, 0.25),
      inset 0 0 60px rgba(0, 0, 0, 0.55),
      0 30px 80px rgba(0, 0, 0, 0.8);
  }
  50% {
    box-shadow:
      inset 0 0 0 6px rgba(0, 0, 0, 0.25),
      inset 0 0 60px rgba(0, 0, 0, 0.55),
      0 30px 80px rgba(0, 0, 0, 0.8),
      0 0 70px rgba(201, 161, 59, 0.22);
  }
}

.puerta-esquina {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: var(--oro);
  border-style: solid;
  border-width: 0;
  opacity: 0.9;
}
.pe-tl { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.pe-tr { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; }
.pe-bl { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; }
.pe-br { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }

.puerta-escudo {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 18px;
  border: 2px solid var(--oro-osc);
  box-shadow: 0 0 0 5px rgba(201, 161, 59, 0.15), 0 10px 25px rgba(0, 0, 0, 0.6);
}

.puerta-titulo {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 44px;
  letter-spacing: 0.08em;
  color: var(--oro-claro);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.puerta-sub {
  font-family: var(--f-display);
  font-size: 14px;
  letter-spacing: 0.34em;
  margin-top: 6px;
  color: var(--oro);
}

.puerta-fechas {
  font-family: var(--f-display);
  font-size: 12px;
  letter-spacing: 0.2em;
  margin-top: 8px;
  color: rgba(230, 204, 125, 0.75);
}

.puerta-regla {
  width: 130px;
  height: 1px;
  margin: 20px auto;
  background: linear-gradient(90deg, transparent, var(--oro), transparent);
}

.puerta-texto {
  font-size: 17px;
  font-style: italic;
  line-height: 1.6;
  color: var(--crema);
  opacity: 0.85;
}

.puerta-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.puerta-form input {
  width: 100%;
  max-width: 280px;
  padding: 12px 16px;
  text-align: center;
  font-family: var(--f-display);
  font-size: 15px;
  letter-spacing: 0.25em;
  color: var(--tinta);
  background: var(--pergamino-claro);
  border: 1px solid var(--oro-osc);
  box-shadow: inset 0 2px 6px rgba(59, 35, 23, 0.25);
}

.puerta-form input::placeholder { letter-spacing: 0.08em; font-family: var(--f-cuerpo); font-style: italic; color: #8a6f4d; }

.puerta-error {
  min-height: 22px;
  margin-top: 12px;
  font-style: italic;
  font-size: 16px;
  color: #e8a099;
}

/* ============ SELLO DE LACRE (imagen generada) ============ */

.sello-lacre {
  width: 110px;
  filter: drop-shadow(0 10px 20px rgba(30, 5, 5, 0.5));
}

/* Sello animado (Remotion): cae y se estampa. El frame lleva margen
   transparente para el rebote, así que el video se muestra más grande que el
   PNG estático (el lacre visible ocupa ~72% del cuadro) y sin sombra CSS
   (va horneada). Póster = PNG estático (fallback en Safari, sin WebM+alfa). */
.sello-video {
  height: auto;
  object-fit: contain;
  filter: none;
}

.sello-puerta {
  position: absolute;
  bottom: -62px;
  left: 50%;
  width: 128px;
  transform: translateX(-50%) rotate(-5deg);
}

.sello-puerta.sello-video {
  width: 182px;
  bottom: -86px;
}

.sello-hero {
  position: absolute;
  left: 34px;
  bottom: -34px;
  width: 138px;
  transform: rotate(-9deg);
  z-index: 5;
}

.sello-hero.sello-video {
  width: 120px;
  left: -34px; /* esquina inferior izquierda de la foto del autor */
  right: auto;
  bottom: -30px;
  transform: rotate(-12deg);
  z-index: 6;
}

.sello-contacto {
  width: 128px;
  margin: 8px auto 0;
  transform: rotate(-4deg);
}

.sello-pie {
  position: absolute;
  right: 44px;
  bottom: 58px;
  width: 158px;
  transform: rotate(7deg);
}

/* ============ CABECERA ============ */

.cabecera {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 28px;
  background: linear-gradient(180deg, #3c0e12 0%, var(--granate-osc) 100%);
  border-bottom: 2px solid var(--oro-osc);
  box-shadow: 0 1px 0 rgba(201, 161, 59, 0.35), 0 8px 24px rgba(20, 4, 6, 0.45);
}

.marca {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.marca-escudo {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 50%;
  border: 1.5px solid var(--oro-osc);
}

.marca-texto { display: flex; flex-direction: column; line-height: 1.25; }

.marca-nombre {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.1em;
  color: var(--oro-claro);
  background: linear-gradient(180deg, #f2dc95 0%, var(--oro) 55%, var(--oro-osc) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.marca-lema {
  font-family: var(--f-display);
  font-size: 9.5px;
  letter-spacing: 0.28em;
  color: var(--oro);
}

.marca-fechas {
  font-family: var(--f-display);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: rgba(230, 204, 125, 0.65);
}

.nav { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.nav { flex: 1; }

.nav a {
  position: relative;
  font-family: var(--f-display);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--crema);
  padding: 8px 7px 18px;
  white-space: nowrap;
  transition: color 0.25s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='7' viewBox='0 0 34 7'%3E%3Cpath d='M0 3.5h13M21 3.5h34' stroke='%239a7526' stroke-width='0.8'/%3E%3Cpath d='M17 0.8 19.4 3.5 17 6.2 14.6 3.5z' fill='%23c9a13b'/%3E%3C/svg%3E") center bottom 6px / 30px 6px no-repeat;
}

.nav a:hover { color: var(--oro-claro); }

.nav-burger {
  display: none;
  font-size: 22px;
  color: var(--oro-claro);
  background: none;
  border: 1px solid var(--oro-osc);
  padding: 4px 10px;
  cursor: pointer;
}

/* ============ HERO ============ */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 3px double var(--oro-osc);
}

/* Difuminado de luz a lo alto de TODO el hero, centrado tras el texto:
   aclara el fondo del collage en una franja vertical para que las letras
   resalten. Va sobre el fondo/video y por debajo del contenido (z-index:1). */
.hero::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(64%, 900px);
  transform: translateX(-50%);
  background: linear-gradient(
    90deg,
    rgba(247, 238, 214, 0) 0%,
    rgba(248, 240, 218, 0.7) 26%,
    rgba(249, 242, 221, 0.84) 50%,
    rgba(248, 240, 218, 0.7) 74%,
    rgba(247, 238, 214, 0) 100%
  );
  filter: blur(34px);
  pointer-events: none;
}

.hero-fondo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url("assets/img/slyder-principal.png") center 42% / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, #000 74%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 74%, transparent 100%);
}

/* Fondo animado (Remotion): Ken Burns + motas doradas. Se apoya sobre
   .hero-fondo, que queda como póster/fallback si el video no carga. */
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 74%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 74%, transparent 100%);
}

/* Motas de polvo dorado en suspensión */
.hero-motas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(154, 117, 38, 0.55) 1px, transparent 1.8px),
    radial-gradient(circle, rgba(240, 217, 140, 0.9) 1.2px, transparent 2px);
  background-size: 260px 280px, 380px 420px;
  background-position: 0 0, 70px 40px;
  animation: motas 30s linear infinite;
  opacity: 0.55;
}

@keyframes motas {
  to { background-position: -90px -280px, -50px -460px; }
}

.hero-contenido {
  position: relative;
  z-index: 1; /* contexto de apilado por encima del fondo/video */
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  align-items: center;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 54px 28px 64px;
}

/* Libros (imagen generada) */

.hero-libros {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  align-self: end; /* ancla la columna al fondo del hero */
}

.hero-tomos {
  width: 372px;
  max-width: 100%;
  transform: translateY(80px); /* baja los tomos casi hasta el filo del hero */
  filter: drop-shadow(0 22px 34px rgba(30, 8, 6, 0.5));
  transition: transform 0.5s ease;
}

.hero-tomos:hover { transform: translateY(74px) scale(1.02); }

/* Centro */

.hero-centro { position: relative; text-align: center; }

/* Escudo animado (Remotion): revelado + barrido de brillo. El frame lleva
   ~10% de margen transparente para el movimiento, de ahí el ancho mayor y los
   márgenes negativos que recuperan el espaciado del escudo estático. La sombra
   va horneada en el video. */
.hero-escudo {
  width: 264px;
  height: 264px;
  margin: -14px auto -8px;
  object-fit: contain;
}

.hero-titulo {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(46px, 6vw, 72px);
  letter-spacing: 0.05em;
  line-height: 1;
  color: var(--granate);
  text-shadow: 0 1px 0 rgba(201, 161, 59, 0.55), 0 4px 14px rgba(59, 35, 23, 0.25);
}

.hero-sub {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(15px, 1.8vw, 22px);
  letter-spacing: 0.3em;
  margin-top: 10px;
  color: var(--granate-claro);
}

.hero-fechas {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(18px, 2.2vw, 24px);
  letter-spacing: 0.3em;
  margin-top: 14px;
  color: var(--granate); /* mismo color que el título */
  text-shadow: 0 1px 0 rgba(201, 161, 59, 0.5), 0 2px 8px rgba(59, 35, 23, 0.2);
}

.hero-fechas::before { content: "✦  "; color: var(--oro); }
.hero-fechas::after { content: "  ✦"; color: var(--oro); }

.hero-lema {
  margin-top: 18px;
  font-size: 20px;
  line-height: 1.5;
  color: var(--tinta);
}

/* Autor */

.hero-autor { display: flex; justify-content: center; }

/* Contenedor del retrato: ancla el sello a la esquina de la foto del autor */
.retrato-wrap {
  position: relative;
  display: inline-block;
  max-width: 250px;
}

.polaroid {
  position: relative;
  background: #f8f4ea;
  padding: 11px 11px 12px;
  border: 1px solid #d9cba8;
  box-shadow: 0 14px 34px rgba(59, 35, 23, 0.35);
  max-width: 252px;
}

.polaroid img { width: 100%; height: auto; }

.polaroid figcaption { text-align: center; }

.polaroid-firma {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 52px;
  font-family: var(--f-firma);
  font-size: 27px;
  color: #fdf8ec;
  line-height: 1.05;
  text-shadow: 0 1px 6px rgba(10, 5, 5, 0.75);
  pointer-events: none;
}

.polaroid-cargo {
  display: block;
  margin-top: 9px;
  font-family: var(--f-display);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--granate);
}

/* Retrato del autor (imagen que ya viene enmarcada y rotulada) */
.retrato-autor {
  width: 100%;
  max-width: 250px;
  height: auto;
  filter: drop-shadow(0 14px 34px rgba(59, 35, 23, 0.4));
}

.retrato-autor-wrap { max-width: 300px; margin: 0 auto; }

.retrato-autor-seccion { max-width: 300px; transform: rotate(-1.5deg); }

.sello-hero {
  position: absolute;
  left: 36px;
  bottom: -12px;
  transform: rotate(-8deg);
  z-index: 5;
}

/* ============ CINTA (distintivo compacto) ============ */

.columna-obra {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.columna-obra .tarjeta { flex: 1; }

.cinta {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #55161b 0%, var(--granate-osc) 100%);
  border: 1px solid var(--oro-osc);
  outline: 1px solid rgba(201, 161, 59, 0.25);
  outline-offset: 3px;
  box-shadow: 0 10px 26px rgba(46, 10, 13, 0.35);
}

.cinta-icono {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--oro-claro);
  border: 1.5px solid var(--oro-osc);
  background: rgba(201, 161, 59, 0.08);
}

.cinta-icono svg { width: 22px; height: 22px; }

.cinta-texto { min-width: 0; }

.cinta-texto h2 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.09em;
  line-height: 1.4;
  color: var(--oro-claro);
}

.cinta-texto p {
  margin-top: 5px;
  font-size: 14.5px;
  line-height: 1.4;
  font-style: italic;
  color: var(--crema);
  opacity: 0.9;
}

/* ============ TARJETAS ============ */

.tarjetas {
  display: grid;
  grid-template-columns: 1.12fr repeat(4, 1fr);
  gap: 16px;
  width: min(1280px, calc(100% - 56px));
  margin: 26px auto 0;
}

.tarjeta {
  display: flex;
  flex-direction: column;
  padding: 16px 15px 18px;
  background: linear-gradient(180deg, var(--pergamino-claro) 0%, #eeddb9 100%);
  border: 1px solid rgba(154, 117, 38, 0.5);
  outline: 1px solid rgba(154, 117, 38, 0.25);
  outline-offset: 3px;
  box-shadow: 0 1px 0 rgba(255, 252, 240, 0.6) inset, 0 8px 20px rgba(59, 35, 23, 0.18);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.tarjeta:hover {
  transform: translateY(-5px);
  box-shadow:
    0 1px 0 rgba(255, 252, 240, 0.6) inset,
    0 16px 32px rgba(59, 35, 23, 0.3),
    0 0 26px rgba(201, 161, 59, 0.3);
}

.tarjeta-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.tarjeta-cab img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 3px 6px rgba(59, 35, 23, 0.3));
  transition: transform 0.35s ease;
}

.tarjeta:hover .tarjeta-cab img { transform: scale(1.1) rotate(-2deg); }

.tarjeta-cab h3 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.1em;
  line-height: 1.45;
  color: var(--granate);
}

.tarjeta p {
  flex: 1;
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--tinta);
  margin-bottom: 14px;
}

.btn-rojo {
  align-self: flex-start;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-decoration: none;
  color: var(--oro-claro);
  background: linear-gradient(180deg, #5c181d 0%, #3a0e12 100%);
  border: 1px solid var(--oro-osc);
  padding: 8px 16px;
  transition: background 0.25s, color 0.25s;
}

.btn-rojo:hover {
  background: linear-gradient(180deg, var(--oro-claro) 0%, var(--oro) 100%);
  color: var(--granate-osc);
}

/* ============ TIMELINE + COMUNIDAD ============ */

.franja-tiempo {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  width: min(1280px, calc(100% - 56px));
  margin: 26px auto 0;
  align-items: stretch;
}

.tiempo {
  padding: 22px 24px 26px;
  background: linear-gradient(180deg, var(--pergamino-claro) 0%, #eeddb9 100%);
  border: 1px solid rgba(154, 117, 38, 0.5);
  box-shadow: 0 8px 20px rgba(59, 35, 23, 0.18);
}

.tiempo .titulo-seccion { margin-bottom: 18px; }
.tiempo .titulo-seccion span { font-size: 15px; }

.tiempo-linea {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.tiempo-linea::before {
  content: "";
  position: absolute;
  left: 3%;
  right: 3%;
  top: 27px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--oro-osc) 8%, var(--oro-osc) 92%, transparent);
}

.hito {
  position: relative;
  flex: 1;
  text-align: center;
  padding: 0 3px;
}

.hito-icono {
  position: relative;
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, #fdf5df 0%, var(--pergamino-claro) 52%, var(--pergamino-osc) 100%);
  border: 1.5px solid var(--oro-osc);
  box-shadow:
    0 0 0 4px rgba(201, 161, 59, 0.16),
    inset 0 1px 2px rgba(255, 250, 235, 0.9),
    inset 0 0 10px rgba(154, 117, 38, 0.22),
    0 5px 12px rgba(59, 35, 23, 0.3);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

/* Anillo grabado interior — aire de medalla acuñada */
.hito-icono::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px solid rgba(154, 117, 38, 0.5);
  box-shadow: inset 0 0 0 1.5px rgba(253, 245, 223, 0.6);
  pointer-events: none;
}

.hito:hover .hito-icono {
  transform: translateY(-3px);
  box-shadow:
    0 0 0 4px rgba(201, 161, 59, 0.28),
    inset 0 1px 2px rgba(255, 250, 235, 0.9),
    inset 0 0 10px rgba(154, 117, 38, 0.22),
    0 9px 18px rgba(59, 35, 23, 0.38);
}

.hito-icono svg {
  position: relative;
  width: 36px;
  height: 36px;
  overflow: visible;
}

/* Estilo grabado heráldico: silueta granate, líneas "talladas" en claro
   (color del pergamino) y acentos en oro viejo. */
.hito-icono svg .s {
  fill: var(--granate);
  stroke: var(--granate-osc);
  stroke-width: 0.5;
}
.hito-icono svg .cut {
  fill: none;
  stroke: #fbf3dd;
  stroke-width: 1.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
}
.hito-icono svg .au {
  fill: none;
  stroke: var(--oro-osc);
  stroke-width: 1.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hito-icono svg .auf {
  fill: var(--oro-osc);
  stroke: none;
}

.hito strong {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--granate);
}

.hito p {
  margin-top: 4px;
  font-size: 13.5px;
  line-height: 1.35;
  font-style: italic;
  color: var(--tinta);
}

.comunidad {
  display: flex;
  flex-direction: column;
  padding: 24px 22px;
  color: var(--crema);
  background: linear-gradient(180deg, #55161b 0%, var(--granate-osc) 100%);
  border: 1px solid var(--oro-osc);
  outline: 1px solid rgba(201, 161, 59, 0.25);
  outline-offset: 3px;
  box-shadow: 0 10px 26px rgba(46, 10, 13, 0.35);
}

.comunidad h2 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--oro-claro);
}

.comunidad p { margin-top: 10px; font-size: 16px; font-style: italic; line-height: 1.5; opacity: 0.9; }

.comunidad-form { margin-top: 16px; display: flex; gap: 8px; }

.comunidad-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  font-family: var(--f-cuerpo);
  font-size: 16px;
  color: var(--tinta);
  background: var(--pergamino-claro);
  border: 1px solid var(--oro-osc);
}

.comunidad-form .btn-oro { padding: 11px 14px; white-space: nowrap; }

.comunidad-aviso { min-height: 20px; margin-top: 8px; font-size: 15px; font-style: italic; color: var(--oro-claro); }

.btn-oro {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--granate-osc);
  background: linear-gradient(180deg, var(--oro-claro) 0%, var(--oro) 60%, var(--oro-osc) 100%);
  border: 1px solid var(--oro-osc);
  padding: 11px 22px;
  cursor: pointer;
  transition: filter 0.25s;
}

.btn-oro:hover { filter: brightness(1.1); }

/* ============ SECCIONES GENERALES ============ */

.seccion {
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 28px 30px;
}

.titulo-seccion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
}

.titulo-seccion::before,
.titulo-seccion::after {
  content: "";
  flex: 1;
  max-width: 220px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--oro-osc));
}

.titulo-seccion::after { background: linear-gradient(90deg, var(--oro-osc), transparent); }

.titulo-seccion span {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.16em;
  color: var(--granate);
}

.seccion-intro {
  margin: 14px auto 34px;
  text-align: center;
  font-size: 20px;
  color: var(--tinta);
  opacity: 0.85;
}

.divisor {
  margin: 60px auto 0;
  text-align: center;
  font-size: 15px;
  letter-spacing: 1.2em;
  padding-left: 1.2em;
  color: var(--oro-osc);
}

.capitular {
  float: left;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 58px;
  line-height: 0.85;
  padding: 6px 10px 0 0;
  color: var(--granate);
}

/* ============ EL LINAJE ============ */

.linaje-cuerpo {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 38px;
  align-items: start;
}

.marco-oro {
  background: var(--pergamino-claro);
  border: 1px solid var(--oro-osc);
  outline: 1px solid rgba(154, 117, 38, 0.35);
  outline-offset: 4px;
  padding: 10px;
  box-shadow: 0 12px 30px rgba(59, 35, 23, 0.25);
}

.marco-oro img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  filter: sepia(0.45) saturate(0.8);
  border: 1px solid rgba(154, 117, 38, 0.4);
}

.marco-oro figcaption {
  padding: 10px 6px 4px;
  text-align: center;
  font-style: italic;
  font-size: 16px;
  color: var(--tinta);
}

.linaje-texto p { margin-bottom: 16px; line-height: 1.65; font-size: 19px; }

.linaje-datos {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 26px;
}

.linaje-datos div {
  text-align: center;
  padding: 14px 8px;
  background: rgba(201, 161, 59, 0.1);
  border: 1px solid rgba(154, 117, 38, 0.4);
}

.linaje-datos strong {
  display: block;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 24px;
  color: var(--granate);
}

.linaje-datos span {
  font-size: 14px;
  font-style: italic;
  color: var(--tinta);
}

/* ============ DOCUMENTOS ============ */

.docs-cuerpo {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 26px;
  align-items: start;
}

.marco-panel {
  background: linear-gradient(180deg, var(--pergamino-claro) 0%, #eeddb9 100%);
  border: 1px solid rgba(154, 117, 38, 0.5);
  box-shadow: 0 8px 20px rgba(59, 35, 23, 0.18);
  padding: 24px;
}

.marco-panel h3 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--granate);
  margin-bottom: 12px;
}

.docs-subida p { font-size: 16px; font-style: italic; margin-bottom: 16px; }

.docs-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 30px 18px;
  text-align: center;
  cursor: pointer;
  border: 1.5px dashed var(--oro-osc);
  background: rgba(201, 161, 59, 0.07);
  color: var(--tinta);
  font-style: italic;
  font-size: 16px;
  transition: background 0.25s;
}

.docs-drop:hover, .docs-drop.activo { background: rgba(201, 161, 59, 0.18); }

.docs-drop svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: var(--granate);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.docs-estado { min-height: 22px; margin-top: 12px; font-style: italic; font-size: 15px; color: var(--granate); }

.docs-ul { list-style: none; }

.docs-ul li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid rgba(154, 117, 38, 0.3);
}

.docs-ul li:last-child { border-bottom: none; }

.docs-vacio { font-style: italic; opacity: 0.75; }

.docs-nombre { flex: 1; font-size: 17px; word-break: break-word; }

.docs-meta { font-size: 14px; font-style: italic; opacity: 0.7; white-space: nowrap; }

.docs-accion {
  font-family: var(--f-display);
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--oro-claro);
  background: linear-gradient(180deg, #5c181d 0%, #3a0e12 100%);
  border: 1px solid var(--oro-osc);
}

.docs-accion:hover { filter: brightness(1.25); }

/* ============ ÁRBOL GENEALÓGICO ============ */
/* Línea de enlace común a todo el árbol */
:root { --linea-arbol: rgba(59, 35, 23, 0.55); }

.arbol {
  position: relative;
  margin: 6px auto 0;
  padding: 8px 20px 24px;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Escudos en las esquinas superiores, con rótulo */
.arbol-escudos {
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}

.arbol-escudo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 104px;
}

.arbol-escudo img {
  width: 78px;
  height: auto;
  filter: drop-shadow(0 6px 12px rgba(59, 35, 23, 0.4));
}

.arbol-escudo span {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--granate);
}

.arbol-tronco {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Generación */
.gen { position: relative; display: flex; justify-content: center; }

.gen:not(:first-child) { padding-top: 32px; }

.gen:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 32px;
  background: var(--linea-arbol);
}

/* Pareja (matrimonio): dos óvalos unidos por una línea horizontal */
.pareja {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 24px;
}

.pareja::before {          /* línea de enlace conyugal */
  content: "";
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 84px;
  height: 2px;
  background: var(--linea-arbol);
  z-index: 0;
}

/* Nodo (persona) */
.nodo { width: 138px; text-align: center; }

.nodo-ovalo {
  width: 84px;
  height: 104px;
  margin: 0 auto 9px;
  border-radius: 50%;
  position: relative;
  z-index: 1;
}

/* Óvalo-retrato (línea troncal): marco bronce y oro con retrato/silueta sepia */
.nodo-troncal .nodo-ovalo {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 110'%3E%3Crect width='90' height='110' fill='%23c8ab7f'/%3E%3Ccircle cx='45' cy='41' r='17' fill='%236f5334'/%3E%3Cpath d='M16 110 C16 85 29 73 45 73 C61 73 74 85 74 110 Z' fill='%236f5334'/%3E%3C/svg%3E") center / cover no-repeat;
  box-shadow:
    inset 0 0 16px rgba(42, 24, 8, 0.6),
    0 0 0 2px var(--oro),
    0 0 0 7px #6e4f28,
    0 0 0 8px #34240f,
    0 9px 16px rgba(30, 15, 8, 0.4);
}

/* Óvalo vacío (por documentar): relleno marrón plano, como en la lámina */
.nodo-vacio .nodo-ovalo {
  background: linear-gradient(160deg, #8f7457 0%, #6e5942 100%);
  border: 1px solid #574430;
  box-shadow:
    inset 0 3px 9px rgba(0, 0, 0, 0.32),
    0 6px 12px rgba(30, 15, 8, 0.28);
}

/* Nodo actual (autor): marco resaltado en oro */
.nodo-actual .nodo-ovalo {
  box-shadow:
    inset 0 0 16px rgba(42, 24, 8, 0.55),
    0 0 0 2px var(--oro-claro),
    0 0 0 7px #8a6a2e,
    0 0 0 8px #34240f,
    0 0 20px rgba(201, 161, 59, 0.5),
    0 9px 16px rgba(30, 15, 8, 0.4);
}

/* Nombres bajo cada óvalo */
.nodo figcaption strong {
  display: block;
  font-family: var(--f-cuerpo);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.25;
  color: var(--tinta);
}

.nodo figcaption span {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  font-style: italic;
  line-height: 1.3;
  color: var(--tinta);
  opacity: 0.72;
}

.nodo-vacio figcaption strong { font-weight: 500; opacity: 0.78; }
.nodo-vacio figcaption span { opacity: 0.62; }

/* Descendencia (rama de hijos) */
.descendencia {
  position: relative;
  padding-top: 32px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.descendencia::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 32px;
  background: var(--linea-arbol);
}

.rama-hijos {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 26px;
  padding-top: 22px;
}

.rama-hijos::before {          /* barra de hermanos */
  content: "";
  position: absolute;
  top: 0;
  left: 69px;
  right: 69px;
  height: 2px;
  background: var(--linea-arbol);
}

.rama-hijos .nodo { position: relative; }

.rama-hijos .nodo::before {    /* baja a cada hijo */
  content: "";
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 22px;
  background: var(--linea-arbol);
}

.arbol-nota {
  margin: 26px auto 0;
  max-width: 620px;
  text-align: center;
  font-style: italic;
  font-size: 16px;
  line-height: 1.5;
  opacity: 0.8;
}

/* ============ LINAJES RELACIONADOS ============ */

.linajes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.linaje-carta {
  text-align: center;
  padding: 26px 20px;
  background: linear-gradient(180deg, var(--pergamino-claro) 0%, #eeddb9 100%);
  border: 1px solid rgba(154, 117, 38, 0.5);
  box-shadow: 0 8px 20px rgba(59, 35, 23, 0.18);
}

.linaje-blason {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 26px;
  color: var(--oro-claro);
  background: linear-gradient(180deg, #55161b 0%, var(--granate-osc) 100%);
  border: 1.5px solid var(--oro-osc);
  box-shadow: 0 0 0 4px rgba(201, 161, 59, 0.15);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}

.linaje-carta h3 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.16em;
  color: var(--granate);
  margin-bottom: 8px;
}

.linaje-carta p { font-size: 16px; line-height: 1.5; font-style: italic; }

/* ============ GALERÍA ============ */

.galeria-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.galeria-grid .marco-oro img { height: 230px; }

/* ============ EL AUTOR ============ */

.autor-cuerpo {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 44px;
  align-items: start;
  margin-top: 30px;
}

.polaroid-autor { transform: rotate(-2deg); margin: 0 auto; }

.autor-texto p { margin-bottom: 16px; line-height: 1.65; font-size: 19px; }

.autor-texto p.autor-firma {
  font-family: var(--f-firma);
  font-size: 42px;
  color: var(--granate);
  margin-top: 6px;
}

/* ============ CONTACTO ============ */

.contacto-cuerpo {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 26px;
  align-items: start;
}

.contacto-form { display: flex; flex-direction: column; gap: 14px; }

.campo-doble { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.contacto-form input,
.contacto-form textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--f-cuerpo);
  font-size: 17px;
  color: var(--tinta);
  background: rgba(255, 252, 240, 0.6);
  border: 1px solid rgba(154, 117, 38, 0.5);
  resize: vertical;
}

.contacto-form input::placeholder,
.contacto-form textarea::placeholder { font-style: italic; color: #8a6f4d; }

.contacto-form .btn-oro { align-self: flex-start; }

.contacto-aviso { min-height: 20px; font-style: italic; font-size: 16px; color: var(--granate); }

.contacto-datos {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 26px 24px;
  color: var(--crema);
  background: linear-gradient(180deg, #55161b 0%, var(--granate-osc) 100%);
  border: 1px solid var(--oro-osc);
  outline: 1px solid rgba(201, 161, 59, 0.25);
  outline-offset: 3px;
}

.contacto-dato { display: flex; gap: 14px; align-items: flex-start; }

.contacto-dato > span {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--oro-claro);
  border: 1px solid var(--oro-osc);
  background: rgba(201, 161, 59, 0.08);
}

.contacto-dato strong {
  font-family: var(--f-display);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--oro-claro);
}

.contacto-dato p { margin-top: 4px; font-size: 16.5px; line-height: 1.4; }

.contacto-datos .sello { margin: 10px auto 0; transform: rotate(-6deg); }

/* ============ PIE ============ */

.pie {
  position: relative;
  margin-top: 80px;
  color: var(--crema);
  background: linear-gradient(180deg, #3c0e12 0%, var(--granate-neg) 100%);
  border-top: 3px double var(--oro-osc);
}

.pie-columnas {
  display: grid;
  grid-template-columns: 1.6fr 1.3fr 1fr 1fr;
  gap: 34px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 44px 28px 30px;
}

.pie-marca { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.pie-marca img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 50%;
  border: 1.5px solid var(--oro-osc);
}

.pie-marca strong {
  display: block;
  font-family: var(--f-display);
  font-size: 19px;
  letter-spacing: 0.1em;
  color: var(--oro-claro);
}

.pie-marca span {
  font-family: var(--f-display);
  font-size: 8.5px;
  letter-spacing: 0.26em;
  color: var(--oro);
}

.pie-col > p { font-size: 16px; font-style: italic; line-height: 1.55; opacity: 0.85; }

.pie-col h4 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--oro-claro);
  margin-bottom: 14px;
}

.pie-enlaces { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; }

.pie-enlaces-una { grid-template-columns: 1fr; }

.pie-enlaces a {
  font-size: 16px;
  text-decoration: none;
  color: var(--crema);
  opacity: 0.85;
  transition: color 0.2s, opacity 0.2s;
}

.pie-enlaces a:hover { color: var(--oro-claro); opacity: 1; }

.pie-contacto { font-size: 16px; margin-bottom: 8px; opacity: 0.9; }

.pie-final {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 28px 26px;
  border-top: 1px solid rgba(201, 161, 59, 0.25);
}

.pie-final p {
  font-family: var(--f-display);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: rgba(243, 231, 205, 0.7);
}

.sello-pie { transform: rotate(6deg); }

/* ============ REVEAL ============ */

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-reveal].visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .puerta { transition: none; }
  .hero-motas { display: none; }
  .puerta-marco { animation: none; }
  .tarjeta, .tarjeta-cab img, .hero-tomos { transition: none; }
}

/* ============ RESPONSIVE ============ */

@media (max-width: 1180px) {
  .hero-contenido { grid-template-columns: 240px 1fr 260px; }
  .tarjetas { grid-template-columns: repeat(3, 1fr); }
  .franja-tiempo { grid-template-columns: 1fr; }
  .comunidad { max-width: 480px; }
}

@media (max-width: 980px) {
  .hero-contenido {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 40px;
  }
  .hero-libros { order: 2; align-self: auto; }
  .hero-centro { order: 1; }
  .hero-autor { order: 3; }
  .hero-tomos, .hero-tomos:hover { transform: none; } /* en apilado no bajan al filo */
  .linaje-cuerpo, .docs-cuerpo, .autor-cuerpo, .contacto-cuerpo { grid-template-columns: 1fr; }
  .marco-oro { max-width: 520px; margin: 0 auto; }
  .tiempo-linea { flex-wrap: wrap; row-gap: 26px; }
  .tiempo-linea::before { display: none; }
  .hito { flex: 1 1 30%; }
  .linajes-grid, .galeria-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--granate-osc);
    border-bottom: 2px solid var(--oro-osc);
    padding: 10px 0;
  }
  .nav.abierto { display: flex; }
  .nav a { padding: 12px 28px; }
  .nav a:not(:last-child)::after { display: none; }
  .nav-burger { display: block; }
  .tarjetas { grid-template-columns: 1fr; }
  .campo-doble { grid-template-columns: 1fr; }
  .linajes-grid, .galeria-grid { grid-template-columns: 1fr; }
  .hito { flex: 1 1 45%; }
  .pie-columnas { grid-template-columns: 1fr; gap: 26px; }
  .cinta { flex-direction: column; text-align: center; }
  .hero-libros { flex-direction: row; }
  .sello-hero { display: none; }
  .hero-tomos { width: 270px; }
  .hero-fondo { opacity: 0.55; }
}

@media (max-width: 560px) {
  .arbol { padding: 6px 8px 24px; }
  .arbol-escudo { width: 76px; }
  .arbol-escudo img { width: 54px; }
  .arbol-escudo span { font-size: 10px; letter-spacing: 0.12em; }
  .pareja { gap: 16px; }
  .pareja::before { width: 46px; top: 39px; }
  .nodo { width: 88px; }
  .nodo-ovalo { width: 62px; height: 78px; }
  .nodo figcaption strong { font-size: 12.5px; }
  .nodo figcaption span { font-size: 11.5px; }
  .rama-hijos { gap: 10px; }
  .rama-hijos::before { left: 44px; right: 44px; }
}
