/* ============================================================================
   STORY.CSS — scrollytelling narrativo, reveals por palabra y parallax cálido
   Se carga después de premium.css.
   ========================================================================== */

:root {
  --ease-warm: cubic-bezier(.19, 1, .22, 1);   /* salida suave, orgánica */
}

/* ============================================================================
   1. REVEAL POR PALABRA (efecto máscara: la palabra sube desde abajo)
   ========================================================================== */
.w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .06em; }
.w__in {
  display: inline-block;
  transform: translateY(115%) rotate(2.5deg);
  opacity: 0;
  transition:
    transform .95s var(--ease-warm) calc(var(--wi) * 52ms),
    opacity .7s ease calc(var(--wi) * 52ms);
}
.is-on .w__in, .is-active .w__in { transform: none; opacity: 1; }

/* ============================================================================
   2. HERO — profundidad y despedida
   ========================================================================== */
.hero__content { will-change: transform, opacity; z-index: 2; }
/* entrada escalonada al llegar al hero */
.hero__pre, .hero__names, .hero__date, .hero__city {
  opacity: 0; animation: heroIn 1.4s var(--ease-warm) forwards;
}
.hero__pre   { animation-delay: .35s; }
.hero__names { animation-delay: .55s; }
.hero__date  { animation-delay: 1.05s; }
.hero__city  { animation-delay: 1.2s; }
@keyframes heroIn { from { opacity: 0; transform: translateY(26px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.hero__vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 85% at 50% 45%, transparent 40%, rgba(20,12,6,.55) 100%);
}
.hero__rule {
  width: min(230px, 55vw); height: 1px; margin: 1.1rem auto;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.85), transparent);
  transform: scaleX(0);
  animation: ruleGrow 1.6s var(--ease-warm) .9s forwards;
}
@keyframes ruleGrow { to { transform: scaleX(1); } }
.hero__bg { will-change: transform; }

/* ============================================================================
   3. SCROLLYTELLING
   ========================================================================== */
.scrolly { position: relative; background: #0d0a08; }
/* height/margin duplicados: vh es el respaldo para navegadores sin svh
   (si sólo declaráramos svh, esos navegadores descartan la regla entera
   y el panel fijo se queda sin altura → el scrollytelling se desarma) */
.scrolly__sticky {
  position: sticky; top: 0; overflow: hidden; display: grid; place-items: center;
  height: 100vh;
  height: 100svh;
}
/* los capítulos se superponen al panel fijo desde el arranque */
.scrolly__steps { position: relative; z-index: 3; margin-top: -100vh; margin-top: -100svh; }

/* --- capas de imagen --- */
.scrolly__layers { position: absolute; inset: 0; }
.scrolly__layer {
  position: absolute; inset: 0; opacity: 0;
  transition: opacity 1.25s var(--ease-warm);
  will-change: opacity;
}
.scrolly__layer.on { opacity: 1; }
.scrolly__img {
  position: absolute; inset: -6%;
  background-size: cover; background-position: center;
  transform: scale(1.14);
  will-change: transform;
  animation: storyDrift 24s ease-in-out infinite alternate;
  animation-play-state: paused;   /* corre solo con la historia a la vista */
}
.scrolly.in-view .scrolly__img { animation-play-state: running; }
@keyframes storyDrift { to { background-position: 54% 46%; } }

/* tinte cálido para que el texto se lea y la escena se sienta amable */
.scrolly__tint {
  position: absolute; inset: 0; z-index: 1;
  background:
    /* velo lateral fuerte donde va el texto (garantiza legibilidad sobre fotos claras) */
    linear-gradient(90deg, rgba(14,9,5,.88) 0%, rgba(14,9,5,.72) 32%, rgba(14,9,5,.3) 62%, transparent 85%),
    linear-gradient(180deg, rgba(14,9,5,.7) 0%, rgba(14,9,5,.34) 40%, rgba(14,9,5,.78) 100%),
    radial-gradient(120% 90% at 60% 50%, transparent 45%, rgba(10,6,3,.55) 100%);
}
@media (max-width: 859px) {
  /* en mobile el texto va centrado: velo parejo */
  .scrolly__tint {
    background:
      linear-gradient(180deg, rgba(14,9,5,.78) 0%, rgba(14,9,5,.55) 40%, rgba(14,9,5,.85) 100%),
      radial-gradient(120% 80% at 50% 50%, transparent 30%, rgba(10,6,3,.6) 100%);
  }
}
/* halo dorado que respira: da la sensación de luz cálida */
.scrolly__glow {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(60% 45% at 22% 42%, rgba(216,170,96,.30), transparent 70%);
  animation: glowBreath 9s ease-in-out infinite alternate;
  animation-play-state: paused;
}
.scrolly.in-view .scrolly__glow { animation-play-state: running; }
@keyframes glowBreath { from { opacity: .5; transform: scale(1); } to { opacity: .95; transform: scale(1.12); } }

/* --- encabezado fijo de la sección --- */
.scrolly__heading { position: absolute; top: 6.5%; left: 0; right: 0; text-align: center; color: #fff; z-index: 4; padding: 0 1.2rem; }
.scrolly__eyebrow { font-family: var(--font-display); font-size: clamp(1.7rem, 6vw, 2.9rem); }
.scrolly__sub { font-family: var(--font-body); font-size: .68rem; letter-spacing: .3em; text-transform: uppercase; opacity: .75; margin-top: .45rem; }

/* --- año gigante de fondo --- */
.scrolly__year {
  position: absolute; z-index: 2; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(7rem, 34vw, 22rem); line-height: 1;
  color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.16);
  user-select: none; pointer-events: none;
  transition: opacity .35s ease;
  will-change: transform;
}
.scrolly__year.swap { opacity: 0; }

/* --- línea de tiempo lateral --- */
.timeline {
  position: absolute; left: max(18px, 4vw); top: 50%; transform: translateY(-50%);
  height: min(56vh, 420px); z-index: 5; display: flex; align-items: stretch; gap: .7rem;
}
.timeline__svg { width: 4px; height: 100%; overflow: visible; }
.timeline__track { stroke: rgba(255,255,255,.18); stroke-width: 2; }
.timeline__fill {
  stroke: var(--accent); stroke-width: 2;
  stroke-dasharray: 300; stroke-dashoffset: 300;
  filter: drop-shadow(0 0 6px rgba(201,168,74,.65));
}
.timeline__dots { position: relative; display: flex; flex-direction: column; justify-content: space-between; }
.timeline__dot { display: flex; align-items: center; gap: .55rem; transform: translateX(-13px); }
.timeline__dot i {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: #0d0a08; border: 1.5px solid rgba(255,255,255,.35);
  transition: all .5s var(--ease-warm);
}
.timeline__dot b {
  font-family: var(--font-body); font-weight: 400; font-size: .6rem; letter-spacing: .18em;
  color: rgba(255,255,255,.45); opacity: 0; transform: translateX(-6px);
  transition: all .5s var(--ease-warm);
}
.timeline__dot.done i { background: var(--accent); border-color: var(--accent); }
.timeline__dot.on i {
  background: var(--accent); border-color: #fff; transform: scale(1.5);
  box-shadow: 0 0 0 5px rgba(201,168,74,.22), 0 0 14px rgba(201,168,74,.8);
}
.timeline__dot.on b { opacity: 1; transform: none; color: #fff; }

/* --- tarjeta de cada capítulo --- */
.scrolly__step {
  min-height: 100vh;
  min-height: 100svh;
  display: flex; align-items: center;
  /* margen lateral fluido: respira en pantallas chicas y no se pega a los bordes */
  padding: 13vh clamp(1.7rem, 7vw, 2.4rem) 13vh;
  padding: 13svh clamp(1.7rem, 7vw, 2.4rem) 13svh;
  justify-content: center;
}
.scrolly__card {
  width: 100%; max-width: 480px; color: #fff; position: relative;
  transform: translateY(38px) scale(.985);
  opacity: .12; filter: blur(3px);
  transition: opacity .85s var(--ease-warm), transform 1s var(--ease-warm), filter .85s ease;
  will-change: transform, opacity;
}
.scrolly__step.is-active .scrolly__card { opacity: 1; transform: none; filter: none; }

.c-meta { display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; }
.c-line { display: block; width: 46px; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left center; transition: transform 1s var(--ease-warm) .15s; }
.scrolly__step.is-active .c-line { transform: scaleX(1); }
.c-when {
  font-family: var(--font-body); font-size: .68rem; letter-spacing: .28em; text-transform: uppercase;
  color: #e8d6ac; font-weight: 500; text-shadow: 0 1px 6px rgba(0,0,0,.8);
}

.c-title {
  font-family: var(--font-display); font-size: clamp(2rem, 8.5vw, 3.4rem); line-height: 1.06; margin-bottom: .8rem;
  text-shadow: 0 3px 24px rgba(0,0,0,.6);
}
.c-text { font-size: 1.03rem; line-height: 1.75; color: rgba(255,255,255,.94); text-shadow: 0 2px 12px rgba(0,0,0,.7); }
.c-cita {
  margin-top: 1.3rem; padding-left: 1rem; border-left: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  font-family: var(--font-display); font-style: italic; font-size: 1.15rem; color: #ecdcb8;
  text-shadow: 0 2px 12px rgba(0,0,0,.75);
  opacity: 0; transform: translateY(14px);
  transition: opacity .8s ease .55s, transform .8s var(--ease-warm) .55s;
}
.scrolly__step.is-active .c-cita { opacity: 1; transform: none; }
.c-cita .icon { opacity: .75; margin-right: .2rem; }

/* ============================================================================
   4. GALERÍA CON PROFUNDIDAD
   ========================================================================== */
.gallery__item { overflow: hidden; }
.gallery__item img { transform: scale(1.16); will-change: transform; }
.gallery__item:hover img { transform: scale(1.22) !important; }

/* ============================================================================
   4b. ERGONOMÍA TÁCTIL Y LEGIBILIDAD (auditoría mobile)
   Objetivo mínimo de toque: 44x44px. Texto mínimo legible: ~11px.
   ========================================================================== */
/* --- Menú hamburguesa: medía 26x14, imposible de acertar con el dedo --- */
.nav__burger {
  width: 44px; height: 44px; padding: 15px 9px;
  align-items: stretch; justify-content: center;
}
.nav__music { width: 44px; height: 44px; }
.nav__brand { min-height: 44px; display: inline-flex; align-items: center; }

/* --- Botones de copiar alias/CBU --- */
.copy-btn { min-height: 40px; padding: .5rem 1rem; display: inline-flex; align-items: center; }

/* --- Selector de temas --- */
.theme-switcher { padding: .45rem .6rem; }
.theme-switcher button { min-height: 40px; padding: .5rem .9rem; font-size: .78rem; }

/* --- Enlaces sueltos: área de toque cómoda --- */
.playlist__spotify, .footer__wa { padding: .55rem 0; display: inline-flex; align-items: center; }
.nav__links a { padding: .95rem 0; }

/* --- Flecha de scroll del hero --- */
.hero__scroll { width: 44px; height: 56px; display: grid; place-items: start center; padding-top: 7px; border: none; }
.hero__scroll::before {
  content: ""; position: absolute; inset: 7px 9px; border: 2px solid rgba(255,255,255,.7); border-radius: 20px;
}

/* --- Saltos de línea elegantes: evitar líneas huérfanas y cortes feos --- */
.hero__date, .hero__names, .section__title, .c-title, .cinematic__quote,
.invite__text, .scrolly__eyebrow, .event-card__lugar { text-wrap: balance; }
.hero__date {
  /* el letter-spacing grande partía "…NOVIEMBRE, / 2026" dejando el año solo */
  letter-spacing: clamp(.12em, 2.5vw - .55rem, .28em);
  font-size: clamp(.82rem, 3.2vw, 1.2rem);
}
.hero__city { letter-spacing: clamp(.12em, 2vw - .4rem, .22em); }

/* --- Tamaños de texto: subir los que quedaban por debajo de ~11px --- */
.countdown__label { font-size: .7rem; }
.envelope__to { font-size: .66rem; }
.letter__date { font-size: .68rem; }
.scrolly__sub { font-size: .7rem; }
.c-when { font-size: .7rem; }
.footer__credit { font-size: .74rem; }
.event-card__hora { font-size: .82rem; }
.info-card p { font-size: .9rem; }

/* --- Campos de formulario cómodos en mobile (y sin zoom en iOS) --- */
.field input, .field select, .field textarea, .playlist__form input {
  min-height: 48px; font-size: 16px;
}
.radio span { min-height: 48px; display: flex; align-items: center; justify-content: center; }
.btn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }

/* ============================================================================
   5. MOVIMIENTO REDUCIDO
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .w__in { transform: none !important; opacity: 1 !important; }
  .scrolly__card { opacity: 1 !important; transform: none !important; filter: none !important; }
  .scrolly__glow, .scrolly__img { animation: none !important; }
  .hero__rule { width: min(230px, 55vw); animation: none; }
  .gallery__item img { transform: none !important; }
}

/* ============================================================================
   5b. ALTURAS ROBUSTAS + ÁREA SEGURA (notch / barra de gestos)
   Con `height` fijo, si el contenido crece (nombres largos, texto traducido,
   fuente grande del sistema) se CORTA. Con min-height, la sección crece.
   ========================================================================== */
.hero { height: auto; min-height: 100vh; min-height: 100svh; }
.cinematic { height: auto; min-height: 92vh; min-height: 92svh; }

/* Barra de gestos del iPhone / notch: que nada quede tapado ni pegado */
.theme-switcher { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.footer { padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px)); }
.nav { padding-left: calc(1.2rem + env(safe-area-inset-left, 0px)); padding-right: calc(1.2rem + env(safe-area-inset-right, 0px)); }
.env { padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1.2rem calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 859px) {
  .timeline { bottom: calc(max(2.2svh, 16px) + env(safe-area-inset-bottom, 0px)); }
}

/* El sobre nunca debe exceder la pantalla. OJO: no fijar aquí el `width`,
   que el tamaño lo define premium.css y este archivo carga después. */
.env__stage { max-width: 100%; }
.envelope { max-width: 100%; }
/* pantallas muy bajas (celular apaisado): que se achique en vez de cortarse */
@media (max-height: 560px) {
  .envelope { width: min(88vw, 62vh, 420px); }
  .env__stage { gap: 1rem; }
  .env__eyebrow { font-size: .62rem; }
}

/* Pantallas MUY angostas (320px: iPhone SE 1ª gen, Galaxy Fold cerrado) */
@media (max-width: 360px) {
  .countdown__box { min-width: 66px; padding: .9rem .45rem; }
  .countdown__grid { gap: .45rem; }
  .info__grid { gap: .7rem; }
  .gallery__grid { gap: .45rem; }
  .radio { min-width: 100%; }
}

/* ============================================================================
   6. DESKTOP
   ========================================================================== */
@media (min-width: 860px) {
  .scrolly__step { justify-content: flex-start; padding-left: max(9vw, 110px); }
  .scrolly__card { margin-left: 2vw; }
  .scrolly__year { right: 6vw; }
  .timeline { left: max(30px, 5vw); }
}
@media (max-width: 859px) {
  /* En mobile la línea vertical robaba ancho y se montaba sobre el texto.
     Pasa a ser un indicador horizontal discreto abajo. */
  .timeline {
    left: 0; right: 0; top: auto; bottom: max(2.2svh, 16px);
    transform: none; height: auto; width: 100%;
    justify-content: center; align-items: center; gap: 0;
    pointer-events: none;
  }
  .timeline__svg { display: none; }
  .timeline__dots { flex-direction: row; gap: .85rem; justify-content: center; }
  .timeline__dot { transform: none; }
  .timeline__dot b { display: none; }
  .timeline__dot i { width: 7px; height: 7px; }
  .timeline__dot.on i { transform: scale(1.6); }

  .scrolly__card { text-align: left; }
  /* aire abajo para no chocar con el indicador */
  .scrolly__step { padding-bottom: 16svh; }
}
