/* Estilos de la carta (proyecto original: joacohbc/flores-amarillas) */

@font-face {
  font-family: "love-font";
  src: url("../assets/fonts/Love.woff2") format("woff2");
  font-display: swap;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100svh;
  min-height: 100dvh;
}

body {
  font-family: "love-font", "Segoe UI", sans-serif;
  font-weight: bolder;
  background-color: #fef9c3;
  overflow-x: hidden;
}

/* ---------- Escena carta ---------- */
#scene-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  width: 100%;
  padding: 1.25rem;
  box-sizing: border-box;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#scene-card.is-pending {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#scene-card.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.bg-frame {
  background-image: url("../assets/images/fondo-rosas.webp");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1.25rem auto;
  border-radius: 1.5rem;
  padding: 1.5rem 1.35rem;
  transition: all 0.3s ease-in-out;
  max-width: 440px;
  width: min(100%, 440px);
  box-sizing: border-box;
}

.card {
  position: relative;
  background-color: #fef08a;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border-radius: 1.5rem;
  margin: 0.75rem;
  padding: 0.5rem 0.75rem 1rem;
  cursor: pointer;
  transition: transform 0.3s ease-in-out, filter 0.3s ease-in-out, scale 0.3s ease-in-out;
  text-align: center;
  width: calc(100% - 1.5rem);
  box-sizing: border-box;
}

.card:focus-visible {
  outline: 3px solid #facc15;
  outline-offset: 4px;
}

.card h1 {
  font-size: clamp(1.4rem, 5vw, 1.875rem);
  margin: 1.25rem 0;
}

.card img {
  max-height: 24rem;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
  pointer-events: none;
  user-select: none;
}

.card-hint {
  font-family: system-ui, sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  color: #854d0e;
  opacity: 0.85;
  margin: 0 0 0.5rem;
  animation: pulse-hint 1.8s ease-in-out infinite;
}

@keyframes pulse-hint {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.flower-icon {
  position: absolute;
  width: 1.75rem;
  animation: spin-flower 5s linear infinite;
}

.flower-icon.top-left {
  top: 1.25rem;
  left: 1.25rem;
}

.flower-icon.top-right {
  top: 1.25rem;
  right: 1.25rem;
}

.flower-icon.bottom-left {
  bottom: 1.25rem;
  left: 1.25rem;
}

.flower-icon.bottom-right {
  bottom: 1.25rem;
  right: 1.25rem;
}

@keyframes spin-flower {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Intro negra ---------- */
#intro {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  background: #000;
  color: #fff;
  text-align: center;
  padding: 1.25rem;
  box-sizing: border-box;
  cursor: pointer;
  transition: opacity 2s ease-in-out;
}

.intro-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.35rem;
}

#intro h2 {
  font-size: clamp(1.35rem, 5.5vw, 2.35rem);
  margin: 0 auto;
  max-width: 22ch;
  line-height: 1.35;
  white-space: pre-line;
  font-family: "love-font", "Segoe UI", sans-serif;
}

.intro-hint {
  margin: 0;
  font-size: clamp(0.7rem, 2.2vw, 0.85rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.38);
  font-family: "Segoe UI", system-ui, sans-serif;
}

#intro.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* ---------- Escena carta secreta (foto) ---------- */
#scene-letter {
  position: fixed;
  inset: 0;
  z-index: 48;
  display: grid;
  place-content: center;
  background: #000;
  color: #fff;
  text-align: center;
  padding: 1.25rem;
  box-sizing: border-box;
  cursor: pointer;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

#scene-letter.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.letter-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  max-width: min(92vw, 420px);
}

.letter-photo {
  display: block;
  width: 100%;
  max-height: min(78vh, 720px);
  max-height: min(78dvh, 720px);
  height: auto;
  object-fit: contain;
  border-radius: 0.35rem;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 768px) {
  #intro,
  #scene-letter {
    padding: 1rem max(1rem, env(safe-area-inset-right))
      max(1.25rem, env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
  }

  #intro h2 {
    font-size: clamp(1.2rem, 6.2vw, 1.85rem);
    max-width: 20ch;
  }

  .letter-content {
    max-width: min(94vw, 380px);
    gap: 0.9rem;
  }

  .letter-photo {
    max-height: min(72dvh, 620px);
  }

  #scene-card {
    min-height: 100svh;
    min-height: 100dvh;
    padding: max(0.75rem, env(safe-area-inset-top))
      max(0.75rem, env(safe-area-inset-right))
      max(0.75rem, env(safe-area-inset-bottom))
      max(0.75rem, env(safe-area-inset-left));
  }

  .bg-frame {
    margin: 0.5rem auto;
    padding: 1rem 0.85rem;
    width: min(100%, 420px);
    border-radius: 1.15rem;
  }

  .card {
    margin: 0.4rem;
    padding: 0.4rem 0.5rem 0.85rem;
    border-radius: 1.15rem;
  }

  .card h1 {
    font-size: clamp(1.35rem, 7vw, 2rem);
  }

  .card img {
    max-width: min(58vw, 220px);
  }
}
