/* Konfeti — ucapan ulang tahun: amplop bersegel emas, konfeti foil, kartu berbingkai. */
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 700; src: url("fonts/playfair-display.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 700; src: url("fonts/playfair-display-italic.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 400 800; src: url("fonts/plus-jakarta-sans.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Pinyon Script"; src: url("fonts/pinyon-script.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --page: #f0d5c8;
  --bg-1: #fef5ef;
  --bg-2: #f8dccf;
  --card: #fffaf5;
  --ink: #4a2a2a;
  --soft: #8a6260;
  --accent: #b5654f;
  --env: #f3cbb9;
  --env-2: #e7b29e;
  --env-3: #dc9f8a;
  --gold-1: #f6e2b1;
  --gold-2: #c99a52;
  --gold-3: #8f6428;
  --emas: linear-gradient(135deg, var(--gold-3) 0%, var(--gold-1) 38%, var(--gold-2) 62%, var(--gold-3) 100%);
  --emas-teks: linear-gradient(135deg, #7a5320 0%, #c8973f 42%, #a87428 64%, #6f4a1a 100%); /* tulisan di atas latar terang */
  --display: "Playfair Display", Georgia, serif;
  --script: "Pinyon Script", "Playfair Display", cursive;
  --body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Tone warna (field "tone"): peach = bawaan di atas. */
:root[data-tone="toska-muda"] { --page: #c3e0db; --bg-1: #f0f9f7; --bg-2: #cfe9e4; --card: #f9fefd; --ink: #1f4643; --soft: #56807b; --accent: #2f7f78; --env: #bfe0da; --env-2: #a3d0c9; --env-3: #8cc1b9; }
:root[data-tone="lavender"] { --page: #d3c7ee; --bg-1: #f6f2fd; --bg-2: #ddd1f3; --card: #fcfaff; --ink: #35285a; --soft: #6f6194; --accent: #6b54b0; --env: #d2c5ef; --env-2: #bcabe5; --env-3: #a995d9; }
:root[data-tone="mint"] { --page: #c5e3cc; --bg-1: #f1faf3; --bg-2: #d0ebd6; --card: #fafefb; --ink: #1f4a2e; --soft: #587f64; --accent: #2f8050; --env: #c3e4cb; --env-2: #a9d5b4; --env-3: #92c69f; }

* { box-sizing: border-box; }
html { background: var(--page); -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font: 400 16px/1.7 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(120% 60% at 50% 0%, #fff 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
}
@media (min-width: 560px) { main { box-shadow: 0 30px 90px color-mix(in srgb, var(--ink) 28%, transparent); } }
section { min-height: 100vh; min-height: 100svh; padding: 64px 26px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; text-align: center; position: relative; }
h1, h2 { margin: 0; font-family: var(--display); font-weight: 500; }
p { margin: 0; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.32em; text-transform: uppercase; color: var(--accent); }
.hint { font-family: var(--display); font-size: 15px; font-style: italic; color: var(--soft); }
.js-only { display: none; }

/* Konfeti foil yang melayang di latar */
.foil { position: absolute; inset: 0; pointer-events: none; }
.foil i { position: absolute; width: 10px; height: 16px; border-radius: 2px; background: var(--emas); opacity: 0.85; box-shadow: 0 2px 6px color-mix(in srgb, var(--gold-3) 30%, transparent); }
.foil i:nth-child(3n) { width: 9px; height: 9px; border-radius: 50%; }
.foil i:nth-child(4n + 1) { background: var(--accent); opacity: 0.45; }
.f1 { top: 3%; left: 9%; rotate: 24deg; } .f2 { top: 6%; right: 12%; rotate: -18deg; } .f3 { top: 11%; left: 46%; }
.f4 { top: 17%; right: 30%; rotate: 62deg; } .f5 { top: 22%; left: 6%; rotate: -40deg; } .f6 { top: 31%; right: 6%; }
.f7 { top: 44%; left: 4%; rotate: 12deg; } .f8 { top: 55%; right: 5%; rotate: -64deg; } .f9 { top: 66%; left: 8%; }
.f10 { top: 76%; right: 9%; rotate: 38deg; } .f11 { top: 86%; left: 5%; rotate: -22deg; } .f12 { top: 93%; right: 14%; }
main > section { z-index: 1; }

/* Hero */
.spark { position: absolute; }
.k1 { width: 22px; height: 22px; top: 12%; left: 12%; }
.k2 { width: 14px; height: 14px; top: 20%; right: 12%; }
.k3 { width: 16px; height: 16px; bottom: 15%; left: 16%; }
.arch {
  position: relative; width: 100%; padding: 58px 22px 40px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  border-radius: 999px 999px 26px 26px; background: var(--card);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold-2) 55%, transparent), 0 30px 60px -28px color-mix(in srgb, var(--ink) 45%, transparent);
}
.arch::before { content: ""; position: absolute; inset: 10px; border-radius: 999px 999px 18px 18px; border: 1.5px solid transparent; background: var(--emas) border-box; -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0); pointer-events: none; }
.medal { position: relative; width: 118px; height: 118px; margin: 4px 0 2px; padding: 0; border: 0; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--emas); color: #4a3310; cursor: pointer; box-shadow: 0 14px 26px -12px var(--gold-3), inset 0 0 0 5px rgba(255, 255, 255, 0.35), inset 0 0 0 6.5px color-mix(in srgb, var(--gold-3) 70%, transparent); -webkit-tap-highlight-color: transparent; }
.medal b { font: 600 50px/1 var(--display); letter-spacing: -0.02em; }
.medal span { font-size: 11px; font-weight: 800; letter-spacing: 0.3em; text-transform: uppercase; margin-top: 2px; padding-left: 0.3em; }
.medal.plain { width: 84px; height: 84px; background: none; box-shadow: none; }
.medal.plain svg { width: 64px; height: 64px; }
.hero h1 { font: 400 clamp(60px, 20vw, 84px)/1.05 var(--script); max-width: 100%; padding: 6px 8px 0; overflow-wrap: anywhere; background: var(--emas-teks); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 1px 0 color-mix(in srgb, var(--gold-3) 35%, transparent)); }
.laurel { display: flex; align-items: flex-end; justify-content: center; gap: 10px; }
.laurel svg { width: 84px; height: 42px; }
.laurel svg:first-child { transform: scaleX(-1) rotate(-6deg); }
.laurel .flip { transform: rotate(-6deg); }
.laurel .dot { width: 14px; height: 14px; margin-bottom: 4px; }
.sub { font: italic 400 19px/1.4 var(--display); color: var(--soft); }
.hero .hint { margin-top: 12px; }

/* Kartu pesan */
.card { position: relative; width: 100%; padding: 50px 30px 42px; text-align: left; background: var(--card); border-radius: 6px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold-2) 55%, transparent), 0 26px 54px -26px color-mix(in srgb, var(--ink) 45%, transparent); }
.sudut { position: absolute; width: 46px; height: 46px; }
.sudut.a { top: 9px; left: 9px; }
.sudut.b { top: 9px; right: 9px; transform: scaleX(-1); }
.sudut.c { bottom: 9px; left: 9px; transform: scaleY(-1); }
.sudut.d { bottom: 9px; right: 9px; transform: scale(-1); }
.card .eyebrow { text-align: center; margin-bottom: 18px; }
.message .text { white-space: pre-line; font: 400 19px/1.75 var(--display); color: var(--ink); }
.from { margin-top: 24px; text-align: right; font: italic 400 15px/1.4 var(--display); color: var(--soft); }
.from span { display: block; font: 400 44px/1.15 var(--script); color: var(--accent); overflow-wrap: anywhere; }

/* Galeri: foto berbingkai lengkung */
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; align-items: start; }
.photos figure { margin: 0; padding: 6px; background: var(--emas); border-radius: 999px 999px 14px 14px; box-shadow: 0 16px 30px -18px color-mix(in srgb, var(--ink) 55%, transparent); }
.photos img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 999px 999px 9px 9px; border: 3px solid var(--card); }
.photos figure:nth-child(even) { margin-top: 26px; }
.photos figure:nth-child(odd):last-child { grid-column: 1 / -1; width: 62%; justify-self: center; margin-top: 0; }

/* Balasan */
.spark.big { position: static; width: 46px; height: 46px; }
.reply h2 { font-size: 34px; line-height: 1.2; }
.reply h2 em { display: block; font: 400 58px/1.1 var(--script); background: var(--emas-teks); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 8px; }
.lead { color: var(--soft); margin-top: 6px; font: italic 400 16px/1.4 var(--display); }
.reply form { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--ink); color: var(--bg-1); font: 700 15px/1 var(--body); cursor: pointer; box-shadow: 0 12px 22px -12px var(--ink); }
.btn.ghost { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gold-2) 70%, transparent); }
.btn:focus-visible, textarea:focus-visible, .envelope:focus-visible, .medal:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
textarea { font: inherit; font-size: 16px; padding: 14px 16px; border: 0; border-radius: 16px; background: var(--card); color: var(--ink); min-height: 96px; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gold-2) 60%, transparent); resize: vertical; }
textarea::placeholder { color: var(--soft); opacity: 0.8; }
.note { color: var(--accent); font-weight: 700; }

/* 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.8s ease both; }
.env-title { font: 500 34px/1.2 var(--display); max-width: 9.5em; margin-bottom: 18px; }
.env-title em { font: 400 54px/1 var(--script); display: block; background: var(--emas-teks); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 4px 8px 0; }
.env { position: relative; width: 288px; height: 196px; filter: drop-shadow(0 26px 30px color-mix(in srgb, var(--ink) 30%, transparent)); }
.env > span { position: absolute; }
.liner { inset: 0; border-radius: 10px; background: repeating-linear-gradient(45deg, var(--gold-2) 0 2px, var(--gold-1) 2px 9px); }
.peek { left: 16px; right: 16px; top: 14px; height: 120px; border-radius: 6px; background: var(--card); box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold-2) 50%, transparent); }
.pocket { inset: 0; border-radius: 10px; background: linear-gradient(180deg, var(--env) 0%, var(--env-2) 100%); clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%); }
.pocket::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--env-3) 80%, transparent)); clip-path: polygon(0 100%, 50% 50%, 100% 100%); }
.flap { inset: 0 0 auto 0; height: 118px; border-radius: 10px 10px 0 0; background: linear-gradient(180deg, var(--env-2) 0%, var(--env) 100%); clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: 50% 0; }
.seal { left: 50%; top: 82px; width: 68px; height: 68px; margin-left: -34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--emas); color: #4a3310; font: italic 600 32px/1 var(--display); text-transform: uppercase; box-shadow: 0 8px 14px -6px var(--gold-3), inset 0 0 0 3px rgba(255, 255, 255, 0.35), inset 0 0 0 4.5px color-mix(in srgb, var(--gold-3) 70%, transparent); }
.envelope .hint { margin-top: 22px; }

/* 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: 5; }
.bars span { flex: 1; height: 3px; border-radius: 3px; background: var(--ink); opacity: 0.16; }
.bars span.done { opacity: 1; background: var(--gold-2); }
.js [data-opener=story] [data-step] { display: none; cursor: pointer; }
.js [data-opener=story] [data-step].active { display: flex; animation: muncul 0.5s ease both; }
.js [data-opener=story] footer { display: none; }
.js [data-opener=story] .js-only { display: block; }

footer { max-width: 480px; margin: 0 auto; padding: 24px 24px 34px; text-align: center; font-size: 13px; color: var(--soft); background: var(--bg-2); border-top: 1px solid color-mix(in srgb, var(--gold-2) 40%, transparent); }
footer a { color: var(--accent); font-weight: 700; }
.music-toggle { position: fixed; right: max(16px, calc(50% - 240px + 16px)); bottom: 16px; z-index: 20; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--emas); color: #4a3310; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 10px 22px -8px var(--gold-3); }
.music-toggle[aria-pressed=true] span { display: inline-block; animation: putar 3s linear infinite; }

.message, .gallery, .reply { min-height: 0; padding: 56px 26px; }
.reply { padding-bottom: 76px; }
.js [data-opener=story] .message, .js [data-opener=story] .gallery, .js [data-opener=story] .reply { min-height: 100vh; min-height: 100svh; }

/* Konfeti jatuh (dibuat ucapan.js) */
.confetti { position: fixed; inset: 0; z-index: 15; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -24px; width: 9px; height: 15px; border-radius: 2px; background: var(--emas); 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: var(--accent); }
.confetti i:nth-child(4n + 2) { width: 8px; height: 8px; border-radius: 50%; }
.confetti i:nth-child(4n + 3) { background: var(--env-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 22px; } to { opacity: 1; translate: 0 0; } }
@keyframes mo-pop { from { opacity: 0; scale: 0.5; } to { opacity: 1; scale: 1; } }
@keyframes mo-kerlip { 0%, 100% { opacity: 1; scale: 1; } 50% { opacity: 0.35; scale: 0.7; } }
@keyframes mo-layang { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
@keyframes mo-angguk { 0%, 100% { rotate: -1.5deg; } 50% { rotate: 1.5deg; translate: 0 -6px; } }
@keyframes mo-kilat { 0%, 60% { background-position: 120% 0; } 100% { background-position: -40% 0; } }

@media (prefers-reduced-motion: no-preference) {
  :root { --mo-e: cubic-bezier(0.2, 0.7, 0.2, 1); }
  .foil i { animation: mo-layang 7s ease-in-out infinite; }
  .foil i:nth-child(2n) { animation-duration: 9s; animation-delay: -3s; }
  .foil i:nth-child(3n) { animation-duration: 11s; animation-delay: -6s; }
  .spark { animation: mo-kerlip 3.2s ease-in-out infinite; }
  .k2 { animation-delay: -1.1s; } .k3 { animation-delay: -2s; }
  main > section:not(.envelope) :where(.arch, .card) { animation: mo-naik 0.9s var(--mo-e) 0.05s both; }
  main > section:not(.envelope) :where(.eyebrow) { animation: mo-naik 0.8s var(--mo-e) 0.25s both; }
  main > section:not(.envelope) :where(.medal) { animation: mo-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both; }
  main > section:not(.envelope) :where(h1, h2) { animation: mo-naik 0.9s var(--mo-e) 0.55s both; }
  main > section:not(.envelope) :where(.laurel, .sub, .lead, .from) { animation: mo-naik 0.9s var(--mo-e) 0.7s both; }
  main > section:not(.envelope) :where(.quick, form, .note, .hint) { animation: mo-naik 0.8s var(--mo-e) 0.85s both; }
  main .photos figure { animation: mo-naik 0.9s var(--mo-e) 0.3s both; }
  main .photos figure:nth-child(2) { animation-delay: 0.42s; }
  main .photos figure:nth-child(3) { animation-delay: 0.54s; }
  main .photos figure:nth-child(n+4) { animation-delay: 0.66s; }

  .env { animation: mo-angguk 3.6s ease-in-out infinite; }
  .flap { transition: transform 0.5s ease-in; }
  .seal { transition: opacity 0.25s ease, scale 0.3s ease; }
  .peek { transition: translate 0.55s ease 0.28s; }
  .opening .env { animation: none; }
  .opening .seal { opacity: 0; scale: 1.5; }
  .opening .flap { transform: perspective(700px) rotateX(178deg); z-index: 0; }
  .opening .peek { translate: 0 -86px; }
  .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: "Playfair Display", Georgia, serif; --k-teks: "Plus Jakarta Sans", system-ui, sans-serif; --k-aksen: var(--accent); --k-aksen2: var(--gold-1); --k-amplop: var(--env); --k-kertas: var(--card); --k-tinta: var(--ink); --k-judul-tinta: var(--ink); --k-latar: rgba(74, 42, 42, .55); }

/* 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; }
