/* Mahkota — undangan pernikahan bertema kerajaan: gerbang istana 3D yang terbuka, mahkota emas, panji berkibar,
   debu emas (scene.js + three.js); isi di atas warna kerajaan dan emas dengan huruf Cinzel. */
@font-face { font-family: "Cinzel"; src: url("fonts/cinzel.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/cormorant-garamond.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/cormorant-garamond-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Pinyon Script"; src: url("fonts/pinyon-script.woff2") format("woff2"); font-weight: 400; font-display: swap; }

/* --door, --stone, --jewel, --gold juga dibaca scene.js untuk warna gerbang, pilar, panji/permata, dan logam. */
:root {
  --bg: #2c0a14;
  --bg2: #3a0f1c;
  --bg3: #4a1525;
  --line: #5c1f31;
  --gold: #d9b45a;
  --gold-hi: #f0d489;
  --gold-lo: #a8842f;
  --ivory: #f5ecd9;
  --sand: #e0cdb4;
  --muted: #b79f93;
  --door: #5a1023;
  --stone: #d8c7a6;
  --jewel: #b3122f;
  --display: "Cinzel", "Cormorant Garamond", Georgia, serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --script: "Pinyon Script", "Cormorant Garamond", cursive;
}

/* Tone warna (field "tone"): marun = bawaan di atas. */
:root[data-tone="biru"] { --bg: #0e1a3a; --bg2: #14234b; --bg3: #1b2e60; --line: #263a70; --ivory: #f1eee4; --sand: #cfd3df; --muted: #9aa3bd; --door: #142a66; --jewel: #1f4fd1; }
:root[data-tone="zamrud"] { --bg: #0b2a22; --bg2: #10362c; --bg3: #164538; --line: #1f5546; --ivory: #f1efe2; --sand: #cfdcd0; --muted: #94ad9f; --door: #0f4a3a; --jewel: #0f8f6a; }
:root[data-tone="hitam"] { --bg: #121212; --bg2: #1c1b19; --bg3: #272522; --line: #37332c; --ivory: #f2efe6; --sand: #d6d0c2; --muted: #a39d8f; --door: #26221b; --stone: #bfb8a6; --jewel: #d9b45a; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ivory); font: 400 19px/1.55 var(--serif); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
h1, h2, p { margin: 0; }
a { color: var(--gold-hi); }
a:hover { color: var(--gold-hi); }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
.page { max-width: 480px; margin: 0 auto; background: var(--bg); min-height: 100vh; overflow: hidden; }
@media (min-width: 560px) { .page { box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0, 0, 0, .5); } }

.caps { font: 400 14px/1.4 var(--display); letter-spacing: .42em; text-transform: uppercase; color: var(--gold-hi); }
.caps.ink { color: var(--gold-lo); }
.lead { font-size: 19px; line-height: 1.6; color: var(--sand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 24px;
  border: 1px solid var(--gold); background: transparent; color: var(--ivory); text-decoration: none; cursor: pointer;
  font: 400 13px/1 var(--display); letter-spacing: .24em; text-transform: uppercase;
}
.btn-gold { background: var(--gold); color: var(--bg); }
.btn-gold:hover { background: var(--gold-hi); color: var(--bg); }
.btn-line:hover { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--ivory); }
.btn-ink { background: var(--bg); border-color: var(--bg); color: var(--ivory); }
.btn-ink:hover { background: var(--bg3); color: var(--ivory); }
.btn.copied { background: var(--gold); color: var(--bg); }

/* Sampul */
.cover { min-height: 100vh; min-height: 100svh; padding: 36px 24px 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; text-align: center; background: var(--bg); }
.cover[hidden] { display: none; }
.cover .names { font: 400 46px/1.05 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.names .amp { display: block; font: italic 400 34px/1.2 var(--serif); text-transform: none; letter-spacing: 0; color: var(--gold-hi); }
.rule { display: block; width: 60px; height: 1px; background: var(--gold); }
.cover-date { font: 400 18px/1.4 var(--display); letter-spacing: .14em; }
.cover-city { font-size: 18px; font-style: italic; color: var(--sand); }
.guest { width: 100%; padding: 18px; border: 1px solid var(--gold); border-top: 0; background: var(--bg2); display: flex; flex-direction: column; gap: 4px; }
.guest p:first-child { font-size: 15px; font-style: italic; color: var(--sand); }
.guest-name { font-size: 22px; font-weight: 600; overflow-wrap: anywhere; }
.cover .open { margin-top: 28px; }

/* Dengan JS: sampul menjadi gerbang sampai tamu menekan "Buka undangan". */
.js .cover { position: fixed; inset: 0; z-index: 40; overflow-y: auto; transition: opacity .6s ease 1.25s; }
.js:not(.is-open) body { overflow: hidden; }
.js.is-open .cover { opacity: 0; pointer-events: none; }
.js.no-anim .cover { transition: none; }
html:not(.js) .cover .open { display: none; }

/* Isi */
.intro { padding: 20px 28px 44px; display: flex; flex-direction: column; align-items: center; gap: 26px; text-align: center; }
.couple { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; width: 100%; }
.person { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.portrait { width: 128px; height: 164px; border-radius: 50%; border: 1px solid var(--gold); padding: 5px; display: flex; }
.portrait > * { flex: 1; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.portrait span { display: flex; align-items: center; justify-content: center; background: var(--bg3); font: 400 40px/1 var(--display); color: var(--gold-hi); }
.person h2 { font: 400 22px/1.2 var(--display); letter-spacing: .04em; overflow-wrap: anywhere; }
.parents { font-size: 15px; line-height: 1.4; color: var(--sand); }
.ig { font-size: 15px; font-weight: 600; color: var(--gold-hi); overflow-wrap: anywhere; }

.count { padding: 0 24px 44px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.countdown div { border: 1px solid var(--gold); padding: 14px 0; display: flex; flex-direction: column; gap: 2px; }
.countdown b { font: 400 30px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.countdown span { font-size: 15px; font-style: italic; color: var(--sand); }
html:not(.js) .countdown { display: none; }

.programme { margin: 0 24px; background: var(--ivory); color: var(--bg); padding: 8px; }
.paper { border: 1px solid var(--gold-lo); padding: 30px 22px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.pdate { font: 400 26px/1.2 var(--display); }
.rows { width: 100%; display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid color-mix(in srgb, var(--gold-lo) 45%, transparent); text-align: left; }
.row:last-child { border-bottom: 1px solid color-mix(in srgb, var(--gold-lo) 45%, transparent); }
.row .t { font: 400 22px/1.2 var(--display); }
.row .d { font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.row strong { font-weight: 600; }
.dress { font-size: 16px; font-style: italic; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.gallery { padding: 48px 24px 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
.grid img { width: 100%; height: 150px; object-fit: cover; border: 1px solid var(--gold); border-radius: 60px 60px 0 0; background: var(--bg2); }
.grid img:nth-child(4n) { grid-column: 1 / -1; height: 200px; border-radius: 0; }

.gifts { margin-top: 24px; padding: 44px 24px; background: var(--bg2); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.gift-card { width: 100%; border: 1px solid var(--gold); padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
.bank { font: 400 14px/1.3 var(--display); letter-spacing: .24em; text-transform: uppercase; color: var(--gold-hi); }
.number { font-size: 22px; font-weight: 600; letter-spacing: .06em; overflow-wrap: anywhere; }
.holder { font-size: 15px; color: var(--sand); }
.gift-card .btn { flex-shrink: 0; padding: 0 16px; min-height: 44px; }
.address { width: 100%; padding: 14px; border: 1px solid var(--line); font-size: 16px; line-height: 1.5; color: var(--sand); text-align: left; }

.rsvp { padding: 48px 24px 28px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.note { width: 100%; padding: 14px 16px; border: 1px dashed var(--gold); font-size: 16px; color: var(--sand); }
.thanks { width: 100%; padding: 26px 18px; border: 1px solid var(--gold); display: flex; flex-direction: column; gap: 8px; color: var(--sand); }
.thanks .big { font: 400 30px/1.2 var(--display); color: var(--ivory); }
.form { width: 100%; display: flex; flex-direction: column; gap: 16px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; font-size: 16px; font-weight: 600; }
.field legend { padding: 0 0 6px; }
.field input, .field textarea { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--gold); border-radius: 0; background: var(--bg2); color: var(--ivory); font: 400 18px/1.4 var(--serif); }
.field textarea { padding: 12px 14px; min-height: 110px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--gold-hi); }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.opt { position: relative; }
.opt input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.opt span { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1px solid var(--gold); font: 400 14px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; text-align: center; }
.opt input:checked + span { background: var(--gold); color: var(--bg); }
.opt input:focus-visible + span { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.form .btn { min-height: 50px; }

.wishes-box { padding: 20px 24px 44px; }
.wishes-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.wishes-head h2 { font: 400 28px/1.2 var(--display); letter-spacing: .02em; }
.wishes-head span { font-size: 15px; color: var(--sand); white-space: nowrap; }
.wishes { list-style: none; margin: 12px 0 0; padding: 0; max-height: 560px; overflow-y: auto; }
.wishes li { padding: 14px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.wish-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wish-head b { font-size: 18px; font-weight: 600; }
.tag { padding: 2px 8px; border: 1px solid var(--gold); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-hi); }
.status { font-size: 14px; font-weight: 600; color: var(--gold-hi); }
.wish-text { font-size: 17px; line-height: 1.5; color: var(--sand); overflow-wrap: anywhere; }
.wish-reply { margin-top: 6px; padding: 8px 12px; border-left: 2px solid var(--gold); font-style: italic; color: var(--muted); }

.closing { padding: 40px 24px 36px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.merci { font: 400 40px/1.2 var(--display); letter-spacing: .06em; color: var(--gold-hi); }
.thanks-line { font-size: 17px; font-style: italic; color: var(--sand); }
footer { padding: 18px 16px 26px; text-align: center; font-size: 14px; color: var(--muted); }
footer a { color: var(--gold-hi); }

.music-toggle { position: fixed; bottom: 16px; right: max(14px, calc(50% - 226px)); z-index: 50; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--gold); border-radius: 50%; background: var(--bg); color: var(--gold-hi); cursor: pointer; }
.music-toggle svg { width: 18px; height: 18px; }
.music-toggle[aria-pressed="false"]::after { content: ""; position: absolute; width: 24px; height: 1.5px; background: var(--gold-hi); transform: rotate(-45deg); }
html:not(.js) .music-toggle { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .cover { transition: opacity .3s ease; }
}

/* Tombol musik muncul setelah undangan dibuka */
.js:not(.is-open) .music-toggle { display: none; }

/* Amplop: beberapa rekening/e-wallet */
.gift-list { display: grid; gap: 14px; width: 100%; }

/* ---------- Animasi ---------- */
.rv { opacity: 0; translate: 0 26px; scale: .96; }
.rv.in { opacity: 1; translate: 0 0; scale: 1; rotate: 0deg; transition: opacity .9s cubic-bezier(.2, .7, .2, 1) calc(var(--d, 0) * 1ms), translate .9s cubic-bezier(.2, .7, .2, 1) calc(var(--d, 0) * 1ms), scale .9s cubic-bezier(.2, .7, .2, 1) calc(var(--d, 0) * 1ms), rotate .9s cubic-bezier(.2, .7, .2, 1) calc(var(--d, 0) * 1ms), clip-path .9s cubic-bezier(.2, .7, .2, 1) calc(var(--d, 0) * 1ms); }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; translate: none; scale: none; rotate: none; clip-path: none; } }

@media (prefers-reduced-motion: no-preference) {
  .cover .caps { animation: muncul 1.2s .4s both; }
  .cover .names { animation: rapat 1.8s .5s cubic-bezier(.2, .7, .2, 1) both; }
  .rule { animation: garis 1.2s 1s both; }
  .cover-date, .cover-city, .guest { animation: muncul 1.1s 1.2s both; }
  .cover .open { animation: muncul 1s 1.5s both, kilau 3.2s 3s ease-in-out infinite; }
  .btn-gold:hover { transform: translateY(-2px); }
  .countdown b { transition: opacity .3s; }
}
@keyframes tumbuh { from { opacity: 0; scale: .8; rotate: -6deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes rapat { from { opacity: 0; letter-spacing: .4em; } to { opacity: 1; letter-spacing: .08em; } }
@keyframes garis { from { width: 0; } to { width: 60px; } }
@keyframes muncul { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
@keyframes kilau { 0%, 100% { box-shadow: 0 0 0 0 rgba(227, 199, 127, 0); } 50% { box-shadow: 0 0 0 8px rgba(227, 199, 127, .18); } }


/* ---------- Khas Mahkota ---------- */
.page { background: radial-gradient(120% 50% at 50% 0%, var(--bg3), var(--bg) 70%) var(--bg); }
.caps { font-weight: 500; letter-spacing: .34em; }
.crest { display: block; width: 86px; height: 64px; color: var(--gold); }
.crest.small { width: 54px; height: 40px; }

/* Sampul: kotak .gate di atas (gerbang 3D digambar scene.js di sini; tanpa 3D tampil lambang mahkota + monogram),
   nama dan tombol di bawahnya. */
.cover { justify-content: flex-start; gap: 8px; padding: 44px 24px 22px; background: radial-gradient(120% 60% at 50% 0%, var(--bg3), var(--bg) 72%) var(--bg); }
.gate { flex: 1 1 auto; width: 100%; min-height: 210px; max-height: 46svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.gate .mono { font: 500 40px/1 var(--display); letter-spacing: .08em; color: var(--ivory); }
.cover .names { font: 600 32px/1.15 var(--display); letter-spacing: .06em; overflow-wrap: anywhere; }
.names .amp { display: inline; margin: 0 .22em; font: 400 38px/1 var(--script); text-transform: none; letter-spacing: 0; color: var(--gold-hi); }
.cover-date { font-weight: 500; }
.guest { margin-top: 6px; padding: 12px 18px; border-top: 1px solid var(--gold); }
.cover .open { flex: none; margin-top: 10px; }
.btn { font-weight: 600; }

/* Dengan 3D aktif: kanvas di atas sampul (tak bisa diklik), lambang SVG disembunyikan dan kotaknya jadi acuan. */
.scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 45; pointer-events: none; opacity: 0; transition: opacity .8s ease; }
.gl .scene { opacity: 1; }
.gl .gate > *, .gl .crown3d > * { visibility: hidden; }
.gl .gate { min-height: 30svh; }
.crown3d { display: grid; place-items: center; }
.gl .crown3d { width: 100%; height: 150px; }

.intro { padding-top: 34px; gap: 20px; }
.role { font: 400 26px/1 var(--script); color: var(--gold-hi); }
.person h2 { font-weight: 600; font-size: 19px; }
.portrait { border-radius: 999px 999px 10px 10px; height: 170px; }
.portrait > * { border-radius: 999px 999px 6px 6px; }
.countdown div { border-radius: 4px; background: color-mix(in srgb, var(--bg2) 80%, transparent); }
.countdown b { font-weight: 600; }

/* Titah acara: perkamen dengan gulungan di atas-bawah dan segel lilin bermonogram. */
.programme { position: relative; margin: 14px 24px 0; padding: 0; background: none; color: #3b2a12; }
.programme::before, .programme::after { content: ""; display: block; height: 18px; margin: 0 -8px; border-radius: 9px; background: linear-gradient(180deg, #caa55a, #8f6c25 55%, #caa55a); box-shadow: 0 4px 10px rgb(0 0 0 / .35); }
.paper { border: 0; background: linear-gradient(90deg, #e9dbb8, #f7eed6 12%, #f7eed6 88%, #e9dbb8); padding: 30px 22px 46px; }
.pdate { font-weight: 600; font-size: 21px; }
.row .t { font-weight: 600; font-size: 19px; }
.seal { position: absolute; left: 50%; bottom: -14px; width: 62px; height: 62px; margin-left: -31px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--jewel) 70%, #fff), var(--jewel) 55%, color-mix(in srgb, var(--jewel) 60%, #000)); color: color-mix(in srgb, var(--jewel) 35%, #fff); display: grid; place-items: center; font: 600 17px/1 var(--display); letter-spacing: .06em; box-shadow: 0 6px 14px rgb(0 0 0 / .4), inset 0 0 0 3px rgb(255 255 255 / .16); z-index: 1; }
.btn-ink { background: #3b2a12; border-color: #3b2a12; color: #f7eed6; }
.btn-ink:hover { background: #5a4220; color: #f7eed6; }
.grid img { border-radius: 999px 999px 4px 4px; }
.merci { font-weight: 600; font-size: 30px; }
.closing .crest { margin-bottom: 4px; }

@media (prefers-reduced-motion: no-preference) {
  .gate { animation: muncul 1.2s both; }
  .crest { animation: kilau-emas 4s ease-in-out infinite; }
}
@keyframes kilau-emas { 0%, 100% { filter: drop-shadow(0 0 0 transparent); } 50% { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--gold-hi) 70%, transparent)); } }

/* Foto sampul (opsional): lengkung berbingkai emas; disembunyikan di layar pendek supaya tombol tetap terlihat. */
.cover-photo { flex: none; width: auto; height: clamp(90px, 15svh, 140px); aspect-ratio: 4 / 5; margin: 4px auto; padding: 4px; border: 1px solid var(--gold); border-radius: 999px 999px 4px 4px; overflow: hidden; }
.cover-photo img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 999px 999px 2px 2px; }
.js body.locked { overflow: visible; }
@media (max-height: 700px) { .cover-photo { display: none; } }
