/* Peluk — ucapan maaf yang manis: lilac & peach, beruang yang membuka tangan untuk memeluk. */
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 400 700; src: url("fonts/fredoka.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400 800; src: url("fonts/nunito.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 600; src: url("fonts/caveat.woff2") format("woff2"); font-display: swap; }

:root {
  --lilac: #eadffb; --lilac-2: #d6c4f6; --lilac-3: #b9a0ec;
  --peach: #ffe3d5; --peach-2: #ffc6b0;
  --plum: #4b3566; --plum-2: #6c5688; --rose: #ff7a93; --paper: #fffbf7;
  --round: "Fredoka", "Nunito", system-ui, sans-serif;
  --hand: "Caveat", "Comic Sans MS", cursive;
 /* warna hasil tone (dulu ditulis langsung) */ --tn-1: #d9c8f8; --tn-2: #4b3566; --tn-3: #c3a6f2; --tn-4: #e2d5f6; --tn-5: #d6c4f6; --tn-6: #eadffb; --tn-7: #3f2d57; --tn-8: #8a77a3;
}

/* Tone warna (field "tone"): lavender = bawaan di atas. */
:root[data-tone="peach"] { --lilac: #fbe7df; --lilac-2: #f6d1c4; --lilac-3: #ecb2a0; --plum: #664635; --plum-2: #886756; --tn-1: #f8d4c8; --tn-2: #664635; --tn-3: #f2bca6; --tn-4: #f6dfd5; --tn-5: #f6d1c4; --tn-6: #fbe7df; --tn-7: #573b2d; --tn-8: #a38677; }
:root[data-tone="mint"] { --lilac: #dffbed; --lilac-2: #c4f6db; --lilac-3: #a0ecc1; --plum: #356650; --plum-2: #568871; --tn-1: #c8f8de; --tn-2: #356650; --tn-3: #a6f2cb; --tn-4: #d5f6e5; --tn-5: #c4f6db; --tn-6: #dffbed; --tn-7: #2d5743; --tn-8: #77a38f; }
:root[data-tone="toska-muda"] { --lilac: #dff8fb; --lilac-2: #c4f3f6; --lilac-3: #a0e9ec; --plum: #355e66; --plum-2: #568188; --tn-1: #c8f5f8; --tn-2: #355e66; --tn-3: #a6ebf2; --tn-4: #d5f3f6; --tn-5: #c4f3f6; --tn-6: #dff8fb; --tn-7: #2d5157; --tn-8: #779da3; }
* { box-sizing: border-box; }
html { background: var(--lilac); }
body { margin: 0; min-height: 100vh; color: var(--plum); font: 17px/1.65 "Nunito", system-ui, sans-serif; -webkit-font-smoothing: antialiased; background: radial-gradient(circle at 15% 20%, #ffe0d3 0, transparent 34%), radial-gradient(circle at 85% 75%, var(--tn-1) 0, transparent 40%), var(--lilac); background-attachment: fixed; }
body::before { content: ""; position: fixed; inset: 0; background: url("img/hati.svg") 0 0 / 140px 140px; opacity: 0.55; pointer-events: none; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
main { max-width: 480px; margin: 0 auto; position: relative; z-index: 1; overflow: hidden; }
section { min-height: 100vh; min-height: 100svh; padding: 60px 26px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; text-align: center; position: relative; }
h1, h2, p, figure { margin: 0; }
.tag { display: inline-block; padding: 8px 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.72); font: 500 16px/1.3 var(--round); color: var(--plum-2); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--tn-2) 35%, transparent); max-width: 100%; }
.tag strong { color: var(--plum); font-weight: 600; }
.hint { font: 700 14px/1.4 "Nunito", sans-serif; color: var(--plum-2); }
.eyebrow { font: 600 28px/1.1 var(--hand); color: var(--rose); }

/* Amplop */
.envelope { display: none; background: radial-gradient(circle at 50% 45%, #fff3ec 0, transparent 55%), linear-gradient(170deg, var(--lilac) 0%, #f4dff0 55%, var(--peach) 100%); }
.envelope::before, .hero::before, .reply::before { content: ""; position: absolute; inset: 0; background: url("img/hati.svg") 20px 10px / 132px 132px; opacity: 0.6; pointer-events: none; }
.psst { font: 600 34px/1 var(--hand); color: var(--rose); transform: rotate(-4deg); margin-bottom: 4px; }
.envelope > * { position: relative; }
.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.45s ease both; }
.envelope:focus-visible { outline: 3px solid var(--lilac-3); outline-offset: -10px; border-radius: 24px; }
.envelope .tag { font-size: 18px; }
.env-wrap { position: relative; width: min(300px, 80vw); padding-top: 70px; margin: 18px 0 26px; animation: goyang 3.2s ease-in-out infinite; }
.peek { position: absolute; left: 50%; top: 4px; width: 47%; margin-left: -23.5%; transition: transform 0.3s ease, opacity 0.3s; }
.env { position: relative; display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 18px 24px rgba(180, 110, 120, 0.3)); }
.env .flap-front, .env .flap-back, .env .letter, .env .seal, .env .paws { transform-box: view-box; }
.env .flap-front, .env .flap-back { transform-origin: 150px 40px; }
.env .flap-front { transition: transform 0.24s ease-in; }
.env .flap-back { transform: scaleY(0); transition: transform 0.22s ease-out 0.24s; }
.env .seal, .env .paws { transform-origin: 150px 124px; transition: opacity 0.16s, transform 0.16s; }
.env .letter { transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) 0.32s; }
.opening .env-wrap { animation: none; }
.opening .peek { transform: translateY(50px); opacity: 0; }
.opening .env .flap-front { transform: scaleY(0); }
.opening .env .flap-back { transform: scaleY(-1); }
.opening .env .seal, .opening .env .paws { opacity: 0; transform: scale(0.6); }
.opening .env .letter { transform: translateY(-60px); }
.envelope .hint { font: 600 26px/1.2 var(--hand); color: var(--plum); animation: denyut 2.2s ease-in-out infinite; }

/* Pembuka + beruang */
.hero { background: linear-gradient(180deg, var(--lilac) 0%, #f6e3f1 60%, var(--peach) 100%); gap: 10px; padding-top: 70px; }
.hero > * { position: relative; }
.cloud { position: absolute !important; width: 120px; height: 46px; border-radius: 999px; background: rgba(255, 255, 255, 0.65); }
.cloud::before, .cloud::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.cloud::before { width: 54px; height: 54px; left: 18px; top: -26px; }
.cloud::after { width: 40px; height: 40px; right: 22px; top: -16px; }
.c1 { top: 12%; left: -34px; }
.c2 { top: 30%; right: -40px; transform: scale(0.8); }
.hero h1 { font: 600 50px/1.02 var(--round); letter-spacing: -0.01em; color: var(--plum); margin-top: 10px; text-wrap: balance; }
.hero h1 span { color: var(--rose); }
.bear { position: relative; display: block; width: min(270px, 72vw); margin: 4px auto 0; padding: 0; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; border-radius: 40px; }
.bear:focus-visible { outline: 3px dashed var(--lilac-3); outline-offset: 6px; }
.bear-svg { display: block; width: 100%; height: auto; overflow: visible; animation: napas 3.4s ease-in-out infinite; transform-origin: 50% 100%; }
.bear .arm { transform-box: view-box; transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1); }
.bear .arm-l { transform-origin: 79px 158px; transform: rotate(-38deg); }
.bear .arm-r { transform-origin: 161px 158px; transform: rotate(38deg); }
.bear[aria-pressed=true] .arm-l { transform: rotate(128deg); }
.bear[aria-pressed=true] .arm-r { transform: rotate(-128deg); }
.bear .happy { opacity: 0; transition: opacity 0.2s; }
.bear .sad { transition: opacity 0.2s; }
.bear[aria-pressed=true] .happy { opacity: 1; }
.bear[aria-pressed=true] .sad { opacity: 0; }
.bear .held { transform-box: view-box; transform-origin: 120px 174px; transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.bear[aria-pressed=true] .held { transform: translateY(-14px) scale(1.25); }
.fly { position: absolute; width: 22px; height: 20px; fill: var(--rose); opacity: 0; pointer-events: none; }
.f1 { left: 20%; top: 40%; } .f2 { left: 74%; top: 36%; width: 16px; fill: var(--tn-3); } .f3 { left: 46%; top: 22%; width: 26px; } .f4 { left: 8%; top: 18%; width: 14px; fill: #ffb08f; } .f5 { left: 86%; top: 14%; width: 18px; }
.bear[aria-pressed=true] .fly { opacity: 0.9; transform: translateY(-34px); transition: opacity 0.3s, transform 0.6s; }
.bear.pop .fly { animation: terbang 1.6s ease-out both; }
.bear.pop .f2 { animation-delay: 0.12s; } .bear.pop .f3 { animation-delay: 0.05s; } .bear.pop .f4 { animation-delay: 0.22s; } .bear.pop .f5 { animation-delay: 0.3s; }
.caption { font: 600 27px/1.2 var(--hand); color: var(--plum-2); min-height: 34px; }
.caption span { display: none; }
.js .caption .before { display: inline; }
.js .bear[aria-pressed=true] + .caption .before { display: none; }
.js .bear[aria-pressed=true] + .caption .after { display: inline; color: var(--rose); }
.js-only { display: none; }
.js [data-opener=story] .js-only { display: block; }
.hero .js-only { margin-top: 10px; opacity: 0.85; }

/* Pesan: kertas catatan dengan selotip */
.message { background: linear-gradient(180deg, var(--peach) 0%, #fdeee6 100%); padding: 72px 22px; }
.note-card { position: relative; width: 100%; padding: 46px 26px 34px; border-radius: 22px; text-align: left; transform: rotate(-1.2deg); box-shadow: 0 28px 50px -26px rgba(120, 60, 80, 0.45), 0 2px 0 color-mix(in srgb, var(--tn-2) 5%, transparent); background: linear-gradient(90deg, transparent 0 40px, rgba(255, 143, 163, 0.35) 40px 42px, transparent 42px), radial-gradient(circle, var(--tn-4) 1.4px, transparent 1.6px) 0 0 / 22px 22px, var(--paper); }
.note-card > * { transform: rotate(1.2deg); }
.tape { position: absolute; top: -16px; left: 50%; width: 120px; height: 34px; margin-left: -60px; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--tn-5) 85%, transparent) 0 8px, color-mix(in srgb, var(--tn-6) 85%, transparent) 8px 16px); border-radius: 3px; transform: rotate(-4deg) !important; box-shadow: 0 2px 6px color-mix(in srgb, var(--tn-2) 12%, transparent); }
.message .eyebrow { padding-left: 26px; margin-bottom: 6px; }
.message .text { padding-left: 26px; font: 500 18px/33px "Nunito", sans-serif; color: var(--tn-7); white-space: pre-line; text-wrap: pretty; }
.from { padding-left: 26px; margin-top: 18px; font: 600 25px/1.2 var(--hand); color: var(--plum-2); }
.from strong { display: block; font-size: 36px; color: var(--plum); font-weight: 600; }
.from svg { display: inline-block; width: 22px; height: 20px; fill: var(--rose); vertical-align: -2px; margin-left: 4px; }

/* Galeri polaroid */
.gallery { background: linear-gradient(180deg, #fdeee6, var(--lilac)); gap: 22px; }
.polaroids { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px 14px; }
.polaroids figure { width: calc(50% - 7px); padding: 8px 8px 28px; background: #fff; border-radius: 6px; box-shadow: 0 16px 30px -18px color-mix(in srgb, var(--tn-2) 55%, transparent); transform: rotate(-3deg); }
.polaroids figure:nth-child(even) { transform: rotate(3deg) translateY(10px); }
.polaroids figure:first-child:nth-last-child(odd) { width: 78%; }
.polaroids img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; }

/* Balasan */
.reply { background: linear-gradient(180deg, var(--lilac) 0%, #f5e4f2 100%); padding: 64px 26px; }
.reply > * { position: relative; }
.mini-bear { width: 128px; height: auto; overflow: visible; animation: napas 3.4s ease-in-out infinite; }
.reply h2 { font: 600 40px/1.05 var(--round); color: var(--plum); }
.reply h2 span { color: var(--rose); }
.reply form { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 4px; }
.quick { display: flex; flex-direction: column; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 10px 22px; border: 0; border-radius: 999px; background: var(--plum); color: #fff; font: 600 18px/1.25 var(--round); cursor: pointer; box-shadow: 0 12px 22px -12px color-mix(in srgb, var(--tn-2) 80%, transparent); transition: transform 0.15s; }
.btn.ghost { background: #fff; color: var(--plum); font-weight: 500; font-size: 17px; box-shadow: inset 0 0 0 2px var(--lilac-2), 0 8px 18px -12px color-mix(in srgb, var(--tn-2) 50%, transparent); }
.btn:active { transform: scale(0.97); }
.btn.ghost:hover { box-shadow: inset 0 0 0 2px var(--lilac-3); }
.btn:focus-visible, textarea:focus-visible { outline: 3px solid var(--lilac-3); outline-offset: 2px; }
textarea { font: 17px/1.5 "Nunito", sans-serif; padding: 14px 18px; border: 2px solid var(--lilac-2); border-radius: 22px; background: rgba(255, 255, 255, 0.8); color: var(--plum); min-height: 104px; resize: vertical; }
textarea::placeholder { color: var(--tn-8); }
.sent { font: 600 26px/1.25 var(--hand); color: var(--plum); background: #fff; padding: 12px 20px; border-radius: 18px; }
footer { position: relative; z-index: 1; padding: 26px; text-align: center; font: 500 14px/1.4 var(--round); color: var(--plum-2); }
footer a { color: var(--plum); }

/* Story */
.bars { display: none; }
.js [data-opener=story] .bars { display: flex; position: fixed; top: 10px; left: 50%; transform: translateX(-50%); width: min(452px, calc(100% - 28px)); gap: 5px; z-index: 30; color: var(--plum); }
.bars span { flex: 1; height: 4px; border-radius: 4px; background: currentColor; opacity: 0.18; }
.bars span.done { opacity: 0.75; }
.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; }

.music-toggle { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 50px; height: 50px; border: 0; border-radius: 50%; background: #fff; color: var(--plum); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--tn-2) 45%, transparent); }
.music-toggle[aria-pressed=true] span { display: inline-block; animation: putar 3s linear infinite; }

@keyframes muncul { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes goyang { 0%, 100% { transform: rotate(-1deg); } 50% { transform: rotate(1deg) translateY(-4px); } }
@keyframes napas { 50% { transform: scale(1.02, 0.985); } }
@keyframes terbang { 0% { opacity: 0; transform: translateY(20px) scale(0.4); } 30% { opacity: 1; } 100% { opacity: 0.9; transform: translateY(-34px) scale(1); } }
@keyframes denyut { 50% { opacity: 0.55; } }
@keyframes putar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 700px) {
  main { margin: 0 auto; border-left: 1px solid rgba(255, 255, 255, 0.7); border-right: 1px solid rgba(255, 255, 255, 0.7); box-shadow: 0 30px 80px -20px color-mix(in srgb, var(--tn-2) 35%, transparent); }
}
/* Mode langsung & tanpa JS: bagian setelah pembuka mengikuti tinggi isinya */
[data-opener=langsung] main > section:not(.hero), [data-opener=amplop].opened main > section:not(.hero), html:not(.js) main > section:not(.hero) { min-height: 0; padding-top: 80px; padding-bottom: 80px; }

/* ---------- Animasi ---------- */
@media (prefers-reduced-motion: no-preference) {
  main > section:not(.envelope) :where(.eyebrow) { animation: mo-naik .8s var(--mo-e) .05s both; }
  main > section:not(.envelope) :where(h1, h2) { animation: mo-naik .9s var(--mo-e) .16s both; }
  main > section:not(.envelope) :where(.text, .lead, .letter) { animation: mo-naik .9s var(--mo-e) .34s both; }
  main > section:not(.envelope) :where(.from) { animation: mo-naik .8s var(--mo-e) .52s both; }
  main > section:not(.envelope) :where(.photos) { animation: mo-naik .9s var(--mo-e) .46s both; }
  main > section:not(.envelope) :where(.quick, form, .note) { animation: mo-naik .8s var(--mo-e) .62s both; }
  main > section:not(.envelope) :where(.hint) { animation: mo-naik .8s var(--mo-e) .75s both; }
  :root { --mo-e: cubic-bezier(.2,.7,.2,1); }

  .cloud { animation: mo-geser 15s ease-in-out infinite alternate; }
}
@keyframes mo-denyut { 0%, 100% { scale: 1; } 50% { scale: 1.08; } }
@keyframes mo-ambang { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }
@keyframes mo-ayun { from { rotate: -2.2deg; } to { rotate: 2.2deg; } }
@keyframes mo-putar { to { rotate: 360deg; } }
@keyframes mo-kerlip { 0%, 100% { opacity: 1; scale: 1; } 50% { opacity: .35; scale: .72; } }
@keyframes mo-kilau { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes mo-geser { from { translate: -26px 0; } to { translate: 26px 0; } }
@keyframes mo-garis { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes mo-naik { from { opacity: 0; translate: 0 22px; } to { opacity: 1; translate: 0 0; } }
@keyframes mo-blur { from { opacity: 0; filter: blur(10px); scale: 1.05; } to { opacity: 1; filter: blur(0); scale: 1; } }
@keyframes mo-pop { from { opacity: 0; scale: .55; rotate: -8deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes mo-nudge { 0%, 100% { translate: 0 0; } 50% { translate: 5px 0; } }
@keyframes mo-hujan { to { background-position: 0 520px, 0 520px, 0 520px, 0 780px, 0 780px; } }
@keyframes mo-wiggle { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; } }

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