/* =========================================================================
   TOKENS
   ========================================================================= */
:root {
  --noche: #070b14;
  --noche-2: #0e1f24;
  --papel: #f5f1e6;
  --girasol: #ffc93c;
  --ambar: #ff9f1c;
  --hoja: #2dd4bf;
  --bruma: #e8e6f3;

  --display: "Fraunces", Georgia, serif;
  --cuerpo: "Manrope", -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--noche);
  color: var(--bruma);
  font-family: var(--cuerpo);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

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

#cielo {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

main { position: relative; z-index: 1; }

section { position: relative; padding: 10vh 8vw; }

/* =========================================================================
   HERO
   ========================================================================= */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 4vw;
}

.hero__ceja {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--girasol);
  margin: 0 0 0.6em;
  opacity: 0.9;
}

.hero__titulo {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.1rem, 5.6vw, 4rem);
  line-height: 1.08;
  margin: 0;
  color: var(--bruma);
  text-shadow: 0 0 34px rgba(255, 201, 60, 0.18);
}

.hero__nombre {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  color: var(--girasol);
  margin: 0.5em 0 0;
  text-shadow: 0 0 24px rgba(255, 201, 60, 0.55), 0 0 60px rgba(255, 201, 60, 0.25);
}

.hero__flor {
  perspective: 1200px;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 62vh;
  justify-self: center;
}

.tilt-grupo {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.flor-capa {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.flor-capa--glow {
  transform: translateZ(-60px) scale(1.2);
  filter: blur(20px);
  opacity: 0.6;
}

.flor-capa--principal {
  transform: translateZ(30px);
  filter: drop-shadow(0 0 18px rgba(255, 201, 60, 0.5));
}

.hero__scroll {
  position: absolute;
  left: 8vw;
  bottom: 6vh;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--bruma);
  font-family: var(--cuerpo);
  font-size: 0.85rem;
  opacity: 0.75;
  animation: flotar 2.6s ease-in-out infinite;
}

.hero__scroll svg { color: var(--girasol); }

@keyframes flotar {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* =========================================================================
   FLOR (SVG compartido)
   ========================================================================= */
.flor { width: 100%; height: auto; overflow: visible; }

.flor__hoja, .flor__tallo { transform-origin: center; }

.flor__petalos {
  transform-origin: 100px 110px;
  animation: mecer 5s ease-in-out infinite;
}

@keyframes mecer {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

/* =========================================================================
   JARDÍN
   ========================================================================= */
.jardin { padding-top: 14vh; padding-bottom: 16vh; }

.jardin__sendero {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.3;
}

.jardin__sendero path {
  fill: none;
  stroke: var(--hoja);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 3 16;
  animation: caminar 7s linear infinite;
}

@keyframes caminar { to { stroke-dashoffset: -190; } }

.jardin__titulo {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 46ch;
  margin: 0 auto 8vh;
}

.jardin__titulo h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  margin: 0 0 0.4em;
}

.jardin__titulo p {
  margin: 0;
  opacity: 0.75;
  font-size: 0.95rem;
}

.jardin__campo {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 2vw 1vw;
  max-width: 1200px;
  margin: 0 auto;
}

.flor-slot {
  position: relative;
  width: clamp(110px, 15vw, 180px);
  cursor: pointer;
}

.flor-slot:nth-child(2n) { margin-bottom: 3vh; }
.flor-slot:nth-child(3n) { margin-bottom: -2vh; }
.flor-slot:nth-child(5n) { margin-bottom: 4vh; }

.flor-slot__flor {
  transform: scale(0.3) translateY(16px);
  opacity: 0.45;
  filter: grayscale(0.5) brightness(0.6);
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1), opacity 900ms ease, filter 900ms ease;
  transition-delay: calc(var(--i) * 120ms);
}

.flor-slot.abierta .flor-slot__flor {
  transform: scale(1) translateY(0);
  opacity: 1;
  filter: none;
}

.flor-slot__nota {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translate(-50%, 8px);
  width: max-content;
  max-width: 220px;
  margin: 0;
  padding: 14px 16px;
  background: rgba(14, 31, 36, 0.9);
  border-left: 2px solid var(--girasol);
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--bruma);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms ease;
  z-index: 5;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.flor-slot.nota-visible .flor-slot__nota {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

/* =========================================================================
   ÁLBUM
   ========================================================================= */
.album {
  background: radial-gradient(ellipse at 50% 30%, rgba(45, 212, 191, 0.08), transparent 60%);
}

.album__titulo {
  text-align: center;
  max-width: 46ch;
  margin: 0 auto 8vh;
}

.album__titulo h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  margin: 0 0 0.4em;
}

.album__titulo p { margin: 0; opacity: 0.75; font-size: 0.95rem; }

.album__mesa {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3.5vw 2.5vw;
  max-width: 1100px;
  margin: 0 auto;
  padding: 4vh 0;
}

.polaroid {
  --rot-escala: 1;
  --despl-escala: 1;
  width: clamp(150px, 19vw, 210px);
  background: var(--papel);
  padding: 12px 12px 30px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
  transform: rotate(calc(var(--rot) * var(--rot-escala))) translateY(calc(var(--despl) * var(--despl-escala)));
  transition: transform 400ms ease, box-shadow 400ms ease;
}

.polaroid:hover {
  transform: rotate(0deg) translateY(calc(var(--despl) - 6px)) scale(1.05);
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.55);
  z-index: 5;
}

.polaroid__marco {
  aspect-ratio: 1 / 1.02;
  background: linear-gradient(160deg, var(--noche-2), var(--noche));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.polaroid__marco img { width: 100%; height: 100%; object-fit: cover; }

.polaroid--vacia .polaroid__marco {
  flex-direction: column;
  gap: 10px;
  color: var(--girasol);
  text-align: center;
  padding: 12px;
}

.polaroid--vacia .polaroid__marco span {
  font-family: var(--cuerpo);
  font-size: 0.72rem;
  line-height: 1.4;
  opacity: 0.8;
}

.polaroid figcaption {
  font-family: var(--display);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--noche);
  text-align: center;
  margin-top: 8px;
}

/* =========================================================================
   CONTADOR
   ========================================================================= */
.contador { text-align: center; padding: 8vh 8vw; }

.contador__numero {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(3rem, 10vw, 6rem);
  color: var(--girasol);
  margin: 0;
  text-shadow: 0 0 40px rgba(255, 201, 60, 0.4);
}

.contador__etiqueta {
  margin: 0.3em 0 0;
  opacity: 0.75;
  font-size: 0.95rem;
}

/* =========================================================================
   CIERRE
   ========================================================================= */
.final {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.final__petalos {
  position: absolute;
  inset: 0;
  left: auto;
  width: 55%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.petalo {
  position: absolute;
  top: -8%;
  width: 9px;
  height: 13px;
  background: linear-gradient(160deg, var(--girasol), var(--ambar));
  border-radius: 50% 0 50% 50%;
  opacity: 0;
  animation-name: caida;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes caida {
  0% { opacity: 0; transform: translateY(-10vh) rotate(0deg); }
  8% { opacity: 0.9; }
  92% { opacity: 0.7; }
  100% { opacity: 0; transform: translateY(115vh) translateX(var(--deriva)) rotate(var(--giro)); }
}

.final__ceja {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-style: italic;
  color: var(--girasol);
  font-size: 1.05rem;
  margin: 0 0 0.6em;
}

.final__mensaje {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.18;
  max-width: 15ch;
  margin: 0;
}

.final__firma {
  position: relative;
  z-index: 1;
  margin: 1em 0 2em;
  font-size: 1.1rem;
  opacity: 0.85;
}

.final__repetir {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  padding: 12px 26px;
  border: 1px solid rgba(255, 201, 60, 0.5);
  border-radius: 999px;
  font-size: 0.9rem;
  color: var(--girasol);
  transition: background 300ms ease, color 300ms ease;
}

.final__repetir:hover { background: var(--girasol); color: var(--noche); }

/* =========================================================================
   REPRODUCTOR FLOTANTE
   ========================================================================= */
.reproductor {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px 8px 8px;
  background: rgba(14, 31, 36, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 201, 60, 0.22);
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.reproductor__play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--girasol);
  color: var(--noche);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 200ms ease;
}

.reproductor__play:hover { transform: scale(1.08); }

.reproductor.sin-cancion .reproductor__play { opacity: 0.55; }

.reproductor__titulo {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bruma);
}

.reproductor__onda {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
}

.reproductor__onda span {
  width: 3px;
  height: 30%;
  background: var(--girasol);
  border-radius: 2px;
  transition: height 200ms ease;
}

.reproductor.sonando .reproductor__onda span {
  animation: onda 900ms ease-in-out infinite;
}

.reproductor.sonando .reproductor__onda span:nth-child(1) { animation-delay: 0ms; }
.reproductor.sonando .reproductor__onda span:nth-child(2) { animation-delay: 120ms; }
.reproductor.sonando .reproductor__onda span:nth-child(3) { animation-delay: 240ms; }
.reproductor.sonando .reproductor__onda span:nth-child(4) { animation-delay: 360ms; }
.reproductor.sonando .reproductor__onda span:nth-child(5) { animation-delay: 480ms; }

@keyframes onda {
  0%, 100% { height: 25%; }
  50% { height: 100%; }
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 780px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 12vh;
    text-align: left;
    gap: 6vh;
  }
  .hero__flor { order: -1; width: 68vw; max-height: 40vh; margin: 0 auto; }
  .hero__scroll { left: 8vw; bottom: 3vh; }
  section { padding: 8vh 6vw; }
  .final { padding: 8vh 6vw; }
  .final__repetir { align-self: flex-start; }

  /* La burbuja de mensaje se ancla a la pantalla, no a cada flor, para
     que nunca se salga por un borde sin importar dónde toques. */
  .flor-slot__nota {
    position: fixed;
    left: 50%;
    bottom: 92px;
    transform: translate(-50%, 10px);
    max-width: min(84vw, 320px);
    z-index: 60;
  }
  .flor-slot.nota-visible .flor-slot__nota {
    transform: translate(-50%, 0);
  }

  /* Menos rotación en las polaroid para que no se recorten en pantallas angostas */
  .polaroid { --rot-escala: 0.45; --despl-escala: 0.6; }

  .reproductor { right: 16px; bottom: 16px; }
  .reproductor__play { width: 44px; height: 44px; }
}

/* =========================================================================
   ACCESIBILIDAD
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flor__petalos,
  .hero__scroll,
  .petalo,
  .reproductor.sonando .reproductor__onda span,
  .jardin__sendero path {
    animation: none !important;
  }
}
