:root {
  --bg-deep: #0a0710;
  --bg-warm: #1a0e1f;
  --bg-mid: #211224;
  --ink: #f4e6e6;
  --ink-soft: #c9b5b8;
  --ink-quiet: #8a777b;
  --rose: #e4a7a4;
  --rose-soft: #c98a8d;
  --gold: #d4b07a;
  --line: rgba(228, 167, 164, 0.18);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --serif: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.22, 0.8, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(180, 90, 100, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(120, 70, 140, 0.16), transparent 60%),
    radial-gradient(ellipse 60% 50% at 10% 50%, rgba(80, 50, 90, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-warm) 100%);
  background-attachment: fixed;
}

/* ============================
   GATE (pantalla de entrada)
   ============================ */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding:
    max(2rem, env(safe-area-inset-top))
    max(1.5rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom))
    max(1.5rem, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(228, 167, 164, 0.1), transparent 70%),
    linear-gradient(180deg, #060409 0%, #120816 100%);
  transition: opacity 0.8s var(--ease), visibility 0.8s var(--ease);
}

.gate--leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate__inner {
  text-align: center;
  max-width: 540px;
  width: 100%;
  animation: rise 1.4s var(--ease) both;
}

.gate__ornament {
  width: 1px;
  height: 80px;
  margin: 0 auto 2.5rem;
  background: linear-gradient(180deg, transparent, var(--rose), transparent);
  opacity: 0.8;
}

.gate__kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.3em;
  text-transform: lowercase;
  color: var(--rose-soft);
  margin: 0 0 1.25rem;
  opacity: 0.85;
}

.gate__question {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.3;
  margin: 0 0 2.5rem;
  color: var(--ink);
  letter-spacing: 0.005em;
}

.gate__form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-items: stretch;
}

.gate__input {
  width: 100%;
  padding: 1.1rem 1.4rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 4px;
  text-align: center;
  letter-spacing: 0.02em;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
  outline: none;
}

.gate__input::placeholder {
  color: var(--ink-quiet);
  font-style: italic;
}

.gate__input:focus {
  border-color: var(--rose);
  background: rgba(255, 255, 255, 0.07);
}

.gate__btn {
  padding: 1.05rem 2rem;
  min-height: 48px;
  background: transparent;
  color: var(--rose);
  border: 1px solid var(--rose-soft);
  border-radius: 4px;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  text-transform: lowercase;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

@media (hover: hover) {
  .gate__btn:hover {
    background: var(--rose);
    color: var(--bg-deep);
    letter-spacing: 0.35em;
  }
}

.gate__btn:active {
  background: var(--rose);
  color: var(--bg-deep);
}

.gate__input {
  -webkit-appearance: none;
  appearance: none;
}

.gate__hint {
  margin: 1.5rem 0 0;
  min-height: 1.4em;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--rose-soft);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.gate__hint--visible { opacity: 0.9; }

.gate--shake .gate__inner {
  animation: shake 0.45s var(--ease);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

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

/* ============================
   CONTENIDO PRINCIPAL
   ============================ */
.content {
  position: relative;
  z-index: 1;
}

.scene {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.scene__inner {
  width: 100%;
  max-width: 980px;
  text-align: center;
}

.scene__inner--narrow {
  max-width: 640px;
}

/* Hero */
.scene--hero {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: 4rem;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.scene--hero::before {
  content: "";
  position: absolute;
  inset: -3%;
  /* Posicion vertical de la foto del hero. 30% = tercio superior visible (caras).
     Si quieres mover: 20% sube mas, 50% centro, 70% baja. */
  background: url("../fotos/foto13.jpg") center 30% / cover no-repeat;
  filter: brightness(0.42) saturate(0.85) contrast(1.05);
  animation: kenburns 30s ease-in-out infinite alternate;
  z-index: -2;
}

.scene--hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 0%, rgba(10, 7, 16, 0.55) 70%, rgba(10, 7, 16, 0.88) 100%),
    linear-gradient(180deg, rgba(10, 7, 16, 0.35) 0%, transparent 28%, transparent 72%, rgba(10, 7, 16, 0.85) 100%);
  z-index: -1;
  pointer-events: none;
}

@keyframes kenburns {
  0% { transform: scale(1.02) translate(0, 0); }
  100% { transform: scale(1.08) translate(-1%, -0.5%); }
}

.kicker {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.4em;
  color: var(--rose-soft);
  margin: 0 0 2rem;
  text-transform: lowercase;
  opacity: 0.8;
}

.hero__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 2rem;
  color: var(--ink);
}

.hero__title em {
  font-style: italic;
  font-weight: 400;
  color: var(--rose);
}

.hero__sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--ink-soft);
  margin: 0 auto;
  max-width: 540px;
  line-height: 1.55;
}

.scroll-hint {
  margin-top: 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  color: var(--ink-quiet);
  text-transform: lowercase;
  opacity: 0.7;
}

.scroll-hint__line {
  width: 1px;
  height: 50px;
  background: linear-gradient(180deg, var(--rose-soft), transparent);
  animation: drip 2.2s var(--ease) infinite;
  transform-origin: top;
}

@keyframes drip {
  0% { transform: scaleY(0); opacity: 0.9; }
  60% { transform: scaleY(1); opacity: 0.9; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* Intro */
.scene--intro {
  padding: 8rem 1.5rem;
}

.prose {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 1.5rem;
  letter-spacing: 0.005em;
}

.prose:last-child { margin-bottom: 0; }

.prose--quiet {
  font-style: italic;
  color: var(--ink-quiet);
  font-size: 1rem;
  letter-spacing: 0.15em;
  margin-top: 3rem;
  text-transform: lowercase;
}

.prose--center { text-align: center; }

/* ============================
   CANCIÓN (cada scene)
   ============================ */
.song {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
  max-width: 1100px;
  width: 100%;
}

@media (min-width: 880px) {
  .song { grid-template-columns: 1.05fr 1fr; gap: 4.5rem; }
  .song--reverse { direction: rtl; }
  .song--reverse > * { direction: ltr; }
}

.song__text {
  text-align: left;
}

.song__num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.4em;
  color: var(--rose-soft);
  margin: 0 0 1.25rem;
  text-transform: lowercase;
  opacity: 0.85;
}

.song__moment {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 1.5rem;
}

.song__moment em {
  font-style: italic;
  color: var(--rose);
}

.song__lyric {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 1.5rem 0 0;
  padding-left: 1.25rem;
  border-left: 1px solid var(--line);
  max-width: 460px;
}

.song__photo {
  position: relative;
  width: 100%;
  max-width: 340px;
  margin: 2.25rem auto 0;
  padding: 14px 14px 56px;
  background: #f4ede1;
  border-radius: 2px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 24px 48px -12px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  transform: rotate(var(--rot, -1.5deg));
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
  z-index: 1;
}

@media (hover: hover) {
  .song__photo:hover {
    transform: rotate(calc(var(--rot, -1.5deg) * 0.25)) scale(1.04);
    box-shadow:
      0 4px 8px rgba(0, 0, 0, 0.45),
      0 32px 64px -10px rgba(0, 0, 0, 0.7),
      inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  }
}

.song__photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1px;
  filter: saturate(0.92) brightness(0.92) contrast(1.04);
}

.song__embed {
  width: 100%;
  isolation: isolate;
}

.song__embed-target {
  position: relative;
  width: 100%;
  height: 152px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow);
}

/* Spinner mientras Spotify carga el embed */
.song__embed-target::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid var(--rose-soft);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  opacity: 0.45;
}

.song__embed-target iframe {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.song__embed iframe {
  width: 100%;
  height: 152px;
  border: 0;
  display: block;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Link "abrir en spotify" debajo de cada player */
.song__open {
  display: inline-block;
  margin-top: 0.85rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--rose-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
  -webkit-tap-highlight-color: rgba(228, 167, 164, 0.2);
}

@media (hover: hover) {
  .song__open:hover {
    color: var(--rose);
    border-bottom-color: var(--rose);
  }
}

.song__open:active {
  color: var(--rose);
}

/* Cierre */
.scene--outro {
  padding: 10rem 1.5rem 8rem;
}

.signature {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--rose);
  margin: 3rem 0 0;
  letter-spacing: 0.08em;
  text-align: center;
}

.heart {
  margin-top: 2rem;
  text-align: center;
  font-size: 2rem;
  color: var(--rose);
  opacity: 0.7;
  animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.12); opacity: 0.9; }
}

/* ============================
   ANIMACIONES DE SCROLL
   ============================ */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================
   PREMIUM: backdrop album art, big numbers, particles
   ============================ */

.scene--song {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.scene--song::before {
  content: "";
  position: absolute;
  inset: -12%;
  background-image: var(--art, none);
  background-size: cover;
  background-position: center;
  filter: blur(100px) saturate(1.4);
  opacity: 0.42;
  z-index: -2;
}

.scene--song::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 7, 16, 0.6) 0%,
    rgba(10, 7, 16, 0.05) 28%,
    rgba(10, 7, 16, 0.05) 72%,
    rgba(10, 7, 16, 0.6) 100%
  );
  z-index: -1;
  pointer-events: none;
}

.song-bigno {
  position: absolute;
  top: 5%;
  font-family: var(--serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(6rem, 18vw, 13rem);
  line-height: 0.85;
  color: var(--rose);
  opacity: 0.09;
  letter-spacing: -0.04em;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

/* Offsets positivos: los numeros estan DENTRO del viewport con margen igual a ambos lados.
   No se cortan, no se pegan al borde. */
.song-bigno--right { right: 3%; }
.song-bigno--left { left: 3%; }

@media (max-width: 600px) {
  .song-bigno {
    font-size: clamp(4rem, 16vw, 6rem);
    top: 2%;
    opacity: 0.08;
  }
  .song-bigno--right { right: 4%; }
  .song-bigno--left { left: 4%; }
}

/* Particulas flotantes */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.particle {
  position: absolute;
  top: -10px;
  background: radial-gradient(circle, rgba(228, 167, 164, 0.55) 0%, transparent 65%);
  border-radius: 50%;
  filter: blur(0.5px);
  animation: fall linear infinite;
  will-change: transform, opacity;
}

@keyframes fall {
  0% { transform: translate(0, 0); opacity: 0; }
  8% { opacity: 0.7; }
  92% { opacity: 0.7; }
  100% { transform: translate(var(--sway, 0), 110vh); opacity: 0; }
}

/* Reduce motion para accesibilidad */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .fade-in { opacity: 1; transform: none; }
}

/* ============================
   MOBILE (iPhone optimizado)
   ============================ */
@media (max-width: 600px) {
  .scene { padding: 4rem 1.25rem; }
  .scene--intro { padding: 5rem 1.25rem; }
  .scene--outro {
    padding: 6rem 1.25rem max(4rem, calc(env(safe-area-inset-bottom) + 3rem));
  }

  /* Scroll hint estorba en movil — ya cabe todo en un swipe */
  .scroll-hint { display: none; }

  /* Hero un pelin mas ajustado en movil para que la sub no se corte */
  .hero__title { letter-spacing: -0.015em; }
  .hero__sub { padding: 0 0.5rem; }

  /* Gate: ornamento mas corto en movil */
  .gate__ornament { height: 56px; margin-bottom: 2rem; }
  .gate__question { margin-bottom: 2rem; }

  /* Backdrop blur reducido en movil (Safari iOS sufre con blur(100px) en 12 capas) */
  .scene--song::before {
    filter: blur(50px) saturate(1.45);
    opacity: 0.5;
    inset: -8%;
  }

  /* Hero backdrop blur menos costoso */
  .scene--hero::before {
    filter: brightness(0.4) saturate(0.85) contrast(1.05);
  }

  /* Polaroid mas compacto */
  .song__photo {
    max-width: 280px;
    padding: 12px 12px 48px;
    margin: 1.75rem auto 0;
  }

  /* Embed Spotify pegado a los bordes para aprovechar ancho */
  .song__embed iframe { height: 152px; }

  /* Intro: parrafos un poco mas chicos */
  .scene--intro .prose { font-size: 1.15rem; }

  /* Outro: heart mas chico */
  .heart { font-size: 1.6rem; margin-top: 1.5rem; }
}

/* Pantallas muy chicas (iPhone SE / mini) */
@media (max-width: 380px) {
  .scene { padding: 3rem 1rem; }
  .gate__question { font-size: 1.5rem; }
  .hero__sub { font-size: 1rem; }
  /* Polaroid mantiene 280px (max del breakpoint padre) — al ancho disponible es ~288px */
}
