/**
 * ====================================================================
 * TEMPLATE 02: LATE NIGHT CHILL / LOFI LOUNGE - STYLESHEET
 * ====================================================================
 * Midnight Violet, Rain on Glass, Interactive Vinyl Turntable,
 * Spiral Notebook Letter, and Cozy Neon Ambiance.
 */

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-handwriting: 'Caveat', cursive;

  --bg-deep: #0a0a14;
  --bg-card: rgba(18, 18, 32, 0.75);
  --bg-card-hover: rgba(28, 28, 48, 0.85);
  
  --accent-violet: #8b5cf6;
  --accent-violet-light: #c4b5fd;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fef08a;
  --accent-cyan: #38bdf8;
  --accent-rose: #f43f5e;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --border-glass: rgba(255, 255, 255, 0.1);
  --border-neon: rgba(139, 92, 246, 0.4);

  --shadow-neon: 0 0 30px rgba(139, 92, 246, 0.35);
  --shadow-amber: 0 0 35px rgba(245, 158, 11, 0.35);
  --shadow-card: 0 20px 45px rgba(0, 0, 0, 0.55);

  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.65;
}

/* Rain on Window Glass Canvas */
#rain-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.65;
}

/* Ambient Room Glow Orbs */
.ambient-room-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.35;
  transition: opacity 0.8s ease;
}

.glow-lamp {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--accent-amber) 0%, transparent 70%);
  top: -80px;
  right: -50px;
}

.glow-neon {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-violet) 0%, transparent 70%);
  bottom: 5%;
  left: -80px;
}

body.ambient-mode .glow-lamp {
  opacity: 0.15;
}

body.ambient-mode .glow-neon {
  opacity: 0.55;
  filter: blur(120px);
}

.site-wrapper {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ====================================================================
   PASSCODE SCREEN (4-Digit PIN)
   ==================================================================== */
.passcode-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #17153a 0%, #06060c 85%);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s ease, visibility 0.6s;
}

.passcode-overlay.unlocked {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.05);
  pointer-events: none;
}

.passcode-card {
  background: rgba(18, 17, 36, 0.9);
  border: 1px solid var(--border-neon);
  border-radius: 28px;
  padding: 2.25rem 2rem;
  backdrop-filter: blur(25px);
  box-shadow: var(--shadow-neon);
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.passcode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 1rem;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid var(--accent-violet);
  border-radius: 999px;
  color: var(--accent-violet-light);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 1.25rem;
}

.passcode-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.passcode-sub {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.passcode-sub strong {
  color: var(--accent-amber-light);
}

.passcode-dots-wrapper {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.passcode-dot-box {
  width: 46px;
  height: 52px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--accent-amber-light);
  transition: all 0.2s ease;
}

.passcode-dot-box.filled {
  border-color: var(--accent-violet);
  background: rgba(139, 92, 246, 0.2);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.passcode-dots-wrapper.error .passcode-dot-box {
  border-color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.2);
}

.passcode-dots-wrapper.success .passcode-dot-box {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.25);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.passcode-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  max-width: 270px;
  margin: 0 auto;
}

.keypad-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  padding: 0.75rem 0;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.keypad-btn:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: var(--accent-violet);
}

.keypad-btn:active {
  transform: scale(0.95);
}

.passcode-error-msg {
  color: var(--accent-rose);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.85rem;
  min-height: 1.2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.passcode-error-msg.visible {
  opacity: 1;
}

/* ====================================================================
   TOP CONTROLS (DESK LAMP & AUDIO)
   ==================================================================== */
.top-controls-bar {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 100;
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  background: rgba(16, 16, 30, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: var(--transition-smooth);
}

.ctrl-btn:hover {
  border-color: var(--accent-violet);
  transform: translateY(-2px);
}

/* ====================================================================
   HERO & INTERACTIVE VINYL TURNTABLE
   ==================================================================== */
.hero-section {
  padding: 6.5rem 0 3.5rem;
  text-align: center;
  position: relative;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.2rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--border-neon);
  border-radius: 999px;
  color: var(--accent-violet-light);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.3rem, 6.5vw, 4.2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.title-glow {
  background: linear-gradient(135deg, #ffffff 10%, #c4b5fd 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.5));
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 1.15rem;
  max-width: 640px;
  margin: 0 auto 2.5rem;
}

/* 3D Vinyl Turntable Unit */
.turntable-container {
  max-width: 440px;
  margin: 0 auto 2.5rem;
  background: linear-gradient(145deg, #1f1d38 0%, #111024 100%);
  border: 1px solid var(--border-neon);
  border-radius: 28px;
  padding: 1.75rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), var(--shadow-neon);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.turntable-platter {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 0 15px rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

/* Vinyl Grooves & Center Label */
.vinyl-disc {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #1a1a1a 0, #1a1a1a 2px, #0f0f0f 3px, #0f0f0f 5px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05);
  transition: transform 0.3s ease;
}

.spinning .vinyl-disc {
  animation: spinVinyl 3.2s linear infinite;
}

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

.vinyl-center-label {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-violet) 0%, var(--accent-amber) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  text-align: center;
  border: 3px solid #111;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.vinyl-spindle-hole {
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-radius: 50%;
  margin-top: 3px;
}

/* Turntable Tone Arm (Needle) */
.tone-arm-wrapper {
  position: relative;
  width: 120px;
  height: 200px;
  cursor: pointer;
}

.tone-arm-base {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #333;
  border: 2px solid #555;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

.tone-arm-rod {
  position: absolute;
  top: 30px;
  right: 30px;
  width: 6px;
  height: 140px;
  background: linear-gradient(90deg, #d1d5db, #9ca3af);
  border-radius: 3px;
  transform-origin: top center;
  transform: rotate(-35deg);
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.5);
  z-index: 4;
}

.tone-arm-head {
  position: absolute;
  bottom: 0;
  left: -8px;
  width: 22px;
  height: 28px;
  background: var(--accent-amber);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Playing state for tone-arm */
.playing .tone-arm-rod {
  transform: rotate(18deg);
}

.turntable-instruction {
  font-size: 0.85rem;
  color: var(--accent-amber-light);
  font-weight: 600;
  margin-top: 0.75rem;
  animation: pulseBadge 2.5s infinite;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.03); }
}

/* ====================================================================
   LATE NIGHT BROADCAST APOLOGY
   ==================================================================== */
.late-apology-banner {
  max-width: 780px;
  margin: 1rem auto 4.5rem;
  background: rgba(24, 22, 45, 0.8);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 20px;
  padding: 1.5rem 2rem;
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-card);
}

.late-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.late-content h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--accent-amber-light);
  margin-bottom: 0.25rem;
}

.late-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ====================================================================
   SECTION COMMON
   ==================================================================== */
.section {
  padding: 4.5rem 0;
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 3rem;
}

.section-eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-violet-light);
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  color: #ffffff;
}

/* ====================================================================
   SPIRAL BOUND NOTEBOOK LETTER
   ==================================================================== */
.notebook-container {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
}

.spiral-binding {
  display: flex;
  justify-content: space-around;
  margin-bottom: -14px;
  z-index: 10;
  position: relative;
  padding: 0 2rem;
}

.spiral-ring {
  width: 14px;
  height: 28px;
  background: linear-gradient(180deg, #9ca3af 0%, #4b5563 50%, #1f2937 100%);
  border-radius: 7px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.notebook-paper {
  background: #fbfbfa;
  color: #1e1e24;
  border-radius: 20px;
  padding: clamp(2rem, 5vw, 3.25rem);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  position: relative;
  border: 1px solid #e5e5e0;
}

/* Notebook Blue Ruled Lines */
.notebook-paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: repeating-linear-gradient(transparent, transparent 31px, rgba(147, 197, 253, 0.25) 31px, rgba(147, 197, 253, 0.25) 32px);
  pointer-events: none;
  border-radius: inherit;
}

.notebook-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed #d1d5db;
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  color: #6b7280;
}

.notebook-time-tag {
  color: #8b5cf6;
  font-weight: 700;
  font-family: monospace;
}

.notebook-salutation {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 800;
  color: #111827;
  margin-bottom: 1.25rem;
}

.notebook-body {
  font-size: 1.1rem;
  line-height: 1.9;
  color: #1f2937;
}

.notebook-body p {
  margin-bottom: 1.4rem;
}

.notebook-postscript {
  margin-top: 1.75rem;
  padding: 1rem 1.25rem;
  background: #fef3c7;
  border-left: 4px solid var(--accent-amber);
  border-radius: 8px;
  font-weight: 600;
  color: #92400e;
}

.notebook-footer {
  margin-top: 2rem;
  text-align: right;
}

.notebook-signature {
  font-family: var(--font-handwriting);
  font-size: 2.2rem;
  font-weight: 700;
  color: #111827;
}

/* ====================================================================
   COZY CUPCAKE CANDLE BLOWOUT
   ==================================================================== */
.cupcake-stage {
  text-align: center;
  margin: 2.5rem auto;
  max-width: 280px;
  cursor: pointer;
}

.cupcake-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: transform 0.3s ease;
}

.cupcake-wrapper:hover {
  transform: scale(1.04);
}

.cupcake-candle {
  position: relative;
  width: 10px;
  height: 42px;
  background: repeating-linear-gradient(45deg, #f59e0b, #f59e0b 5px, #ffffff 5px, #ffffff 10px);
  border-radius: 3px 3px 0 0;
  z-index: 5;
}

.cupcake-flame {
  position: absolute;
  top: -20px;
  left: calc(50% - 7px);
  width: 14px;
  height: 20px;
  background: radial-gradient(ellipse at bottom, #fef08a 0%, #f59e0b 60%, #ea580c 100%);
  border-radius: 50% 50% 35% 35%;
  box-shadow: 0 0 20px #f59e0b, 0 0 35px #ea580c;
  animation: flameFlicker 1s infinite alternate;
  transform-origin: center bottom;
  transition: opacity 0.5s ease;
}

@keyframes flameFlicker {
  0% { transform: scale(1) rotate(-2deg); }
  100% { transform: scale(1.08) rotate(2deg); }
}

.cupcake-wrapper.blown .cupcake-flame {
  opacity: 0;
}

.cupcake-icing {
  width: 130px;
  height: 60px;
  background: linear-gradient(180deg, #ec4899 0%, #db2777 100%);
  border-radius: 35px 35px 15px 15px;
  margin-top: -5px;
  box-shadow: 0 10px 25px rgba(219, 39, 119, 0.4);
  position: relative;
  z-index: 4;
}

.cupcake-base {
  width: 105px;
  height: 55px;
  background: linear-gradient(180deg, #d97706 0%, #92400e 100%);
  border-radius: 6px 6px 20px 20px;
  margin-top: -4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 3;
}

.btn-blow-cupcake {
  margin-top: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 2rem;
  background: linear-gradient(135deg, var(--accent-violet) 0%, #6d28d9 100%);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-neon);
  transition: var(--transition-smooth);
}

.btn-blow-cupcake:hover {
  transform: translateY(-2px);
}

.cupcake-wish-banner {
  margin-top: 1.5rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-amber-light);
  display: none;
}

.cupcake-wish-banner.active {
  display: block;
}

/* ====================================================================
   CTA & DIRECT RECONNECT
   ==================================================================== */
.cta-box {
  background: rgba(18, 17, 36, 0.85);
  border: 1px solid var(--border-neon);
  border-radius: 28px;
  padding: 3rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-card);
  max-width: 760px;
  margin: 0 auto;
}

.cta-box h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  margin-bottom: 0.8rem;
}

.cta-box p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.reply-buttons-wrapper {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 2rem;
  background: #25d366;
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
}

.btn-ig {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 2rem;
  background: linear-gradient(135deg, #f09433 0%, #dc2743 50%, #bc1888 100%);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  box-shadow: 0 10px 25px rgba(220, 39, 67, 0.4);
}

.site-footer {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border-glass);
  margin-top: 4rem;
}

/* ====================================================================
   MOBILE & TABLET VIEWPORT RESPONSIVENESS
   ==================================================================== */
@media (max-width: 768px) {
  .stage-content, .container, .hero-section {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }
  .hero-heading, .hero-title, .hero-giant-name {
    font-size: clamp(1.8rem, 6vw, 2.8rem) !important;
    line-height: 1.2 !important;
  }
  .hero-desc, .hero-sub {
    font-size: 1rem !important;
    padding: 0 0.5rem !important;
  }
  .letter-paper, .letter-card, .scroll-letter, .letter-parchment, .notebook-card, .boarding-pass, .manifesto-card, .mixtape-card {
    padding: 1.75rem 1.25rem !important;
  }
  .timeline-grid, .memories-grid, .grid-2 {
    grid-template-columns: 1fr !important;
  }
  .cta-row, .btn-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.85rem !important;
  }
  .btn-cta, .btn-wa, .btn-ig {
    width: 100% !important;
    justify-content: center !important;
  }
}

@media (max-width: 480px) {
  .hero-heading, .hero-title, .hero-giant-name {
    font-size: 1.75rem !important;
  }
  .heart-card, .passcode-card, .pin-card {
    padding: 1.75rem 1.25rem !important;
  }
  .cake-tier {
    width: 160px !important;
    height: 65px !important;
    font-size: 1rem !important;
  }
}
