/* ==========================================================================
   Naster Weddings NW-LAB-04 — Experiencia Cinematográfica & Papelería de Lujo
   ========================================================================== */

body {
  background-image: var(--nw-paper-grain);
}

body.envelope-locked {
  overflow: hidden;
}

/* Botón oro mate editorial */
.btn--gold {
  background: linear-gradient(135deg, var(--nw-gold) 0%, var(--nw-accent-hover) 100%);
  color: #FFFFFF;
  border-color: rgba(217, 192, 152, 0.45);
  box-shadow: var(--nw-shadow-gold);
}

.btn--gold:hover {
  background: linear-gradient(135deg, var(--nw-accent-hover) 0%, var(--nw-gold-deep) 100%);
  color: #FFFFFF;
  transform: translateY(-2px);
}

.btn--ghost-subtle {
  background: rgba(255, 255, 255, 0.65);
  color: var(--nw-ink-soft);
  border-color: var(--nw-border-strong);
}

.btn--ghost-subtle:hover {
  background: var(--nw-surface);
  color: var(--nw-ink);
}

/* ==========================================================================
   1. APERTURA: SOBRE DIGITAL INTERACTIVO CON SELLO G&M
   ========================================================================== */
.envelope-stage {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  overflow-y: auto;
  background: var(--nw-bg);
  transition: opacity 720ms var(--nw-ease), visibility 720ms var(--nw-ease);
}

.envelope-stage[hidden] {
  display: none;
}

.envelope-stage.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-stage__bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(63, 90, 69, 0.1), transparent 46%),
    radial-gradient(circle at 80% 85%, rgba(166, 132, 82, 0.16), transparent 52%),
    linear-gradient(180deg, #FAF6EE 0%, #EFE5D5 100%);
  background-image: var(--nw-paper-grain);
  z-index: -1;
}

.envelope-stage__branch {
  position: fixed;
  width: clamp(120px, 22vw, 240px);
  opacity: 0.55;
  pointer-events: none;
  z-index: -1;
}

.envelope-stage__branch--tl {
  top: 0;
  left: 0;
  transform: rotate(180deg);
}

.envelope-stage__branch--br {
  bottom: 0;
  right: 0;
}

.envelope-stage__card {
  width: min(100%, 480px);
  text-align: center;
  padding: 1.25rem 0.5rem;
}

.envelope-stage__demo-tag {
  display: inline-block;
  margin: 0 0 0.9rem;
  padding: 0.25rem 0.85rem;
  border-radius: var(--nw-radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--nw-botanical);
  background: var(--nw-botanical-soft);
  border: 1px solid var(--nw-botanical-border);
}

.envelope-stage__title {
  font-size: clamp(1.65rem, 5vw, 2.35rem);
  margin-bottom: 0.4rem;
}

.envelope-stage__guest {
  font-size: var(--nw-fs-sm);
  color: var(--nw-botanical);
  font-weight: 600;
  margin-bottom: 1.35rem;
}

/* Escena 3D del sobre */
.envelope-scene {
  position: relative;
  width: min(100%, 340px);
  height: 224px;
  margin: 1.35rem auto 1.75rem;
  perspective: 1100px;
}

.envelope-body {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(160deg, #FBF8F1 0%, #EDE1CE 100%);
  border: 1px solid var(--nw-border-strong);
  box-shadow: 0 22px 50px rgba(36, 31, 26, 0.14), inset 0 0 0 6px rgba(255, 255, 255, 0.55);
  z-index: 2;
  overflow: hidden;
}

.envelope-body::before,
.envelope-body::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Pliegues laterales sutiles del sobre */
.envelope-body::before {
  background:
    linear-gradient(33deg, rgba(166, 132, 82, 0.13) 50%, transparent 50.4%) left bottom / 50% 100% no-repeat,
    linear-gradient(-33deg, rgba(166, 132, 82, 0.13) 50%, transparent 50.4%) right bottom / 50% 100% no-repeat;
}

.envelope-body::after {
  inset: 10px;
  border: 1px solid rgba(166, 132, 82, 0.32);
  border-radius: 8px;
}

/* Tarjeta interior que emerge al abrir */
.envelope-letter {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 22px;
  height: 176px;
  border-radius: 10px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FAF5EC 100%);
  border: 1px solid var(--nw-gold-light);
  box-shadow: 0 8px 24px rgba(36, 31, 26, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  z-index: 1;
  transform: translateY(18px) scale(0.96);
  transition: transform 780ms var(--nw-ease) 160ms;
}

.envelope-letter__monogram {
  font-family: var(--nw-font-display);
  font-size: 1.75rem;
  color: var(--nw-ink);
  letter-spacing: 0.12em;
}

.envelope-letter__date {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--nw-botanical);
}

/* Solapa superior 3D */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 122px;
  background: linear-gradient(180deg, #F5ECDC 0%, #E7D8C0 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 700ms var(--nw-ease);
  z-index: 3;
  filter: drop-shadow(0 6px 8px rgba(36, 31, 26, 0.08));
}

/* Sello de lacre oro mate G&M */
.wax-seal {
  position: absolute;
  left: 50%;
  top: 112px;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid rgba(255, 245, 224, 0.55);
  background: radial-gradient(circle at 32% 28%, #D9BE8F 0%, #A68452 55%, #7B5D32 100%);
  color: #FFFBF4;
  font-family: var(--nw-font-display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 10px 24px rgba(110, 83, 43, 0.35), inset 0 2px 5px rgba(255, 255, 255, 0.38);
  transition: transform 420ms var(--nw-ease), opacity 420ms var(--nw-ease);
  animation: nwSealPulse 2.8s ease-in-out infinite;
}

.wax-seal:hover {
  transform: translate(-50%, -50%) scale(1.06);
}

.wax-seal__ring {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 248, 232, 0.55);
  pointer-events: none;
}

/* Estado animado al abrir el sobre */
.envelope-scene.is-opening .envelope-flap {
  transform: rotateX(-176deg);
  z-index: 0;
}

.envelope-scene.is-opening .wax-seal {
  opacity: 0;
  transform: translate(-50%, -80%) scale(0.7);
  animation: none;
}

.envelope-scene.is-opening .envelope-letter {
  z-index: 3;
  transform: translateY(-68px) scale(1.02);
}

.envelope-stage__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
}

.envelope-stage__hint {
  margin: 0.9rem 0 0;
  font-size: 0.74rem;
  color: var(--nw-ink-muted);
}

.envelope-stage__hint kbd {
  padding: 0.1rem 0.38rem;
  border-radius: 4px;
  border: 1px solid var(--nw-border-strong);
  background: var(--nw-surface);
  font-family: inherit;
  font-size: 0.72rem;
}

@keyframes nwSealPulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(110, 83, 43, 0.35), 0 0 0 0 rgba(166, 132, 82, 0.28); }
  50% { box-shadow: 0 12px 28px rgba(110, 83, 43, 0.42), 0 0 0 12px rgba(166, 132, 82, 0); }
}

/* ==========================================================================
   2. PORTADA CINEMATOGRÁFICA DE ALTO IMPACTO
   ========================================================================== */
.hero--cinema {
  padding: clamp(2.4rem, 6vw, 4.5rem) 0 clamp(3rem, 7vw, 5rem);
  position: relative;
}

.hero__branch {
  position: absolute;
  width: clamp(110px, 18vw, 230px);
  opacity: 0.42;
  pointer-events: none;
  z-index: 0;
  transition: transform 300ms linear;
}

.hero__branch--left {
  top: 0.5rem;
  left: -1rem;
  transform: rotate(175deg);
}

.hero__branch--right {
  bottom: 0.5rem;
  right: -1rem;
}

.hero-cinema-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}

.hero-cinema-copy {
  text-align: center;
}

.hero-cinema-grid.has-photo .hero-cinema-media {
  order: -1;
}

@media (min-width: 920px) {
  .hero-cinema-grid.has-photo {
    grid-template-columns: 1.08fr 0.92fr;
    gap: 3rem;
  }
  .hero-cinema-grid.has-photo .hero-cinema-copy {
    text-align: left;
  }
  .hero-cinema-grid.has-photo .hero__monogram {
    margin-inline: 0;
    width: 86px;
    height: 86px;
  }
  .hero-cinema-grid.has-photo .hero__subtitle,
  .hero-cinema-grid.has-photo .guest-card,
  .hero-cinema-grid.has-photo .countdown {
    margin-inline: 0;
  }
  .hero-cinema-grid.has-photo .hero__actions {
    justify-content: flex-start;
  }
  .hero-cinema-grid.has-photo .hero-cinema-media {
    order: 1;
  }
}

/* Arco arquitectónico para la foto protagonista */
.cinema-arch {
  margin: 0 auto;
  max-width: 420px;
  padding: 0.85rem;
  background: linear-gradient(180deg, #FFFFFF 0%, #F7EFE2 100%);
  border: 1px solid var(--nw-gold-light);
  border-radius: 220px 220px 22px 22px;
  box-shadow: 0 26px 60px rgba(36, 31, 26, 0.14), 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  position: relative;
  will-change: transform;
}

.cinema-arch::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 214px 214px 16px 16px;
  border: 1px solid rgba(166, 132, 82, 0.35);
  pointer-events: none;
}

.cinema-arch__frame {
  overflow: hidden;
  border-radius: 208px 208px 14px 14px;
  background: var(--nw-bg-alt);
}

.cinema-arch__img {
  width: 100%;
  aspect-ratio: 4 / 4.55;
  object-fit: cover;
  object-position: 50% 60%;
  transition: transform 900ms var(--nw-ease);
}

.cinema-arch:hover .cinema-arch__img {
  transform: scale(1.025);
}

.cinema-arch__caption {
  text-align: center;
  padding: 0.75rem 0.5rem 0.25rem;
  font-size: 0.75rem;
  color: var(--nw-ink-muted);
  letter-spacing: 0.03em;
}

/* Indicador suave de scroll */
.scroll-cue {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-top: 2.2rem;
  text-decoration: none;
  color: var(--nw-ink-muted);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.scroll-cue__line {
  width: 1px;
  height: 30px;
  background: linear-gradient(180deg, var(--nw-gold), transparent);
  animation: nwScrollBob 2.2s ease-in-out infinite;
}

@keyframes nwScrollBob {
  0%, 100% { transform: translateY(0); opacity: 0.9; }
  50% { transform: translateY(6px); opacity: 0.4; }
}

/* Transición suave de dígitos del contador */
.countdown__value {
  animation: nwDigitReveal 650ms var(--nw-ease) both;
}

@keyframes nwDigitReveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   3. CAPÍTULOS, CONTRATE BOTÁNICO PROFUNDO Y LÍNEA DE TIEMPO VISUAL
   ========================================================================== */
.chapter-tag {
  display: inline-block;
  font-family: var(--nw-font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--nw-gold);
  margin-bottom: 0.55rem;
}

.nw-section--silk {
  background-color: var(--nw-bg-alt);
  background-image: var(--nw-paper-grain);
}

/* Sección de contraste editorial en Verde Botánico Profundo (WCAG AAA) */
.nw-section--velvet {
  background: linear-gradient(165deg, #243629 0%, #1C2B20 100%);
  color: #FAF6EE;
}

.nw-section--velvet .section-header__title,
.nw-section--velvet h3 {
  color: #FAF6EE;
}

.nw-section--velvet .section-header__lead {
  color: #D7E2D7;
}

.nw-section--velvet .chapter-tag {
  color: var(--nw-gold-light);
}

.nw-section--velvet .demo-badge {
  background: rgba(250, 246, 238, 0.12);
  color: #E8DFC8;
  border-color: rgba(217, 192, 152, 0.42);
}

/* Línea de tiempo vertical con columna oro mate y nodos botánicos */
.timeline--cinema {
  position: relative;
  padding-left: 1.75rem;
}

.timeline--cinema::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(180deg, var(--nw-gold-light), var(--nw-gold), transparent);
}

.timeline--cinema .timeline__item {
  position: relative;
  border-left: 1px solid rgba(217, 192, 152, 0.32);
  background: rgba(255, 255, 255, 0.96);
  color: var(--nw-ink);
  box-shadow: var(--nw-shadow-md);
}

.timeline--cinema .timeline__item::before {
  content: "";
  position: absolute;
  left: -1.75rem;
  top: 1.35rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--nw-gold-light);
  border: 3px solid var(--nw-botanical-deep);
  box-shadow: 0 0 0 2px var(--nw-gold-light);
}

.nw-section--velvet .timeline__title {
  color: var(--nw-ink);
}

/* Galería interactiva con botón de lightbox */
.gallery-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: zoom-in;
}

.gallery-figure {
  transition: transform 320ms var(--nw-ease), box-shadow 320ms var(--nw-ease);
}

.gallery-figure:hover {
  transform: translateY(-4px);
  box-shadow: var(--nw-shadow-md);
}

/* ==========================================================================
   4. LIGHTBOX ACCESIBLE
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 21, 18, 0.92);
  backdrop-filter: blur(6px);
}

.lightbox__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 880px);
  text-align: center;
  color: #FAF6EE;
}

.lightbox__close {
  position: absolute;
  top: -0.5rem;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(250, 246, 238, 0.35);
  background: rgba(36, 31, 26, 0.85);
  color: #FAF6EE;
  font-size: 1.15rem;
  cursor: pointer;
}

.lightbox__media-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2.5rem;
}

.lightbox__img {
  max-height: 70vh;
  max-width: calc(100% - 104px);
  border-radius: 14px;
  border: 1px solid rgba(217, 192, 152, 0.4);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.lightbox__nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(250, 246, 238, 0.35);
  background: rgba(36, 31, 26, 0.75);
  color: #FAF6EE;
  font-size: 1.5rem;
  cursor: pointer;
  flex: 0 0 auto;
}

.lightbox__caption {
  margin: 1rem 0 0.25rem;
  font-size: var(--nw-fs-sm);
  color: #F2E9DB;
}

.lightbox__counter {
  margin: 0;
  font-size: var(--nw-fs-xs);
  color: var(--nw-gold-light);
  letter-spacing: 0.14em;
}

/* Confirmación elegante de RSVP */
.rsvp-seal-ok {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rsvp-seal-ok svg {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

/* ==========================================================================
   5. BOTÓN FLOTANTE DE MÚSICA INSTRUMENTAL OPCIONAL (SIN AUTOPLAY)
   ========================================================================== */
.audio-fab {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
}

.audio-fab[hidden] {
  display: none;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: var(--nw-radius-pill);
  border: 1px solid var(--nw-gold-light);
  background: rgba(250, 246, 238, 0.94);
  color: var(--nw-ink);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--nw-shadow-md);
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.audio-btn[aria-pressed="true"] {
  background: var(--nw-botanical-deep);
  color: #FAF6EE;
  border-color: var(--nw-gold-light);
}

.audio-btn__bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 14px;
}

.audio-btn__bars span {
  display: block;
  width: 2.5px;
  height: 5px;
  border-radius: 2px;
  background: currentColor;
  transition: height 200ms ease;
}

.audio-btn[aria-pressed="true"] .audio-btn__bars span:nth-child(1) {
  animation: nwEq 1s ease-in-out infinite;
}
.audio-btn[aria-pressed="true"] .audio-btn__bars span:nth-child(2) {
  animation: nwEq 0.85s ease-in-out 0.2s infinite;
}
.audio-btn[aria-pressed="true"] .audio-btn__bars span:nth-child(3) {
  animation: nwEq 1.15s ease-in-out 0.35s infinite;
}

@keyframes nwEq {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

/* Controles discretos del pie */
.footer__controls {
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.76rem;
  color: var(--nw-ink-muted);
}

.footer__link-btn {
  background: transparent;
  border: 0;
  padding: 0.25rem;
  color: var(--nw-ink-muted);
  text-decoration: underline;
  font: inherit;
  cursor: pointer;
}

/* Respeto estricto a prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .wax-seal,
  .scroll-cue__line,
  .countdown__value,
  .audio-btn[aria-pressed="true"] .audio-btn__bars span {
    animation: none !important;
  }
  .envelope-flap,
  .envelope-letter,
  .cinema-arch__img,
  .gallery-figure {
    transition: none !important;
  }
}
