/* ═══════════════════════════════════════════
   ilovi — Love Letter Card Styles
   Letters from the Heart 💌
   ═══════════════════════════════════════════ */

/* --- Smooth Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #1a0a10; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #fb7185, #e11d48);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #f43f5e, #be123c);
}

/* --- Selection --- */
::selection {
  background: rgba(244, 63, 94, 0.4);
  color: #fff;
}

/* ═══════════════════════════════════════════
   THEME SYSTEM
   ═══════════════════════════════════════════ */
:root {
  --bg-from: #4c0519;
  --bg-via: #1a0a10;
  --bg-to: #0a0a0a;
  --accent: #fb7185;
  --accent-dark: #e11d48;
  --glow: rgba(244, 63, 94, 0.5);
  --card-bg: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.12);
  --text-primary: #fff1f2;
  --text-muted: rgba(255,241,242,0.6);
}

body[data-theme="pink"] {
  --bg-from: #831843;
  --bg-via: #9f1239;
  --bg-to: #4c0519;
}
body[data-theme="dark"] {
  --bg-from: #0f172a;
  --bg-via: #1e0a1a;
  --bg-to: #000;
}
body[data-theme="vintage"] {
  --bg-from: #78350f;
  --bg-via: #451a03;
  --bg-to: #1c0a00;
  --accent: #d4a574;
  --accent-dark: #a07d5e;
}
body[data-theme="night"] {
  --bg-from: #020617;
  --bg-via: #1e1b4b;
  --bg-to: #0c0a2a;
  --accent: #818cf8;
  --accent-dark: #6366f1;
}
body[data-theme="rose-gold"] {
  --bg-from: #3b1520;
  --bg-via: #2a1015;
  --bg-to: #1a0a0d;
  --accent: #e8b4b8;
  --accent-dark: #b76e79;
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(180deg, var(--bg-from) 0%, var(--bg-via) 40%, var(--bg-to) 100%);
  background-size: 200% 200%;
  animation: bgShift 20s ease infinite;
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
}

@keyframes bgShift {
  0%, 100% { background-position: 50% 0%; }
  50% { background-position: 50% 100%; }
}

/* ═══════════════════════════════════════════
   CINEMATIC INTRO
   ═══════════════════════════════════════════ */
#cinematic-intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a0510 0%, #000 100%);
  transition: opacity 1s ease, visibility 1s ease;
}
#cinematic-intro.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.intro-heart {
  animation: introHeartbeat 1.3s ease-in-out infinite;
  filter: drop-shadow(0 0 40px rgba(244, 63, 94, 0.7));
}
@keyframes introHeartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.2); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}
.intro-quote {
  opacity: 0;
  transform: translateY(20px);
  animation: introQuoteFade 1.5s ease 0.8s forwards;
}
@keyframes introQuoteFade {
  to { opacity: 1; transform: translateY(0); }
}
.intro-tap-hint {
  opacity: 0;
  animation: introHintFade 1s ease 2.5s forwards;
}
@keyframes introHintFade {
  to { opacity: 0.6; }
}

/* ═══════════════════════════════════════════
   ENVELOPE
   ═══════════════════════════════════════════ */
.envelope-wrapper {
  perspective: 1200px;
  cursor: pointer;
}
.envelope-body {
  position: relative;
  width: 320px;
  height: 220px;
  margin: 0 auto;
  transition: transform 0.5s ease;
}
.envelope-body:hover {
  transform: scale(1.03);
}
.envelope-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #be123c, #9f1239);
  border-radius: 12px;
  box-shadow:
    0 20px 60px rgba(190, 18, 60, 0.4),
    0 0 80px rgba(244, 63, 94, 0.15),
    inset 0 -3px 6px rgba(0,0,0,0.2);
}
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #e11d48, #be123c);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  transform-origin: top center;
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 3;
  border-radius: 12px 12px 0 0;
}
.envelope-flap.opened {
  transform: rotateX(180deg);
}
.envelope-front {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 55%;
  background: linear-gradient(0deg, #f43f5e, #e11d48);
  border-radius: 0 0 12px 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.envelope-heart-seal {
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, #fda4af, #fb7185);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(251,113,133,0.5);
  transition: transform 0.6s ease, opacity 0.6s ease;
}
.envelope-heart-seal.broken {
  transform: scale(0) rotate(180deg);
  opacity: 0;
}

/* Letter emerging from envelope */
.letter-emerge {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  width: 85%;
  z-index: 2;
  opacity: 0;
  transition: none; /* GSAP handles this */
}

/* ═══════════════════════════════════════════
   LETTER CARD (Glassmorphism)
   ═══════════════════════════════════════════ */
.letter-card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.4),
    0 0 60px rgba(244, 63, 94, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.1);
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
}
.letter-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(251,113,133,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.letter-card .letter-heading {
  font-family: 'Great Vibes', cursive;
  font-size: 3rem;
  background: linear-gradient(135deg, #fda4af, #fb7185, #f43f5e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem;
  text-shadow: none;
}
.letter-card .letter-body-text {
  font-family: 'Dancing Script', cursive;
  font-size: 1.25rem;
  line-height: 2;
  color: rgba(255,241,242,0.85);
  min-height: 200px;
}
.letter-card .letter-signature {
  font-family: 'Parisienne', cursive;
  font-size: 2rem;
  color: #fb7185;
  margin-top: 2rem;
  text-align: right;
}
.letter-card .typed-cursor {
  color: #fb7185;
  font-weight: 100;
}

/* ═══════════════════════════════════════════
   PHOTO GALLERY (Polaroids)
   ═══════════════════════════════════════════ */
.polaroid {
  background: #fff;
  padding: 10px;
  padding-bottom: 50px;
  box-shadow:
    0 10px 30px rgba(0,0,0,0.3),
    0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.polaroid:hover {
  transform: rotate(0deg) scale(1.08) !important;
  z-index: 10;
}
.polaroid img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}
.polaroid-caption {
  font-family: 'Dancing Script', cursive;
  font-size: 1.1rem;
  color: #4a3728;
  text-align: center;
  margin-top: 8px;
}

/* Gallery Modal */
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
  cursor: zoom-out;
}
.gallery-modal.active {
  opacity: 1;
  visibility: visible;
}
.gallery-modal img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform: scale(0.8);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.gallery-modal.active img {
  transform: scale(1);
}

/* ═══════════════════════════════════════════
   MUSIC PLAYER
   ═══════════════════════════════════════════ */
.music-player-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 7000;
  display: flex;
  align-items: center;
  gap: 12px;
}
.music-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border: 2px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 8px 30px rgba(225, 29, 72, 0.4),
    0 0 40px rgba(244, 63, 94, 0.15);
  transition: all 0.3s ease;
  color: #fff;
}
.music-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 40px rgba(225, 29, 72, 0.6);
}

/* Vinyl disk */
.vinyl-disk {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #1a1a1a, #333, #1a1a1a, #444, #1a1a1a);
  border: 3px solid #333;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}
.vinyl-disk::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--glow);
}
.vinyl-disk.spinning {
  animation: vinylSpin 3s linear infinite;
}
@keyframes vinylSpin {
  to { transform: rotate(360deg); }
}

/* Music Visualizer Bars */
.visualizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
}
.visualizer .bar {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.1s ease;
  opacity: 0.7;
}
.visualizer .bar:nth-child(1) { animation: vizBar 0.8s ease-in-out infinite alternate; }
.visualizer .bar:nth-child(2) { animation: vizBar 0.6s ease-in-out infinite alternate 0.1s; }
.visualizer .bar:nth-child(3) { animation: vizBar 0.9s ease-in-out infinite alternate 0.2s; }
.visualizer .bar:nth-child(4) { animation: vizBar 0.7s ease-in-out infinite alternate 0.15s; }
.visualizer .bar:nth-child(5) { animation: vizBar 0.85s ease-in-out infinite alternate 0.05s; }

@keyframes vizBar {
  0%   { height: 4px; }
  100% { height: 22px; }
}
.visualizer.paused .bar {
  animation-play-state: paused;
  height: 4px;
}

/* ═══════════════════════════════════════════
   COUNTDOWN
   ═══════════════════════════════════════════ */
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 500px;
  margin: 0 auto;
}
.countdown-tile {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 1.5rem 1rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.countdown-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(244, 63, 94, 0.15);
}
.countdown-tile .cd-number {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fda4af, #fb7185);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.countdown-tile .cd-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255,241,242,0.5);
  margin-top: 6px;
}

/* ═══════════════════════════════════════════
   SCRATCH REVEAL
   ═══════════════════════════════════════════ */
.scratch-container {
  position: relative;
  width: 340px;
  height: 200px;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}
.scratch-hidden-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a0510, #2d0a1a);
  border-radius: 20px;
  padding: 1.5rem;
}
.scratch-hidden-message .reveal-text {
  font-family: 'Great Vibes', cursive;
  font-size: 1.8rem;
  color: #fda4af;
  text-align: center;
  line-height: 1.4;
}
.scratch-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 20px;
  cursor: grab;
  touch-action: none;
}

/* ═══════════════════════════════════════════
   SHARE & DOWNLOAD
   ═══════════════════════════════════════════ */
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 9999px;
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}
.action-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(244, 63, 94, 0.2);
}
.action-btn-primary {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border-color: transparent;
  box-shadow: 0 8px 25px rgba(225, 29, 72, 0.35);
}
.action-btn-primary:hover {
  box-shadow: 0 12px 35px rgba(225, 29, 72, 0.5);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

/* ═══════════════════════════════════════════
   THEME SWITCHER PILLS
   ═══════════════════════════════════════════ */
.theme-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 7000;
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 9999px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
}
.theme-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
}
.theme-dot:hover {
  transform: scale(1.2);
}
.theme-dot.active {
  border-color: #fff;
  box-shadow: 0 0 12px var(--glow);
}
.theme-dot[data-set-theme="dark"]      { background: linear-gradient(135deg, #0f172a, #4c0519); }
.theme-dot[data-set-theme="pink"]      { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.theme-dot[data-set-theme="vintage"]   { background: linear-gradient(135deg, #d4a574, #a07d5e); }
.theme-dot[data-set-theme="night"]     { background: linear-gradient(135deg, #6366f1, #312e81); }
.theme-dot[data-set-theme="rose-gold"] { background: linear-gradient(135deg, #e8b4b8, #b76e79); }

/* ═══════════════════════════════════════════
   FLOATING HEARTS LAYER
   ═══════════════════════════════════════════ */
#hearts-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* ═══════════════════════════════════════════
   FALLING PETALS / STARS
   ═══════════════════════════════════════════ */
.petal {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  font-size: 18px;
  opacity: 0;
}

/* ═══════════════════════════════════════════
   CURSOR TRAIL
   ═══════════════════════════════════════════ */
.cursor-sparkle {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--glow);
  opacity: 1;
  transition: none;
}

/* ═══════════════════════════════════════════
   CONFETTI HEARTS
   ═══════════════════════════════════════════ */
.confetti-heart {
  position: fixed;
  pointer-events: none;
  z-index: 8500;
  font-size: 20px;
}

/* ═══════════════════════════════════════════
   SECTION UTILITIES
   ═══════════════════════════════════════════ */
.section-heading-label {
  font-family: 'Parisienne', cursive;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.section-heading-title {
  font-size: 2.2rem;
  font-weight: 300;
  line-height: 1.3;
}
.glow-text {
  text-shadow:
    0 0 20px rgba(244, 63, 94, 0.35),
    0 0 40px rgba(244, 63, 94, 0.15),
    0 0 80px rgba(244, 63, 94, 0.08);
}
.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto;
  padding: 0 1rem;
}
.section-divider span {
  height: 1px;
  width: 60px;
  background: linear-gradient(90deg, transparent, rgba(251,113,133,0.4), transparent);
}

/* Glass card generic */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.25);
}

/* Shimmer on buttons */
.btn-shimmer {
  position: relative;
  overflow: hidden;
}
.btn-shimmer::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 3s infinite;
}
@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Particles */
#particles-js canvas {
  position: absolute;
  width: 100%;
  height: 100%;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .envelope-body {
    width: 260px;
    height: 180px;
  }
  .letter-card {
    padding: 2rem 1.5rem;
  }
  .letter-card .letter-heading {
    font-size: 2.2rem;
  }
  .letter-card .letter-body-text {
    font-size: 1.05rem;
  }
  .countdown-grid {
    gap: 10px;
  }
  .countdown-tile .cd-number {
    font-size: 1.8rem;
  }
  .scratch-container {
    width: 90vw;
    max-width: 340px;
  }
  .music-player-float {
    bottom: 16px;
    right: 16px;
  }
  .theme-switcher {
    top: 12px;
    right: 12px;
  }
  .theme-dot {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  .letter-card .letter-heading {
    font-size: 1.8rem;
  }
  .section-heading-title {
    font-size: 1.7rem;
  }
}

/* ═══════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body { animation: none !important; }
}
