/* ── Warm & light birthday design system ─────────────────────────── */

/* handwriting display face, bundled locally (Vietnamese-capable) */
@font-face {
  font-family: "Wenkai";
  src: url("../fonts/LXGWWenKai-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --peach:   #ffe3cf;
  --lav:     #f0e2ff;
  --cream:   #fff8f1;
  --ink:     #3a2b32;
  --muted:   #8a6f79;
  --accent:  #ff5c9a;
  --accent2: #ffa1c9;
  --card:    rgba(255, 255, 255, 0.55);
  --card-brd:rgba(255, 255, 255, 0.75);
  --shadow:  0 18px 50px rgba(120, 70, 90, 0.18);
  --font:    "Be Vietnam Pro", system-ui, sans-serif;
  --display: "Wenkai", "Be Vietnam Pro", cursive;
  --step:    clamp(2rem, 6vw, 3.4rem);   /* base scene line size */
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(1200px 800px at 15% 10%, #fff6ec 0%, transparent 55%),
    radial-gradient(1100px 900px at 85% 90%, #f6e8ff 0%, transparent 55%),
    linear-gradient(140deg, var(--peach) 0%, var(--cream) 45%, var(--lav) 100%);
  background-attachment: fixed;
}

/* ── Stages: only one visible at a time ──────────────────────────── */
.stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: max(6vh, env(safe-area-inset-top)) 6vw max(6vh, env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity .7s ease, transform .7s ease, visibility .7s;
}
.stage.on {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* ── Glass card (intro / outro) ──────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--card-brd);
  border-radius: 28px;
  padding: clamp(2rem, 5vw, 3.5rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: min(90vw, 560px);
  animation: pop .8s cubic-bezier(.2,.9,.3,1.3) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(10px); } }

.eyebrow {
  margin: 0;
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.title {
  margin: .1em 0 .3em;
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.05;
  font-size: clamp(2.8rem, 11vw, 5.5rem);
  color: var(--accent);
  text-shadow: 0 3px 0 rgba(255,255,255,.6);
}
.lead {
  margin: 0 auto;
  max-width: 34ch;
  font-size: clamp(1rem, 3.4vw, 1.3rem);
  font-weight: 300;
  line-height: 1.6;
  color: var(--ink);
}
.hint { margin: 1.4rem 0 0; font-size: .9rem; color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  margin-top: 1.6rem;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  color: #fff;
  padding: .9em 1.8em;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 10px 24px rgba(255, 92, 154, .35);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 30px rgba(255, 92, 154, .45); }
.btn:active { transform: translateY(0) scale(.99); }
.btn.ghost {
  background: rgba(255,255,255,.65);
  color: var(--accent);
  border: 1.5px solid var(--accent2);
  box-shadow: var(--shadow);
}

/* ── Story lines ─────────────────────────────────────────────────── */
.scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8vh 7vw;
  opacity: 0;
  transform: translateY(18px) scale(.98);
  transition: opacity .8s ease, transform .8s ease;
  pointer-events: none;
}
.scene.show { opacity: 1; transform: none; }
.line {
  margin: 0;
  max-width: 22ch;
  font-size: var(--step);
  font-weight: 600;
  line-height: 1.28;
}
.line.accent { color: var(--accent); font-family: var(--display); }
.line strong {
  display: inline-block;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  padding: .05em .35em;
  border-radius: .3em;
  box-shadow: 0 6px 16px rgba(255,92,154,.35);
}
.smiley { display: inline-block; }
.huge {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  color: var(--accent);
  line-height: .95;
  font-size: clamp(4rem, 22vw, 12rem);
  text-shadow: 0 6px 0 rgba(255,255,255,.5);
}
.huge span { display: inline-block; }

/* chat bubble */
.chat {
  position: relative;
  width: min(90vw, 460px);
  background: #fff;
  border-radius: 20px 20px 20px 6px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.3rem 3.4rem;
  text-align: left;
}
.chat-text { margin: 0; font-size: clamp(1rem, 4vw, 1.4rem); color: var(--ink); min-height: 1.4em; }
.chat-send {
  position: absolute;
  right: .8rem; bottom: .8rem;
  color: #fff;
  background: var(--accent2);
  padding: .5em 1.1em;
  border-radius: 12px;
  font-weight: 700;
  transition: background .3s ease;
}
.chat.sent .chat-send { background: #6bd6a0; }

/* ── Gallery ─────────────────────────────────────────────────────── */
#gallery { justify-content: center; gap: 1rem; }
.wish { max-width: 32ch; }
.wish-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  color: var(--accent);
  font-size: clamp(1.8rem, 7vw, 3rem);
}
.wish-text { margin: .4rem 0 0; font-weight: 300; line-height: 1.55; font-size: clamp(.95rem, 3.3vw, 1.15rem); }

.frame {
  position: relative;
  width: min(86vw, 420px);
  aspect-ratio: 4 / 5;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #fff;
}
.frame-blur {
  position: absolute; inset: -8%;
  background-size: cover;
  background-position: center;
  filter: blur(26px) saturate(1.2) brightness(.9);
  transform: scale(1.15);
  transition: background-image .8s ease;
}
.frame-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .8s ease;
  animation: kenburns 8s ease-out both;
}
.frame-img.show { opacity: 1; }
@keyframes kenburns {
  from { transform: scale(1.09); }
  to   { transform: scale(1.0); }
}
.frame-img { will-change: transform, opacity; }
.frame-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2.6rem .9rem .8rem;
  font-size: clamp(.8rem, 3vw, 1rem);
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.5);
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
  text-align: left;
}

.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: min(86vw, 420px); }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,92,154,.28);
  border: none; padding: 0; cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}
.dot.active { background: var(--accent); transform: scale(1.5); }

.smiley-xl { font-size: clamp(3rem, 14vw, 6rem); margin: .4rem 0; }

/* ── Music toggle ────────────────────────────────────────────────── */
.music {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 50;
  width: 46px; height: 46px;
  border: none; border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
  background: rgba(255,255,255,.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  transition: transform .3s ease;
}
.music.playing { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Fireworks canvas ────────────────────────────────────────────── */
#fx {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* ── Drifting hearts (decorative, behind content) ────────────────── */
.drift { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.drift span {
  position: absolute;
  bottom: -10vh;
  font-size: 1.4rem;
  opacity: .5;
  animation: rise linear infinite;
}
@keyframes rise {
  to { transform: translateY(-120vh) rotate(40deg); opacity: 0; }
}

/* respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .frame-img, .music.playing, .drift span { animation: none !important; }
  .stage, .scene { transition-duration: .2s; }
}
