/* =========================================================================
   Папе — a birthday gift   |   warm, quiet, cinematic, mobile-first
   ========================================================================= */

:root {
  --bg:        #0e0b09;   /* warm near-black */
  --bg-soft:   #161110;
  --ink:       #efe7da;   /* warm ivory */
  --ink-dim:   #cabfae;   /* dimmed ivory */
  --muted:     #9a8f80;
  --muted-deep:#6f665b;
  --flame:     #e0a861;   /* candle glow */
  --flame-deep:#b9763a;
  --line:      rgba(224,168,97,0.28);
  --maxw:      640px;

  --serif:   'Cormorant Garamond', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --body:    'Lora', Georgia, serif;
  --ui:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.7;
  font-size: 19px;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* warm vignette + faint candle glow from the top */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(224,168,97,0.10), transparent 55%),
    radial-gradient(140% 120% at 50% 120%, rgba(0,0,0,0.55), transparent 60%);
}

/* film grain for warmth/texture */
body::after {
  content: '';
  position: fixed; inset: -50%;
  pointer-events: none; z-index: 1; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(6) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0) }
  20% { transform: translate(-3%, 2%) }
  40% { transform: translate(2%, -4%) }
  60% { transform: translate(-2%, 3%) }
  80% { transform: translate(3%, -2%) }
}

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

/* ---------- shared layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

.scene {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center;
  padding: 14vh 0;
}
.scene.left { text-align: left; align-items: stretch; }

/* ---------- opening reveal (the held breath) ---------- */
#overture {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 28px;
  transition: opacity 1.6s ease;
}
#overture.gone { opacity: 0; pointer-events: none; }
#overture .line {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.4rem, 11vw, 4.6rem);
  color: var(--ink);
  opacity: 0;
  letter-spacing: 0.02em;
}
#overture .line.sub {
  font-size: clamp(1.2rem, 5.4vw, 1.9rem);
  color: var(--flame);
  font-style: italic;
  letter-spacing: 0.04em;
}
#overture .hint {
  position: absolute;
  bottom: calc(40px + env(safe-area-inset-bottom));
  left: 0; right: 0; text-align: center;
  font-family: var(--ui);
  font-size: 0.7rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--muted-deep);
  opacity: 0;
  animation: hintIn 1.4s ease 4.5s forwards;
}
@keyframes hintIn { to { opacity: 0.55; } }

/* ---------- reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 1.3s ease, transform 1.3s ease; }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .15s }
.reveal.d2 { transition-delay: .35s }
.reveal.d3 { transition-delay: .55s }
.reveal.d4 { transition-delay: .75s }

/* ---------- typography pieces ---------- */
.eyebrow {
  font-family: var(--ui);
  font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--flame); opacity: 0.85;
}
.display {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.6rem, 12vw, 4.4rem);
  line-height: 1.05; letter-spacing: 0.01em;
}
.display em { font-style: italic; color: var(--flame); }

.kicker {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.4rem, 6vw, 2.1rem);
  color: var(--ink); line-height: 1.3;
}

.letter p {
  font-family: var(--body);
  font-size: clamp(1.05rem, 4.6vw, 1.22rem);
  line-height: 1.85;
  margin: 0 0 1.35em;
  color: var(--ink);
}
.letter p.lead::first-letter {
  font-family: var(--serif);
  font-size: 3.1em; line-height: 0.8;
  float: left; padding: 0.05em 0.12em 0 0;
  color: var(--flame); font-weight: 400;
}

.soft { color: var(--muted); }
.center { text-align: center; }

/* hairline divider with a small flame dot */
.rule { display:flex; align-items:center; justify-content:center; gap:14px; margin: 8vh 0; }
.rule span { height:1px; width:64px; background:linear-gradient(90deg, transparent, var(--line)); }
.rule span:last-child { background:linear-gradient(90deg, var(--line), transparent); }
.rule b { width:6px; height:6px; border-radius:50%; background:var(--flame); box-shadow:0 0 12px var(--flame); }

/* ---------- audio player ---------- */
.player {
  display: flex; align-items: center; gap: 18px;
  background: var(--bg-soft);
  border: 1px solid rgba(224,168,97,0.20);
  border-radius: 18px;
  padding: 18px 20px;
  width: 100%;
  box-shadow: 0 16px 50px rgba(0,0,0,0.4);
}
.player__btn {
  flex: 0 0 auto;
  width: 58px; height: 58px; border-radius: 50%;
  border: none; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, var(--flame), var(--flame-deep));
  color: #1b1208; display: grid; place-items: center;
  box-shadow: 0 0 0 0 rgba(224,168,97,0.55);
  transition: transform .2s ease, box-shadow .3s ease;
}
.player__btn:active { transform: scale(0.94); }
.player__btn.pulse { animation: pulse 2.6s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(224,168,97,0.45); }
  70% { box-shadow: 0 0 0 18px rgba(224,168,97,0); }
  100% { box-shadow: 0 0 0 0 rgba(224,168,97,0); }
}
.player__btn svg { width: 22px; height: 22px; }
.player__meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.player__label { font-family: var(--ui); font-size: 0.95rem; color: var(--ink); }
.player__hint { font-family: var(--ui); font-size: 0.78rem; color: var(--muted); }
.player__bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.player__fill { height: 100%; width: 0%; background: var(--flame); transition: width .2s linear; }

/* ---------- the gift card ---------- */
.gift {
  background: linear-gradient(180deg, #1a1411, #120d0b);
  border: 1px solid rgba(224,168,97,0.28);
  border-radius: 22px;
  padding: 34px 28px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
}
.gift__eyebrow { font-family: var(--ui); font-size:0.7rem; letter-spacing:0.3em; text-transform:uppercase; color:var(--flame); }
.gift__title { font-family: var(--serif); font-weight:400; font-size: clamp(1.8rem,8vw,2.6rem); margin:14px 0 6px; line-height:1.15; }
.gift__author { font-family: var(--body); font-style: italic; color: var(--muted); margin-bottom: 20px; }
.gift__body { font-size: 1.05rem; color: var(--ink); margin-bottom: 26px; }
.gift__cta {
  display:inline-flex; align-items:center; gap:10px;
  font-family: var(--ui); font-weight:600; font-size:1rem;
  color:#1b1208; text-decoration:none;
  background: linear-gradient(180deg, var(--flame), var(--flame-deep));
  padding: 16px 30px; border-radius: 999px;
  box-shadow: 0 14px 36px rgba(185,118,58,0.4);
  transition: transform .2s ease, box-shadow .3s ease;
}
.gift__cta:active { transform: translateY(1px) scale(0.99); }
.gift__note { display:block; margin-top:16px; font-family:var(--ui); font-size:0.8rem; color:var(--muted); }

/* ---------- portrait ---------- */
.portrait { width: 100%; display:flex; justify-content:center; }
.portrait img {
  max-width: 320px; width: 80%;
  border-radius: 14px;
  filter: saturate(0.92) contrast(1.02);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.06);
}
.portrait figcaption { /* unused unless photo */ }

/* ---------- the bare note (tough-love register) ---------- */
.voice { text-align: center; padding-top: 7vh; margin-bottom: 13vh; }
.voice .player { text-align: left; }

.letter.bare p {
  font-family: var(--body);
  font-size: clamp(1.12rem, 4.8vw, 1.34rem);
  line-height: 1.75;
  margin: 0 0 1.55em;
  color: var(--ink);
}
.letter.bare p:last-of-type { margin-bottom: 0; }

/* the quiet, understated book link — no ornate card */
.booklink-wrap { margin: 2.6em 0 0; }
.booklink {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--ui); font-weight: 500; font-size: 0.95rem;
  color: var(--ink); text-decoration: none;
  border: 1px solid rgba(224,168,97,0.42);
  border-radius: 999px; padding: 13px 26px;
  transition: border-color .25s ease, background .25s ease, transform .15s ease;
}
.booklink:active { transform: scale(0.985); background: rgba(224,168,97,0.06); }

/* ---------- signature (restrained) ---------- */
.sign {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.25rem, 5vw, 1.55rem);
  color: var(--muted);
  margin-top: 3em !important;
}

/* ---------- candle (closing) ---------- */
.candle { display:flex; flex-direction:column; align-items:center; gap:2px; margin: 4vh 0; }
.candle .flame {
  width: 14px; height: 26px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff3c4, var(--flame) 55%, var(--flame-deep) 90%);
  box-shadow: 0 0 24px 6px rgba(224,168,97,0.55);
  transform-origin: 50% 90%;
  animation: flicker 2.4s ease-in-out infinite;
}
.candle .stick { width: 8px; height: 64px; border-radius: 3px; background: linear-gradient(180deg, #e9ddc8, #b9a07a); }
@keyframes flicker {
  0%,100% { transform: rotate(-2deg) scaleY(1); opacity: 1; }
  25% { transform: rotate(2deg) scaleY(1.06); opacity: 0.92; }
  50% { transform: rotate(-1deg) scaleY(0.96); opacity: 1; }
  75% { transform: rotate(1.5deg) scaleY(1.04); opacity: 0.95; }
}

/* ---------- scroll cue ---------- */
.cue { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); display:flex; flex-direction:column; align-items:center; gap:8px; color: var(--muted); font-family:var(--ui); font-size:0.72rem; letter-spacing:0.18em; text-transform:uppercase; animation: bob 2.4s ease-in-out infinite; }
.cue svg { width: 18px; height: 18px; opacity: 0.7; }
@keyframes bob { 0%,100%{ transform: translateX(-50%) translateY(0);} 50%{ transform: translateX(-50%) translateY(7px);} }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: .001s !important; }
  .reveal { opacity: 1; transform: none; }
}
