/* Toga — ucapan wisuda & kelulusan: gulungan ijazah, toga yang dilempar, piagam berstempel emas. */
@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: #070e22;
  --bg: #0e1a36;
  --bg-2: #182a57;
  --text: #f4ecd8;
  --muted: #b9c2dc;
  --gold: #e2bd6b;
  --gold-soft: #f6e2aa;
  --gold-deep: #b0822f;
  --paper: #fbf5e6;
  --paper-2: #eadcb9;
  --paper-3: #cdb98a;
  --ink: #1c2440;
  --ink-soft: #5a6382;
  --ribbon: #b3323a;
  --ribbon-2: #8a1f28;
  --cap: #233669;
  --cap-2: #182650;
  --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"): biru-malam = bawaan di atas. */
:root[data-tone="marun"] { --page: #1f060c; --bg: #3a0f1a; --bg-2: #5b1c2b; --muted: #e3c5cb; --ink: #3a0f1a; --ink-soft: #7d4d58; --ribbon: #22346a; --ribbon-2: #16224a; --cap: #74263a; --cap-2: #581b2a; }
:root[data-tone="zamrud"] { --page: #061a13; --bg: #0d3326; --bg-2: #165544; --muted: #c0dccf; --ink: #0f2e23; --ink-soft: #4d7063; --cap: #1d6e56; --cap-2: #155544; }

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

/* Warna bagian SVG (ikut tone) */
.c-gold { fill: var(--gold); }
.c-gold-deep { fill: var(--gold-deep); }
.c-scallop { fill: none; stroke: var(--gold-deep); stroke-width: 7; stroke-dasharray: 5.4 4.34; }
.c-ring { fill: none; stroke: var(--gold-deep); stroke-width: 1.2; opacity: 0.7; }
.c-ribbon { fill: var(--ribbon); }
.c-ribbon-2 { fill: var(--ribbon-2); }
.c-paper { fill: var(--paper); }
.c-paper-2 { fill: var(--paper-2); }
.c-paper-3 { fill: var(--paper-3); }
.c-shadow { fill: #000; opacity: 0.28; }
.c-cap { fill: var(--cap); }
.c-cap-2 { fill: var(--cap-2); }
.c-cap-edge { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linejoin: round; }
.c-cap-shine { fill: none; stroke: #fff; stroke-opacity: 0.1; stroke-width: 1; }
.c-cord { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.c-fringe { fill: none; stroke: var(--gold-deep); stroke-width: 1.2; stroke-linecap: round; }

main {
  max-width: 480px; margin: 0 auto; position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.6px),
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.4) 0 1px, transparent 1.6px),
    radial-gradient(circle at 42% 64%, rgba(255, 255, 255, 0.35) 0 1px, transparent 1.6px),
    radial-gradient(circle at 90% 82%, rgba(255, 255, 255, 0.45) 0 1px, transparent 1.6px),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 55%, var(--bg) 100%);
  background-size: 190px 210px, 230px 170px, 160px 250px, 210px 190px, auto;
}
@media (min-width: 560px) { main { box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55); } }
section { min-height: 100vh; min-height: 100svh; padding: 60px 28px; 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(--gold); }
.hint { font-family: var(--display); font-size: 15px; font-style: italic; color: var(--muted); }
.js-only, .tap { display: none; }
.js .tap { display: block; }

/* Hero */
.hero { background: radial-gradient(closest-side circle at 50% 34%, color-mix(in srgb, var(--gold) 26%, transparent), transparent 100%); }
.star { position: absolute; color: var(--gold-soft); }
.s1 { width: 18px; height: 18px; top: 9%; left: 13%; }
.s2 { width: 11px; height: 11px; top: 16%; right: 16%; }
.s3 { width: 14px; height: 14px; top: 39%; left: 8%; }
.s4 { width: 10px; height: 10px; top: 33%; right: 9%; }
.s5 { width: 13px; height: 13px; bottom: 7%; left: 16%; }
.cap { position: relative; width: min(74%, 264px); padding: 0; margin: 6px 0 2px; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cap svg { width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.45)); }
.tassel { transform-box: view-box; transform-origin: 202px 86px; }
.hero h1 { display: flex; flex-direction: column; align-items: center; max-width: 100%; }
.greet { font-size: 30px; line-height: 1.2; font-weight: 500; letter-spacing: 0.01em; color: var(--text); }
.hero .name { font: 400 clamp(56px, 19vw, 78px)/1.05 var(--script); color: var(--gold-soft); padding: 4px 10px 0; max-width: 100%; overflow-wrap: anywhere; text-shadow: 0 2px 18px color-mix(in srgb, var(--gold) 35%, transparent); }
.laurel { display: flex; align-items: flex-end; justify-content: center; gap: 10px; color: var(--gold); margin-top: 2px; }
.laurel svg { width: 92px; height: 46px; }
.laurel svg:first-child { transform: scaleX(-1) rotate(-6deg); }
.laurel .flip { transform: rotate(-6deg); }
.laurel .star { position: static; width: 14px; height: 14px; margin-bottom: 4px; color: var(--gold-soft); }
.degree { font-family: var(--display); font-size: 21px; font-weight: 600; line-height: 1.3; color: var(--text); margin-top: 4px; }
.school { font-size: 13px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); line-height: 1.6; }
.hero .hint { margin-top: 10px; }

/* Piagam */
.cert { position: relative; width: 100%; padding: 40px 26px 46px; text-align: left; color: var(--ink); background: var(--paper); border-radius: 4px; box-shadow: 0 0 0 1px var(--gold-deep), 0 24px 50px rgba(0, 0, 0, 0.45); }
.cert::before { content: ""; position: absolute; inset: 9px; border: 1.5px solid var(--gold-deep); outline: 1px solid color-mix(in srgb, var(--gold-deep) 55%, transparent); outline-offset: 3px; border-radius: 2px; pointer-events: none; }
.cert .eyebrow { color: var(--gold-deep); margin-bottom: 16px; font-size: 11px; letter-spacing: 0.26em; line-height: 1.6; }
.message .text { white-space: pre-line; font-family: var(--display); font-size: 18px; line-height: 1.75; }
.from { margin-top: 22px; font-family: var(--display); font-size: 15px; font-style: italic; color: var(--ink-soft); padding-right: 76px; }
.from span { display: block; font: 400 42px/1.2 var(--script); color: var(--ink); overflow-wrap: anywhere; }
.seal { position: absolute; right: 14px; bottom: -22px; width: 76px; height: 99px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.3)); }

/* Galeri */
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.photos figure { margin: 0; background: var(--paper); padding: 8px 8px 24px; box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4); transform: rotate(-2deg); }
.photos figure:nth-child(even) { transform: rotate(2deg); }
.photos figure:first-child:last-child, .photos figure:nth-child(3):last-child, .photos figure:nth-child(5):last-child { grid-column: 1 / -1; }
.photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.photos figure:nth-child(odd):last-child img { aspect-ratio: 3 / 2; }

/* Balasan */
.reply { background: radial-gradient(closest-side circle at 50% 40%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 100%); }
.medal { width: 62px; height: 81px; }
.reply h2 { font-size: 32px; line-height: 1.2; max-width: 11em; }
.reply h2 em { display: block; font: 400 52px/1.1 var(--script); color: var(--gold-soft); }
.lead { color: var(--muted); margin-top: 8px; font-family: var(--display); font-style: italic; }
.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: linear-gradient(180deg, var(--gold-soft), var(--gold) 55%, var(--gold-deep)); color: #2a1e05; font: 700 15px/1 var(--body); cursor: pointer; box-shadow: 0 10px 22px -10px var(--gold); }
.btn.ghost { background: color-mix(in srgb, var(--bg) 55%, transparent); color: var(--text); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gold) 60%, transparent); font-weight: 600; }
.btn:focus-visible, textarea:focus-visible, .envelope:focus-visible, .cap:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 3px; }
textarea { font: inherit; font-size: 16px; padding: 14px 16px; border: 0; border-radius: 14px; background: color-mix(in srgb, var(--bg) 60%, transparent); color: var(--text); min-height: 96px; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--gold) 45%, transparent); resize: vertical; }
textarea::placeholder { color: var(--muted); opacity: 0.8; }
.note { color: var(--gold-soft); font-weight: 600; }

/* Gulungan ijazah (opener "amplop") */
.envelope { display: none; }
.js [data-opener=amplop] .envelope { display: flex; cursor: pointer; background: radial-gradient(closest-side circle at 50% 56%, color-mix(in srgb, var(--gold) 24%, transparent), transparent 100%); }
.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 36px/1.15 var(--display); color: var(--text); margin-bottom: 10px; }
.scroll { width: min(100%, 320px); height: auto; overflow: visible; }
.roll, .tie { transform-box: view-box; transform-origin: 150px 73px; }
.envelope .hint { margin-top: 12px; }

/* 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(--text); opacity: 0.22; }
.bars span.done { opacity: 0.95; background: var(--gold); }
.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(--muted); background: var(--bg); border-top: 1px solid color-mix(in srgb, var(--gold) 22%, transparent); }
footer a { color: var(--gold); font-weight: 700; }
.music-toggle { position: fixed; right: max(16px, calc(50% - 240px + 16px)); bottom: 16px; z-index: 20; width: 48px; height: 48px; border: 1px solid var(--gold); border-radius: 50%; background: var(--bg); color: var(--gold-soft); font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }
.music-toggle[aria-pressed=true] span { display: inline-block; animation: putar 3s linear infinite; }

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

/* Konfeti (dibuat toga.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(--gold); opacity: 0; animation: jatuh var(--t, 2.6s) cubic-bezier(0.25, 0.6, 0.45, 1) var(--dl, 0s) forwards; }
.confetti i:nth-child(4n + 1) { background: var(--paper); }
.confetti i:nth-child(4n + 2) { background: var(--gold-soft); width: 7px; height: 7px; border-radius: 50%; }
.confetti i:nth-child(4n + 3) { background: var(--ribbon); }
@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.55; rotate: -8deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes mo-kerlip { 0%, 100% { opacity: 1; scale: 1; } 50% { opacity: 0.3; scale: 0.7; } }
@keyframes mo-ambang { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }
@keyframes mo-ayun { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
@keyframes mo-angguk { 0%, 100% { rotate: -2deg; } 50% { rotate: 2deg; translate: 0 -6px; } }
@keyframes mo-mendarat { from { opacity: 0; translate: 0 -120px; rotate: -24deg; } to { opacity: 1; translate: 0 0; rotate: 0deg; } }
@keyframes mo-lempar { 0% { translate: 0 0; rotate: 0deg; } 38% { translate: 0 -190px; rotate: -200deg; } 70% { translate: 0 10px; rotate: -360deg; } 84% { translate: 0 -12px; rotate: -360deg; } 100% { translate: 0 0; rotate: -360deg; } }

@media (prefers-reduced-motion: no-preference) {
  :root { --mo-e: cubic-bezier(0.2, 0.7, 0.2, 1); }
  main > section:not(.envelope) :where(.eyebrow) { animation: mo-naik 0.8s var(--mo-e) 0.05s both; }
  main > section:not(.envelope) :where(h1, h2) { animation: mo-naik 0.9s var(--mo-e) 0.3s both; }
  main > section:not(.envelope) :where(.laurel, .degree, .school) { animation: mo-naik 0.9s var(--mo-e) 0.5s both; }
  main > section:not(.envelope) :where(.cert, .lead) { animation: mo-naik 0.9s var(--mo-e) 0.2s both; }
  main > section:not(.envelope) :where(.quick, form, .note) { animation: mo-naik 0.8s var(--mo-e) 0.5s both; }
  main > section:not(.envelope) :where(.hint) { animation: mo-naik 0.8s var(--mo-e) 0.8s both; }
  .hero .cap { animation: mo-mendarat 1s cubic-bezier(0.3, 1.35, 0.5, 1) 0.1s both; }
  .hero .cap svg { animation: mo-ambang 6s ease-in-out 1.2s infinite; }
  .hero .cap.toss svg { animation: mo-lempar 1.25s cubic-bezier(0.3, 0.6, 0.4, 1) both; }
  .tassel { animation: mo-ayun 2.6s ease-in-out infinite alternate; }
  .star { animation: mo-kerlip 3.2s ease-in-out infinite; }
  .s2 { animation-delay: -1.1s; } .s3 { animation-delay: -2s; } .s4 { animation-delay: -0.5s; } .s5 { animation-delay: -1.6s; }
  .seal { animation: mo-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s both; }
  main .photos figure { animation: mo-pop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both; }
  main .photos figure:nth-child(2) { animation-delay: 0.52s; }
  main .photos figure:nth-child(3) { animation-delay: 0.64s; }
  main .photos figure:nth-child(n+4) { animation-delay: 0.76s; }

  .scroll { animation: mo-angguk 3.6s ease-in-out infinite; }
  .tie { transition: opacity 0.35s ease, translate 0.45s ease-in; }
  .roll { transition: scale 0.6s ease-in 0.2s, opacity 0.4s ease-in 0.4s; }
  .opening .envelope .tie { opacity: 0; translate: 0 46px; }
  .opening .envelope .roll { scale: 1.5 1.25; opacity: 0; }
  .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; } }

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