/* ========== 1. WARNA & FONT (ubah di sini kalau mau ganti) ========== */
:root {
  --navy-gelap: #101D36;
  --navy: #243B60;
  --biru-lembut: #7896BD;
  --ivory: #FFF9EF;
  --pink: #F3C9D8;
  --burgundy: #702B43;

  --font-nama: "Pinyon Script", cursive;
  --font-judul: "Cormorant Garamond", serif;
  --font-isi: "Jost", sans-serif;

  /* kurva gerak yang halus (dipakai di banyak animasi) */
  --halus: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ========== 2. DASAR HALAMAN ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  background: var(--navy-gelap);
}
body {
  font-family: var(--font-isi);
  font-weight: 300;
  line-height: 1.7;
  color: var(--navy-gelap);
  background: var(--ivory);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.terkunci { overflow: hidden; height: 100vh; }
/* selama opening, halaman di belakangnya tidak digambar (supaya ringan) */
body.terkunci #undangan { visibility: hidden; }

/* ========== 3. SETIAP BAGIAN ========== */
#undangan section {
  position: relative;
  overflow: hidden;
  padding: 96px 28px;
  text-align: center;
}
#undangan section > *:not(.bunga):not(.kilau) { position: relative; z-index: 2; }

#hero, #countdown {
  background: radial-gradient(ellipse at 50% 0%, var(--navy) 0%, var(--navy-gelap) 80%);
  color: var(--ivory);
}
#kutipan, #rsvp {
  background: linear-gradient(180deg, var(--navy), var(--navy-gelap));
  color: var(--ivory);
}
#sapaan, #acara, #gift {
  background: linear-gradient(180deg, var(--ivory), #FBEFE9);
}
#mempelai, #turut, #penutup {
  background: radial-gradient(circle at 50% 30%, var(--ivory), #F8E1E8);
}

/* ========== 4. TULISAN ========== */
h1 {
  font-family: var(--font-nama);
  font-weight: 400;
  font-size: clamp(3.4rem, 15vw, 6.5rem);
  line-height: 1.1;
  margin: 12px 0;
}
h1 span { display: block; }
h2 {
  font-family: var(--font-judul);
  font-weight: 500;
  font-size: 2rem;
  color: var(--burgundy);
  margin-bottom: 16px;
}
#kutipan h2, #rsvp h2 { color: var(--pink); }

/* nama lengkap mempelai: serif yang mudah dibaca */
h3 {
  font-family: var(--font-judul);
  font-weight: 500;
  font-size: clamp(1.75rem, 7.2vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--burgundy);
  margin-bottom: 4px;
}
.mempelai-info p { font-size: 0.98rem; }

.dan {
  font-family: var(--font-nama);
  font-size: 3.2rem;
  color: var(--burgundy);
  margin-top: 28px;
}
.nama-tamu { font-size: 2.3rem; margin: 6px 0 0; }

#hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; }
#hero p:first-child { letter-spacing: 0.25em; color: var(--pink); }

/* --- kutipan: ayat Arab, terjemahan, sumber, doa (di dalam satu kartu) --- */
.kartu-kutipan {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  padding: 42px 24px 38px;
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.10), rgba(255, 249, 239, 0.03));
  border: 1px solid rgba(243, 201, 216, 0.38);
  border-radius: 30px;
  box-shadow: 0 26px 56px rgba(4, 9, 22, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
/* garis kedua yang lebih tipis di dalam kartu */
.kartu-kutipan::before {
  content: "";
  position: absolute; inset: 8px;
  border: 1px solid rgba(243, 201, 216, 0.18);
  border-radius: 23px;
  pointer-events: none;
}

/* teks Arab ayat (di atas terjemahan) */
.arab {
  font-family: "Amiri", serif;
  direction: rtl;
  font-size: clamp(1.35rem, 5.4vw, 1.8rem);
  font-weight: 400;
  line-height: 2.1;
  max-width: 22em;
  margin: 0 auto 18px;
}

blockquote {
  font-family: var(--font-judul);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.65;
  max-width: 36ch;
  margin: 0 auto;
}
cite {
  display: block;
  margin-top: 14px;
  color: var(--pink);
  font-style: normal;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

/* hiasan garis + berlian */
.hias-kutipan {
  display: flex; align-items: center; justify-content: center;
  gap: 12px;
  max-width: 240px;
  margin: 26px auto 20px;
}
.hias-kutipan i {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--pink));
}
.hias-kutipan i:last-child { transform: scaleX(-1); }
.hias-kutipan b {
  width: 8px; height: 8px;
  background: var(--pink);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(243, 201, 216, 0.7);
}

/* teks penutup di bawah ayat */
.kutipan-doa {
  font-family: var(--font-judul);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 34ch;
  margin: 0 auto;
  opacity: 0.92;
}

/* ========== 5. FOTO PENGANTIN (lengkung, bukan kotak) ========== */
/* tulisan penanda sebelum foto */
.label-atas {
  font-size: 0.8rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--burgundy);
  margin-bottom: 4px;
}
.judul-mempelai {
  font-family: var(--font-nama);
  font-weight: 400;
  font-size: clamp(2.6rem, 10vw, 3.6rem);
  line-height: 1.2;
  color: var(--burgundy);
  margin-bottom: 36px;
}
.judul-mempelai::after {
  content: "";
  display: block;
  width: 64px; height: 1px;
  margin: 10px auto 0;
  background: var(--burgundy);
  opacity: 0.45;
}

.foto-frame {
  /* warna latar foto (bisa diganti lewat config.js -> latarFoto) */
  --latar: linear-gradient(180deg, #CBD9EC, #9DB4D3);
  position: relative;
  width: min(78vw, 320px);
  aspect-ratio: 3 / 4;
  margin: 0 auto 40px;
  border-radius: 999px 999px 28px 28px;
  background: var(--ivory);
  box-shadow: 0 0 0 8px var(--ivory), 0 0 0 9px var(--pink), 0 28px 60px rgba(16, 29, 54, 0.3);
}
.foto-frame.latar-biru  { --latar: linear-gradient(180deg, #CBD9EC, #9DB4D3); }
.foto-frame.latar-pink  { --latar: linear-gradient(180deg, #FBE4EC, #F3C9D8); }
.foto-frame.latar-ivory { --latar: linear-gradient(180deg, #FFFDF8, #F6E3DA); }
.foto-frame.latar-navy  { --latar: radial-gradient(circle at 50% 30%, #243B60, #101D36 80%); }

/* wadah foto: memotong foto sesuai lengkungan, dan jadi "kanvas" efek warna */
.foto-isi {
  position: absolute; inset: 0;
  border-radius: inherit;
  overflow: hidden;
  isolation: isolate;
  background: var(--latar);
}
.foto-isi img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 52%;
  display: block;
  transform: scale(1.25);
  transition: transform 3.2s var(--halus);
}
.foto-frame.tampil .foto-isi img { transform: scale(1); }

/* efek warna tema: foto hitam-putih "dicampur" dengan warna latar, bagian gelap jadi navy.
   Matikan lewat config.js -> efekFotoTema: false */
.foto-tema .foto-isi img {
  filter: grayscale(1) contrast(1.05) brightness(1.15);
  mix-blend-mode: multiply;
}
.foto-tema .foto-isi::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--navy-gelap);
  mix-blend-mode: lighten;
  pointer-events: none;
}
/* kalau file foto tidak ditemukan */
.foto-isi.hilang img { display: none; }
.foto-isi.hilang::before {
  content: "Foto belum ditemukan.\A Cek nama file di assets/images";
  white-space: pre;
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--burgundy);
}

.foto-frame::after {
  content: "";
  position: absolute; inset: -18px;
  border: 1px solid rgba(112, 43, 67, 0.45);
  border-radius: 999px 999px 40px 40px;
  pointer-events: none;
  animation: denyut 5s ease-out infinite;
}
@keyframes denyut {
  from { transform: scale(0.96); opacity: 0.9; }
  to   { transform: scale(1.1);  opacity: 0; }
}

/* kartu nama & orang tua mempelai */
.mempelai-info {
  max-width: 420px;
  margin: 28px auto 0;
  padding: 26px 20px;
  background: rgba(255, 249, 239, 0.74);
  border: 1px solid rgba(112, 43, 67, 0.16);
  border-radius: 24px;
  box-shadow: 0 18px 38px rgba(16, 29, 54, 0.14), 0 2px 6px rgba(16, 29, 54, 0.06);
}

/* ========== 6. COUNTDOWN ========== */
#countdown { display: flex; justify-content: center; gap: clamp(14px, 5vw, 36px); }
#countdown div { display: flex; flex-direction: column; }
#countdown div + div { border-left: 1px solid rgba(243, 201, 216, 0.35); padding-left: clamp(14px, 5vw, 36px); }
#countdown span {
  display: inline-block;
  font-family: var(--font-judul);
  font-size: 2.8rem;
  line-height: 1.1;
  min-width: 2ch;
}
#countdown small { color: var(--pink); }
#countdown span.ganti { animation: angka-ganti 0.6s var(--halus); }
@keyframes angka-ganti {
  from { opacity: 0.2; transform: translateY(-12px); }
  to   { opacity: 1;   transform: none; }
}

/* ========== 7. ACARA, TURUT MENGUNDANG ========== */
#acara h2:nth-of-type(2) { margin-top: 40px; }
#acara p { margin-bottom: 4px; }
#daftar-turut { list-style: none; }
#daftar-turut li { margin-bottom: 8px; }

/* ========== 7b. WEDDING GIFT ========== */
#daftar-rekening { max-width: 420px; margin: 0 auto; }
.gift-intro {
  font-family: var(--font-judul);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.6;
  margin-bottom: 34px;
}
.rek {
  padding: 30px 0;
  border-top: 1px solid rgba(112, 43, 67, 0.28);
}
.rek:last-child { border-bottom: 1px solid rgba(112, 43, 67, 0.28); }
.rek-bank {
  font-family: var(--font-judul);
  font-weight: 500;
  font-size: 1.75rem;
  letter-spacing: 0.06em;
  line-height: 1.3;
  color: var(--burgundy);
}
.rek-nomor {
  font-family: var(--font-judul);
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: 0.08em;
  line-height: 1.3;
  margin: 6px 0 2px;
  overflow-wrap: anywhere;
}
.rek-nama { font-size: 0.95rem; }
.btn-salin {
  margin-top: 18px;
  padding: 11px 28px;
  border: 1px solid var(--burgundy);
  border-radius: 999px;
  background: transparent;
  color: var(--burgundy);
  font-family: var(--font-isi);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.5s var(--halus), color 0.5s var(--halus), transform 0.5s var(--halus), box-shadow 0.5s var(--halus);
}
.btn-salin:hover {
  background: var(--burgundy);
  color: var(--ivory);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(112, 43, 67, 0.3);
}
.btn-salin:active { transform: scale(0.96); }
.btn-salin.berhasil { background: var(--burgundy); color: var(--ivory); }

/* ========== 7c. RSVP (formulir tanpa kotak, hanya garis) ========== */
.rsvp-intro {
  max-width: 30ch;
  margin: 0 auto 34px;
  font-family: var(--font-judul);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.6;
}
#form-rsvp { max-width: 420px; margin: 0 auto; text-align: left; }
.f-field { display: block; position: relative; margin-bottom: 28px; }
.f-field > span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--pink);
}
#form-rsvp input[type="text"],
#form-rsvp textarea {
  width: 100%;
  padding: 10px 2px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(243, 201, 216, 0.5);
  border-radius: 0;
  color: var(--ivory);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.5s var(--halus), box-shadow 0.5s var(--halus);
}
#form-rsvp textarea { resize: vertical; min-height: 96px; }
#form-rsvp input[type="text"]:focus,
#form-rsvp textarea:focus {
  border-bottom-color: var(--pink);
  box-shadow: 0 1px 0 0 var(--pink);
}
/* nama yang sudah terisi dari link tamu: terkunci */
#form-rsvp input[readonly] {
  cursor: default;
  border-bottom-style: dotted;
  font-family: var(--font-judul);
  font-weight: 500;
  font-size: 1.4rem;
}
#form-rsvp input[readonly]:focus { box-shadow: none; border-bottom-color: rgba(243, 201, 216, 0.5); }

/* pilihan Insyaallah hadir / Maaf belum bisa hadir */
.pilih { display: flex; flex-wrap: wrap; gap: 10px; position: relative; }
.pilih input { position: absolute; opacity: 0; pointer-events: none; }
.pilih label {
  flex: 1 1 150px;
  text-align: center;
  padding: 12px 14px;
  border: 1px solid rgba(243, 201, 216, 0.5);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.5s var(--halus), color 0.5s var(--halus), border-color 0.5s var(--halus);
}
.pilih input:checked + label {
  background: var(--pink);
  border-color: var(--pink);
  color: var(--burgundy);
}
.pilih input:focus-visible + label { outline: 2px solid var(--ivory); outline-offset: 3px; }

.rsvp-catatan {
  margin-top: 16px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.8;
}
#status-form {
  min-height: 1.7em;
  margin-top: 12px;
  text-align: center;
  font-size: 0.95rem;
}
#status-form.ok { color: var(--pink); }
#status-form.gagal { color: #FFB4A8; }

/* ========== 7d. UCAPAN DI BAWAH FORM ========== */
#daftar-ucapan { max-width: 420px; margin: 48px auto 0; text-align: left; }
#daftar-ucapan:empty { display: none; }
.ucapan-judul {
  text-align: center;
  font-family: var(--font-judul);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--pink);
  margin-bottom: 8px;
}
.ucapan-item {
  padding: 20px 0;
  border-top: 1px solid rgba(243, 201, 216, 0.25);
  animation: muncul-ucapan 0.9s var(--halus) both;
}
.ucapan-nama {
  font-family: var(--font-judul);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.3;
  color: var(--pink);
}
.ucapan-tanda {
  margin-left: 8px;
  font-family: var(--font-isi);
  font-size: 0.8rem;
  font-weight: 300;
  opacity: 0.75;
}
.ucapan-isi { margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }
@keyframes muncul-ucapan {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ========== 7e. PENUTUP ========== */
#penutup p {
  font-family: var(--font-judul);
  font-style: italic;
  font-size: 1.3rem;
}
#penutup h2 {
  font-family: var(--font-nama);
  font-weight: 400;
  font-size: clamp(3rem, 12vw, 4.5rem);
  line-height: 1.2;
  margin-top: 10px;
}

/* ========== 8. TOMBOL ========== */
#btn-buka, #btn-maps, #btn-kirim {
  position: relative;
  overflow: hidden;
  display: inline-block;
  margin-top: 32px;
  padding: 14px 34px;
  border: 1px solid var(--pink);
  border-radius: 999px;
  background: var(--burgundy);
  color: var(--ivory);
  font-family: var(--font-isi);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.5s var(--halus), box-shadow 0.5s var(--halus), opacity 0.5s ease;
}
#btn-kirim { width: 100%; margin-top: 8px; }
#btn-buka:hover, #btn-maps:hover, #btn-kirim:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(112, 43, 67, 0.45);
}
#btn-buka:active, #btn-maps:active, #btn-kirim:active { transform: translateY(0) scale(0.97); }
#btn-buka:disabled { opacity: 0; pointer-events: none; }
/* tombol baru bisa ditekan setelah amplop muncul sepenuhnya */
#opening:not(.siap) #btn-buka { pointer-events: none; }
#btn-buka::after, #btn-maps::after, #btn-kirim::after {
  content: "";
  position: absolute; top: 0; left: 0;
  width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-200%) skewX(-20deg);
  animation: kilap 5.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes kilap {
  0%, 55% { transform: translateX(-200%) skewX(-20deg); }
  100%    { transform: translateX(450%) skewX(-20deg); }
}

/* ========== 9. OPENING ========== */
#opening {
  position: fixed; inset: 0; z-index: 100;
  overflow: hidden;
  color: var(--ivory);
  text-align: center;
}
#opening.tutup { display: none; }

.latar {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 35%, var(--navy), var(--navy-gelap) 75%);
  pointer-events: none;
}
.isi-opening {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
}
#bunga-opening { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

/* --- 9a. Bunga besar yang mekar --- */
#bunga-utama {
  position: absolute;
  left: 50%; top: 50%;
  width: min(120vw, 620px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#bunga-utama::before {
  content: "";
  position: absolute;
  inset: 10% 10% 0;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.5), transparent 68%);
  transform: translateY(7%);
  animation: bayang 3.6s var(--halus) both;
}
@keyframes bayang {
  from { opacity: 0; transform: translateY(7%) scale(0.6); }
  to   { opacity: 1; transform: translateY(7%) scale(1); }
}
#bunga-utama svg {
  display: block; width: 100%; height: 100%;
  animation: putar-mekar 3.6s var(--halus) both;
  will-change: transform;
}
.kelopak {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: mekar 2.6s var(--halus) both;
  animation-delay: var(--w, 0s);
}
@keyframes mekar {
  from { transform: scale(0.18); opacity: 0.6; }
  to   { transform: scale(1);    opacity: 1; }
}
@keyframes putar-mekar {
  from { transform: rotate(-35deg) scale(0.85); }
  to   { transform: rotate(0deg) scale(1); }
}

/* --- 9b. Amplop (muncul setelah bunga mekar) --- */
#area-amplop {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  opacity: 0;
  transform: translateY(50px);
  animation: naik 1.6s var(--halus) forwards;
  animation-delay: 2.7s;
}
@keyframes naik { to { opacity: 1; transform: none; } }

#amplop {
  position: relative;
  width: min(80vw, 340px);
  aspect-ratio: 10 / 7;
  perspective: 900px;
  animation: melayang 5s ease-in-out 4.5s infinite alternate;
}
@keyframes melayang {
  from { transform: translateY(0); }
  to   { transform: translateY(-8px); }
}
.amplop-belakang, .amplop-depan, .tutup-amplop, .surat, .segel { position: absolute; }

.amplop-belakang {
  inset: 0;
  background: #5B7AA6;
  border-radius: 6px;
  box-shadow: 0 24px 34px rgba(0, 0, 0, 0.45);
  z-index: 0;
}
.surat {
  left: 6%; right: 6%; bottom: 6%;
  height: 82%;
  padding: 22px 14px 0;
  background: linear-gradient(180deg, var(--ivory), #FBEFE9);
  border-radius: 4px;
  color: var(--navy-gelap);
  z-index: 2;
  transition: transform 1.3s var(--halus);
  will-change: transform;
}
.surat p { font-size: 0.9rem; }
#opening .surat .nama-tamu {
  color: var(--burgundy);
  font-size: 1.9rem;
  margin: 4px 0 10px;
  line-height: 1.15;
}
.surat-kecil { font-family: var(--font-judul); font-style: italic; font-size: 1rem !important; }

.amplop-depan {
  inset: 0;
  background: #7896BD;
  clip-path: polygon(0 100%, 0 0, 50% 56%, 100% 0, 100% 100%);
  border-radius: 6px;
  z-index: 3;
}
.tutup-amplop {
  left: 0; right: 0; top: 0;
  height: 56%;
  background: linear-gradient(180deg, #9DB4D3, #86A1C6);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  z-index: 4;
  will-change: transform;
}
.segel {
  left: 50%; top: 56%;
  width: 21%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #A9506E, var(--burgundy) 70%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 0 0 3px rgba(243, 201, 216, 0.35);
  color: var(--pink);
  font-family: var(--font-nama);
  font-size: clamp(1rem, 5vw, 1.4rem);
  z-index: 6;
  transition: opacity 0.5s ease, transform 0.5s var(--halus);
}
.segel::after {
  content: "";
  position: absolute; inset: 0;
  border: 2px solid var(--pink);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: segel-cincin 3s ease-out 4s infinite;
}
@keyframes segel-cincin {
  from { transform: scale(1);   opacity: 0.7; }
  to   { transform: scale(1.8); opacity: 0; }
}

/* --- 9c. Saat tombol ditekan: amplop terbuka --- */
#amplop.buka { animation-play-state: paused; }
#amplop.buka .segel { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
#amplop.buka .tutup-amplop {
  transform: rotateX(180deg);
  z-index: 1;
  transition: transform 1.1s var(--halus), z-index 0s 0.55s;
}
#amplop.buka .surat {
  transform: translateY(-68%);
  transition-delay: 0.9s;
}

/* --- 9d. Kertas sobek (dua belahan saling menimpa, tanpa celah) --- */
.sobek {
  position: absolute; left: 0; right: 0;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease, transform 1.7s cubic-bezier(0.7, 0, 0.2, 1);
  will-change: transform, opacity;
}
.sobek-atas {
  top: 0; height: 57%;
  background: linear-gradient(180deg, var(--ivory), #FBEFE9);
  clip-path: polygon(0 0, 100% 0, 100% 96%, 95% 100%, 90% 94%, 84% 99%, 78% 93%, 72% 100%, 66% 95%, 60% 99%, 54% 93%, 48% 100%, 42% 94%, 36% 99%, 30% 93%, 24% 100%, 18% 95%, 12% 99%, 6% 94%, 0 98%);
}
.sobek-bawah {
  bottom: 0; height: 59%;
  background: linear-gradient(180deg, #FBEFE9, #F3C9D8);
  clip-path: polygon(0 2%, 6% 6%, 12% 1%, 18% 5%, 24% 0, 30% 7%, 36% 1%, 42% 6%, 48% 0, 54% 7%, 60% 1%, 66% 5%, 72% 0, 78% 7%, 84% 1%, 90% 6%, 95% 0, 100% 4%, 100% 100%, 0 100%);
}
#opening.kertas .sobek { opacity: 1; }
#opening.pisah .latar,
#opening.pisah .isi-opening { opacity: 0; transition: opacity 0.3s ease; }
#opening.pisah .sobek-atas  { transform: translateY(-105%); }
#opening.pisah .sobek-bawah { transform: translateY(105%); }

/* ========== 10. KELOPAK BERJATUHAN (pelan & halus) ========== */
#kelopak-jatuh {
  position: fixed; inset: 0;
  z-index: 101;
  pointer-events: none;
  overflow: hidden;
}
.kelopak-jatuh {
  position: absolute;
  top: -6vh;
  left: var(--x);
  width: var(--s);
  height: calc(var(--s) * 1.35);
  background: linear-gradient(135deg, var(--c1), var(--c2));
  border-radius: 150% 0 150% 0;
  opacity: 0;
  animation: jatuh var(--d) linear infinite;
  animation-delay: var(--w);
  will-change: transform, opacity;
}
@keyframes jatuh {
  0%   { transform: translate3d(0, -8vh, 0) rotate(0deg);                          opacity: 0; }
  8%   { opacity: 0.85; }
  25%  { transform: translate3d(calc(var(--g) * 0.6), 24vh, 0) rotate(90deg); }
  50%  { transform: translate3d(calc(var(--g) * -0.4), 52vh, 0) rotate(190deg); }
  75%  { transform: translate3d(calc(var(--g) * 0.5), 82vh, 0) rotate(285deg); }
  92%  { opacity: 0.85; }
  100% { transform: translate3d(calc(var(--g) * -0.2), 110vh, 0) rotate(360deg);   opacity: 0; }
}

/* ========== 11. KILAU BINTANG (di bagian gelap) ========== */
.kilau {
  position: absolute; z-index: 1;
  left: var(--x); top: var(--y);
  width: var(--s); height: var(--s);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px 2px rgba(243, 201, 216, 0.8);
  opacity: 0;
  pointer-events: none;
  animation: kedip var(--d) ease-in-out infinite;
  animation-delay: var(--w);
}
@keyframes kedip {
  0%, 100% { opacity: 0;   transform: scale(0.4); }
  50%      { opacity: 0.9; transform: scale(1); }
}

/* ========== 12. TOMBOL MUSIK MELAYANG ========== */
#btn-musik {
  position: fixed;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 102;
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  border: 1px solid var(--pink);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #A9506E, var(--burgundy) 70%);
  box-shadow: 0 10px 24px rgba(16, 29, 54, 0.4), inset 0 0 0 3px rgba(243, 201, 216, 0.2);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.4);
  pointer-events: none;
  transition: opacity 1s var(--halus), transform 1s var(--halus), box-shadow 0.4s ease;
}
#btn-musik.tampil { opacity: 1; transform: none; pointer-events: auto; }
#btn-musik.tampil:hover { transform: scale(1.08); box-shadow: 0 14px 30px rgba(112, 43, 67, 0.55), inset 0 0 0 3px rgba(243, 201, 216, 0.3); }
#btn-musik.tampil:active { transform: scale(0.94); }

#btn-musik::after {
  content: "";
  position: absolute; inset: 0;
  border: 1px solid var(--pink);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
#btn-musik:not(.jeda)::after { animation: cincin 2.8s ease-out infinite; }
@keyframes cincin {
  from { transform: scale(1);   opacity: 0.7; }
  to   { transform: scale(1.7); opacity: 0; }
}

#btn-musik span {
  width: 3px; height: 20px;
  border-radius: 3px;
  background: var(--pink);
  transform-origin: center;
  animation: nada 1.1s ease-in-out infinite alternate;
}
#btn-musik span:nth-child(1) { animation-delay: -0.2s; }
#btn-musik span:nth-child(2) { animation-delay: -0.6s; }
#btn-musik span:nth-child(3) { animation-delay: -0.1s; }
#btn-musik span:nth-child(4) { animation-delay: -0.8s; }
@keyframes nada {
  from { transform: scaleY(0.25); }
  to   { transform: scaleY(1); }
}
#btn-musik.jeda span { animation: none; transform: scaleY(0.25); opacity: 0.7; }
#btn-musik.jeda::before {
  content: "";
  position: absolute;
  width: 2px; height: 30px;
  background: var(--ivory);
  border-radius: 2px;
  transform: rotate(45deg);
  box-shadow: 0 0 0 1px rgba(112, 43, 67, 0.7);
}

/* ========== 13. BUNGA DEKORASI ========== */
.bunga {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  filter: blur(var(--blur, 0px)) drop-shadow(0 14px 22px rgba(16, 29, 54, 0.3));
  animation: goyang 14s ease-in-out infinite alternate;
  translate: 0 calc(var(--py, 0) * var(--f, 0.1) * 1px);
  will-change: transform;
}
.bunga svg { display: block; width: 100%; height: 100%; }
@keyframes goyang {
  from { transform: rotate(-5deg) scale(1); }
  to   { transform: rotate(6deg) scale(1.04); }
}

/* ========== 14. HERO MUNCUL SETELAH UNDANGAN DIBUKA ========== */
#hero > * { opacity: 0; transform: translateY(26px); }
body.terbuka #hero > * { animation: muncul 1.8s var(--halus) forwards; }
body.terbuka #hero > *:nth-child(2) { animation-delay: 0.3s; }
body.terbuka #hero > *:nth-child(3) { animation-delay: 0.9s; }
@keyframes muncul { to { opacity: 1; transform: none; } }

#hero h1 span { opacity: 0; filter: blur(14px); transform: translateY(18px); }
body.terbuka #hero h1 span { animation: kabut 2.2s var(--halus) forwards; }
body.terbuka #hero h1 span:nth-child(1) { animation-delay: 0.6s; }
body.terbuka #hero h1 span:nth-child(2) { animation-delay: 1.1s; }
@keyframes kabut { to { opacity: 1; filter: blur(0); transform: none; } }

/* ========== 15. MUNCUL SAAT SCROLL ========== */
.rv {
  opacity: 0;
  transition:
    opacity 1.5s var(--halus) calc(var(--i, 0) * 0.18s),
    transform 1.5s var(--halus) calc(var(--i, 0) * 0.18s),
    filter 1.5s var(--halus) calc(var(--i, 0) * 0.18s);
  will-change: opacity, transform;
}
.rv-naik  { transform: translate3d(0, 44px, 0); }
.rv-kiri  { transform: translate3d(-56px, 0, 0); }
.rv-kanan { transform: translate3d(56px, 0, 0); }
.rv-zoom  { transform: scale(0.82); }
.rv-foto  { transform: translate3d(0, 50px, 0) scale(0.85); filter: blur(14px); }
.rv.tampil { opacity: 1; transform: none; filter: none; }

/* ========== 16. UNTUK YANG MEMATIKAN ANIMASI DI HP/LAPTOPNYA ========== */
@media (prefers-reduced-motion: reduce) {
  .bunga, .kelopak, #bunga-utama svg, #bunga-utama::before, .kilau, #amplop,
  .segel::after, .foto-frame::after, #btn-buka::after, #btn-maps::after, #btn-kirim::after,
  #btn-musik span, #btn-musik::after, .ucapan-item { animation: none; }
  #area-amplop { animation: none; opacity: 1; transform: none; }
  #kelopak-jatuh { display: none; }
  #hero > *, #hero h1 span { opacity: 1; transform: none; filter: none; }
  .rv { opacity: 1; transform: none; filter: none; transition: none; }
  .foto-isi img { transform: none; transition: none; }
}

/* ========== 17. LAPTOP ========== */
@media (min-width: 768px) {
  #undangan section { padding: 120px 40px; }
  h2 { font-size: 2.6rem; }
  .judul-mempelai { font-size: 4rem; }
  #btn-musik { right: 28px; bottom: 28px; }
}