/* ============ Joy's Birthday Website ============ */
:root {
  --bg: #1a0b14;
  --bg2: #2b1020;
  --wine: #8e2a4e;
  --pink: #ff8fb1;
  --gold: #f2c879;
  --cream: #fff4ec;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Quicksand', sans-serif;
  background: radial-gradient(ellipse at top, var(--bg2), var(--bg) 70%);
  color: var(--cream);
  overflow-x: hidden;
  min-height: 100vh;
}

.script { font-family: 'Great Vibes', cursive; font-weight: 400; }
.gold { color: var(--gold); }
.mr { margin-right: 8px; }

/* ---------- music fab ---------- */
.music-fab {
  position: fixed; right: 16px; bottom: 16px;
  z-index: 80;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(242,200,121,.45);
  background: rgba(43,16,32,.85);
  backdrop-filter: blur(6px);
  color: var(--gold); font-size: 19px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  transition: transform .2s;
  display: none;
}
.music-fab.show { display: block; }
.music-fab:active { transform: scale(.92); }
.music-fab.playing { animation: spinPulse 3s linear infinite; }
@keyframes spinPulse {
  0% { box-shadow: 0 0 0 0 rgba(242,200,121,.4); }
  70% { box-shadow: 0 0 0 14px rgba(242,200,121,0); }
  100% { box-shadow: 0 0 0 0 rgba(242,200,121,0); }
}
.music-fab.muted { color: rgba(255,244,236,.45); }
.music-fab.muted::after {
  content: '';
  position: absolute; left: 10px; right: 10px; top: 50%;
  height: 2px; background: var(--pink);
  transform: rotate(-40deg);
}

/* ---------- floating hearts ---------- */
#hearts-bg {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  overflow: hidden;
}
.f-heart {
  position: absolute;
  bottom: -40px;
  color: var(--pink);
  opacity: 0;
  animation: floatUp linear forwards;
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 0; }
  10%  { opacity: .5; }
  90%  { opacity: .3; }
  100% { transform: translateY(-110vh) rotate(40deg) scale(1.3); opacity: 0; }
}

/* ---------- intro screen ---------- */
#intro-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, var(--bg2), var(--bg) 75%);
  z-index: 50;
  transition: opacity 1s ease, visibility 1s;
  text-align: center;
  padding: 24px;
}
#intro-screen.fade-out { opacity: 0; visibility: hidden; }

.intro-heart {
  font-size: 56px; color: var(--pink);
  animation: pulse 1.4s ease-in-out infinite;
  margin-bottom: 24px;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); text-shadow: 0 0 30px rgba(255,143,177,.6); }
}
.intro-eyebrow { letter-spacing: 2px; font-size: 13px; text-transform: uppercase; opacity: .7; margin-bottom: 14px; }
.intro-title { font-family: 'Playfair Display', serif; font-size: clamp(34px, 7vw, 56px); margin-bottom: 12px; }
.intro-sub { opacity: .85; margin-bottom: 32px; font-size: 17px; }
.intro-btns { display: flex; gap: 16px; justify-content: center; align-items: center; flex-wrap: wrap; }
.btn-ghost {
  font-family: 'Quicksand', sans-serif;
  font-size: 16px; font-weight: 600;
  color: var(--cream);
  background: transparent;
  border: 1.5px solid rgba(255,244,236,.35);
  border-radius: 999px;
  padding: 14px 30px;
  cursor: pointer;
  position: relative;
  transition: left .25s ease, top .25s ease;
}
.no-tease { margin-top: 22px; min-height: 24px; color: var(--pink); font-size: 15px; font-weight: 600; }
.intro-tip { margin-top: 30px; font-size: 13px; opacity: .55; }

/* ---------- buttons ---------- */
.btn-main {
  font-family: 'Quicksand', sans-serif;
  font-size: 17px; font-weight: 600;
  color: #3b0f22;
  background: linear-gradient(135deg, var(--gold), #ffdfa6);
  border: none; border-radius: 999px;
  padding: 15px 34px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(242, 200, 121, .35);
  transition: transform .2s, box-shadow .2s;
}
.btn-main:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 10px 32px rgba(242,200,121,.5); }
.btn-main:active { transform: scale(.97); }

.btn-small {
  font-family: 'Quicksand', sans-serif;
  font-size: 15px; font-weight: 600;
  color: var(--cream);
  background: var(--wine);
  border: none; border-radius: 999px;
  padding: 10px 26px;
  cursor: pointer;
  margin-top: 20px;
}

/* ---------- countdown ---------- */
.countdown-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; max-width: 460px; width: 100%;
  margin-top: 10px;
}
.count-box {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(242,200,121,.3);
  border-radius: 16px;
  padding: 18px 6px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.count-box span {
  font-family: 'Playfair Display', serif;
  font-size: clamp(26px, 7vw, 42px);
  font-weight: 600; color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.count-box label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; opacity: .65; }
.countdown-msg { margin-top: 26px; font-size: 17px; opacity: .9; max-width: 420px; line-height: 1.7; }
.countdown-grid.birthday-now { display: none; }

/* ---------- surprise lock ---------- */
body.locked .locked-content,
body.locked .locked-extra { display: none; }

.lock-notice {
  margin-top: 40px;
  max-width: 440px;
  background: rgba(255,255,255,.05);
  border: 1px dashed rgba(242,200,121,.45);
  border-radius: 22px;
  padding: 34px 28px;
}
.lock-icon {
  width: 58px; height: 58px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--wine), #5e1c36);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-size: 22px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: lockWiggle 3.2s ease-in-out infinite;
}
@keyframes lockWiggle {
  0%, 88%, 100% { transform: rotate(0); }
  90% { transform: rotate(-8deg); }
  93% { transform: rotate(8deg); }
  96% { transform: rotate(-5deg); }
}
.lock-title { font-size: 32px; color: var(--pink); margin-bottom: 12px; }
.lock-text { font-size: 15.5px; line-height: 1.8; opacity: .92; }
.lock-text strong { color: var(--gold); }
.lock-sub { margin-top: 16px; font-size: 13px; opacity: .55; }

/* unlock moment */
@keyframes unlockGlow {
  0% { opacity: 0; transform: translateY(30px) scale(.97); }
  100% { opacity: 1; transform: none; }
}
.unlocking .locked-content,
.unlocking .locked-extra { animation: unlockGlow 1.2s ease both; }

/* ---------- journey / panels ---------- */
.hidden-journey { display: none; }

.panel {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px 24px;
  text-align: center;
}

.eyebrow { letter-spacing: 3px; font-size: 12px; text-transform: uppercase; color: var(--gold); margin-bottom: 18px; }
.hero-title { font-family: 'Playfair Display', serif; font-size: clamp(42px, 9vw, 84px); line-height: 1.1; margin-bottom: 18px; }
.hero-title .script { font-size: clamp(64px, 13vw, 130px); }
.hero-sub { font-size: 18px; opacity: .9; max-width: 480px; }

.scroll-hint { margin-top: 60px; opacity: .65; font-size: 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.bounce { animation: bounce 1.6s infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0);} 50% { transform: translateY(8px);} }

.section-title { font-size: clamp(36px, 6vw, 54px); color: var(--pink); margin-bottom: 14px; }
.small-hint { opacity: .6; font-size: 14px; margin-bottom: 36px; }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity .9s ease, transform .9s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- polaroid ---------- */
.polaroid {
  background: #fffdf8;
  padding: 16px 16px 60px;
  border-radius: 4px;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
  max-width: 320px;
  position: relative;
}
.tilt-left { transform: translateY(40px) rotate(-3deg); }
.tilt-left.visible { transform: translateY(0) rotate(-3deg); }
.polaroid img { width: 100%; display: block; border-radius: 2px; }
.polaroid-caption {
  position: absolute; bottom: 12px; left: 0; right: 0;
  color: #6b2340; font-size: 26px;
}
.photo-note { margin-top: 36px; font-size: 18px; line-height: 1.7; opacity: .92; max-width: 460px; }
.photo-note em { color: var(--gold); }
.big-script { font-size: 40px; }

/* ---------- gallery wall ---------- */
.gallery-wall {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px 18px;
  max-width: 560px; width: 100%;
  margin-top: 10px;
}
.g-card {
  background: #fffdf8;
  padding: 10px 10px 40px;
  border-radius: 4px;
  box-shadow: 0 14px 34px rgba(0,0,0,.45);
  cursor: pointer;
  transition: transform .25s, box-shadow .25s;
  position: relative;
}
.g-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; border-radius: 2px; }
.g-card figcaption {
  position: absolute; bottom: 8px; left: 0; right: 0;
  text-align: center; color: #6b2340; font-size: 19px;
}
.r-left  { transform: translateY(40px) rotate(-2.5deg); }
.r-right { transform: translateY(40px) rotate(2deg); }
.r-left2 { transform: translateY(40px) rotate(-1.5deg); }
.r-right2{ transform: translateY(40px) rotate(3deg); }
.r-left.visible  { transform: rotate(-2.5deg); }
.r-right.visible { transform: rotate(2deg); }
.r-left2.visible { transform: rotate(-1.5deg); }
.r-right2.visible{ transform: rotate(3deg); }
.g-card:hover { transform: rotate(0deg) scale(1.04) !important; box-shadow: 0 20px 46px rgba(0,0,0,.55); z-index: 2; }

#lightbox { cursor: zoom-out; }
#lightbox img {
  max-width: 92vw; max-height: 86vh;
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0,0,0,.7);
  border: 4px solid #fffdf8;
}

/* ---------- ornate frame ---------- */
.ornate-frame {
  padding: 14px;
  background: linear-gradient(135deg, var(--gold), #b98a3e, var(--gold));
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 0 60px rgba(242,200,121,.18);
  max-width: 320px;
}
.ornate-frame img { width: 100%; display: block; border-radius: 8px; }

/* ---------- note cards ---------- */
.notes-stack { display: flex; flex-direction: column; gap: 22px; max-width: 520px; width: 100%; }
.note-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,143,177,.25);
  backdrop-filter: blur(6px);
  border-radius: 18px;
  padding: 26px 28px;
  font-size: 16.5px; line-height: 1.7;
  text-align: left;
  display: flex; gap: 18px; align-items: flex-start;
}
.note-icon { color: var(--gold); font-size: 22px; margin-top: 4px; flex-shrink: 0; }

/* ---------- reasons grid ---------- */
.reasons-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 18px; max-width: 420px; width: 100%;
}
.reason-card {
  aspect-ratio: 1;
  border: none; border-radius: 20px;
  background: linear-gradient(145deg, var(--wine), #5e1c36);
  color: var(--pink); font-size: 30px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,0,0,.4);
  transition: transform .2s, box-shadow .2s;
  display: flex; align-items: center; justify-content: center;
}
.reason-card:hover { transform: translateY(-4px) scale(1.05); box-shadow: 0 14px 30px rgba(142,42,78,.5); }
.reason-card.opened { background: linear-gradient(145deg, #3c1226, #2b0d1b); color: var(--gold); }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10,4,8,.8);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
}
.modal-overlay.show { display: flex; }
.modal-card {
  background: linear-gradient(160deg, #3a1226, #24091a);
  border: 1px solid rgba(242,200,121,.35);
  border-radius: 24px;
  max-width: 420px; width: 100%;
  padding: 44px 34px;
  text-align: center;
  animation: popIn .35s ease;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
@keyframes popIn { from { transform: scale(.8); opacity: 0;} to { transform: scale(1); opacity: 1;} }
.modal-heart { color: var(--pink); font-size: 34px; margin-bottom: 20px; animation: pulse 1.4s infinite; }
#reason-text { font-size: 18px; line-height: 1.7; }

/* ---------- quiz ---------- */
.quiz-q { font-size: 19px; margin-bottom: 30px; font-weight: 600; max-width: 420px; }
.quiz-options { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 380px; }
.quiz-opt {
  font-family: 'Quicksand', sans-serif;
  font-size: 16px; font-weight: 600;
  color: var(--cream);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,143,177,.3);
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  text-align: left;
  transition: background .2s, transform .15s;
}
.quiz-opt:hover { background: rgba(255,143,177,.15); transform: translateX(4px); }
.quiz-opt.correct { background: linear-gradient(135deg, var(--gold), #ffdfa6); color: #3b0f22; border-color: transparent; }
.quiz-result { margin-top: 28px; font-size: 18px; min-height: 28px; color: var(--gold); font-weight: 600; }

/* ---------- hold the heart ---------- */
.charge-heart {
  border: none; background: none;
  color: var(--pink);
  font-size: 90px;
  cursor: pointer;
  margin: 10px 0 26px;
  transition: transform .1s;
  filter: drop-shadow(0 0 18px rgba(255,143,177,.35));
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}
.charge-heart.charging { animation: heartBeat .45s infinite; color: #ff5c8d; }
@keyframes heartBeat { 0%,100% { transform: scale(1);} 50% { transform: scale(1.15);} }
.charge-bar-wrap {
  width: 100%; max-width: 340px; height: 16px;
  background: rgba(255,255,255,.1);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(242,200,121,.3);
}
.charge-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  border-radius: 999px;
  transition: width .1s linear;
}
.charge-label { margin-top: 14px; font-size: 22px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.charge-msg { margin-top: 12px; font-size: 17px; min-height: 26px; color: var(--pink); font-weight: 600; max-width: 380px; line-height: 1.6; }

/* ---------- cake ---------- */
.cake-wrap { margin-bottom: 34px; }
.cake { position: relative; width: 190px; margin: 0 auto; }
.cake-top, .cake-mid, .cake-base { margin: 0 auto; border-radius: 8px; }
.cake-top  { width: 110px; height: 38px; background: linear-gradient(180deg, #ffb3c9, #e2779b); }
.cake-mid  { width: 150px; height: 42px; background: linear-gradient(180deg, #fff0d9, #eccda0); margin-top: -4px; }
.cake-base { width: 190px; height: 48px; background: linear-gradient(180deg, #a03657, #7c2743); margin-top: -4px; }
.candles { display: flex; justify-content: center; gap: 26px; margin-bottom: 2px; }
.candle { position: relative; width: 9px; height: 34px; background: repeating-linear-gradient(45deg, #fff, #fff 4px, var(--pink) 4px, var(--pink) 8px); border-radius: 3px; display: inline-block; }
.flame {
  position: absolute; top: -16px; left: 50%;
  width: 12px; height: 16px;
  background: radial-gradient(circle at 50% 70%, #ffdf6b, #ff9d3c 70%, transparent);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  transform: translateX(-50%);
  animation: flicker .3s infinite alternate;
  transition: opacity .5s;
}
@keyframes flicker { from { transform: translateX(-50%) scale(1) rotate(-3deg);} to { transform: translateX(-50%) scale(1.15) rotate(3deg);} }
.cake.blown .flame { opacity: 0; }

/* ---------- wish ---------- */
.wish-box { max-width: 480px; font-size: 18px; line-height: 2.1; margin-bottom: 40px; opacity: .95; }
.candle-result { max-height: 0; overflow: hidden; transition: max-height 1s ease; margin-top: 24px; }
.candle-result.show { max-height: 200px; }

/* ---------- envelope & letter ---------- */
.envelope-wrap { cursor: pointer; transition: transform .25s; }
.envelope-wrap:hover { transform: scale(1.05); }
.envelope { position: relative; width: 200px; height: 130px; margin: 0 auto; }
.env-body {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #a03657, var(--wine));
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
.env-flap {
  position: absolute; top: 0; left: 0; right: 0;
  height: 0;
  border-left: 100px solid transparent;
  border-right: 100px solid transparent;
  border-top: 70px solid #c14a6e;
  z-index: 2;
  transform-origin: top;
  transition: transform .6s ease;
  border-radius: 10px 10px 0 0;
}
.envelope-wrap.open .env-flap { transform: rotateX(180deg); }
.env-seal {
  color: var(--gold); font-size: 30px; z-index: 3;
  animation: pulse 1.6s infinite;
}
.env-label { margin-top: 18px; font-size: 16px; opacity: .85; }

.letter-paper {
  display: none;
  background: #fffaf2;
  color: #4a2233;
  max-width: 560px; width: 100%;
  border-radius: 14px;
  padding: 48px 38px;
  text-align: left;
  box-shadow: 0 30px 70px rgba(0,0,0,.55);
  line-height: 1.85;
  font-size: 16.5px;
  animation: letterIn .8s ease;
}
.letter-paper.show { display: block; }
@keyframes letterIn { from { transform: translateY(40px) scale(.95); opacity: 0;} to { transform: none; opacity: 1;} }
.letter-paper p { margin-bottom: 18px; }
.letter-date { text-align: right; font-size: 14px; opacity: .6; }
.letter-greet { font-size: 34px; color: #8e2a4e; }
.letter-sign { font-size: 30px; color: #8e2a4e; margin-top: 10px; }
.letter-paper .btn-main { display: block; margin: 30px auto 0; }

/* ---------- finale ---------- */
#finale { position: relative; z-index: 1; text-align: center; padding: 90px 24px 90px; }
#finale .btn-small { margin-top: 34px; }
.finale-text { font-size: clamp(44px, 9vw, 80px); text-shadow: 0 0 40px rgba(242,200,121,.35); }
.finale-sub { margin-top: 18px; opacity: .6; font-size: 14px; }

/* ---------- confetti ---------- */
#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

/* ---------- mobile ---------- */
@media (max-width: 480px) {
  .panel { padding: 70px 18px; }
  .reasons-grid { gap: 14px; }
  .polaroid, .ornate-frame { max-width: 260px; }
  .letter-paper { padding: 36px 24px; }
  .gallery-wall { gap: 20px 12px; }
  .g-card figcaption { font-size: 16px; }
  .charge-heart { font-size: 74px; }
  .count-box { padding: 14px 4px 10px; border-radius: 12px; }
  .music-fab { width: 46px; height: 46px; font-size: 16px; }
}
