/* ==========================================================================
   Invitación XV — "Jardín de grabado y acuarela"
   Composición: una tarjeta vertical de 460 px (pantalla de móvil) centrada,
   con escenas a pantalla completa que se revelan al desplazarse.
   Los colores del tema se inyectan desde config.js (variables --f0…--f4).
   ========================================================================== */
/* Tipografías alojadas en la propia invitación (no dependen de servicios externos) */
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-style: italic; font-display: swap; src: url("../fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Pinyon Script"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/pinyon-script-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/cinzel-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/cinzel-latin-500-normal.woff2") format("woff2"); }

:root {
  /* Flor (se sobrescriben según el tema) */
  --f0: #FFF4F2; --f1: #F8DCDB; --f2: #EDB7BC; --f3: #D9919C; --f4: #B56B7A;
  --leaf1: #C9D3C1; --leaf2: #8D9F86;
  --wing1: #F4D6D8; --wing2: #C99AA4;
  /* Papel, tinta y oro */
  --paper: #FFFBFA;
  --paper-2: #FBEFEE;
  --backdrop: #EFD9D9;
  --ink: #5B3B43;
  --ink-soft: #7E5D65;
  --accent: #9E5466;
  --gold: #C29D5C;
  --gold-ink: #876628;
  --line: rgba(194, 157, 92, .55);
  /* Tipografía */
  --script: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;
  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --caps: "Cinzel", "Trajan Pro", "Cormorant Garamond", serif;
  --card-w: 460px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 15% 10%, var(--f1), transparent 60%),
    radial-gradient(900px 700px at 90% 80%, var(--paper-2), transparent 60%),
    var(--backdrop);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
body.is-locked { overflow: hidden; }
img, svg { max-width: 100%; }
p, h1, h2, h3, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Tarjeta ---------- */
.card {
  position: relative;
  max-width: var(--card-w);
  margin: 0 auto;
  background-color: var(--paper);
  background-image: var(--grain);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(194, 157, 92, .18), 0 30px 80px -30px rgba(120, 60, 70, .35);
}
@media (max-width: 480px) { .card { box-shadow: none; } }

.demo-band {
  position: relative; z-index: 5; padding-right: 70px !important; padding-left: 70px !important;
  font-family: var(--caps); font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  text-align: center; padding: 7px 12px; color: var(--gold-ink);
  background: var(--paper-2); border-bottom: 1px solid var(--line);
}

/* ---------- Escenas ---------- */
.scene {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 150px 34px;
  isolation: isolate;
}
.scene + .scene::before { /* costura entre escenas */
  content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 46px;
  background: linear-gradient(var(--line), transparent); transform: translateX(-50%);
}
.scene__inner { position: relative; z-index: 2; width: 100%; display: flex; flex-direction: column; align-items: center; }

.deco { position: absolute; left: -7%; width: 114%; z-index: 1; pointer-events: none; }
.deco--top { top: -10px; }
.deco--bottom { bottom: -12px; }
.deco svg { display: block; width: 100%; height: auto; }
.deco--corner-tl { top: -16px; left: -26px; width: 58%; }
.deco--corner-br { bottom: -16px; right: -26px; left: auto; width: 58%; transform: rotate(180deg); }
.deco--corner-tr { top: -16px; right: -26px; left: auto; width: 54%; transform: scaleX(-1); }
.deco--sm { width: 42% !important; }
.scene--intro { padding-bottom: 190px; }
.deco--corner-bl { bottom: -16px; left: -26px; width: 54%; transform: scaleY(-1); }

/* Tipografía */
.label {
  font-family: var(--caps); font-weight: 500; font-size: 12px; letter-spacing: .32em;
  text-transform: uppercase; color: var(--gold-ink); margin: 0;
}
.script {
  font-family: var(--script); font-weight: 400; color: var(--accent); margin: 0;
  line-height: 1.1; text-wrap: balance;
}
.h-script { font-size: 46px; }
.lead { font-size: 21px; line-height: 1.5; max-width: 30ch; margin: 0; text-wrap: pretty; font-style: italic; color: var(--ink-soft); }
.body { font-size: 19px; max-width: 32ch; margin: 0; text-wrap: pretty; }
.muted { color: var(--ink-soft); }
.gold-text {
  background: linear-gradient(135deg, #D8BC82 0%, #A9833F 40%, #E6CF98 60%, #9C7634 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Piezas ilustradas ---------- */
.art { display: block; }
.art--corner, .art--garland, .art--stem { overflow: visible; }
.crown { width: 128px; margin: 0 auto 10px; position: relative; }
.crown .spark { position: absolute; width: 14px; }
.divider { width: 170px; margin: 18px auto; }
.spark { display: block; }

/* ---------- Portada ---------- */
.scene--hero { padding-top: 190px; padding-bottom: 210px; }
.arch-wrap { position: absolute; inset: 120px 22px 70px; z-index: 1; pointer-events: none; }
.arch-wrap svg { width: 100%; height: 100%; }
.hero-xv {
  font-family: var(--caps); font-weight: 400; font-size: 96px; line-height: .9; letter-spacing: .06em;
  margin: 4px 0 0; position: relative;
}
.hero-pre { margin-bottom: 6px; }
.hero-post { margin-top: 12px; }
.hero-name { font-size: clamp(64px, 19vw, 88px); margin-top: 18px; padding: 0 .1em; }
.hero-second { font-size: 40px; margin-top: -4px; }
.hero-last { margin-top: 10px; }
.hero-date { margin-top: 22px; font-family: var(--caps); font-size: 13px; letter-spacing: .3em; color: var(--ink-soft); }
.pass-note {
  margin-top: 20px; font-style: italic; color: var(--ink-soft); font-size: 18px;
  padding: 8px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.scroll-cue {
  position: relative; margin-top: 26px; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: var(--caps); font-size: 10px; letter-spacing: .3em; color: var(--gold-ink);
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.scroll-cue i { width: 1px; height: 30px; background: linear-gradient(var(--gold), transparent); display: block; }

/* ---------- Presentación ---------- */
.dress { width: min(230px, 62vw); margin: 4px auto 22px; }
.scene--intro .script.big { font-size: 58px; margin-top: 8px; }

/* ---------- Mensaje ---------- */
.frame-wrap { position: absolute; inset: 70px 18px; z-index: 1; pointer-events: none; }
.frame-wrap svg { width: 100%; height: 100%; }
.stem-l { position: absolute; left: 4px; bottom: 60px; width: 74px; z-index: 2; pointer-events: none; }
.stem-r { position: absolute; right: 4px; top: 60px; width: 74px; z-index: 2; pointer-events: none; transform: rotate(180deg); }
.quote-mark { font-family: var(--script); font-size: 80px; line-height: .5; color: var(--f3); margin-bottom: 10px; }
.signature { font-family: var(--script); font-size: 38px; color: var(--accent); margin-top: 16px; }

/* ---------- Familia ---------- */
.family { display: grid; gap: 30px; width: 100%; margin-top: 8px; }
.family__group { display: grid; gap: 6px; }
.family__group .script { font-size: 40px; }
.family__names { display: grid; gap: 2px; font-size: 21px; }

/* ---------- Celebración ---------- */
.date-block { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin: 14px 0 6px; width: 100%; max-width: 320px; }
.date-block__side { font-family: var(--caps); font-size: 14px; letter-spacing: .24em; color: var(--ink); padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.date-block__day { font-family: var(--caps); font-size: 58px; line-height: 1; padding: 0 6px; }
.date-year { font-family: var(--caps); letter-spacing: .4em; font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.date-tbd { font-style: italic; color: var(--ink-soft); }
.countdown { display: grid; grid-template-columns: repeat(4, 62px); gap: 10px; justify-content: center; margin: 24px 0 8px; }
.countdown__unit {
  width: 62px; height: 62px; border-radius: 50%; border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .55);
}
.countdown__num { font-family: var(--caps); font-size: 20px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.countdown__lab { font-size: 9px; font-family: var(--caps); letter-spacing: .14em; color: var(--ink-soft); margin-top: 4px; }

.events { display: grid; gap: 22px; width: 100%; margin-top: 26px; }
.event {
  position: relative; padding: 26px 22px 24px;
  background: rgba(255, 255, 255, .62);
  border: 1px solid var(--line); border-radius: 160px 160px 14px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.event .ico { width: 40px; height: 40px; margin-bottom: 4px; }
.event .script { font-size: 34px; }
.event__time { font-family: var(--caps); font-size: 13px; letter-spacing: .22em; color: var(--gold-ink); margin: 4px 0 6px; }
.event__place { font-weight: 600; font-size: 19px; }
.event__addr { font-size: 17px; color: var(--ink-soft); margin-bottom: 12px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--caps); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; text-decoration: none;
  padding: 13px 22px; min-height: 46px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--gold); color: var(--ink); background: rgba(255, 255, 255, .7);
  transition: background .25s, color .25s, transform .25s, box-shadow .25s;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: scale(.98); }
.btn--solid { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 8px 20px -10px var(--accent); }
.btn--solid:hover { background: var(--f4); }
.btn .ico-s { width: 17px; height: 17px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }

/* ---------- Vestimenta ---------- */
.dress-code { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; width: 100%; max-width: 300px; margin: 22px 0 12px; }
.dress-code__item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dress-code__item .ico { width: 70px; height: 86px; }
.dress-code__who { font-family: var(--caps); font-size: 12px; letter-spacing: .3em; color: var(--gold-ink); }
.dress-code__what { font-size: 18px; color: var(--ink-soft); font-style: italic; margin-top: -4px; }
.swatch-note { display: flex; align-items: center; gap: 12px; margin-top: 18px; max-width: 30ch; text-align: left; font-size: 18px; }
.swatch { flex: none; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--f1), var(--f3)); box-shadow: 0 0 0 1px var(--gold), 0 0 0 4px var(--paper), 0 0 0 5px var(--line); }

/* ---------- Regalos y confirmación ---------- */
.gifts { display: grid; gap: 14px; width: 100%; margin: 20px 0 0; }
.gift { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; text-align: left; padding: 14px 16px; border-top: 1px solid var(--line); }
.gift:last-child { border-bottom: 1px solid var(--line); }
.gift .ico { width: 48px; height: 48px; }
.gift__t { font-weight: 600; font-size: 19px; }
.gift__d { font-size: 17px; color: var(--ink-soft); }
.gift a { color: var(--accent); }

.rsvp {
  width: 100%; margin-top: 40px; padding: 30px 22px 26px; text-align: left;
  background: rgba(255, 255, 255, .72); border: 1px solid var(--line); border-radius: 14px;
  display: grid; gap: 16px;
}
.rsvp__head { text-align: center; display: grid; gap: 6px; }
.rsvp__head .script { font-size: 40px; }
.field { display: grid; gap: 6px; }
.field > span, .field legend { font-family: var(--caps); font-size: 11px; letter-spacing: .2em; color: var(--gold-ink); text-transform: uppercase; padding: 0; }
.field input, .field select, .field textarea {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent;
  padding: 8px 2px; font-size: 19px; border-radius: 0; color: var(--ink);
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.choice { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.choice label { flex: 1 1 130px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block; text-align: center; padding: 11px 10px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 17px; cursor: pointer; transition: all .2s;
}
.choice input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-error { color: #A23A4A; font-size: 16px; min-height: 1em; margin: 0; text-align: center; }
.rsvp .btn { width: 100%; }
.rsvp__fine { font-size: 15px; color: var(--ink-soft); text-align: center; margin: 0; }

/* ---------- Cierre ---------- */
.scene--end { padding-bottom: 230px; }
.bow { width: 150px; margin: 0 auto -6px; }
.end-name { font-size: 62px; margin-top: 18px; }
.made-by { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-family: var(--caps); font-size: 9.5px; letter-spacing: .25em; color: var(--ink-soft); opacity: .7; z-index: 3; }

/* ---------- Capa ambiental (mariposas y pétalos) ---------- */
.ambient {
  position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(100%, var(--card-w)); pointer-events: none; z-index: 30; overflow: hidden;
}
.ambient canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ambient .flyer { position: absolute; top: 0; left: 0; width: 46px; will-change: transform; }
.bf { display: block; width: 100%; height: auto; overflow: visible; }
.bf__w { transform-box: view-box; transform-origin: 50% 50%; animation: flap .32s ease-in-out infinite alternate; }
.perch .bf__w { animation: flapSlow 3.6s ease-in-out infinite; }
@keyframes flap { from { transform: scaleX(1); } to { transform: scaleX(.28); } }
@keyframes flapSlow { 0%, 70%, 100% { transform: scaleX(1); } 78% { transform: scaleX(.35); } 86% { transform: scaleX(1); } 92% { transform: scaleX(.5); } }
.perch { position: absolute; z-index: 3; width: 40px; pointer-events: none; }

/* destellos */
.twinkle circle, .spark { animation: twinkle 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.twinkle circle:nth-child(2n) { animation-delay: 1.1s; }
.twinkle circle:nth-child(3n) { animation-delay: 2.1s; }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.1); } }

/* ---------- Controles fijos ---------- */
.ui-music {
  position: fixed; z-index: 40;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: max(14px, calc((100vw - var(--card-w)) / 2 + 14px), env(safe-area-inset-right, 0px));
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--gold); background: rgba(255, 251, 250, .85);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; cursor: pointer; color: var(--accent);
  box-shadow: 0 6px 18px -8px rgba(120, 60, 70, .4);
}
.ui-music svg { width: 20px; height: 20px; }
.ui-music .bars { display: none; gap: 2px; align-items: flex-end; height: 16px; }
.ui-music .bars i { width: 2px; height: 9px; background: currentColor; border-radius: 1px; animation: bar 1s ease-in-out infinite; }
.ui-music .bars i:nth-child(2) { animation-delay: .2s; } .ui-music .bars i:nth-child(3) { animation-delay: .4s; } .ui-music .bars i:nth-child(4) { animation-delay: .1s; }
@keyframes bar { 0%, 100% { height: 4px; } 50% { height: 15px; } }
.ui-music[aria-pressed="true"] .bars { display: flex; }
.ui-music[aria-pressed="true"] .note { display: none; }

.ui-nav {
  position: fixed; z-index: 40; top: 50%; transform: translateY(-50%);
  right: max(8px, calc((100vw - var(--card-w)) / 2 + 8px), env(safe-area-inset-right, 0px));
  display: grid; gap: 4px;
}
.ui-nav button {
  width: 22px; height: 22px; border: 0; background: none; padding: 0; cursor: pointer;
  display: grid; place-items: center;
}
.ui-nav button::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  border: 1px solid var(--gold); background: rgba(255, 251, 250, .8); transition: all .3s;
}
.ui-nav button[aria-current="true"]::before { background: var(--gold); transform: scale(1.35); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  z-index: 60; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 16px; opacity: 0; transition: all .35s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Apertura (gatefold de encaje) ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center;
  background: var(--backdrop);
  perspective: 1600px;
}
.gate__stage { position: relative; width: min(100%, var(--card-w)); height: 100%; transform-style: preserve-3d; }
.gate__door {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background-color: var(--f1);
  background-image:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.55) 1.2px, transparent 1.8px),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.35) 1px, transparent 1.6px),
    linear-gradient(180deg, var(--f1), var(--f2));
  background-size: 14px 14px, 14px 14px, 100% 100%;
  background-position: 0 0, 7px 7px, 0 0;
  transition: transform 1.6s cubic-bezier(.6, .02, .2, 1);
  backface-visibility: hidden;
}
.gate__door::before { /* filete dorado interior */
  content: ""; position: absolute; inset: 14px; border: 1px solid rgba(194, 157, 92, .8);
}
.gate__door--l { left: 0; transform-origin: left center; }
.gate__door--l::before { right: 26px; border-right: 0; }
.gate__door--r { right: 0; transform-origin: right center; }
.gate__door--r::before { left: 26px; border-left: 0; }
.gate__lace { position: absolute; top: 0; bottom: 0; width: 26px; background-image: var(--lace); background-size: 26px 30px; background-repeat: repeat-y; }
.gate__door--l .gate__lace { right: 0; }
.gate__door--r .gate__lace { left: 0; transform: scaleX(-1); }
.gate__ribbon {
  position: absolute; left: 0; right: 0; height: 30px; top: 58%;
  background: linear-gradient(180deg, var(--f2), var(--f1) 40%, #fff 50%, var(--f1) 60%, var(--f3));
  box-shadow: 0 2px 6px rgba(120, 60, 70, .2);
  transition: transform 1s cubic-bezier(.6, 0, .3, 1), opacity .8s;
}
.gate__ribbon--l { right: 50%; }
.gate__ribbon--r { left: 50%; }
.gate__center {
  position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); z-index: 3;
  display: flex; flex-direction: column; align-items: center;
  transition: transform .8s cubic-bezier(.5, 0, .5, 1), opacity .6s;
}
.gate__center .bow { width: 230px; margin: 0; }
.seal {
  position: absolute; left: 50%; top: 39%; transform: translate(-50%, -50%);
  width: 62px; height: 62px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--paper) 55%, var(--f1));
  box-shadow: 0 0 0 1.5px var(--gold), 0 0 0 5px rgba(255,255,255,.7), 0 0 0 6px var(--line), 0 6px 14px -4px rgba(120,60,70,.35);
  display: grid; place-items: center;
  font-family: var(--script); font-size: 38px; line-height: 1; padding-top: 5px; color: var(--gold-ink);
}
.gate__top {
  position: absolute; top: 15%; left: 0; right: 0; z-index: 3; text-align: center; padding: 0 30px;
  display: grid; gap: 10px; transition: opacity .6s, transform .8s;
}
.gate__top .crown { width: 92px; margin: 0 auto; }
.gate__top .script { font-size: 34px; color: var(--accent); }
.gate__guest { font-size: 20px; font-style: italic; color: var(--ink); margin: 0; }
.gate__bottom {
  position: absolute; left: 0; right: 0; bottom: calc(9% + env(safe-area-inset-bottom, 0px)); z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 12px; transition: opacity .5s;
}
.gate__hint { font-size: 15px; color: var(--ink-soft); font-style: italic; margin: 0; }
.gate .btn--solid { min-width: 220px; }

.gate.is-opening .gate__top, .gate.is-opening .gate__bottom { opacity: 0; transform: translateY(-8px); }
.gate.is-opening .gate__center { transform: translate(-50%, -50%) scale(.6); opacity: 0; }
.gate.is-opening .gate__ribbon--l { transform: translateX(-105%); transition-delay: .35s; }
.gate.is-opening .gate__ribbon--r { transform: translateX(105%); transition-delay: .35s; }
.gate.is-opening .gate__door--l { transform: rotateY(-108deg); transition-delay: .75s; }
.gate.is-opening .gate__door--r { transform: rotateY(108deg); transition-delay: .75s; }
.gate.is-opening { background: transparent; transition: background .6s .7s; }
.gate.is-gone { display: none; }
.anim .gate .draw { stroke-dashoffset: 0; }
.gate__top { width: min(78%, 300px); left: 50% !important; right: auto !important; transform: translateX(-50%);
  padding: 22px 18px 20px !important; background: rgba(255, 251, 250, .94); border: 1px solid var(--line);
  border-radius: 140px 140px 10px 10px; box-shadow: 0 10px 30px -18px rgba(120, 60, 70, .45); }
.gate.is-opening .gate__top { transform: translate(-50%, -8px); }

/* ---------- Animaciones de entrada (solo con JS y movimiento permitido) ---------- */
.anim [data-r] {
  opacity: 0; transform: translateY(16px);
  transition: opacity 1.2s ease, transform 1.2s cubic-bezier(.2, .7, .2, 1), clip-path 2s cubic-bezier(.4, 0, .2, 1), filter 2s ease;
  transition-delay: calc(var(--d, 0) * 1ms);
}
.anim .is-in [data-r] { opacity: 1; transform: none; }
.anim [data-r="write"] { opacity: 1; transform: none; clip-path: inset(-30% 100% -30% -10%); filter: blur(3px); }
.anim .is-in [data-r="write"] { clip-path: inset(-30% -10% -30% -10%); filter: blur(0); }
.anim [data-r="rise"] { transform: translateY(26px) scale(.94); }
.anim [data-r="fade"] { transform: none; }

.anim .fl { opacity: 0; transform: scale(.35) rotate(-24deg); transform-box: fill-box; transform-origin: center;
  transition: opacity 1.2s ease, transform 1.8s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i) * 60ms + var(--fd, 0ms)); }
.anim .is-in .fl { opacity: 1; transform: none; }
.anim .fl--flower { transform: scale(.2) rotate(-50deg); }

.anim .draw { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.4s cubic-bezier(.45, 0, .2, 1); transition-delay: calc(var(--dd, 300) * 1ms); }
.anim .is-in .draw { stroke-dashoffset: 0; }
.anim .wash { opacity: 0; transition: opacity 2s ease 1.2s; }
.anim .is-in .wash { opacity: 1; }

.anim .perch { opacity: 0; transition: opacity 1.4s ease 1.4s; }
.anim .is-in .perch { opacity: 1; }

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

/* Pantallas bajas: compactar escenas */
@media (max-height: 700px) {
  .scene { padding-top: 120px; padding-bottom: 120px; }
  .hero-xv { font-size: 80px; }
}
@media (max-width: 360px) {
  .scene { padding-left: 22px; padding-right: 22px; }
  .countdown { grid-template-columns: repeat(4, 56px); gap: 8px; }
  .countdown__unit { width: 56px; height: 56px; }
}

/* ---------- Fotografías ---------- */
.photo-arch {
  position: relative; width: min(250px, 64vw); aspect-ratio: 3 / 4; margin: 10px auto 26px;
  border-radius: 999px 999px 14px 14px; overflow: hidden; background: var(--f1);
  box-shadow: 0 0 0 1px var(--gold), 0 0 0 7px var(--paper), 0 0 0 8px var(--line), 0 26px 40px -26px rgba(30, 50, 38, .55);
}
.photo-arch img, .gallery__item img, .end-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-top: 22px; padding-bottom: 36px; }
.gallery__item {
  position: relative; display: block; padding: 0; border: 0; cursor: zoom-in; background: var(--f1);
  aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 16px 28px -20px rgba(30, 50, 38, .5);
}
.gallery__item:nth-child(4n+1) { border-radius: 200px 200px 10px 10px; }
.gallery__item:nth-child(4n+0) { border-radius: 10px 10px 200px 200px; }
.gallery__item:nth-child(even) { transform: translateY(36px); }
.gallery__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.gallery__hint { margin-top: 20px; font-size: 15px; font-style: italic; color: var(--ink-soft); }
.scene--end.has-photo { padding-top: 0; justify-content: flex-start; }
.end-photo {
  width: calc(100% + 68px); margin: 0 -34px 6px; aspect-ratio: 3 / 2; position: relative; z-index: 1;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%); mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
}
.scene--end.has-photo .scene__inner { margin-top: -30px; }
.rsvp--solo { margin-top: 0; }

.anim [data-r="photo"] { opacity: 0; transform: translateY(18px) scale(.97); transition: opacity 1.4s ease, transform 1.6s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--d, 0) * 1ms); }
.anim .is-in [data-r="photo"] { opacity: 1; transform: none; }
.anim .is-in .gallery__item[data-r="photo"]:nth-child(even) { transform: translateY(36px); }
.anim [data-r="photo"] img { transform: scale(1.1); transition: transform 3s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--d, 0) * 1ms); }
.anim .is-in [data-r="photo"] img { transform: none; }

.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(22, 32, 26, .94); display: grid; place-items: center; padding: 56px 12px; }
.lightbox[hidden] { display: none !important; }
.lightbox img { max-width: min(94vw, 720px); max-height: 82vh; object-fit: contain; border-radius: 6px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); }
.lb-btn { position: absolute; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.08); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.lb-close { top: calc(12px + env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); }
.lb-prev { left: max(8px, env(safe-area-inset-left, 0px)); top: 50%; transform: translateY(-50%); }
.lb-next { right: max(8px, env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.8); font-family: var(--caps); font-size: 12px; letter-spacing: .2em; margin: 0; }

/* Paleta de vestimenta */
.palette { display: flex; justify-content: center; gap: 34px; margin-top: 18px; }
.palette__item { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.palette__dot { width: 54px; height: 54px; border-radius: 50%; box-shadow: 0 0 0 1px var(--gold), 0 0 0 5px var(--paper), 0 0 0 6px var(--line), 0 10px 18px -10px rgba(30, 50, 38, .5); }
.palette__name { font-family: var(--caps); font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--gold-ink); }
.palette__text { margin-top: 18px; font-size: 18px; font-style: italic; }
