/* ═══════════════════════════════════════════════════════════
   style.css  —  Carta romántica para Isa ❤️
   Paleta:
     --cream-light  #FDF6EF  (fondo suave)
     --cream-mid    #F5E8D8  (papel carta)
     --rose-soft    #E8A8A8  (acento rosa apagado)
     --rose-deep    #C0616C  (acento profundo)
     --ink          #3A2E2E  (texto)
     --ink-light    #7A6A6A  (texto secundario)
     --gold         #C8A96A  (decorativo)
   Tipografía:
     Display  → Cormorant Garamond (serif elegante, temperamental)
     Body     → Lato 300 (limpio, sin peso propio)
═══════════════════════════════════════════════════════════ */

/* ── RESET & BASE ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream-light: #FDF6EF;
  --cream-mid:   #F5E8D8;
  --cream-dark:  #EDD9C0;
  --rose-soft:   #E8A8A8;
  --rose-deep:   #C0616C;
  --ink:         #3A2E2E;
  --ink-light:   #7A6A6A;
  --gold:        #C8A96A;
  --white:       #FFFAF5;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Lato', system-ui, sans-serif;

  --transition-base: 0.35s ease;
  --transition-slow: 0.8s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--cream-light);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCREENS ── */
.screen {
  display: none;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fade-in para la carta */
#letter-screen.active {
  animation: fadeIn 1.2s ease forwards;
  flex-direction: column;
  background-color: var(--cream-light);
}

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


/* ════════════════════════════════════════════
   PANTALLA DE LOGIN
════════════════════════════════════════════ */
#login-screen {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(232,168,168,0.18) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(200,169,106,0.12) 0%, transparent 55%),
    var(--cream-light);
  padding: 24px;
}

/* Pétalos decorativos de fondo */
.bg-petal {
  position: fixed;
  font-size: 2.5rem;
  opacity: 0.08;
  color: var(--rose-deep);
  user-select: none;
  pointer-events: none;
  animation: petalsway 8s ease-in-out infinite alternate;
}

@keyframes petalsway {
  from { transform: rotate(-8deg) scale(1); }
  to   { transform: rotate(8deg)  scale(1.1); }
}

/* Tarjeta de login */
.login-card {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: 20px;
  padding: 52px 44px 44px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 4px 24px rgba(192,97,108,0.08),
    0 1px 4px rgba(0,0,0,0.04);
  position: relative;
  z-index: 1;

  animation: cardAppear 0.9s cubic-bezier(.22,.68,0,1.2) forwards;
}

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

.lock-icon {
  font-size: 3.2rem;
  margin-bottom: 16px;
  display: block;
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.login-question {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.4;
}

.login-hint {
  font-size: 0.82rem;
  color: var(--ink-light);
  margin-bottom: 28px;
  letter-spacing: 0.03em;
}

/* Input */
.input-wrapper {
  position: relative;
  margin-bottom: 18px;
}

.input-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  width: 0; height: 2px;
  background: var(--rose-deep);
  transition: width var(--transition-base), left var(--transition-base);
}

.input-wrapper:focus-within::after {
  width: 100%;
  left: 0;
}

#password-input {
  width: 100%;
  padding: 14px 18px;
  border: 1.5px solid var(--cream-dark);
  border-radius: 10px;
  background: var(--cream-light);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--ink);
  text-align: center;
  letter-spacing: 0.05em;
  outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

#password-input::placeholder {
  color: var(--ink-light);
  font-style: italic;
  font-size: 0.95rem;
}

#password-input:focus {
  border-color: var(--rose-soft);
  box-shadow: 0 0 0 3px rgba(232,168,168,0.2);
}

/* Botón primario */
.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--rose-deep), #A84F5A);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition:
    transform var(--transition-base),
    box-shadow var(--transition-base),
    opacity var(--transition-base);
  box-shadow: 0 4px 16px rgba(192,97,108,0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(192,97,108,0.42);
}

.btn-primary:active {
  transform: translateY(0);
  opacity: 0.88;
}

/* Mensaje de error */
.error-msg {
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--rose-deep);
  font-style: italic;
  letter-spacing: 0.02em;
  animation: errorShake 0.45s ease;
}

.error-msg.hidden {
  display: none;
}

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


/* ════════════════════════════════════════════
   CORAZONES FLOTANTES
════════════════════════════════════════════ */
#hearts-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.heart {
  position: absolute;
  bottom: -40px;
  font-size: 1rem;
  opacity: 0;
  user-select: none;
  animation: riseHeart linear infinite;
}

@keyframes riseHeart {
  0%   { transform: translateY(0)   rotate(0deg);   opacity: 0; }
  10%  { opacity: 0.55; }
  85%  { opacity: 0.35; }
  100% { transform: translateY(-110vh) rotate(25deg); opacity: 0; }
}


/* ════════════════════════════════════════════
   BOTÓN DE MÚSICA
════════════════════════════════════════════ */
.music-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: rgba(253,246,239,0.88);
  border: 1px solid var(--cream-dark);
  border-radius: 30px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--ink-light);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background var(--transition-base), box-shadow var(--transition-base);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.music-btn:hover {
  background: var(--white);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

#music-icon {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.music-btn.playing #music-icon {
  animation: spin 3s linear infinite;
}

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


/* ════════════════════════════════════════════
   LA CARTA
════════════════════════════════════════════ */
.letter-wrapper {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 60px 24px 80px;
  position: relative;
  z-index: 1;
}

/* Papel con textura sutil */
.letter-paper {
  background: var(--cream-mid);
  background-image:
    repeating-linear-gradient(
      transparent,
      transparent 27px,
      rgba(200,169,106,0.08) 27px,
      rgba(200,169,106,0.08) 28px
    );
  border: 1px solid var(--cream-dark);
  border-radius: 4px;
  padding: 56px 52px 52px;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.06),
    0 12px 40px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.6);
  position: relative;
}

/* Línea roja del margen izquierdo (detalle de carta) */
.letter-paper::before {
  content: '';
  position: absolute;
  top: 0; left: 64px;
  width: 1px;
  height: 100%;
  background: rgba(192,97,108,0.18);
  border-radius: 1px;
}

/* Sello superior */
.letter-seal {
  text-align: center;
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 24px;
  opacity: 0.7;
  letter-spacing: 0.1em;
}

/* Encabezado */
.letter-header {
  text-align: center;
  margin-bottom: 36px;
}

.letter-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 300;
  font-style: italic;
  color: var(--rose-deep);
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin-bottom: 20px;
}

/* Divisor decorativo */
.letter-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.letter-divider::before,
.letter-divider::after {
  content: '';
  flex: 1;
  max-width: 80px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold));
}

.letter-divider::after {
  background: linear-gradient(to left, transparent, var(--gold));
}

.letter-divider:not(.letter-divider--bottom)::before {
  background: linear-gradient(to right, transparent, var(--gold));
}

/* Secciones del cuerpo */
.letter-section {
  margin-bottom: 32px;
  animation: sectionReveal 0.8s ease both;
}

.letter-section:nth-child(2)  { animation-delay: 0.15s; }
.letter-section:nth-child(3)  { animation-delay: 0.30s; }
.letter-section:nth-child(4)  { animation-delay: 0.45s; }
.letter-section:nth-child(5)  { animation-delay: 0.60s; }
.letter-section:nth-child(6)  { animation-delay: 0.75s; }

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

.letter-section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.letter-body {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.9;
  margin-bottom: 14px;
}

.letter-body.italic {
  font-style: italic;
  color: var(--ink-light);
}

/* Cierre */
.letter-closing {
  text-align: right;
  margin-top: 8px;
}

.letter-signature {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-style: italic;
  font-weight: 300;
  color: var(--rose-deep);
  margin-top: 4px;
}

/* Divisor inferior */
.letter-divider--bottom {
  margin: 36px 0 32px;
}

/* Botón CTA */
.letter-cta-wrapper {
  text-align: center;
}

.btn-cta {
  display: inline-block;
  padding: 17px 36px;
  background: transparent;
  border: 1.5px solid var(--rose-deep);
  border-radius: 50px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 400;
  color: var(--rose-deep);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition:
    background    var(--transition-base),
    color         var(--transition-base),
    box-shadow    var(--transition-base),
    transform     var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--rose-deep);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
  z-index: -1;
}

.btn-cta:hover {
  color: var(--white);
  box-shadow: 0 6px 22px rgba(192,97,108,0.35);
  transform: translateY(-2px);
}

.btn-cta:hover::before {
  transform: scaleX(1);
}

.btn-cta:active {
  transform: translateY(0);
}


/* ════════════════════════════════════════════
   MODAL
════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58,46,46,0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 500;
  animation: overlayIn 0.4s ease forwards;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: 18px;
  padding: 48px 44px 44px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  animation: modalIn 0.5s cubic-bezier(.22,.68,0,1.15) forwards;
}

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

.modal-close {
  position: absolute;
  top: 16px; right: 18px;
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--ink-light);
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition-base);
  padding: 4px 8px;
}

.modal-close:hover {
  opacity: 1;
}

.modal-icon {
  font-size: 2.4rem;
  margin-bottom: 14px;
  animation: float 4s ease-in-out infinite;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  font-style: italic;
  color: var(--rose-deep);
  margin-bottom: 22px;
}

.modal-body {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.85;
  text-align: left;
}

.modal-body p {
  margin-bottom: 14px;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

/* Botón modal */
.btn-primary--modal {
  width: auto;
  margin-top: 28px;
  padding: 13px 32px;
  font-size: 1rem;
}


/* ════════════════════════════════════════════
   RESPONSIVE — MOBILE
════════════════════════════════════════════ */
@media (max-width: 600px) {
  .login-card {
    padding: 40px 26px 36px;
    border-radius: 16px;
  }

  .login-question {
    font-size: 1.25rem;
  }

  .letter-paper {
    padding: 36px 24px 36px;
  }

  .letter-paper::before {
    left: 36px;
  }

  .letter-title {
    font-size: 1.85rem;
  }

  .letter-body {
    font-size: 1rem;
  }

  .btn-cta {
    padding: 15px 28px;
    font-size: 1rem;
  }

  .modal-card {
    padding: 36px 24px 32px;
  }

  .modal-body {
    font-size: 0.98rem;
  }

  .music-btn {
    top: 14px;
    right: 14px;
    padding: 8px 12px;
    font-size: 0.72rem;
  }
}

/* ── Preferencia de movimiento reducido ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
