/* =========================================================
   Invitación · Oscar & Andrea
   Papelería fina en verde oliva, pensada primero para móvil.
   ========================================================= */

:root {
  --olive: #68735A;
  --olive-dark: #3F4937;
  --ivory: #F7F3EA;
  --cream: #EDE8DC;
  --gold: #B5A477;
  --charcoal: #292B27;

  --olive-soft: rgba(104, 115, 90, .14);
  --line: rgba(104, 115, 90, .35);
  --text-soft: #545A4C;

  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sans: "Jost", "Montserrat", "Helvetica Neue", Arial, sans-serif;

  --space-section: clamp(4.5rem, 16vw, 8.5rem);
  --gutter: clamp(1.4rem, 6vw, 2.5rem);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --slow: 1.1s;

  --paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .27 0 0 0 0 .2 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

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

body {
  margin: 0;
  background: var(--ivory) var(--paper);
  color: var(--charcoal);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }
button { font: inherit; color: inherit; }
a { color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

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

.container {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container.narrow { max-width: 560px; }

.section {
  padding-block: var(--space-section);
  text-align: center;
  position: relative;
}

.section-title {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 400;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--olive);
  padding-left: .34em; /* compensa el tracking para centrar */
}

.ornament {
  display: block;
  width: 132px;
  height: 44px;
  margin: 2.4rem auto;
  color: var(--olive);
}
.ornament--small { width: 96px; height: 32px; margin: 1.2rem auto 2rem; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 52px;
  padding: .9rem 2rem;
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 400;
  letter-spacing: .24em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease), opacity .3s;
  -webkit-tap-highlight-color: transparent;
}
.btn__icon { width: 18px; height: 18px; flex: none; }

.btn--outline {
  border: 1px solid var(--olive);
  color: var(--olive-dark);
  background: transparent;
}
.btn--outline:hover, .btn--outline:active { background: var(--olive); color: var(--ivory); }

.btn--solid {
  border: 1px solid var(--olive-dark);
  background: var(--olive-dark);
  color: var(--ivory);
}
.btn--solid:hover { background: var(--olive); border-color: var(--olive); }
.btn--solid:disabled { opacity: .6; cursor: progress; }
.btn--block { width: 100%; }

/* ---------- Portada ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  color: var(--ivory);
  text-align: center;
  overflow: hidden;
  isolation: isolate;
  background: var(--olive-dark);
}

.hero__media {
  position: absolute;
  inset: -4% 0;
  z-index: -2;
  will-change: transform;
}
.hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 30%;
  opacity: 0;
  transform: scale(1.12);
  transition: opacity 1.8s var(--ease), transform 7s cubic-bezier(.16, .7, .3, 1);
}
.hero.is-loaded.is-ready .hero__img { opacity: 1; transform: scale(1); }

/* Sin fotografía todavía: fondo oliva con ramas, igual de elegante */
.hero.is-missing .hero__media {
  background:
    radial-gradient(120% 80% at 50% 20%, rgba(181, 164, 119, .18), transparent 60%),
    linear-gradient(170deg, var(--olive) 0%, var(--olive-dark) 75%);
}
.hero.is-missing .hero__img { display: none; }

.hero__veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(41, 43, 39, .28) 0%, rgba(41, 43, 39, 0) 28%),
    linear-gradient(to top, rgba(40, 46, 34, .78) 0%, rgba(40, 46, 34, .35) 38%, rgba(40, 46, 34, 0) 62%);
}

.hero__content {
  padding: 0 var(--gutter) calc(6.5rem + env(safe-area-inset-bottom, 0px));
}

.hero__phrase {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 4.6vw, 1.4rem);
  letter-spacing: .02em;
  opacity: .92;
  margin-bottom: .6rem;
}

.hero__names {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.9rem, 19vw, 7.5rem);
  line-height: .92;
  letter-spacing: -.01em;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero__amp {
  font-style: italic;
  font-size: .42em;
  line-height: 1.3;
  color: #D9CDA8;
}

.hero__date {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  margin-top: 1.4rem;
  font-size: .78rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  padding-left: .3em;
}
.hero__date::before, .hero__date::after {
  content: "";
  display: inline-block;
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: .6;
  flex: none;
  margin: 0 .9rem;
}

.hero__scroll {
  position: absolute;
  left: 50%;
  bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  font-size: .68rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: .8;
  white-space: nowrap;
  padding: .4rem 1rem;
}
.hero__scroll-line {
  width: 1px;
  height: 34px;
  background: linear-gradient(to bottom, currentColor, transparent);
  transform-origin: top;
  animation: scrollLine 2.6s var(--ease) infinite;
}
@keyframes scrollLine {
  0% { transform: scaleY(0); opacity: 0; }
  40% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* Entrada orquestada de la portada */
.js .hero__phrase, .js .hero__names > *, .js .hero__date, .js .hero__scroll {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1.4s var(--ease), transform 1.4s var(--ease);
}
.js .hero.is-ready .hero__phrase { opacity: .92; transform: none; transition-delay: .3s; }
.js .hero.is-ready .hero__names > :nth-child(1) { opacity: 1; transform: none; transition-delay: .6s; }
.js .hero.is-ready .hero__names > :nth-child(2) { opacity: 1; transform: none; transition-delay: .9s; }
.js .hero.is-ready .hero__names > :nth-child(3) { opacity: 1; transform: none; transition-delay: 1.1s; }
.js .hero.is-ready .hero__date { opacity: 1; transform: none; transition-delay: 1.5s; }
.js .hero.is-ready .hero__scroll { opacity: .8; transform: translateX(-50%); transition-delay: 2.1s; }
.js .hero__scroll { transform: translate(-50%, 14px); }

/* ---------- Introducción ---------- */
.intro__greeting {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--olive-dark);
  margin-bottom: 2rem;
}
.intro__text p {
  font-family: var(--serif);
  font-size: clamp(1.28rem, 5.2vw, 1.55rem);
  line-height: 1.55;
  color: var(--charcoal);
}
.intro__text p + p { margin-top: 1.3rem; font-style: italic; color: var(--olive-dark); }

.intro__names {
  font-family: var(--serif);
  font-style: italic;
  font-size: 2.3rem;
  color: var(--olive-dark);
  line-height: 1.1;
}
.intro__date {
  margin-top: .6rem;
  font-size: .78rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--olive);
}

/* ---------- Fecha ---------- */
.date { padding-top: 0; }

.date-card {
  max-width: 440px;
  margin-inline: auto;
  padding: clamp(2.6rem, 10vw, 3.6rem) 1.4rem;
  background: var(--cream);
  border: 1px solid var(--line);
  outline: 1px solid rgba(181, 164, 119, .55);
  outline-offset: -9px;
  color: var(--olive-dark);
}
.date-card__weekday {
  font-size: .8rem;
  letter-spacing: .4em;
  text-transform: uppercase;
  padding-left: .4em;
  color: var(--olive);
}
.date-card__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .9rem;
  margin: 1.1rem 0 1.3rem;
}
.date-card__side {
  font-size: .78rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  padding: .75rem 0;
  border-block: 1px solid var(--line);
}
.date-card__day {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(5.4rem, 27vw, 7.5rem);
  line-height: .8;
  color: var(--olive-dark);
  font-variant-numeric: lining-nums;
}
.date-card__place {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-soft);
}

/* ---------- Cuenta regresiva ---------- */
.countdown {
  background: var(--olive-dark) var(--paper);
  color: var(--ivory);
  padding-block: clamp(3.8rem, 13vw, 6rem);
}
.countdown__title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.6rem;
  color: #D9CDA8;
  margin-bottom: 1.6rem;
}
.countdown__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 460px;
  margin-inline: auto;
}
.countdown__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .2rem 0;
}
.countdown__unit + .countdown__unit { border-left: 1px solid rgba(247, 243, 234, .2); }
.countdown__num {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.3rem, 11vw, 3.3rem);
  line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
}
.countdown__label {
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .75;
  padding-left: .14em;
}
.countdown__done {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  line-height: 1.25;
}

/* ---------- Ceremonia y celebración ---------- */
.event__icon {
  width: 48px;
  height: 48px;
  color: var(--olive);
  margin: 0 auto 1.3rem;
  display: block;
}
.event__time {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.6rem, 12vw, 3.3rem);
  line-height: 1;
  color: var(--olive-dark);
  margin: 1.1rem 0 1rem;
}
.event__place {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 6.2vw, 1.75rem);
  line-height: 1.25;
  color: var(--charcoal);
}
.event__detail {
  margin: .5rem 0 1.8rem;
  font-size: .95rem;
  color: var(--text-soft);
}

.bridge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .9rem;
  padding: 2.6rem 0;
  color: var(--olive);
}
.bridge__line {
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, transparent, var(--olive), transparent);
  transform-origin: top;
}
.bridge__branch { width: 80px; height: 27px; }
.bridge__text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--olive-dark);
}
.js .bridge .bridge__line { transform: scaleY(0); transition: transform 1.4s var(--ease); }
.js .bridge.is-visible .bridge__line { transform: scaleY(1); }
.js .bridge.is-visible .bridge__line:last-child { transition-delay: .6s; }

/* ---------- Vestimenta y adultos ---------- */
.notes { background: var(--cream) var(--paper); }

.dress__icon {
  display: block;
  width: 56px;
  height: 56px;
  margin: 1.6rem auto 1rem;
  color: var(--olive);
}
.dress__title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2.8rem, 13vw, 3.6rem);
  line-height: 1;
  color: var(--olive-dark);
}
.dress__note {
  max-width: 400px;
  margin: 1.4rem auto 0;
}
.dress__intro {
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--text-soft);
}
.dress__rules {
  list-style: none;
  margin: 1.6rem 0;
  padding: 0;
  text-align: left;
  border-top: 1px solid var(--line);
}
.dress__rule {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  align-items: start;
  gap: .4rem;
  padding: 1.1rem .2rem;
  border-bottom: 1px solid var(--line);
  font-size: .98rem;
  line-height: 1.6;
  color: var(--charcoal);
}
.dress__rule-icon {
  font-size: 1.05rem;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
  letter-spacing: -.1em;
}
.dress__closing {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--olive-dark);
}

.adults {
  margin-top: clamp(3.5rem, 12vw, 5rem);
  padding: 2.4rem 1.6rem 2.2rem;
  background: var(--ivory);
  border: 1px solid var(--olive);
  outline: 1px solid var(--line);
  outline-offset: 6px;
}
.adults__age {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 3.6rem;
  line-height: 1;
  color: var(--olive);
}
.adults__age small { font-size: .5em; vertical-align: super; margin-left: .05em; }
.adults__title {
  margin-top: .8rem;
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--olive-dark);
  padding-left: .26em;
}
.adults__text {
  margin-top: .9rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--charcoal);
}

/* ---------- Galería ---------- */
.gallery__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.gallery__item {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--cream);
}
.gallery__item--tall { grid-column: span 2; aspect-ratio: 4 / 5; }
.gallery__item--wide { grid-column: span 2; aspect-ratio: 3 / 2; }
.gallery__item--square { aspect-ratio: 1 / 1; }

.gallery__btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.2s var(--ease), transform 1.6s var(--ease);
}
.gallery__item.is-loaded .gallery__img { opacity: 1; transform: scale(1); }
.gallery__item.is-loaded .gallery__btn:hover .gallery__img { transform: scale(1.03); }

.gallery__placeholder {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid var(--line);
  outline: 1px solid rgba(181, 164, 119, .35);
  outline-offset: -7px;
  color: var(--olive);
  padding: 1rem;
}
.gallery__placeholder b {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 1.9rem;
  line-height: 1;
}
.gallery__placeholder span {
  font-size: .62rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.gallery__item.is-missing .gallery__placeholder { display: flex; }
.gallery__item.is-missing .gallery__btn { display: none; }

/* ---------- Confirmación ---------- */
.rsvp { background: var(--olive) var(--paper); }

.rsvp__card {
  background: var(--ivory);
  padding: clamp(2.4rem, 9vw, 3.4rem) clamp(1.3rem, 6vw, 2.6rem);
  text-align: left;
  outline: 1px solid rgba(247, 243, 234, .4);
  outline-offset: 8px;
}
.rsvp__card .section-title { text-align: center; }
.rsvp__intro {
  margin: 1rem auto 2.2rem;
  max-width: 30ch;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--text-soft);
}

.form { display: grid; gap: 1.5rem; }
.field { display: grid; gap: .45rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend {
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--olive-dark);
  padding: 0;
}
.field legend { margin-bottom: .6rem; }
.req { color: var(--olive); }
.optional { text-transform: none; letter-spacing: .02em; color: var(--text-soft); font-size: .8rem; }

.field input[type="text"],
.field input[type="tel"],
.field textarea,
.field select {
  width: 100%;
  font-family: var(--sans);
  font-size: 16px; /* evita el zoom automático en iPhone */
  font-weight: 300;
  color: var(--charcoal);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: .65rem 0;
  transition: border-color .3s;
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { resize: vertical; min-height: 5.5rem; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-bottom-color: var(--olive-dark);
  box-shadow: 0 1px 0 0 var(--olive-dark);
}
.field.has-error input, .field.has-error select { border-bottom-color: #8A4B3B; }

.select { position: relative; }
.select::after {
  content: "";
  position: absolute;
  right: .3rem;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--olive-dark);
  border-bottom: 1px solid var(--olive-dark);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.field select { padding-right: 1.6rem; cursor: pointer; }
.field select:disabled { color: var(--text-soft); opacity: .7; cursor: not-allowed; }

.field--choices { display: flex; flex-wrap: wrap; gap: .6rem; }
.field--choices legend { width: 100%; }
.field .choice {
  flex: 1 1 140px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-size: 1rem;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice__box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: .7rem 1rem;
  border: 1px solid var(--line);
  font-size: .95rem;
  text-align: center;
  color: var(--charcoal);
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s;
}
.choice input:checked + .choice__box {
  background: var(--olive-dark);
  border-color: var(--olive-dark);
  color: var(--ivory);
}
.choice input:focus-visible + .choice__box { outline: 2px solid var(--gold); outline-offset: 2px; }

.field__hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--olive-dark);
}

.field__error {
  min-height: 0;
  font-size: .82rem;
  color: #8A4B3B;
}
.field__error:empty { display: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form__status {
  text-align: center;
  font-size: .92rem;
  color: var(--olive-dark);
}
.form__status:empty { display: none; }
.form__status.is-error { color: #8A4B3B; }

/* ---------- Cierre ---------- */
.closing { padding-bottom: calc(var(--space-section) + 3rem); }
.closing .ornament { margin-top: 0; }
.closing__text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--text-soft);
}
.closing__names {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.4rem;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3rem, 14vw, 4.6rem);
  line-height: 1;
  color: var(--olive-dark);
}
.closing__amp { font-style: italic; color: var(--gold); font-size: .5em; line-height: 1.4; }
.closing__full {
  margin-top: 1.6rem;
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  line-height: 2;
  color: var(--olive);
}
.closing__date {
  margin-top: 1.6rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--olive-dark);
}

/* ---------- Música ---------- */
.music {
  position: fixed;
  right: calc(1rem + env(safe-area-inset-right, 0px));
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(247, 243, 234, .35);
  background: rgba(63, 73, 55, .92);
  color: var(--ivory);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(41, 43, 39, .22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform .3s var(--ease), background-color .3s;
  -webkit-tap-highlight-color: transparent;
}
.music[hidden] { display: none; }
.music:active { transform: scale(.94); }
.music__icon { width: 20px; height: 20px; grid-area: 1 / 1; }
.music__icon--pause { display: none; }
.music.is-playing .music__icon--play { display: none; }
.music.is-playing .music__icon--pause { display: block; }
.music__ring {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  opacity: 0;
}
.music.is-playing .music__ring { animation: ring 2.8s var(--ease) infinite; }
@keyframes ring {
  0% { transform: scale(1); opacity: .7; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(33, 36, 30, .96);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(3.6rem + env(safe-area-inset-top, 0px)) .8rem calc(3.2rem + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  transition: opacity .45s var(--ease);
  touch-action: pan-y;
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lightbox__figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; }
.lightbox__img {
  max-width: 100%;
  max-height: calc(100svh - 8rem);
  object-fit: contain;
  transition: opacity .35s var(--ease);
}
.lightbox__img.is-changing { opacity: 0; }
.lightbox__count {
  margin-top: .9rem;
  color: rgba(247, 243, 234, .7);
  font-size: .72rem;
  letter-spacing: .24em;
}
.lightbox__btn {
  position: absolute;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ivory);
  cursor: pointer;
  border-radius: 50%;
}
.lightbox__btn svg { width: 26px; height: 26px; }
.lightbox__close { top: calc(.6rem + env(safe-area-inset-top, 0px)); right: .6rem; }
.lightbox__prev { left: .2rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: .2rem; top: 50%; transform: translateY(-50%); }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 1.4rem;
  background: rgba(41, 43, 39, .55);
  opacity: 0;
  transition: opacity .5s var(--ease);
}
.modal[hidden] { display: none; }
.modal.is-open { opacity: 1; }
.modal__card {
  width: 100%;
  max-width: 400px;
  background: var(--ivory) var(--paper);
  text-align: center;
  padding: 2.8rem 1.8rem 2.4rem;
  outline: 1px solid rgba(181, 164, 119, .55);
  outline-offset: -9px;
  transform: translateY(16px) scale(.98);
  transition: transform .6s var(--ease);
}
.modal.is-open .modal__card { transform: none; }
.modal__title {
  font-family: var(--serif);
  font-size: 1.9rem;
  line-height: 1.2;
  color: var(--olive-dark);
}
.modal__text {
  margin: 1rem 0 2rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--text-soft);
}

body.is-locked { overflow: hidden; }

.noscript { padding: 2rem; text-align: center; }

/* ---------- Aparición progresiva ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--slow) var(--ease), transform var(--slow) var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .gallery__item.reveal { transform: translateY(16px) scale(.985); }
.js .gallery__item.reveal.is-visible { transform: none; }

/* ---------- Pantallas grandes ---------- */
@media (min-width: 768px) {
  .gallery__grid { grid-template-columns: repeat(4, 1fr); gap: 10px; grid-auto-flow: dense; }
  .gallery__item--tall { grid-row: span 2; aspect-ratio: auto; }
  .gallery__item--square { aspect-ratio: 3 / 4; }
  .hero__img { object-position: center 35%; }
  .lightbox__prev { left: 1.5rem; }
  .lightbox__next { right: 1.5rem; }
  .lightbox__close { right: 1.5rem; }
}

/* ---------- Movimiento reducido ---------- */
@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;
  }
  .js .reveal, .js .hero__phrase, .js .hero__names > *, .js .hero__date { opacity: 1; transform: none; }
  .js .hero__scroll { opacity: .8; transform: translateX(-50%); }
  .js .bridge .bridge__line { transform: none; }
  .hero__media { transform: none !important; }
}

/* =========================================================
   SOBRE DE ENTRADA
   ========================================================= */
.envelope {
  --env-back: #3F4937;
  --env-side: #68735A;
  --env-bottom: #6F7A60;
  --env-flap: #636E55;

  position: fixed;
  inset: 0;
  z-index: 100;
  overflow: hidden;
  background: var(--env-back);
  perspective: 1400px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .9s var(--ease), transform 1.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.envelope.is-ready { opacity: 1; }
.envelope.is-gone { opacity: 0; transform: scale(1.06); pointer-events: none; }

.envelope__back {
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 60% at 50% 30%, #4B5642, var(--env-back));
}

/* Tarjeta dentro del sobre */
.envelope__letter {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 9%;
  height: 64%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12%;
  background: var(--ivory) var(--paper);
  outline: 1px solid rgba(181, 164, 119, .6);
  outline-offset: -8px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .18);
  transform: translateY(6%);
  transition: transform 1.5s cubic-bezier(.2, .8, .25, 1);
  color: var(--olive-dark);
  text-align: center;
}
.envelope__letter-branch { width: 88px; height: 30px; color: var(--olive); }
.envelope__letter-names {
  margin-top: .8rem;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2rem, 9vw, 2.8rem);
  line-height: 1.05;
}
.envelope__letter-names em { color: var(--gold); font-size: .7em; }
.envelope__letter-date {
  margin-top: .6rem;
  font-size: .72rem;
  letter-spacing: .3em;
}

/* Frente del sobre (solapas laterales e inferior) */
.envelope__front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  filter: drop-shadow(0 -2px 6px rgba(0, 0, 0, .18));
}
.env-side { fill: var(--env-side); }
.env-side--r { fill: #647056; }
.env-bottom { fill: var(--env-bottom); }

/* Solapa superior */
.envelope__flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60%;
  z-index: 3;
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 1.1s cubic-bezier(.45, .05, .25, 1);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .28));
}
.envelope__flap-shape {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, .05), rgba(0, 0, 0, .06)),
    var(--env-flap);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* Sello de cera */
.envelope__seal {
  position: absolute;
  left: 50%;
  top: 60%;
  z-index: 4;
  width: clamp(92px, 27vw, 124px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 47% 53% 50% 50% / 52% 48% 52% 48%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  color: #7C6E45;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 250, 225, .55), transparent 38%),
    radial-gradient(circle at 50% 50%, #CDBF93 0%, #B5A477 55%, #93845A 100%);
  box-shadow:
    inset 0 0 0 5px rgba(147, 132, 90, .55),
    inset 0 3px 6px rgba(255, 255, 240, .45),
    inset 0 -4px 8px rgba(80, 70, 40, .35),
    0 8px 16px rgba(0, 0, 0, .3);
  transition: transform .5s var(--ease), opacity .5s var(--ease);
  animation: sealPulse 3.2s ease-in-out infinite 1.2s;
}
.envelope__seal svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 0 rgba(255, 250, 230, .45));
}
@keyframes sealPulse {
  0%, 100% { box-shadow: inset 0 0 0 5px rgba(147, 132, 90, .55), inset 0 3px 6px rgba(255, 255, 240, .45), inset 0 -4px 8px rgba(80, 70, 40, .35), 0 8px 16px rgba(0, 0, 0, .3), 0 0 0 0 rgba(217, 205, 168, .35); }
  50% { box-shadow: inset 0 0 0 5px rgba(147, 132, 90, .55), inset 0 3px 6px rgba(255, 255, 240, .45), inset 0 -4px 8px rgba(80, 70, 40, .35), 0 8px 16px rgba(0, 0, 0, .3), 0 0 0 14px rgba(217, 205, 168, 0); }
}

/* Destinatario */
.envelope__to {
  position: absolute;
  left: 0;
  right: 0;
  top: 73%;
  z-index: 4;
  padding: 0 var(--gutter);
  text-align: center;
  color: var(--ivory);
  transition: opacity .5s var(--ease);
}
.envelope__guest {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.5rem, 6.8vw, 2rem);
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.envelope__guest.is-generic { font-size: clamp(1.25rem, 5.6vw, 1.6rem); }
.envelope__seats {
  margin-top: .3rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  opacity: .85;
}
.envelope__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(1.8rem + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  text-align: center;
  font-size: .66rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(247, 243, 234, .75);
  animation: hintBreath 2.6s ease-in-out infinite;
  transition: opacity .4s;
}
@keyframes hintBreath { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

.envelope__grain {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: var(--paper);
  opacity: .9;
  mix-blend-mode: multiply;
}

/* Entrada del sobre */
.envelope__seal, .envelope__to { opacity: 0; }
.envelope.is-ready .envelope__seal { opacity: 1; transition-delay: .35s; }
.envelope.is-ready .envelope__to { opacity: 1; transition: opacity 1s var(--ease) .7s; }

/* Secuencia de apertura */
.envelope.is-breaking .envelope__seal {
  animation: none;
  transform: translate(-50%, -30%) scale(.7) rotate(-14deg);
  opacity: 0;
  transition-delay: 0s;
}
.envelope.is-breaking .envelope__to,
.envelope.is-breaking .envelope__hint { opacity: 0; animation: none; transition: opacity .4s; }
.envelope.is-flap-open .envelope__flap { transform: rotateX(180deg); }
.envelope.is-letter-out .envelope__flap { z-index: 0; }
.envelope.is-letter-out .envelope__letter { transform: translateY(-13%); }

/* =========================================================
   ANIMACIONES ADICIONALES
   ========================================================= */

/* Hojas cayendo en la portada */
.leaves {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.leaf {
  position: absolute;
  top: -40px;
  left: var(--x);
  width: var(--size);
  height: calc(var(--size) / 2);
  color: #DCD3B4;
  opacity: 0;
  animation: leafFall var(--dur) linear var(--delay) infinite;
}
.leaves.is-paused .leaf { animation-play-state: paused; }
@keyframes leafFall {
  0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  8% { opacity: var(--o); }
  85% { opacity: var(--o); }
  100% { opacity: 0; transform: translate3d(var(--dx), 105svh, 0) rotate(var(--rot)); }
}

/* Ramas que crecen desde el centro */
.js .ornament.reveal {
  clip-path: inset(0 50% 0 50%);
  transform: none;
  transition: clip-path 1.8s var(--ease), opacity 1s var(--ease);
}
.js .ornament.reveal.is-visible { clip-path: inset(0 0 0 0); }

/* Iconos que se dibujan a mano */
.js .event__icon, .js .dress__icon {
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  transition: stroke-dashoffset 2.6s cubic-bezier(.4, .1, .3, 1) .3s;
}
.js .is-visible .event__icon, .js .is-visible .dress__icon { stroke-dashoffset: 0; }

/* Títulos que se asientan */
.js .reveal .section-title, .js .section-title.reveal {
  letter-spacing: .5em;
  transition: letter-spacing 1.8s var(--ease), opacity var(--slow) var(--ease), transform var(--slow) var(--ease);
}
.js .is-visible .section-title, .js .section-title.is-visible { letter-spacing: .34em; }

/* Tarjeta de fecha */
.js .date-card .date-card__day {
  opacity: 0;
  filter: blur(8px);
  transform: scale(1.12);
  transition: opacity 1.6s var(--ease) .35s, filter 1.6s var(--ease) .35s, transform 1.8s var(--ease) .35s;
}
.js .date-card .date-card__side { opacity: 0; transition: opacity 1.2s var(--ease) .9s, transform 1.2s var(--ease) .9s; }
.js .date-card .date-card__side:first-child { transform: translateX(-18px); }
.js .date-card .date-card__side:last-child { transform: translateX(18px); }
.js .date-card.is-visible .date-card__day { opacity: 1; filter: none; transform: none; }
.js .date-card.is-visible .date-card__side { opacity: 1; transform: none; }

/* Números de la cuenta regresiva */
.countdown__num.is-tick { animation: tick .6s var(--ease); }
@keyframes tick {
  from { opacity: .25; transform: translateY(-7px); }
  to { opacity: 1; transform: none; }
}

/* Galería escalonada */
.js .gallery__item:nth-child(odd).reveal { transition-delay: .12s; }

/* Movimiento reducido: sin sobre animado ni hojas */
@media (prefers-reduced-motion: reduce) {
  .leaves { display: none; }
  .envelope__seal, .envelope__hint { animation: none; }
  .js .ornament.reveal { clip-path: none; }
  .js .event__icon, .js .dress__icon { stroke-dashoffset: 0; }
  .js .date-card .date-card__day, .js .date-card .date-card__side { opacity: 1; filter: none; transform: none; }
}
/* ---------- Lluvia de sobres ---------- */
.gift { margin-top: clamp(3.5rem, 12vw, 5rem); }
.gift__icon {
  display: block;
  width: 52px;
  height: 52px;
  margin: 0 auto 1.1rem;
  color: var(--olive);
}
.gift__text {
  max-width: 32ch;
  margin: 1.1rem auto 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--olive-dark);
}
.js .gift__icon {
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  transition: stroke-dashoffset 2.6s cubic-bezier(.4, .1, .3, 1) .3s;
}
.js .gift.is-visible .gift__icon { stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) { .js .gift__icon { stroke-dashoffset: 0; } }