/* Benang — ucapan permintaan maaf, lukisan cat air: sudut baca yang tenang di sore hari (jendela bertirai, bangku
   jendela berselimut merah muda, keranjang wol). Di atasnya benang merah kusut (SVG) keluar dari gulungan wol.
   Dibuka ("mengurai benang kusut"): benang kusut tergulung habis, lalu benang yang sama ditarik rapi membentuk hati,
   dan ram sulam muncul di tengahnya dengan tulisan "Maaf, {nama}" yang tersulam dari kiri. Isinya: surat di kain
   linen berjahit, janji (list `promises`) sebagai jahitan yang terajut satu per satu, foto disemat jarum pentul,
   balasan. Tanpa JS adegan tidak dipakai dan semua isi langsung terbaca. */
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces.woff2") format("woff2"); font-weight: 300 700; 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; }
@font-face { font-family: "Caveat"; src: url("fonts/caveat.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --bg: #f6ece6; --card: #fffaf5; --ink: #3a2a2a; --soft: #7a6461; --merah: #c4302b; --rose: #b8606a; --sage: #7d927a; --linen: #f4ece0; --line: #ead8cf;
  --display: "Fraunces", Georgia, serif; --sans: "Plus Jakarta Sans", system-ui, sans-serif; --hand: "Caveat", cursive;
  --W: min(100vw, 480px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; color: var(--ink); font: 500 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; background: var(--bg); }
img { max-width: 100%; display: block; }
h1, h2, p, figure, ol { margin: 0; }
a { color: var(--rose); }
:focus-visible { outline: 2px solid var(--merah); outline-offset: 3px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
main { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; }

/* ---------- Adegan (latar saja): sudut baca + sinar + debu cahaya. ---------- */
.scene { position: fixed; top: 0; left: 50%; width: min(100%, 480px); height: 100%; transform: translateX(-50%); z-index: 0; pointer-events: none; overflow: hidden; contain: strict; background: #efe2d8; display: none; }
.js .scene { display: block; }
.scene-off .scene { visibility: hidden; }
.stage { position: absolute; left: 50%; top: 50%; height: max(100%, calc(min(100vw, 480px) * 1.7917)); aspect-ratio: 1536 / 2752; translate: -50% -50%; }
.latar { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.sinar { position: absolute; left: 15%; top: 5%; width: 75%; height: 70%; background: linear-gradient(165deg, rgba(255, 236, 200, .5), rgba(255, 230, 190, .1) 60%, transparent); clip-path: polygon(25% 0, 75% 0, 100% 100%, 10% 100%); mix-blend-mode: screen; }
.debu i { position: absolute; width: .6%; aspect-ratio: 1; border-radius: 50%; background: #fff6e4; box-shadow: 0 0 6px 2px rgba(255, 240, 210, .7); opacity: .7; }
.debu i:nth-child(1) { left: 30%; top: 30%; } .debu i:nth-child(2) { left: 48%; top: 22%; } .debu i:nth-child(3) { left: 62%; top: 40%; }
.debu i:nth-child(4) { left: 40%; top: 48%; } .debu i:nth-child(5) { left: 70%; top: 26%; } .debu i:nth-child(6) { left: 55%; top: 55%; }
/* Selubung lembut supaya benang & ram terbaca di atas lukisan. */
.js .hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 45% at 50% 50%, rgba(255, 248, 240, .55), transparent 75%); pointer-events: none; }

/* ---------- Layar pertama: benang, gulungan wol, ram sulam ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; text-align: center; background: linear-gradient(180deg, #f1e1d8, var(--bg)); }
.js .hero { background: none; display: block; padding: 0; }
.kicker { font: 700 11px/1.4 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--rose); }
.benang { display: none; }
.js .benang { display: block; position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.benang path { fill: none; stroke: var(--merah); stroke-width: .65; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 1; } /* lebar dalam satuan viewBox: vector-effect membuat pathLength diabaikan */
.gulungan { display: none; }
/* Ujung benang di (27, 152) satuan SVG = lebar/100; gulungan diletakkan supaya ujung wolnya tepat di situ. */
.js .gulungan { display: block; position: absolute; left: 7%; top: calc(50% + var(--W) * .445); width: 24%; }
.js .ram { position: absolute; left: 50%; top: 50%; width: 52%; translate: -50% calc(-50% + var(--W) * .04); }
.ram { position: relative; width: min(80%, 320px); }
.ram-img { width: 100%; height: auto; }
.sulam { position: absolute; left: 18%; right: 18%; top: 22%; bottom: 34%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.sulam .kicker { font-size: 9px; letter-spacing: .2em; }
.sulam h1 { font: 500 clamp(24px, 7.5vw, 34px)/1.05 var(--display); color: var(--ink); }
.sulam h1 em { font: 700 clamp(32px, 10vw, 46px)/1 var(--hand); color: var(--merah); font-style: normal; }
.ketuk { display: none; }
.js:not(.is-open) .ketuk { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 10px; max-width: 480px; margin: 0 auto; padding-bottom: 6vh; cursor: pointer; }
.ketuk .kicker { color: var(--ink); text-shadow: 0 1px 6px rgba(255, 250, 245, .9); }
.ketuk .hint { padding: 12px 24px; border-radius: 999px; background: var(--merah); color: #fff; font: 700 14px/1 var(--sans); box-shadow: 0 10px 24px rgba(120, 30, 30, .3); }
.memuat .ketuk { pointer-events: none; } .memuat .ketuk .hint { opacity: .55; }
.mouse { position: absolute; left: 50%; bottom: 2vh; width: 20px; height: 32px; margin-left: -10px; border: 2px solid var(--rose); border-radius: 12px; opacity: .8; }
.mouse::after { content: ""; position: absolute; left: 50%; top: 6px; width: 3px; height: 6px; margin-left: -1.5px; border-radius: 2px; background: var(--rose); }
html:not(.js) .mouse { display: none; }

/* Keadaan sesudah dibuka: benang kusut tergulung habis, hati tergambar, ram tampil. */
.kusut { stroke-dashoffset: -1; opacity: 0; }
.hati { stroke-dashoffset: 0; }
.js .kusut { transition: stroke-dashoffset 1.6s cubic-bezier(.6, 0, .4, 1), opacity .3s ease 1.5s; }
.js .hati { transition: stroke-dashoffset 2s cubic-bezier(.45, 0, .2, 1) 1.1s; }
.js:not(.is-open) .kusut { stroke-dashoffset: 0; opacity: 1; }
.js:not(.is-open) .hati { stroke-dashoffset: 1; }
.no-anim .kusut, .no-anim .hati, .no-anim .ram, .no-anim .sulam > * { transition: none !important; }

/* ---------- Isi ---------- */
.content { position: relative; z-index: 1; background-color: var(--bg); background-image: repeating-linear-gradient(0deg, rgba(184, 96, 106, .05) 0 1px, transparent 1px 6px), repeating-linear-gradient(90deg, rgba(184, 96, 106, .05) 0 1px, transparent 1px 6px); }
.content > section { padding: 56px 22px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.lbl { font: 700 11px/1.4 var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--rose); }
.content h2 { font: 500 28px/1.2 var(--display); color: var(--ink); }
.content h2 em { font: 700 34px/1 var(--hand); color: var(--merah); font-style: normal; }
.hint { font-size: 14px; color: var(--soft); }
.orn { pointer-events: none; }
.rangkai { width: 94%; margin-bottom: -26px; position: relative; z-index: 1; }
.kain { position: relative; width: 100%; padding: 40px 26px 26px; text-align: left; background: repeating-linear-gradient(0deg, rgba(120, 90, 60, .05) 0 1px, transparent 1px 4px), repeating-linear-gradient(90deg, rgba(120, 90, 60, .05) 0 1px, transparent 1px 4px), var(--linen); border-radius: 6px; box-shadow: 0 16px 34px rgba(80, 40, 40, .12); }
.kain::before { content: ""; position: absolute; inset: 10px; border: 2px dashed rgba(196, 48, 43, .55); border-radius: 4px; pointer-events: none; }
.msg { font: 500 24px/1.4 var(--hand); white-space: pre-line; }
.sign { font: 700 28px/1.2 var(--hand); color: var(--merah); text-align: right; }

/* Janji: tiap baris diikat simpul silang dan digarisbawahi jahitan putus-putus. */
.jahitan { width: 100%; list-style: none; padding: 0; display: grid; gap: 14px; text-align: left; }
.jahitan li { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 4px 12px; font: 500 17px/1.45 var(--display); }
.jahitan li::after { content: ""; position: absolute; left: 34px; right: 0; bottom: 0; border-bottom: 2px dashed var(--merah); transform-origin: 0 50%; }
.jahitan svg { flex: none; width: 20px; height: 20px; color: var(--merah); }

/* Foto disemat jarum pentul. */
.sematan { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.sematan figure { position: relative; width: 46%; padding: 7px 7px 24px; background: #fff; box-shadow: 0 10px 22px rgba(80, 40, 40, .18); rotate: -2deg; }
.sematan figure:nth-child(even) { rotate: 2.5deg; }
.sematan figure::before { content: ""; position: absolute; left: 50%; top: -7px; width: 14px; height: 14px; translate: -50% 0; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f19a9a, var(--merah)); box-shadow: 0 2px 3px rgba(0, 0, 0, .25); }
.sematan img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.card { margin: 0 16px; border-radius: 18px; background: var(--card); box-shadow: 0 16px 34px rgba(80, 40, 40, .1); }
.reply form { width: 100%; display: grid; gap: 10px; }
.quick { display: grid; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--merah); color: #fff; cursor: pointer; font: 700 14px/1.2 var(--sans); }
.btn.ghost { background: transparent; color: var(--merah); border: 1.5px solid var(--merah); }
.reply textarea { width: 100%; min-height: 96px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; font: 500 16px/1.4 var(--sans); color: var(--ink); background: #fff; }
.penutup { padding-bottom: 90px !important; }
.gulungan-kecil { width: 30%; }
.penutup p:not(.sign) { font: italic 400 22px/1.4 var(--display); color: var(--ink); max-width: 18em; }
.penutup .sign { text-align: center; }
.foot { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; padding: 0 16px 90px; text-align: center; font-size: 12px; color: var(--soft); background: var(--bg); }

.music-toggle { position: fixed; right: max(14px, calc(50% - 226px)); bottom: 16px; z-index: 50; width: 46px; height: 46px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--merah); color: #fff; cursor: pointer; box-shadow: 0 8px 20px rgba(100, 20, 20, .3); }
.music-toggle svg { width: 20px; height: 20px; }
.js:not(.is-open) .music-toggle { display: none; }
.js:not(.is-open) body { overflow: hidden; }

/* ---------- Gerak ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js:not(.is-open) .ketuk .hint { animation: denyut 1.6s ease-in-out infinite alternate; }
  .js:not(.is-open) .benang { animation: getar 2.6s ease-in-out infinite; }
  .js .ram { transition: scale 1.1s cubic-bezier(.3, 1.35, .4, 1) 2.5s, opacity .6s ease 2.5s; }
  .js:not(.is-open) .ram { scale: .4; opacity: 0; }
  .js .sulam > * { transition: clip-path 1s cubic-bezier(.5, 0, .3, 1); clip-path: inset(0 0 0 0); }
  .js:not(.is-open) .sulam > * { clip-path: inset(0 100% 0 0); }
  .js .sulam > :nth-child(1) { transition-delay: 3.2s; } .js .sulam > :nth-child(2) { transition-delay: 3.5s; }
  .js.is-open .hati { animation: denyut 2.4s ease-in-out 3.4s infinite alternate; transform-origin: 50% 50%; transform-box: fill-box; }
  .js.is-open .gulungan { animation: putar .5s linear 6 forwards; transform-origin: 50% 50%; }
  .debu i { animation: debu 7s ease-in-out infinite alternate; } .debu i:nth-child(2n) { animation-duration: 9s; animation-delay: -3s; }
  .mouse::after { animation: gulir 1.6s ease-in-out infinite; }
  .anim .reveal { transition: opacity .9s cubic-bezier(.2, .7, .2, 1), translate .9s cubic-bezier(.2, .7, .2, 1); }
  .anim .reveal:not(.in) { opacity: 0; translate: 0 30px; }
  .anim .janji:not(.in) .jahitan li::after { scale: 0 1; }
  .jahitan li::after { transition: scale 1s cubic-bezier(.5, 0, .3, 1); }
  .jahitan li:nth-child(1)::after { transition-delay: .3s; } .jahitan li:nth-child(2)::after { transition-delay: .7s; } .jahitan li:nth-child(3)::after { transition-delay: 1.1s; }
  .jahitan li:nth-child(4)::after { transition-delay: 1.5s; } .jahitan li:nth-child(n+5)::after { transition-delay: 1.9s; }
  .anim .janji:not(.in) .jahitan svg { rotate: -180deg; opacity: 0; }
  .jahitan svg { transition: rotate .6s ease .2s, opacity .4s ease .2s; }
  .anim .kenangan.in .sematan figure { animation: semat .9s cubic-bezier(.3, 1.3, .4, 1) both; }
  .sematan figure:nth-child(2) { animation-delay: .2s !important; } .sematan figure:nth-child(3) { animation-delay: .4s !important; }
}
@keyframes denyut { from { opacity: .8; scale: .98; } to { opacity: 1; scale: 1.02; } }
@keyframes getar { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(.4%, -.3%); } 75% { transform: translate(-.4%, .3%); } }
@keyframes putar { to { rotate: 360deg; } }
@keyframes debu { from { translate: 0 0; opacity: .3; } to { translate: 12px -26px; opacity: .9; } }
@keyframes semat { from { opacity: 0; transform: translateY(-30px) rotate(-10deg); } to { opacity: 1; transform: none; } }
@keyframes gulir { 0% { translate: 0 0; opacity: 1; } 70% { translate: 0 10px; opacity: 0; } 100% { translate: 0 0; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; } .js .kusut, .js .hati, .js .ram, .js .sulam > * { transition: none !important; } }

/* Video opsional (field "video"). */
.vk { width: min(100%, 440px); margin: 34px auto; padding: 0 20px; text-align: center; flex-direction: column; align-items: center; justify-content: center; }
.vk-judul { margin: 0 0 12px; font-weight: 700; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; opacity: .85; }
.vk-layar { position: relative; width: 100%; 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; }
