/* ============================================================================
   Birthday template — full stylesheet
   Extracted verbatim from the original single-file birthday page.
   ========================================================================== */

:root {
  --bg-1: #fdeef2;
  --bg-2: #f7d9e1;
  --bg-3: #efc8d2;
  --plum: #4a1f2e;
  --plum-2: #6b2b3f;
  --rose: #a13b58;
  --pink-soft: #f7e3ea;
  --ink: #2a1520;
  --muted: #7a5765;
  --card: #ffffff;
  --border: rgba(74, 31, 46, 0.15);
  --shadow: 0 20px 60px -20px rgba(74, 31, 46, 0.25);
}

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

html, body {
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-1) 100%);
  color: var(--ink);
  font-family: 'Cormorant Garamond', 'Cairo', serif;
  height: 100%;
  overflow-x: hidden;
}
/* Default: button-driven pages are locked to viewport, no scrolling */
body { overflow-y: hidden; }
/* Once the final flow unlocks, allow vertical scroll */
body.scrollable { overflow-y: auto; height: auto; min-height: 100vh; }

body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.5), transparent 30%),
    radial-gradient(circle at 85% 70%, rgba(239,200,210,0.4), transparent 35%);
  pointer-events: none;
  z-index: 0;
}

.petals {
  position: fixed; inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.petal {
  position: absolute;
  top: -30px;
  font-size: 22px;
  opacity: 0.7;
  animation: fall linear infinite;
}
@keyframes fall {
  0%   { transform: translateY(-30px) rotate(0deg); }
  100% { transform: translateY(105vh) rotate(360deg); }
}

main { position: relative; z-index: 2; }

/* ---------- Section shell ---------- */
section.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
}
.container {
  width: 100%;
  max-width: 560px;
  text-align: center;
}

/* ---------- Hero ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.32em;
  font-size: 12px;
  color: var(--plum);
  text-transform: uppercase;
  margin-bottom: 28px;
}
.eyebrow::before, .eyebrow::after {
  content: "";
  width: 32px; height: 1px;
  background: var(--plum);
  opacity: 0.6;
}
h1.title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(44px, 8vw, 68px);
  line-height: 1.05;
  color: var(--plum);
  margin-bottom: 20px;
}
h1.title em {
  font-style: italic;
  background: linear-gradient(135deg, #b0284a, #7a1f38);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 20px;
  color: var(--muted);
  margin-bottom: 40px;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: 'Cairo', 'Playfair Display', sans-serif;
  font-weight: 600;
  padding: 18px 42px;
  border-radius: 999px;
  font-size: 16px;
  letter-spacing: 0.05em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--plum) 0%, var(--plum-2) 100%);
  color: #fff;
  box-shadow: 0 12px 30px -10px rgba(74, 31, 46, 0.5);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -12px rgba(74, 31, 46, 0.6); }
.btn-outline {
  background: transparent;
  color: var(--plum);
  border: 1.5px solid var(--plum);
  padding: 16px 40px;
}
.btn-outline:hover { background: var(--plum); color: #fff; }

/* ---------- Quiz ---------- */
.quiz-head {
  font-family: 'Playfair Display', serif;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
  color: var(--plum);
  margin-bottom: 8px;
}
.quiz-head em { font-style: normal; color: var(--rose); }
.quiz-sub {
  font-family: 'Cairo', sans-serif;
  color: var(--plum-2);
  margin-bottom: 32px;
  font-size: 15px;
}
.quiz-card {
  background: var(--card);
  border-radius: 24px;
  padding: 32px 24px;
  box-shadow: var(--shadow);
  text-align: right;
  direction: rtl;
}
.q-label {
  font-family: 'Cairo', serif;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin-bottom: 8px;
}
.q-text {
  font-family: 'Cairo', sans-serif;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 18px;
  font-weight: 600;
}
.options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }
.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  color: var(--ink);
  transition: all 0.2s ease;
}
.option:hover { border-color: var(--plum); background: var(--pink-soft); }
.option.selected {
  border-color: var(--plum);
  background: var(--pink-soft);
  box-shadow: 0 0 0 3px rgba(161, 59, 88, 0.15);
}
.radio {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s;
}
.option.selected .radio {
  border-color: var(--plum);
  background: var(--plum);
  box-shadow: inset 0 0 0 3px #fff;
}
.q-divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ---------- Wrong-answer modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(74, 31, 46, 0.35);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.show { display: flex; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: 20px;
  padding: 40px 28px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  border: 2px solid var(--plum);
  box-shadow: 0 30px 60px rgba(0,0,0,0.25);
  animation: pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal .emoji { font-size: 60px; margin-bottom: 20px; }
.modal .msg {
  font-family: 'Cairo', sans-serif;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 24px;
  direction: rtl;
  font-weight: 600;
}

/* ---------- Celebrate section ---------- */
#celebrate-screen h1.title em::after { content: " 🎂"; }
.celebrate-btn { position: relative; }
.celebrate-btn::before { content: "🎉"; margin-right: 8px; }

/* ---------- Memories ---------- */
#memories .eyebrow { justify-content: center; }
.memories-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 700;
  color: var(--plum);
  margin-bottom: 40px;
}
.memories-title em { font-style: italic; color: var(--rose); }
.memories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.memory {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}
.memory:hover { transform: translateY(-4px); }
.memory .img-wrap {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f7d9e1, #efc8d2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--plum);
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 14px;
  overflow: hidden;
}
.memory .img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.memory .caption {
  padding: 14px 16px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-align: right;
  text-transform: uppercase;
}

/* ---------- Letter ---------- */
.letter-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  color: var(--rose);
  font-size: 15px;
  margin-bottom: 24px;
}
.letter-name {
  font-family: 'Cairo', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--plum);
  margin-bottom: 12px;
  text-align: right;
  direction: rtl;
}
.letter-line { height: 1px; background: var(--plum); opacity: 0.4; margin: 20px 0; }
.letter-ar {
  font-family: 'Cairo', sans-serif;
  font-size: 17px;
  line-height: 2;
  color: var(--ink);
  text-align: right;
  direction: rtl;
  margin-bottom: 24px;
  white-space: pre-line;    /* preserve admin's paragraph breaks */
}
.letter-en {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 18px;
  line-height: 1.9;
  color: var(--ink);
  margin-bottom: 20px;
  white-space: pre-line;
}
.signature {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 24px;
  color: var(--rose);
  text-align: right;
  margin-top: 30px;
}
.signature .name {
  font-family: 'Cairo', sans-serif;
  display: block;
  font-size: 22px;
  font-style: normal;
  color: var(--plum);
  margin-top: 4px;
}

/* ---------- Video ---------- */
.video-wrap {
  background: #fff;
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-top: 30px;
}
.video-wrap video,
.video-wrap iframe {
  width: 100%;
  border-radius: 14px;
  display: block;
  background: #f7e3ea;
  border: 0;
}
.video-wrap iframe { aspect-ratio: 9 / 16; max-height: 640px; }
.video-placeholder {
  aspect-ratio: 9 / 16;
  max-height: 500px;
  margin: 0 auto;
  background: linear-gradient(135deg, #f7d9e1, #efc8d2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--plum);
  font-family: 'Playfair Display', serif;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* ---------- Page swap ---------- */
section.page { display: none; }
section.page.active {
  display: flex;
  align-items: flex-start;  /* combined with .container margin:auto → scroll-safe centering */
  justify-content: center;
  animation: fadePage 0.5s ease;
  height: 100vh;
  overflow-y: auto;   /* long pages (quiz) scroll INSIDE the page only */
  overflow-x: hidden;
}
section.page.active > .container { margin: auto; }
@keyframes fadePage {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* When the final flow is unlocked, its three sections stack and scroll together */
#final-flow { display: none; flex-direction: column; }
#final-flow.active { display: flex; animation: fadePage 0.5s ease; }
#final-flow .screen { min-height: auto; padding: 80px 24px; }
#final-flow .screen:first-child { min-height: 100vh; }

/* ---------- "Not found" state ---------- */
.notfound-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 28px;
  max-width: 420px;
  margin: 0 auto;
  box-shadow: var(--shadow);
  text-align: center;
}
.notfound-card h2 {
  font-family: 'Playfair Display', serif;
  color: var(--plum);
  margin-bottom: 10px;
}
.notfound-card p { color: var(--muted); font-family: 'Cormorant Garamond', serif; font-size: 17px; line-height: 1.6; margin-bottom: 20px; }
.notfound-card code {
  background: var(--pink-soft);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: monospace;
  color: var(--plum);
}

/* ---------- Loading spinner ---------- */
.loading {
  position: fixed; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--plum);
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 18px;
  z-index: 500;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .memories-grid { grid-template-columns: 1fr; }
  .quiz-card { padding: 24px 18px; }
}
