/* ============================================================
   Undangan Pawiwahan — redesign premium (watercolor, lembut)
   Ivory / emas / emerald. Mobile-first; >900px = split layout.

   Layer background:
   - body::before  : bg-main.jpg fixed + overlay ivory (fallback gradient)
   - body::after   : (desktop) panel kiri foto + nama pasangan
   - .cover / .section pseudo : ornamen floral sudut + divider

   Gambar opsional dideteksi js/main.js (class di <html>):
   - html.has-bg      → images/bg-main.jpg ada
   - html.has-floral  → images/floral-corner.png ada
   - html.has-cover   → images/cover.jpg ada (untuk panel desktop)
   ============================================================ */

:root {
  --ivory: #faf6ee;
  --ivory-2: #f2ead9;
  --gold: #b8944d;
  --gold-light: #d9bf8a;
  --gold-soft: rgba(184, 148, 77, 0.35);
  --emerald: #1c4d3a;
  --emerald-light: #2e6b52;
  --text: #2f4f43;
  --text-soft: #5f7268;
  --card-bg: rgba(250, 246, 238, 0.88);
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-script: 'Great Vibes', cursive;

  /* Ornamen frangipani placeholder (data URI).
     Otomatis diganti floral-corner.png kalau file ada (html.has-floral). */
  --floral-img: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--text);
  background: var(--ivory);
}

/* ---------- Layer 1: background utama fixed seluruh halaman ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  /* fallback: gradient krem → ivory */
  background: linear-gradient(180deg, #f4ecdb 0%, var(--ivory) 45%, #f0e8d6 100%);
}
html.has-bg body::before {
  background:
    linear-gradient(180deg, rgba(250, 246, 238, 0.86) 0%, rgba(250, 246, 238, 0.78) 50%, rgba(250, 246, 238, 0.88) 100%),
    url('../images/bg-main.jpg') center / cover no-repeat;
}

/* Terkunci sebelum "Buka Undangan" diklik — HANYA kunci scroll,
   tanpa height/display/visibility supaya konten tidak terpotong */
body.locked { overflow: hidden; }

img { max-width: 100%; display: block; }

.script { font-family: var(--font-script); font-weight: 400; }
.amp { display: block; font-size: 0.6em; color: var(--gold); margin: 0.05em 0; }

.hidden { display: none !important; }

/* ---------- Sub-teks kecil: small-caps + tracking lebar ---------- */
.cover-label, .hero-sub, .greeting-om, .cover-to,
.count-box small, .event-badge, .origin, .closing-om {
  font-variant: small-caps;
  letter-spacing: 0.2em;
}

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-serif);
  font-size: 1rem;
  letter-spacing: 0.1em;
  padding: 0.95em 2.6em;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, opacity 0.25s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: #fff;
  box-shadow: 0 6px 18px rgba(184, 148, 77, 0.35);
}
.btn-gold:hover { box-shadow: 0 8px 22px rgba(184, 148, 77, 0.45); }
/* Ikon amplop */
.btn-gold::before {
  content: "";
  width: 1.05em;
  height: 1.05em;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="1.6"><rect x="2.5" y="5" width="19" height="14" rx="2.5"/><path d="M3 6.5l9 6.5 9-6.5"/></svg>') center/contain no-repeat;
}
.btn-outline {
  background: rgba(250, 246, 238, 0.6);
  color: var(--emerald);
  border: 1px solid var(--gold);
}
.btn-outline:hover { background: rgba(250, 246, 238, 0.9); }
.btn[disabled] { opacity: 0.6; cursor: wait; }

/* ---------- Section umum: transparan di atas kanvas ---------- */
.section {
  position: relative;
  padding: 5rem 1.5rem 5.5rem;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
  background: transparent;
}
.section-title {
  font-size: 2.1rem;
  font-weight: 500;
  color: var(--emerald);
  margin-bottom: 1.6rem;
  text-shadow: 0 1px 2px rgba(250, 246, 238, 0.8);
}
.section-title::after {
  content: "";
  display: block;
  width: 70px;
  height: 2px;
  margin: 0.6rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* Ornamen floral sudut section — selang-seling kiri-atas / kanan-atas */
.section::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 4px;
  width: clamp(80px, 22vw, 140px);
  aspect-ratio: 1;
  background: var(--floral-img) center / contain no-repeat;
  opacity: 0.9;
  pointer-events: none;
}
main .section:nth-of-type(even)::before {
  left: auto;
  right: 4px;
  transform: scaleX(-1);
}

/* Divider ornamen di dasar tiap section: garis + motif kecil */
.section::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(280px, 70%);
  height: 26px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 280 26"><path d="M10 13 H115 M165 13 H270" stroke="%23b8944d" stroke-width="1" opacity="0.6"/><g transform="translate(140 13)" fill="%23b8944d" opacity="0.85"><ellipse cx="0" cy="-6" rx="3" ry="6"/><ellipse cx="0" cy="-6" rx="3" ry="6" transform="rotate(72)"/><ellipse cx="0" cy="-6" rx="3" ry="6" transform="rotate(144)"/><ellipse cx="0" cy="-6" rx="3" ry="6" transform="rotate(216)"/><ellipse cx="0" cy="-6" rx="3" ry="6" transform="rotate(288)"/><circle r="2.2" fill="%23eadfb8"/></g><circle cx="122" cy="13" r="1.8" fill="%23b8944d" opacity="0.6"/><circle cx="158" cy="13" r="1.8" fill="%23b8944d" opacity="0.6"/></svg>') center / contain no-repeat;
  pointer-events: none;
}
.closing::after { content: none; }

/* Ornamen lama (elemen .ornament di HTML) — tetap didukung */
.ornament.flower {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.2rem;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-60 -60 120 120"><g fill="%23b8944d" opacity="0.85"><ellipse cx="0" cy="-30" rx="15" ry="30"/><ellipse cx="0" cy="-30" rx="15" ry="30" transform="rotate(72)"/><ellipse cx="0" cy="-30" rx="15" ry="30" transform="rotate(144)"/><ellipse cx="0" cy="-30" rx="15" ry="30" transform="rotate(216)"/><ellipse cx="0" cy="-30" rx="15" ry="30" transform="rotate(288)"/></g><circle r="10" fill="%23eadfb8"/></svg>') center/contain no-repeat;
}
.ornament.corner { display: none; } /* digantikan ornamen floral sudut via ::before */

/* ---------- 1. Cover: kanvas terang watercolor ---------- */
.cover {
  position: relative;
  min-height: 100dvh; /* min-height, bukan height: konten panjang tidak terpotong */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.cover-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Overlay ivory lembut — teks emerald/emas tetap terbaca */
.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(250, 246, 238, 0.88) 0%,
    rgba(250, 246, 238, 0.72) 45%,
    rgba(250, 246, 238, 0.9) 100%);
}
/* Floral 4 sudut cover: .cover::before/::after atas, .cover-overlay::before/::after bawah */
.cover::before, .cover::after,
.cover-overlay::before, .cover-overlay::after {
  content: "";
  position: absolute;
  width: clamp(110px, 30vw, 200px);
  aspect-ratio: 1;
  background: var(--floral-img) center / contain no-repeat;
  opacity: 0.9;
  pointer-events: none;
  z-index: 1;
}
.cover::before { top: 0; left: 0; }
.cover::after  { top: 0; right: 0; transform: scaleX(-1); }
.cover-overlay::before { bottom: 0; left: 0; transform: scaleY(-1); }
.cover-overlay::after  { bottom: 0; right: 0; transform: scale(-1); }

.cover-content {
  position: relative;
  z-index: 2;
  color: var(--text);
  padding: 2rem 1.5rem;
  max-width: 560px;
}
.greeting-om {
  font-size: 0.95rem;
  color: var(--gold);
  margin-bottom: 1.2rem;
}
.cover-to { font-size: 0.9rem; color: var(--text-soft); }
.guest-name {
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--emerald);
  margin: 0.3rem 0 2rem;
  border-bottom: 1px solid var(--gold-soft);
  display: inline-block;
  padding: 0 1rem 0.3rem;
}
.cover-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-bottom: 0.6rem;
}
.cover-names {
  /* Nama lengkap panjang: lebih kecil dari hero supaya cover + tombol
     muat dalam satu layar HP */
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  line-height: 1.45;
  margin-bottom: 1.2rem;
  color: var(--emerald);
  text-shadow: 0 1px 3px rgba(250, 246, 238, 0.9);
}
.cover-date { font-size: 1.1rem; letter-spacing: 0.15em; margin-bottom: 2.2rem; color: var(--text); }

/* ---------- Tombol musik floating ---------- */
.music-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--gold-soft);
  background: rgba(28, 77, 58, 0.9);
  color: var(--gold-light);
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(28, 77, 58, 0.3);
}
.music-toggle.playing { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 2. Hero ---------- */
.hero { padding-top: 6rem; }
.hero-sub {
  font-size: 0.85rem;
  color: var(--text-soft);
}
.hero-names {
  font-size: clamp(3rem, 9vw, 5.5rem);
  line-height: 1.4;
  color: var(--emerald);
  margin: 0.4rem 0 2rem;
  text-shadow: 0 1px 3px rgba(250, 246, 238, 0.9);
}
.hero-date { margin-top: 1.6rem; letter-spacing: 0.18em; color: var(--text-soft); }
.hero-photo { max-width: 300px; margin: 0 auto; }

/* ---------- Frame arch ---------- */
.arch-frame {
  border-radius: 999px 999px 14px 14px;
  overflow: hidden;
  border: 1px solid var(--gold);
  outline: 1px solid var(--gold-soft);
  outline-offset: 6px;
  box-shadow: 0 12px 32px rgba(47, 79, 67, 0.14);
  aspect-ratio: 3 / 4;
  background: var(--card-bg);
}
.arch-frame img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 3. Sloka: menyatu dengan kanvas ---------- */
.sloka { max-width: 640px; }
.sloka blockquote {
  max-width: 560px;
  margin: 0 auto;
  background: var(--card-bg);
  border: 1px solid var(--gold-soft);
  border-radius: 18px;
  padding: 2rem 1.6rem;
  box-shadow: 0 6px 24px rgba(47, 79, 67, 0.08);
}
.sloka-sanskerta {
  font-style: italic;
  font-size: 1.15rem;
  color: var(--emerald);
  margin-bottom: 1rem;
}
.sloka-terjemahan { color: var(--text-soft); margin-bottom: 1rem; }
.sloka cite { font-size: 0.9rem; color: var(--gold); font-style: normal; letter-spacing: 0.08em; }

/* ---------- 4. Countdown ---------- */
.count-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  max-width: 440px;
  margin: 0 auto 2.2rem;
}
.count-box {
  background: var(--card-bg);
  border: 1px solid var(--gold-soft);
  border-radius: 14px;
  padding: 1.1rem 0.3rem;
  box-shadow: 0 4px 14px rgba(47, 79, 67, 0.07);
}
.count-box span {
  display: block;
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--emerald);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.count-box small {
  font-size: 0.72rem;
  color: var(--text-soft);
}

/* ---------- 5. Mempelai ---------- */
.couple-intro { color: var(--text-soft); margin-bottom: 2.5rem; text-shadow: 0 1px 2px rgba(250, 246, 238, 0.7); }
.couple-cards { display: flex; flex-direction: column; gap: 1.6rem; align-items: center; }
.profile-card {
  max-width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--gold-soft);
  border-radius: 20px;
  padding: 1.6rem 1.4rem 1.8rem;
  box-shadow: 0 8px 28px rgba(47, 79, 67, 0.09);
}
.profile-card .arch-frame { margin-bottom: 1.3rem; }
.profile-card h3 { font-size: 2.6rem; color: var(--gold); line-height: 1.3; }
.full-name { font-size: 1.25rem; font-weight: 600; color: var(--emerald); margin: 0.2rem 0 0.8rem; }
.parents { color: var(--text-soft); font-size: 0.95rem; }
.origin { margin-top: 0.6rem; font-size: 0.88rem; color: var(--gold); }
.amp-divider { font-size: 3.2rem; color: var(--gold); text-shadow: 0 1px 2px rgba(250, 246, 238, 0.8); }

/* ---------- 6. Acara: timeline dua lokasi ---------- */
.events { max-width: 640px; }
.events-intro { color: var(--text-soft); margin-bottom: 2.5rem; }
.timeline { max-width: 560px; margin: 0 auto; }

.event-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--gold-soft);
  border-radius: 18px;
  padding: 2rem 1.5rem 2rem 1.7rem;
  text-align: left;
  box-shadow: 0 8px 28px rgba(47, 79, 67, 0.09);
  border-left: 4px solid;
  display: flex;
  gap: 1rem;
}
.event-card.accent-gold { border-left-color: var(--gold); }
.event-card.accent-emerald { border-left-color: var(--emerald-light); }

.event-number {
  flex-shrink: 0;
  font-size: 3.2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--gold-light);
  font-family: var(--font-serif);
}
.accent-emerald .event-number { color: var(--emerald-light); opacity: 0.5; }

.event-body h3 { font-size: 1.75rem; color: var(--emerald); margin: 0.5rem 0 0.1rem; }
.event-sub { font-size: 0.95rem; color: var(--text-soft); font-style: italic; margin-bottom: 0.8rem; }
.event-when { margin-bottom: 1rem; }
.event-when strong { color: var(--emerald); font-size: 1.15rem; }

.event-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.35em 1.1em;
  border-radius: 999px;
  color: #fff;
}
.badge-gold { background: var(--gold); }
.badge-emerald { background: var(--emerald-light); }

.location-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(250, 246, 238, 0.85);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 0.45em 1.1em;
  font-weight: 600;
  color: var(--emerald);
  font-size: 1rem;
}
.accent-emerald .location-badge { border-color: var(--emerald-light); }
.event-note { font-size: 0.85rem; color: var(--text-soft); margin: 0.3rem 0 0.6rem; }
.event-desc { color: var(--text-soft); font-size: 0.95rem; margin-bottom: 1.2rem; }
.btn-map { font-size: 0.9rem; padding: 0.7em 1.8em; }

.timeline-connector {
  width: 2px;
  height: 56px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--gold), var(--emerald-light));
  border-radius: 3px;
}

.events-warning {
  max-width: 560px;
  margin: 2.5rem auto 0;
  padding: 1rem 1.3rem;
  border-left: 3px solid var(--gold);
  background: var(--card-bg);
  border-radius: 0 12px 12px 0;
  text-align: left;
  font-size: 0.95rem;
  color: var(--text);
}

/* ---------- 7. Galeri ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--gold-soft);
  cursor: zoom-in;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.gallery-grid img:hover { transform: scale(1.02); box-shadow: 0 8px 20px rgba(47, 79, 67, 0.15); }
.gallery-grid img:active { transform: scale(0.97); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 35, 28, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.lightbox img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 10px;
}
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
}

/* ---------- 8. RSVP ---------- */
.rsvp form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: var(--card-bg);
  border: 1px solid var(--gold-soft);
  border-radius: 20px;
  padding: 1.8rem 1.5rem;
  box-shadow: 0 8px 28px rgba(47, 79, 67, 0.09);
}
.rsvp label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--emerald);
  font-size: 0.95rem;
}
.rsvp input,
.rsvp select,
.rsvp textarea {
  font-family: var(--font-serif);
  font-size: 1rem;
  padding: 0.75em 1em;
  border: 1px solid var(--gold-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  width: 100%;
  transition: border-color 0.2s ease;
}
.rsvp input:focus,
.rsvp select:focus,
.rsvp textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 148, 77, 0.15);
}
.phone-wrap { display: flex; align-items: stretch; }
.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.9em;
  background: rgba(242, 234, 217, 0.9);
  border: 1px solid var(--gold-soft);
  border-right: none;
  border-radius: 12px 0 0 12px;
  color: var(--text-soft);
}
.phone-wrap input { border-radius: 0 12px 12px 0; }
.rsvp .btn { align-self: center; margin-top: 0.5rem; }
.form-status { text-align: center; min-height: 1.4em; font-size: 0.95rem; }
.form-status.ok { color: var(--emerald-light); }
.form-status.err { color: #a04a3a; }

/* ---------- 9. Ucapan ---------- */
.wishes-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  text-align: left;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.wish-item {
  background: var(--card-bg);
  border: 1px solid var(--gold-soft);
  border-radius: 14px;
  padding: 1rem 1.2rem;
}
.wish-item .wish-name { font-weight: 700; color: var(--emerald); }
.wish-item .wish-time { font-size: 0.8rem; color: var(--text-soft); margin-left: 0.5rem; }
.wish-item .wish-text { margin-top: 0.3rem; color: var(--text); font-size: 0.95rem; }
.wishes-empty { color: var(--text-soft); font-style: italic; text-align: center; }

/* ---------- 10. Penutup ---------- */
.closing { padding-bottom: 3.5rem; }
.closing p { text-shadow: 0 1px 2px rgba(250, 246, 238, 0.7); }
.closing-names { font-size: clamp(2.6rem, 7vw, 3.6rem); color: var(--gold); margin: 1.2rem 0 0.8rem; line-height: 1.3; }
.closing-om { color: var(--emerald); font-size: 1rem; }

/* ---------- 11. Footer ---------- */
.footer {
  background: rgba(28, 77, 58, 0.92);
  color: rgba(250, 246, 238, 0.75);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

/* ============================================================
   Layar sedang (700–900px): dua kolom ringan
   ============================================================ */
@media (min-width: 700px) {
  .couple-cards { flex-direction: row; justify-content: center; align-items: flex-start; gap: 2rem; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .section { padding: 5.5rem 2rem 6rem; }
}

/* ============================================================
   Desktop >900px: satu kolom terpusat max 520px.
   (Split layout dihapus — memotong cover & menyembunyikan tombol.
   99% tamu buka dari HP; prioritas halaman berfungsi.)
   ============================================================ */
@media (min-width: 901px) {
  .section, .cover-content { max-width: 520px; }
}
