/* ==========================================================
   Variables
   ========================================================== */
:root {
  --crema: #F3EEE4;
  --crema-oscuro: #E9E2D6;
  --morado: #7B6A9C;
  --morado-claro: #CFC6DD;
  --oliva: #3F4033;

  --fuente-texto: "EB Garamond", Georgia, serif;
  --fuente-firma: "Pinyon Script", cursive;

  --ancho-max: 520px;
  --alto-header: 80px;
  --video-ratio: 0.5625;
  /* ancho/alto del vídeo (9/16) */

  /* Brillo en el hero (1 = original · 0.75 = 25 % más oscuro · 0.5 = mitad):
     - vídeo (y póster): mientras se reproduce
     - imagen final: cuando el vídeo termina, para que se lean bien los textos */
  --hero-brillo-video: 1;
  --hero-brillo-final: 0.6;
}

/* ==========================================================
   Reset básico
   ========================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--alto-header);
}

body {
  margin: 0;
  background: var(--crema);
  color: var(--oliva);
  font-family: var(--fuente-texto);
  font-size: 1.125rem;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ==========================================================
   Navbar
   ========================================================== */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--alto-header);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 10;
  transition: background-color .3s ease;
}

/* Al hacer scroll: fondo sólido */
.site-header.is-scrolled {
  background: var(--crema);
  /* mismo color que el body: no se nota el navbar */
}

.logo-link {
  display: block;
  line-height: 0;
  transition: opacity .8s ease .4s;
  /* aparece junto a los textos al acabar el vídeo */
}

/* Mientras carga y se reproduce el vídeo, el logo del navbar no se ve */
html.hero-lock .logo-link {
  opacity: 0;
  pointer-events: none;
}

.logo {
  height: calc(var(--alto-header) - 16px);
  width: auto;
  /* Arriba del todo: logo en blanco (sobre el vídeo) */
  filter: brightness(0) invert(1);
  transition: filter .3s ease;
}

/* Con el navbar visible: logo con su color original (morado) */
.site-header.is-scrolled .logo {
  filter: none;
}

/* Hamburguesa: oculta arriba del todo, visible tras hacer scroll */
.menu-toggle {
  position: absolute;
  left: 16px;
  display: grid;
  gap: 5px;
  padding: 8px;
  background: none;
  border: 0;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}

.site-header.is-scrolled .menu-toggle {
  opacity: 1;
  visibility: visible;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--oliva);
}

.site-menu {
  position: fixed;
  inset: var(--alto-header) 0 auto 0;
  display: grid;
  gap: 4px;
  padding: 16px 24px;
  background: var(--crema);
  z-index: 9;
}

.site-menu[hidden] {
  display: none;
}

.site-menu a {
  padding: 8px 0;
  text-decoration: none;
}

/* ==========================================================
   Secciones
   ========================================================== */
.section {
  min-height: 100vh;
  min-height: 100svh;
  /* en móvil descuenta las barras del navegador */
  padding: calc(var(--alto-header) + 32px) 24px 48px;
  max-width: var(--ancho-max);
  margin-inline: auto;
  text-align: center;
}

/* Scroll bloqueado mientras se reproduce el vídeo del hero */
html.hero-lock,
html.hero-lock body {
  overflow: hidden;
  overscroll-behavior: none;
}

/* ==========================================================
   Hero (sección 1)
   ========================================================== */
.section--hero {
  position: relative;
  max-width: none;
  padding: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--crema);
  /* color de los laterales cuando el vídeo no llena el ancho */
}

.hero__video,
.hero__last {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__video {
  filter: brightness(var(--hero-brillo-video));
}

.hero__last {
  filter: brightness(var(--hero-brillo-final));
}

/* La imagen final está encima del vídeo, invisible hasta que termina */
.hero__last {
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
}

.hero.is-ended .hero__last {
  opacity: 1;
}

/* Al volver a ver el vídeo, la imagen final se oculta */
.hero.is-ended.is-replaying .hero__last {
  opacity: 0;
}

/* Logo grande centrado mientras carga el vídeo */
.hero__loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: opacity .5s ease, visibility 0s linear .5s;
}

.hero__logo {
  width: min(60vw, 260px);
  height: auto;
  filter: brightness(0) invert(1) drop-shadow(0 1px 10px rgba(40, 30, 20, .35));
}

/* Desaparece al empezar el vídeo y no vuelve a salir */
.hero.is-started .hero__loader {
  opacity: 0;
  visibility: hidden;
}

/* Escritorio y tablets (pantallas anchas): se ve el alto entero del vídeo y quedan
   franjas a los lados. Se decide por el ANCHO, no solo por la proporción, porque en
   móvil las barras del navegador cambian el alto visible y dejarían franjas.
   Los móviles en vertical siempre llenan la pantalla (cover).
   9/16 = proporción del vídeo (ancho/alto). */
@media (min-width: 768px) and (min-aspect-ratio: 9/16) {

  .hero__video,
  .hero__last {
    object-fit: contain;
  }

  /* los textos se mantienen dentro de la franja que ocupa el vídeo */
  .hero__content {
    width: min(100%, calc(100svh * var(--video-ratio)));
    margin-inline: auto;
  }
}

/* Textos del hero: invisibles hasta que termina el vídeo */
.hero__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--alto-header) + 24px) 24px calc(48px + env(safe-area-inset-bottom, 0px));
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 14px rgba(40, 30, 20, .35);
  opacity: 0;
  visibility: hidden;
  transition: opacity .8s ease .4s, visibility 0s linear 1.2s;
}

.hero.is-ended .hero__content {
  opacity: 1;
  visibility: visible;
  transition: opacity .8s ease .4s, visibility 0s;
}

.hero__nombres {
  margin: 0;
  font-size: clamp(2.5rem, 11vw, 4rem);
  font-weight: 500;
  line-height: 1.1;
}

.hero__fecha {
  margin: .75rem 0 0;
  font-size: 1rem;
  letter-spacing: .25em;
  text-transform: uppercase;
}

/* Contador + botón de volver a ver, agrupados abajo */
.hero__pie {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* Botón redondo con icono de replay */
.hero__replay {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 50%;
  cursor: pointer;
  /* Oculto (pero ocupando su sitio, para que los textos no se muevan) */
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s, background-color .2s ease;
}

.hero__replay:hover {
  background: rgba(255, 255, 255, .18);
}

.hero__replay:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* Visible cuando el vídeo ha terminado (no mientras se vuelve a reproducir) */
.hero.is-ended:not(.is-replaying) .hero__replay {
  opacity: 1;
  visibility: visible;
  transition: opacity .5s ease .8s, visibility 0s linear .8s, background-color .2s ease;
}

/* Cuenta atrás */
.cuenta-atras__intro {
  margin: 0 0 .75rem;
  font-size: 1.25rem;
  font-style: italic;
}

.cuenta-atras__items {
  display: flex;
  justify-content: center;
}

.cuenta-atras__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 5.5rem;
  padding: 0 1rem;
}

.cuenta-atras__item+.cuenta-atras__item {
  border-left: 1px solid rgba(255, 255, 255, .8);
}

.cuenta-atras__num {
  font-size: 2.25rem;
  line-height: 1.1;
  font-variant-numeric: lining-nums tabular-nums;
}

.cuenta-atras__txt {
  font-size: .8rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}

/* Texto solo para lectores de pantalla */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}