/* Kejutan — ucapan ulang tahun ala story: angka balon foil, balon mengilap, kartu pesan malam. */
@font-face { font-family: "Bagel Fat One"; src: url("fonts/bagel-fat-one.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("fonts/plus-jakarta-sans.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --page: #f39a2c;
  --bg-a: #ffe59a;
  --bg-b: #ffbd45;
  --bg-c: #ff8a4c;
  --ink: #1b1a2e;
  --ink-2: #2c2a4a;
  --soft: rgba(27, 26, 46, 0.72);
  --accent: #ff4d7e;
  --accent-2: #3d7bff;
  --card: #fffdf6;
  --foil-1: #fff6d6;
  --foil-2: #ffd56b;
  --foil-3: #e79a1f;
  --foil-4: #b26a0c;
  --display: "Bagel Fat One", "Plus Jakarta Sans", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Tone warna (field "tone"): kuning = bawaan di atas. */
:root[data-tone="merah-muda"] { --page: #f0558a; --bg-a: #ffd9e4; --bg-b: #ff9dbb; --bg-c: #ff5c93; --accent: #3d7bff; --accent-2: #ffb53e; --foil-1: #fff; --foil-2: #ffe1ea; --foil-3: #f7a8c0; --foil-4: #c9507a; }
:root[data-tone="biru-langit"] { --page: #3f7fe8; --bg-a: #d6ecff; --bg-b: #8ec8ff; --bg-c: #4a8dff; --accent: #ff6b8b; --accent-2: #ffd25e; --foil-1: #fff; --foil-2: #e3eefc; --foil-3: #a9c4ec; --foil-4: #5b7fc2; }
:root[data-tone="mint"] { --page: #1f9e74; --bg-a: #d8f9e6; --bg-b: #8fe3b6; --bg-c: #27b07f; --accent: #ff6b8b; --accent-2: #ffd25e; }

* { box-sizing: border-box; }
html { background: var(--page); -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font: 500 16px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { display: block; }

main {
  max-width: 480px; margin: 0 auto; position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.4) 0 2px, transparent 3px),
    linear-gradient(168deg, var(--bg-a) 0%, var(--bg-b) 52%, var(--bg-c) 100%);
  background-size: 120px 140px, 150px 110px, auto;
}
@media (min-width: 560px) { main { box-shadow: 0 30px 90px rgba(27, 26, 46, 0.35); } }
section { min-height: 100vh; min-height: 100svh; padding: 74px 26px 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; position: relative; }
h1, h2 { margin: 0; font-family: var(--display); font-weight: 400; line-height: 0.98; letter-spacing: -0.01em; }
p { margin: 0; }
.eyebrow { font-size: 15px; font-weight: 700; color: var(--ink); }
.hint { font-size: 14px; font-weight: 600; color: var(--soft); }
.js-only { display: none; }

/* "Dari …" di pojok atas */
.from-bar { position: absolute; top: 28px; left: max(18px, calc(50% - 240px + 18px)); z-index: 6; display: flex; align-items: center; gap: 9px; padding: 5px 14px 5px 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 13px; color: var(--ink); }
.from-bar i { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg-a); font: 800 13px/1 var(--body); font-style: normal; text-transform: uppercase; }
.on-dark .from-bar { background: rgba(255, 255, 255, 0.12); color: #fff; }
.on-dark .from-bar i { background: var(--bg-b); color: var(--ink); }

/* Slide 1: angka balon foil */
.s0 { justify-content: flex-start; gap: 0; padding-top: 104px; }
.s0 .top { position: relative; width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.s0 h1 { font-size: clamp(46px, 14.5vw, 62px); color: var(--ink); overflow-wrap: anywhere; text-shadow: 0 3px 0 rgba(255, 255, 255, 0.45); }
.s0 h1 span { color: var(--accent); text-shadow: 0 3px 0 rgba(255, 255, 255, 0.6); }
.sinar { position: absolute; left: 50%; bottom: 4%; width: 620px; height: 620px; margin-left: -310px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.34) 0 6deg, transparent 6deg 12deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 18%, transparent 100%); mask-image: radial-gradient(closest-side, #000 18%, transparent 100%); }
.age { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; margin: 0; padding: 0 0 10px; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  font: 400 clamp(170px, 58vw, 250px)/0.9 var(--display); letter-spacing: -0.02em;
  background-image: linear-gradient(158deg, var(--foil-1) 0%, var(--foil-2) 26%, #fff 40%, var(--foil-2) 52%, var(--foil-3) 76%, var(--foil-4) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 5px 0 var(--foil-4)) drop-shadow(0 10px 0 color-mix(in srgb, var(--ink) 80%, transparent)) drop-shadow(0 30px 30px rgba(27, 26, 46, 0.3)); }
.age.star svg { width: 190px; height: 190px; color: var(--foil-2); }
.balon { position: absolute; }
.b1 { width: 76px; height: 162px; right: 6%; top: 21%; color: var(--accent); rotate: 8deg; }
.b2 { width: 58px; height: 124px; left: 5%; top: 46%; color: var(--accent-2); rotate: -10deg; }
.b3 { width: 50px; height: 106px; right: 14%; bottom: 13%; color: var(--card); rotate: 14deg; }
.kilau { position: absolute; color: #fff; }
.k1 { width: 26px; height: 26px; left: 12%; top: 38%; }
.k2 { width: 16px; height: 16px; right: 30%; top: 36%; }
.k3 { width: 20px; height: 20px; left: 22%; bottom: 14%; }
.s0 .hint { position: relative; }

/* Slide 2: pesan di kartu malam */
.s1 { background: radial-gradient(120% 70% at 50% 0%, var(--ink-2) 0%, var(--ink) 70%); color: #fff; }
.msg { position: relative; width: 100%; padding: 46px 26px 30px; text-align: left; border-radius: 30px; background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 30px 60px -24px rgba(0, 0, 0, 0.6); }
.kutip { position: absolute; top: -34px; left: 20px; font: 400 130px/1 var(--display); color: var(--bg-b); text-shadow: 0 6px 0 rgba(0, 0, 0, 0.25); }
.s1 .eyebrow { color: var(--bg-b); font-size: 14px; margin-bottom: 12px; }
.s1 .text { white-space: pre-line; font-size: 21px; font-weight: 600; line-height: 1.5; }
.sign { display: flex; align-items: center; gap: 10px; margin-top: 24px; font-weight: 700; color: #fff; }
.sign i { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(140deg, var(--bg-a), var(--bg-c)); color: var(--ink); font: 800 16px/1 var(--body); font-style: normal; text-transform: uppercase; }
.s1 .hint { color: rgba(255, 255, 255, 0.7); margin-top: 6px; }

/* Slide 3: foto + balasan */
.s2 { gap: 18px; }
.photos { display: flex; justify-content: center; width: 100%; padding: 8px 0 14px; }
.photos figure { flex: none; width: 46%; max-width: 190px; margin: 0 -9%; padding: 7px 7px 22px; border-radius: 10px; background: #fff; box-shadow: 0 22px 34px -14px rgba(27, 26, 46, 0.5); rotate: -9deg; }
.photos figure:nth-child(2) { rotate: 6deg; translate: 0 14px; z-index: 1; }
.photos figure:nth-child(3) { rotate: -3deg; translate: 0 -6px; }
.photos figure:nth-child(n+4) { display: none; }
.photos figure:first-child:last-child { margin: 0; width: 64%; max-width: 250px; rotate: -4deg; }
.photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 5px; }
.s2 h2 { font-size: clamp(40px, 12.5vw, 52px); color: var(--ink); text-shadow: 0 3px 0 rgba(255, 255, 255, 0.5); }
.reply { width: 100%; padding: 20px 18px 18px; border-radius: 28px; background: var(--card); text-align: left; box-shadow: 0 26px 50px -22px rgba(27, 26, 46, 0.55); }
.reply:empty { display: none; }
.who { font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); margin-bottom: 10px; }
.reply form { display: flex; flex-direction: column; gap: 10px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--bg-a) 55%, #fff); color: var(--ink); font: 700 14px/1 var(--body); cursor: pointer; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 14%, transparent); }
.pill.solid { min-height: 50px; background: var(--ink); color: #fff; font-size: 15px; box-shadow: 0 12px 22px -10px var(--ink); }
.pill:focus-visible, textarea:focus-visible, .envelope:focus-visible, .age:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 3px; }
textarea { font: inherit; font-size: 16px; padding: 13px 15px; border: 0; border-radius: 18px; background: #fff; color: var(--ink); min-height: 88px; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 16%, transparent); resize: vertical; }
textarea::placeholder { color: rgba(27, 26, 46, 0.5); }
.note { font-weight: 800; color: var(--ink); }
.reply .hint { color: var(--soft); }

/* Kado (opener "amplop") */
.envelope { display: none; }
.js [data-opener=amplop] .envelope { display: flex; cursor: pointer; }
.js [data-opener=amplop] main > section:not(.envelope) { display: none; }
.js [data-opener=amplop].opened .envelope { display: none; }
.js [data-opener=amplop].opened main > section:not(.envelope) { display: flex; animation: muncul 0.7s ease both; }
.env-title { font: 400 44px/1 var(--display); color: var(--ink); max-width: 7em; text-shadow: 0 3px 0 rgba(255, 255, 255, 0.5); margin-bottom: 26px; }
.box { position: relative; width: 210px; height: 200px; }
.box > span { position: absolute; }
.glow { inset: -70px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 255, 255, 0.7), transparent); }
.base { left: 14px; right: 14px; bottom: 0; height: 132px; border-radius: 8px 8px 18px 18px; background: linear-gradient(90deg, transparent 43%, var(--foil-2) 43% 57%, transparent 57%), linear-gradient(160deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent) 60%, color-mix(in srgb, var(--accent) 75%, #000)); box-shadow: 0 30px 34px -18px rgba(27, 26, 46, 0.55); }
.lid { left: 0; right: 0; top: 30px; height: 46px; border-radius: 12px; background: linear-gradient(90deg, transparent 44%, var(--foil-2) 44% 56%, transparent 56%), linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent)); box-shadow: 0 10px 14px -8px rgba(27, 26, 46, 0.5); }
.bow { left: 50%; top: 0; width: 112px; height: 44px; margin-left: -56px; background: radial-gradient(circle at 50% 78%, var(--foil-3) 0 9px, transparent 10px), radial-gradient(ellipse 44% 78% at 24% 56%, var(--foil-2) 0 98%, transparent 100%), radial-gradient(ellipse 44% 78% at 76% 56%, var(--foil-2) 0 98%, transparent 100%); filter: drop-shadow(0 4px 4px rgba(27, 26, 46, 0.25)); }
.envelope .hint { margin-top: 30px; }

/* Story */
.bars { display: none; }
.js [data-opener=story] .bars { display: flex; position: fixed; top: 12px; left: 50%; transform: translateX(-50%); width: min(452px, calc(100% - 28px)); gap: 4px; z-index: 7; }
.bars span { flex: 1; height: 4px; border-radius: 4px; background: var(--ink); opacity: 0.18; }
.bars span.done { opacity: 1; }
.on-dark .bars span { background: #fff; opacity: 0.25; }
.on-dark .bars span.done { opacity: 1; }
.js [data-opener=story] [data-step] { display: none; cursor: pointer; }
.js [data-opener=story] [data-step].active { display: flex; animation: muncul 0.45s ease both; }
.js [data-opener=story] footer { display: none; }
.js [data-opener=story] .js-only { display: block; }
.js [data-opener=amplop]:not(.opened) .from-bar { display: none; }

footer { max-width: 480px; margin: 0 auto; padding: 22px 24px 32px; text-align: center; font-size: 13px; font-weight: 600; color: var(--soft); background: var(--bg-c); }
footer a { color: var(--ink); font-weight: 800; }
.music-toggle { position: fixed; right: max(16px, calc(50% - 240px + 16px)); bottom: 16px; z-index: 20; width: 50px; height: 50px; border: 0; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 12px 22px -8px var(--ink); }
.music-toggle svg { width: 22px; height: 22px; }
.music-toggle[aria-pressed=true] svg { animation: putar 3s linear infinite; }

.s1, .s2 { min-height: 0; padding-top: 64px; padding-bottom: 64px; }
.js [data-opener=story] .s1, .js [data-opener=story] .s2 { min-height: 100vh; min-height: 100svh; padding-top: 84px; }

/* Konfeti jatuh (dibuat kejutan.js) */
.confetti { position: fixed; inset: 0; z-index: 15; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -24px; width: 10px; height: 16px; border-radius: 3px; background: var(--accent); opacity: 0; animation: jatuh var(--t, 2.8s) cubic-bezier(0.25, 0.6, 0.45, 1) var(--dl, 0s) forwards; }
.confetti i:nth-child(4n + 1) { background: #fff; }
.confetti i:nth-child(4n + 2) { background: var(--accent-2); width: 9px; height: 9px; border-radius: 50%; }
.confetti i:nth-child(4n + 3) { background: var(--foil-2); }
@keyframes jatuh { 0% { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate3d(var(--dx, 0px), 104vh, 0) rotate(var(--r, 540deg)); } }

/* ---------- Animasi ---------- */
@keyframes putar { to { transform: rotate(360deg); } }
@keyframes muncul { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes mo-naik { from { opacity: 0; translate: 0 26px; } to { opacity: 1; translate: 0 0; } }
@keyframes mo-pop { 0% { opacity: 0; scale: 0.3; rotate: -12deg; } 70% { scale: 1.08; } 100% { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes mo-layang { 0%, 100% { translate: 0 0; } 50% { translate: 0 -16px; } }
@keyframes mo-terbang { from { translate: 0 120vh; } to { translate: 0 0; } }
@keyframes mo-kerlip { 0%, 100% { opacity: 1; scale: 1; } 50% { opacity: 0.3; scale: 0.6; } }
@keyframes mo-goyang { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; translate: 0 -8px; } }
@keyframes mo-sinar { to { rotate: 360deg; } }

@media (prefers-reduced-motion: no-preference) {
  .sinar { animation: mo-sinar 70s linear infinite; }
  .balon { animation: mo-terbang 1.5s cubic-bezier(0.2, 0.8, 0.3, 1) both, mo-layang 6s ease-in-out 1.5s infinite; }
  .b2 { animation-delay: 0.15s, 1.65s; animation-duration: 1.5s, 7.5s; }
  .b3 { animation-delay: 0.3s, 1.8s; animation-duration: 1.5s, 9s; }
  .kilau { animation: mo-kerlip 2.8s ease-in-out infinite; }
  .k2 { animation-delay: -1s; } .k3 { animation-delay: -1.9s; }
  .s0 .top { animation: mo-naik 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.05s both; }
  .age { animation: mo-pop 0.9s cubic-bezier(0.3, 1.3, 0.5, 1) 0.3s both; }
  .msg { animation: mo-naik 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s both; }
  .kutip { animation: mo-pop 0.7s cubic-bezier(0.3, 1.3, 0.5, 1) 0.4s both; }
  .photos figure { animation: mo-pop 0.7s cubic-bezier(0.3, 1.3, 0.5, 1) 0.1s both; }
  .photos figure:nth-child(2) { animation-delay: 0.22s; }
  .photos figure:nth-child(3) { animation-delay: 0.34s; }
  .s2 h2 { animation: mo-naik 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.4s both; }
  .reply { animation: mo-naik 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.55s both; }

  .box { animation: mo-goyang 2.6s ease-in-out infinite; }
  .lid, .bow { transition: translate 0.6s cubic-bezier(0.3, 0, 0.3, 1), rotate 0.6s ease, opacity 0.4s ease 0.3s; }
  .opening .box { animation: none; }
  .opening .lid { translate: 40px -150px; rotate: 26deg; opacity: 0; }
  .opening .bow { translate: 40px -170px; rotate: 26deg; opacity: 0; }
  .opening .glow { scale: 1.6; transition: scale 0.7s ease; }
  .opening .envelope :is(.eyebrow, .hint, .env-title) { opacity: 0; transition: opacity 0.3s; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .confetti { display: none; } }


/* Kado kejutan: tema (bentuk & perilaku di kado.css). */
.kado-sec, .kartu-kado { --k-judul: "Bagel Fat One", system-ui, sans-serif; --k-judul-w: 400; --k-teks: "Plus Jakarta Sans", system-ui, sans-serif; --k-aksen: var(--accent); --k-aksen-b: var(--accent-2); --k-aksen-c: #1fae9b; --k-aksen2: var(--foil-2); --k-kertas: var(--card); --k-tinta: var(--ink); --k-judul-tinta: var(--ink); --k-latar: rgba(27, 26, 46, .6); }

/* Video unggahan (field video): ditaruh sebelum galeri, bingkai mengikuti warna teks template (currentColor). */
.vk { width: min(100%, 440px); margin: 34px auto; padding: 0 20px; text-align: center; flex-direction: column; align-items: center; justify-content: center; }
.vk-layar { width: 100%; }
.vk-judul { margin: 0 0 12px; font-weight: 700; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; opacity: .85; }
.vk-layar { position: relative; margin: 0; padding: 10px; border-radius: 20px; border: 1px solid color-mix(in srgb, currentColor 28%, transparent); background: color-mix(in srgb, currentColor 7%, transparent); box-shadow: 0 16px 34px rgba(0, 0, 0, .16); }
.vk-layar video { display: block; width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }
.vk-layar figcaption { margin-top: 10px; font-size: 14px; font-style: italic; opacity: .75; }
