/* ==========================================================================
   Aniversario — rosa palo, salvia y champán
   ========================================================================== */

/* Las letras viven en este mismo sitio: cargan antes y nunca dependen de Google */
@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 300 600; font-display: swap;
  src: url('../media/fonts/fraunces.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces'; font-style: italic; font-weight: 300 600; font-display: swap;
  src: url('../media/fonts/fraunces-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Pinyon Script'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../media/fonts/pinyon.woff2') format('woff2');
}

:root {
  --rosa-palo: #e7c3c1;
  --rubor: #f8ebe7;
  --marfil: #fffaf6;
  --ciruela: #6b3344;
  --ciruela-hondo: #4a2230;
  --salvia: #8c9f88;
  --champan: #c5a26b;

  --font-display: 'Pinyon Script', 'Snell Roundhand', cursive;
  --font-text: 'Fraunces', 'Iowan Old Style', Georgia, serif;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow-soft: 0 18px 40px -18px rgba(107, 51, 68, .45);
}

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

html { scroll-behavior: smooth; overflow-x: clip; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-text);
  font-weight: 350;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--ciruela);
  background: var(--marfil);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.is-locked { overflow: hidden; height: 100vh; }
/* Visor abierto: bloquea el scroll sin mover la página de donde estaba */
html.has-modal { overflow: hidden; }

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

h1, h2, p { margin: 0; }

button { font: inherit; color: inherit; cursor: pointer; }

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

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

/* --------------------------------------------------------------------------
   Invitación de bienvenida: réplica de la de nuestra boda
   (solapas de encaje plateado, tarjeta crema sobre marco champán)
   -------------------------------------------------------------------------- */
.intro {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-content: center; justify-items: center; gap: clamp(.8rem, 3.5svh, 2rem);
  padding: 1rem; text-align: center; overflow: hidden;
  background:
    radial-gradient(circle at 20% 15%, #fff6f2 0, transparent 45%),
    radial-gradient(circle at 85% 85%, #dcb3b3 0, transparent 50%),
    var(--rosa-palo);
  transition: opacity 1.1s var(--ease), visibility 0s linear 1.1s;
}
/* is-open: solapas abiertas · is-waiting: ya se puede continuar · is-leaving: da paso a la página */
.intro.is-leaving { opacity: 0; visibility: hidden; }

.intro > * { opacity: 0; transition: opacity .9s var(--ease), transform .9s var(--ease), scale 1.8s var(--ease); transform: translateY(14px); }
.fonts-ready .intro > * { opacity: 1; transform: none; }
.fonts-ready .intro .gatefold { transition-delay: .12s; }
.fonts-ready .intro__cta { transition-delay: .3s; }

.intro__hint { font-family: var(--font-display); font-size: clamp(2rem, min(7vw, 9svh), 3.6rem); line-height: 1; }
.intro__cta { font-style: italic; font-size: 1rem; animation: breathe 2.4s ease-in-out infinite; }
.intro.is-open .intro__hint, .intro.is-open .intro__cta { opacity: 0; transition: opacity .4s; }
.intro.is-open .intro__cta { animation: none; }
.intro.is-waiting .intro__cta { opacity: 1; transition: opacity .9s var(--ease); animation: breathe 2.4s ease-in-out .9s infinite; }

.gatefold {
  --ink: #3f383b;
  position: relative; container-type: inline-size;
  width: min(64vw, 300px, 42svh); aspect-ratio: 5 / 7; cursor: pointer;
  perspective: 1400px;
}
.gatefold__back {
  position: absolute; inset: 0; border-radius: 3px;
  background: linear-gradient(135deg, #eef0f3, #b4b9c1 38%, #f1f2f4 58%, #a7acb5);
  box-shadow: 0 28px 36px -14px rgba(74, 34, 48, .45);
}
.gatefold__card {
  position: absolute; inset: 2.4% 3.4%; padding: 3.2cqw; display: grid;
  background: linear-gradient(135deg, #ead7b2, #cdb084 48%, #ecdcbb);
  box-shadow: 0 1px 4px rgba(63, 56, 59, .35);
}
/* Con las solapas cerradas, la tarjeta queda en penumbra */
.gatefold__card::after {
  content: ''; position: absolute; inset: 0; background: rgba(58, 40, 50, .2);
  transition: opacity 1.2s var(--ease) .3s;
}
.gatefold__paper {
  display: grid; align-content: space-between; justify-items: center; gap: 1cqw;
  min-width: 0; padding: 6cqw 3cqw 5cqw; color: var(--ink);
  background: radial-gradient(circle at 30% 20%, #fffdf8, #f8f1e4);
}
/* La tinta aparece al abrirse las solapas: cerrada, el encaje se ve limpio sobre el papel */
.gatefold__paper > * { opacity: 0; transition: opacity 1s var(--ease) .7s; }
.gatefold__verse, .gatefold__names, .gatefold__blessing, .gatefold__venue { font-family: var(--font-display); line-height: 1.1; }
.gatefold__verse { justify-self: stretch; display: grid; font-size: 6.4cqw; }
.gatefold__verse small { justify-self: end; font-size: .62em; opacity: .8; }
.gatefold__names { font-size: 11.4cqw; white-space: nowrap; }
.gatefold__blessing { font-size: 5cqw; }
.gatefold__flourish { width: 36cqw; fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: round; }
.gatefold__flourish circle { fill: currentColor; stroke: none; }
.gatefold__date {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2.4cqw;
  font-size: 4.3cqw; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; line-height: 1.25;
}
.gatefold__date > p { display: grid; }
.gatefold__date > p:last-child { font-size: 1.5em; letter-spacing: .02em; line-height: 1; }
.gatefold__date small { font-size: .5em; font-weight: 600; letter-spacing: .1em; }
/* El día va entre dos flechas, cada dígito en su círculo, como en la original */
.gatefold__day { grid-auto-flow: column; align-items: center; gap: 1cqw; }
.gatefold__day span {
  display: grid; place-items: center; width: 8.6cqw; aspect-ratio: 1; border-radius: 50%;
  background: var(--ink); color: #fbf6ec; font-size: 1.4em; letter-spacing: 0;
}
.gatefold__day::before, .gatefold__day::after {
  content: ''; width: 2.6cqw; height: 12cqw; margin-inline: .6cqw;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 40'%3E%3Cpath d='M4 3v30M1.500 2 4 5l2.500-3M1.500 5.500 4 8.500l2.500-3' fill='none' stroke='%233f383b' stroke-width='.9' stroke-linecap='round'/%3E%3Cpath d='M4 39 1.800 32.500h4.400z' fill='%233f383b'/%3E%3C/svg%3E") center / contain no-repeat;
}
.gatefold__day::after { rotate: 180deg; }
.gatefold__venue { font-size: 6cqw; }

.gatefold__flap {
  position: absolute; top: 0; bottom: 0; z-index: 3; width: 54%;
  transition: transform 1.6s var(--ease) .25s;
}
.gatefold__flap::before {
  content: ''; position: absolute; inset: 0;
  background: url('../media/intro/encaje.svg') center / 100% 100% no-repeat;
}
.gatefold__flap--left { left: 0; transform-origin: left center; }
.gatefold__flap--right { right: 0; z-index: 4; transform-origin: right center; transition-delay: .4s; }
.gatefold__flap--right::before { scale: -1 1; }

/* Sello: el monograma de nuestra boda sobre una placa crema con filo champán */
.gatefold__seal {
  position: absolute; left: 50%; top: 50%; z-index: 5;
  width: 64cqw; aspect-ratio: 2 / 1; translate: -50% -50%;
  display: grid; place-items: center; padding: 0;
  border: 1px solid #cdb084; border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fffdf8, #f5ebd8);
  box-shadow: 0 6px 14px rgba(74, 34, 48, .45);
  animation: pulse 2.2s ease-in-out infinite;
  transition: opacity .4s, scale .4s;
}
.gatefold__seal::before { content: ''; position: absolute; inset: 3px; border: 1px solid rgba(205, 176, 132, .85); border-radius: inherit; }
.gatefold__seal img { width: 76%; height: auto; }
.gatefold__seal:hover { scale: 1.07; }

.intro.is-open .gatefold { scale: 1.08; }
.intro.is-open .gatefold__flap--left { transform: rotateY(-124deg); }
.intro.is-open .gatefold__flap--right { transform: rotateY(124deg); }
.intro.is-open .gatefold__card::after { opacity: 0; }
.intro.is-open .gatefold__paper > * { opacity: 1; }
.intro.is-open .gatefold__seal { opacity: 0; scale: .5; pointer-events: none; }

/* --------------------------------------------------------------------------
   Capas flotantes
   -------------------------------------------------------------------------- */
.petals { position: fixed; inset: 0; z-index: 40; pointer-events: none; width: 100%; height: 100%; transition: opacity 1.2s var(--ease); }
/* Fuera de la portada se atenúan para no tapar fotos ni texto */
.is-past-hero .petals { opacity: .3; }
/* Mientras se ve el video, nada flota encima */
.is-watching .petals { opacity: 0; }

.spark {
  position: fixed; z-index: 90; pointer-events: none;
  width: var(--size, 14px); height: var(--size, 14px);
  background: var(--color, var(--rosa-palo));
  clip-path: path('M7 13S1 9 .5 5C0 2 4 .5 7 4c3-3.500 7-2 6.500 1C13 9 7 13 7 13z');
  animation: spark var(--life, 1s) ease-out forwards;
}

.music {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1rem; border-radius: 999px;
  border: 1px solid rgba(107, 51, 68, .25);
  background: rgba(255, 250, 246, .85); backdrop-filter: blur(8px);
  font-size: .9rem;
}
.music[hidden] { display: none; }
.music svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.music[aria-pressed="true"] svg { animation: sway 1.2s ease-in-out infinite; }

/* --------------------------------------------------------------------------
   Portada
   -------------------------------------------------------------------------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; text-align: center;
  padding: 5rem 1.5rem 6rem; overflow: hidden; isolation: isolate;
}
.hero__photo {
  position: absolute; inset: -8% 0; z-index: -2;
  background:
    radial-gradient(60% 50% at 25% 20%, #fff3ee 0, transparent 70%),
    radial-gradient(50% 45% at 80% 75%, #d8aeb0 0, transparent 70%),
    radial-gradient(40% 40% at 70% 15%, #cfd9c9 0, transparent 70%),
    var(--rosa-palo);
  background-size: cover; background-position: center;
  will-change: transform;
}
.hero__photo.has-photo { animation: kenburns 24s ease-in-out infinite alternate; }
.hero__veil { position: absolute; inset: 0; z-index: -1; }
.hero__photo.has-photo + .hero__veil { background: rgba(0, 0, 0, .55); }

/* Portada con foto: capa negra y texto claro */
.hero--photo { color: var(--marfil); }
.hero--photo .hero__names { color: var(--marfil); text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
.hero--photo .counter__list span { color: var(--rosa-palo); filter: none; }
.hero--photo .hero__scroll svg { fill: var(--rosa-palo); }

/* "&" legible: la caligrafía lo dibuja demasiado fino */
.amp {
  font-family: var(--font-text); font-style: italic; font-weight: 300;
  font-size: .5em; color: var(--champan); padding: 0 .12em; vertical-align: .12em;
}
.hero__names .word { display: inline-block; white-space: nowrap; }
.hero__names .amp { padding: 0 .25em; }

.hero__names {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(3.8rem, 13vw, 10rem); line-height: 1;
  color: var(--ciruela);
  text-shadow: 0 2px 30px rgba(255, 250, 246, .9);
}
.hero__names .char { display: inline-block; opacity: 0; transform: translateY(.35em) rotate(6deg); }
.is-ready .hero__names .char {
  animation: charIn .9s var(--ease) forwards;
  animation-delay: calc(var(--i) * 70ms + 300ms);
}
.hero__date { margin-top: 1.4rem; font-size: clamp(1.1rem, 2.6vw, 1.5rem); font-style: italic; letter-spacing: .02em; }
.hero__phrase { margin: .6rem auto 0; max-width: 34ch; }
.hero__date, .hero__phrase, .counter { opacity: 0; }
.is-ready .hero__date, .is-ready .hero__phrase, .is-ready .counter { animation: rise 1.2s var(--ease) 1.5s forwards; }
.is-ready .counter { animation-delay: 1.9s; }

.counter { margin-top: 3rem; }
.counter__lead { font-style: italic; margin-bottom: .8rem; }
.counter__list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.6rem;
}
.counter__list li { min-width: 4.2rem; }
.counter__list strong {
  display: block; font-weight: 300; font-size: clamp(2rem, 5.5vw, 3.4rem); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.counter__list span { font-size: .9rem; color: var(--salvia); filter: brightness(.75); }

.hero__scroll {
  position: absolute; bottom: 1rem; left: 50%; translate: -50% 0;
  display: grid; justify-items: center; gap: .15rem; min-width: 44px; min-height: 44px; padding: .3rem .8rem;
  color: inherit; text-decoration: none; font-size: .8rem; font-style: italic; letter-spacing: .04em; white-space: nowrap;
  opacity: 0;
}
.is-ready .hero__scroll { animation: rise 1.2s var(--ease) 2.4s forwards; }
.hero__scroll svg { width: 30px; height: 30px; fill: var(--ciruela); animation: heartbeat 1.6s ease-in-out infinite; }

/* --------------------------------------------------------------------------
   Capítulos
   -------------------------------------------------------------------------- */
.chapter { position: relative; padding: clamp(4.5rem, 11vw, 9rem) clamp(1rem, 4vw, 1.5rem); overflow-x: clip; }
.chapter__head { max-width: 40rem; margin: 0 auto clamp(2.5rem, 6vw, 4.5rem); text-align: center; }
.chapter__head h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.8rem, 8vw, 5rem); line-height: 1.05; margin-bottom: 1rem;
}
.chapter__head p { font-style: italic; }
.chapter__head h2, .chapter__head p, .hero__phrase, .place__note { text-wrap: balance; }

.has-js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.has-js .reveal.is-visible { opacity: 1; transform: none; }

/* Video */
.chapter--video { background: linear-gradient(180deg, var(--marfil), var(--rubor)); }
.videos { display: grid; gap: 3rem; max-width: 60rem; margin: 0 auto; }
.film {
  margin: 0; padding: clamp(.6rem, 1.6vw, 1rem); background: #fff;
  box-shadow: var(--shadow-soft); rotate: -.6deg; position: relative;
}
.film:nth-child(even) { rotate: .7deg; }
.film::before, .film::after {
  content: ''; position: absolute; top: -14px; width: min(110px, 24%); height: 30px;
  background: rgba(140, 159, 136, .55); backdrop-filter: blur(2px);
}
.film::before { left: 8%; rotate: -5deg; }
.film::after { right: 8%; rotate: 4deg; }
.film__empty { width: 100%; aspect-ratio: 16 / 9; }
.film figcaption { padding: .9rem .4rem .3rem; text-align: center; font-family: var(--font-display); font-size: 1.9rem; line-height: 1.1; }
.film__empty, .polaroid__empty {
  display: grid; place-items: center; text-align: center; padding: 1.5rem;
  background: repeating-linear-gradient(135deg, #f3d9d6 0 14px, #f8e6e2 14px 28px);
  color: var(--ciruela); font-style: italic; font-size: 1rem; line-height: 1.4;
}

/* Reproductor */
.player {
  position: relative; isolation: isolate; overflow: hidden;
  aspect-ratio: 16 / 9; background: var(--ciruela-hondo); color: var(--marfil);
  -webkit-tap-highlight-color: transparent;
}
.player video { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.player::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(74, 34, 48, .35), transparent 60%),
    linear-gradient(180deg, transparent 55%, rgba(74, 34, 48, .8));
  transition: opacity .5s var(--ease);
}
.player.is-playing::after { background: linear-gradient(180deg, transparent 68%, rgba(74, 34, 48, .75)); }
.player.is-playing.is-idle::after { opacity: 0; }
.player.is-playing.is-idle, .player.is-playing.is-idle video { cursor: none; }

.player .icon { width: 1.35rem; height: 1.35rem; fill: currentColor; }
.player .icon .line { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.player .icon--pause, .player .icon--muted, .player .icon--shrink { display: none; }
.player.is-playing .player__btn--toggle .icon--play,
.player.is-muted .icon--volume,
.player.is-fullscreen .icon--expand { display: none; }
.player.is-playing .player__btn--toggle .icon--pause,
.player.is-muted .icon--muted,
.player.is-fullscreen .icon--shrink { display: block; }

.player__big {
  position: absolute; z-index: 2; top: 50%; left: 50%; translate: -50% -50%;
  width: clamp(4.2rem, 11vw, 6rem); aspect-ratio: 1; padding: 0;
  display: grid; place-items: center; border-radius: 50%;
  border: 1px solid rgba(255, 250, 246, .7); color: var(--marfil);
  background: rgba(255, 250, 246, .16);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px -10px rgba(0, 0, 0, .55);
  transition: scale .4s var(--ease), background-color .4s var(--ease), opacity .35s var(--ease), visibility .35s;
}
.player__big .icon { width: 42%; height: 42%; margin-left: 6%; }
.player__big::before {
  content: ''; position: absolute; inset: -1px; border-radius: 50%;
  border: 1px solid var(--champan); animation: player-pulse 2.6s var(--ease) infinite;
}
.player__big:hover { scale: 1.08; background: rgba(197, 162, 107, .55); }
.player.is-playing .player__big { opacity: 0; visibility: hidden; scale: 1.25; }
@keyframes player-pulse {
  from { scale: 1; opacity: .9; }
  to { scale: 1.55; opacity: 0; }
}

.player.is-waiting::before {
  content: ''; position: absolute; z-index: 2; top: 50%; left: 50%;
  width: 3rem; height: 3rem; margin: -1.5rem 0 0 -1.5rem; border-radius: 50%;
  border: 2px solid rgba(255, 250, 246, .3); border-top-color: var(--champan);
  animation: player-spin .9s linear infinite; pointer-events: none;
}
@keyframes player-spin { to { rotate: 360deg; } }

.player__bar {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: clamp(.35rem, 1.4vw, .8rem);
  padding: .5rem clamp(.5rem, 2vw, 1.1rem) .6rem;
  opacity: 0; visibility: hidden; translate: 0 .6rem;
  transition: opacity .4s var(--ease), translate .4s var(--ease), visibility 0s .4s;
}
/* Al mostrarse es visible de inmediato (para poder recibir el foco); al ocultarse espera al desvanecido */
.player.is-started .player__bar { opacity: 1; visibility: visible; translate: 0 0; transition-delay: 0s; }
.player.is-playing.is-idle .player__bar { opacity: 0; visibility: hidden; translate: 0 .6rem; transition-delay: 0s, 0s, .4s; }

.player__btn {
  flex: none; width: 2.4rem; height: 2.4rem; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: var(--marfil);
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.player__btn:hover { background: rgba(255, 250, 246, .16); color: #fff; }
.player__btn:focus-visible, .player__big:focus-visible, .player__seek:focus-visible { outline-offset: 2px; }
.player:focus-visible { outline-offset: -2px; }

.player__time {
  flex: none; min-width: 2.6em; text-align: center;
  font-size: .82rem; line-height: 1; letter-spacing: .04em; font-variant-numeric: tabular-nums;
}

.player__seek {
  --progress: 0%;
  flex: 1; min-width: 0; height: 1.5rem; margin: 0; padding: 0;
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.player__seek::-webkit-slider-runnable-track {
  height: 3px; border-radius: 3px;
  background: linear-gradient(to right, var(--champan) var(--progress), rgba(255, 250, 246, .32) var(--progress));
}
.player__seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; margin-top: -5px; border-radius: 50%;
  background: var(--marfil); box-shadow: 0 0 0 3px rgba(197, 162, 107, .5);
  transition: scale .25s var(--ease);
}
.player__seek:hover::-webkit-slider-thumb, .player__seek:active::-webkit-slider-thumb { scale: 1.25; }
.player__seek::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(255, 250, 246, .32); }
.player__seek::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--champan); }
.player__seek::-moz-range-thumb {
  width: 13px; height: 13px; border: 0; border-radius: 50%;
  background: var(--marfil); box-shadow: 0 0 0 3px rgba(197, 162, 107, .5);
}

.player:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; background: #000; }
.player:fullscreen video { object-fit: contain; }
.player:fullscreen .player__bar { padding-bottom: max(.9rem, env(safe-area-inset-bottom)); }

/* Táctil: áreas de toque de al menos 44px */
@media (pointer: coarse) {
  .player__btn { width: 2.75rem; height: 2.75rem; }
  .player__seek { height: 2.75rem; }
}
@media (max-width: 600px) {
  .player__bar { gap: .2rem; padding-inline: .2rem; }
  .player__time { font-size: .74rem; min-width: 2.3em; }
  .player__btn--mute { display: none; } /* en el celular el volumen va con los botones del teléfono */
}
@media (prefers-reduced-motion: reduce) {
  .player__big::before { animation: none; opacity: 0; }
}

/* Fotos */
.chapter--photos { background: var(--rubor); }
.gallery {
  max-width: 76rem; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense; align-items: center;
  gap: clamp(1.4rem, 3vw, 2.6rem);
}
.polaroid {
  --r: 0deg; --rx: 0deg; --ry: 0deg;
  margin: 0; padding: .7rem .7rem 0; background: #fff; border: 0; text-align: center;
  box-shadow: var(--shadow-soft);
  transform: perspective(900px) rotate(var(--r)) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), opacity .9s var(--ease);
}
.has-js .polaroid { opacity: 0; transform: perspective(900px) translateY(60px) rotate(calc(var(--r) * 4)) scale(.9); }
.has-js .polaroid.is-visible { opacity: 1; transform: perspective(900px) rotate(var(--r)) rotateX(var(--rx)) rotateY(var(--ry)); }
.polaroid:focus-visible { --r: 0deg; z-index: 2; box-shadow: 0 30px 50px -20px rgba(107, 51, 68, .6); }
@media (hover: hover) {
  .polaroid:hover { --r: 0deg; z-index: 2; box-shadow: 0 30px 50px -20px rgba(107, 51, 68, .6); }
}
.polaroid img, .polaroid__empty { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
/* Mientras la foto baja, el marco muestra un brillo de nácar */
.polaroid img {
  background: linear-gradient(100deg, #f4ded9 32%, #fdf2ee 50%, #f4ded9 68%) var(--rubor);
  background-size: 300% 100%;
  animation: photo-wait 1.8s linear infinite;
  opacity: 0; transition: opacity .8s var(--ease);
}
.polaroid img.is-loaded { opacity: 1; background: none; animation: none; }
.polaroid--wide { grid-column: span 2; }
.polaroid--wide img { aspect-ratio: 3 / 2; }
.polaroid figcaption, .polaroid__caption {
  display: block; min-height: 3.4rem; padding: .6rem .2rem .8rem;
  font-family: var(--font-display); font-size: 1.55rem; line-height: 1.1; color: var(--ciruela);
}

/* Carta */
.chapter--letter {
  background:
    radial-gradient(50% 40% at 10% 10%, rgba(140, 159, 136, .28) 0, transparent 70%),
    radial-gradient(50% 40% at 90% 90%, rgba(231, 195, 193, .8) 0, transparent 70%),
    var(--marfil);
}
.letter {
  max-width: 38rem; margin: 0 auto; padding: clamp(2rem, 6vw, 4rem);
  background:
    repeating-linear-gradient(transparent 0 calc(1.9em - 1px), rgba(107, 51, 68, .09) calc(1.9em - 1px) 1.9em),
    #fffdfb;
  line-height: 1.9; box-shadow: var(--shadow-soft); rotate: -.4deg;
}
.letter__greeting { font-family: var(--font-display); font-weight: 400; font-size: 2.8rem; line-height: 1.36; }
.letter__body p { min-height: 1.9em; margin-bottom: 1.9em; }
.letter:not(.is-done) { cursor: pointer; }
.letter__rest { visibility: hidden; }
.letter__body p.is-typing .letter__ink::after { content: ''; display: inline-block; width: 1px; height: 1em; margin-left: 2px; background: currentColor; vertical-align: -.1em; animation: blink .8s steps(1) infinite; }
.letter__signature { font-family: var(--font-display); font-size: 2.4rem; line-height: 1.58; text-align: right; opacity: 0; transition: opacity 1.4s; }
.letter.is-done .letter__signature { opacity: 1; }

/* Invitación */
.chapter--invite {
  background:
    radial-gradient(60% 50% at 50% 0, #8a4659 0, transparent 70%),
    var(--ciruela-hondo);
  color: var(--rubor);
}
.invite { max-width: 60rem; margin: 0 auto; display: grid; gap: 2.4rem; justify-items: center; }
.invite__places { border: 0; margin: 0; padding: 0; width: 100%; }
.places { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1.4rem; }

.place { position: relative; display: block; cursor: pointer; }
.place input { position: absolute; opacity: 0; inset: 0; }
.place__card {
  height: 100%; display: grid; justify-items: center; gap: .6rem; text-align: center;
  padding: 2.4rem 1.4rem 2rem;
  border: 1px solid rgba(248, 235, 231, .28); border-radius: 160px 160px 10px 10px;
  background: rgba(248, 235, 231, .05);
  transition: transform .5s var(--ease), background .5s, color .5s, border-color .5s;
}
.place__card svg { width: 58px; height: 58px; fill: none; stroke: var(--champan); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; transition: transform .8s var(--ease); }
.place__label { font-family: var(--font-display); font-size: clamp(2.2rem, 6vw, 2.8rem); line-height: 1; }
.place__note { font-size: 1rem; line-height: 1.5; max-width: 22ch; }
@media (hover: hover) {
  .place:hover .place__card { transform: translateY(-6px); border-color: var(--rosa-palo); }
  .place:hover svg { transform: rotate(-8deg) scale(1.08); }
}
.place input:focus-visible + .place__card { outline: 2px solid var(--champan); outline-offset: 4px; }
.place input:checked + .place__card {
  background: var(--rubor); color: var(--ciruela-hondo); border-color: var(--rubor);
  transform: translateY(-12px); box-shadow: 0 30px 50px -25px rgba(0, 0, 0, .6);
}
.places.has-choice .place input:not(:checked) + .place__card { opacity: .7; }

.invite__submit[hidden] { display: none; }

.invite__submit {
  max-width: 100%; padding: 1rem clamp(1.2rem, 5vw, 2.2rem); border: 0; border-radius: 999px;
  background: linear-gradient(120deg, var(--champan), #e3c891, var(--champan)); background-size: 200% 100%;
  color: var(--ciruela-hondo); font-weight: 500; font-size: 1.1rem;
  box-shadow: 0 14px 30px -12px rgba(197, 162, 107, .8);
  animation: rise .8s var(--ease) both, shimmer 3.5s linear infinite;
  transition: scale .3s var(--ease); scroll-margin-block: 1.5rem;
}
.invite__submit:hover { scale: 1.04; }

.accepted { text-align: center; margin-top: 3rem; animation: rise 1s var(--ease) both; }
.accepted__title { font-family: var(--font-display); font-size: clamp(3.4rem, 11vw, 6.5rem); line-height: 1; color: var(--rosa-palo); }
.accepted__detail { margin-top: 1rem; font-style: italic; }

/* Pie */
.footer { padding: 3.5rem 1.5rem 5rem; text-align: center; background: var(--ciruela-hondo); color: var(--rosa-palo); }
.footer p { font-family: var(--font-display); font-size: 2.6rem; line-height: 1.1; }
.footer small { font-size: .95rem; font-style: italic; }

/* --------------------------------------------------------------------------
   Visor de fotos
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 80; overscroll-behavior: contain;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem;
  padding: 1rem; background: rgba(74, 34, 48, .93); backdrop-filter: blur(6px);
  animation: fade .4s ease both; cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox__figure { margin: 0; display: grid; justify-items: center; gap: .8rem; }
.lightbox__figure img {
  max-height: 80svh; width: auto; border: 10px solid #fff; background: var(--rubor);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: zoomIn .5s var(--ease) both;
}
.lightbox__figure img { cursor: default; }
.lightbox__count { font-size: .8rem; letter-spacing: .14em; color: rgba(248, 235, 231, .7); font-variant-numeric: tabular-nums; }
.lightbox__figure figcaption { font-family: var(--font-display); font-size: 2rem; color: var(--rubor); line-height: 1.1; text-align: center; }
.lightbox__btn {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(248, 235, 231, .4);
  background: transparent; color: var(--rubor); font-size: 1.8rem; line-height: 1;
}
.lightbox__btn:hover { background: rgba(248, 235, 231, .15); }
.lightbox__btn--close { position: absolute; top: 1rem; right: 1rem; }

/* --------------------------------------------------------------------------
   Animaciones
   -------------------------------------------------------------------------- */
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 14px rgba(74, 34, 48, .45), 0 0 0 0 rgba(107, 51, 68, .35); } 50% { box-shadow: 0 6px 14px rgba(74, 34, 48, .45), 0 0 0 16px rgba(107, 51, 68, 0); } }
@keyframes breathe { 50% { opacity: .45; } }
@keyframes heartbeat { 0%, 100% { scale: 1; } 15% { scale: 1.2; } 30% { scale: 1; } 45% { scale: 1.14; } }
@keyframes charIn { to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes zoomIn { from { opacity: 0; scale: .92; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes sway { 50% { rotate: 10deg; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes kenburns { from { scale: 1; } to { scale: 1.12; } }
@keyframes photo-wait { to { background-position: -300% 0; } }
@keyframes spark {
  from { opacity: .95; transform: translate(-50%, -50%) rotate(0) scale(.4); }
  to { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, -60px))) rotate(var(--rot, 40deg)) scale(1.2); }
}

@media (max-width: 600px) {
  body { font-size: 1.05rem; }

  /* Fotos: dos columnas en celular */
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .polaroid { padding: .4rem .4rem 0; }
  .polaroid figcaption, .polaroid__caption { min-height: 2.4rem; padding: .4rem .1rem .5rem; font-size: 1.2rem; }
  .polaroid__empty { padding: .5rem; font-size: .85rem; }

  .film figcaption { font-size: 1.6rem; }
  .letter { rotate: 0deg; }
  .letter__greeting { font-size: 2.3rem; line-height: 1.65; }
  .place__card { padding: 1.8rem 1.2rem 1.6rem; border-radius: 120px 120px 10px 10px; }
  .music span { display: none; }
  .music { padding: .7rem; }
  .lightbox__figure img { max-height: 68svh; border-width: 6px; }
  .lightbox__figure figcaption { font-size: 1.6rem; padding-bottom: 3.5rem; }
  .lightbox { grid-template-columns: 1fr; }
  .lightbox__btn--prev, .lightbox__btn--next { position: absolute; bottom: 1rem; }
  .lightbox__btn--prev { left: 1rem; }
  .lightbox__btn--next { right: 1rem; }
  .lightbox__count { position: absolute; bottom: 1.9rem; left: 50%; translate: -50% 0; }
}

/* Celular en horizontal y pantallas bajas */
@media (max-height: 520px) {
  .hero { padding-block: 2.5rem 4.5rem; }
  .hero__names { font-size: clamp(3rem, 16svh, 6rem); }
  .counter { margin-top: 1.4rem; }
  .intro__cta { font-size: .9rem; }
  .hero__scroll-label { display: none; }
  .lightbox__figure img { max-height: 70svh; }
  .lightbox__figure figcaption { font-size: 1.4rem; }
}

/* Pantallas muy grandes */
@media (min-width: 1800px) {
  html { font-size: 112.5%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .petals { display: none; }
}
