/* Virtual Mottobooth — tampilan tamu.
   Warna datang dari tema acara (api/_vlayouts.js) lewat variabel di :root,
   diisi app.js begitu info acara termuat. Nilai di bawah hanya cadangan. */
:root {
  --bg: #1f3a2e;
  --on-bg: #f6f1e4;
  --paper: #f6f1e4;
  --ink: #1b2b23;
  --accent: #c9a25c;
  --on-accent: #1b2b23;
  --muted: color-mix(in srgb, var(--on-bg) 65%, transparent);
  --line: color-mix(in srgb, var(--on-bg) 18%, transparent);
  --radius: 14px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --script: 'Parisienne', 'Cormorant Garamond', cursive;
  --sans: 'Jost', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--on-bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
[hidden] { display: none !important; }

.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; animation: masuk .45s ease both; }
@keyframes masuk { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pad { padding: 20px 20px calc(32px + env(safe-area-inset-bottom)); }
.center { text-align: center; }

/* ---------- tipografi ---------- */
.eyebrow {
  margin: 0 0 6px; font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--accent); font-weight: 500;
}
.names {
  margin: 0; font-family: var(--script); font-weight: 400; font-size: clamp(40px, 12vw, 56px);
  line-height: 1.15; color: var(--on-bg);
}
.date { font-variant-numeric: lining-nums; margin: 6px 0 0; font-family: var(--serif); font-size: 18px; letter-spacing: .08em; color: var(--muted); }
.tagline { margin: 14px auto 0; max-width: 32ch; font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.45; }
.title { margin: 0 0 18px; font-family: var(--serif); font-weight: 600; font-size: 28px; line-height: 1.2; }
.label { display: block; margin: 18px 0 8px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.hint { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; font-size: 14px; }

/* ---------- sambutan ---------- */
#s-welcome { justify-content: flex-start; }
.cover { position: relative; height: 56dvh; min-height: 320px; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 45%, var(--bg) 98%);
}
.welcome-body { flex: 1; padding: 28px 24px 12px; text-align: center; display: flex; flex-direction: column; justify-content: center; }
.cover:not([hidden]) + .welcome-body { margin-top: -70px; position: relative; justify-content: flex-start; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 30px; }
.brand { text-align: center; padding: 16px 0 calc(18px + env(safe-area-inset-bottom)); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }

/* ---------- tombol & form ---------- */
.btn {
  appearance: none; border: 0; border-radius: 999px; padding: 15px 22px; font: 500 15px/1 var(--sans);
  letter-spacing: .04em; cursor: pointer; text-align: center; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-outline { background: transparent; color: var(--on-bg); border: 1px solid var(--line); }
.btn-link { background: none; color: var(--on-bg); text-decoration: underline; text-underline-offset: 4px; padding: 10px; }
.btn-block { width: 100%; margin-top: 22px; }
.row { display: flex; gap: 10px; margin-top: 18px; }
.row > .btn { flex: 1; }

.input {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--line); padding: 14px;
  background: color-mix(in srgb, var(--on-bg) 7%, transparent); color: var(--on-bg); font: 15px/1.5 var(--sans);
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.input { resize: vertical; }

.msg { margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-size: 14px; background: rgba(208, 113, 109, .18); border: 1px solid rgba(208, 113, 109, .5); }

/* ---------- kamera ---------- */
.screen.dark { background: #0b0d0c; color: #fff; }
.bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
.bar.light { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar-title { font-family: var(--serif); font-size: 21px; font-weight: 600; }
.bar-spacer, .icon-spacer { width: 44px; flex-shrink: 0; }
.bar .bar-title, .shot-count { flex: 1; text-align: center; }
.shot-count { font-size: 14px; letter-spacing: .1em; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .06); color: inherit; font-size: 20px; cursor: pointer; flex-shrink: 0;
}
.bar.light .icon-btn { border-color: var(--line); background: transparent; }

.viewfinder {
  position: relative; margin: 6px 16px 0; border-radius: 10px; overflow: hidden; background: #000;
  aspect-ratio: 1 / 1; max-height: 62dvh;
}
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder video.mirror { transform: scaleX(-1); }
.vf-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; font-size: 14px; color: #ccc; }
.countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 600 110px/1 var(--serif); text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: kilat .35s ease; }
@keyframes kilat { from { opacity: .9; } to { opacity: 0; } }
.thumbs { display: flex; gap: 8px; justify-content: center; min-height: 64px; padding: 12px 16px 0; }
.thumbs canvas, .thumbs .slot-empty { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .3); }
.thumbs .slot-empty { background: rgba(255, 255, 255, .06); }
.cam-controls { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: 18px 34px calc(26px + env(safe-area-inset-bottom)); }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: var(--accent); cursor: pointer; }
.shutter:disabled { opacity: .4; }

/* ---------- pilih layout ---------- */
.layout-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; margin-top: 14px; align-items: end; }
.layout-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px; cursor: pointer;
  border-radius: var(--radius); border: 1px solid var(--line); background: color-mix(in srgb, var(--on-bg) 6%, transparent); color: var(--on-bg);
}
.layout-opt:active { transform: scale(.97); }
.layout-opt b { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.layout-opt small { font-size: 12px; color: var(--muted); }
.layout-prev { position: relative; width: 70%; max-height: 180px; background: var(--paper); border-radius: 4px; margin-bottom: 6px; }
.layout-prev i { position: absolute; background: var(--accent); opacity: .55; border-radius: 2px; }

/* ---------- hasil ---------- */
.result { margin: 0 auto; max-width: 340px; border-radius: 6px; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.result img { display: block; width: 100%; }

/* ---------- pesan suara ---------- */
.voice { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #d0716d; flex-shrink: 0; }
.rec-dot.on { animation: denyut 1.1s ease-in-out infinite; }
@keyframes denyut { 50% { transform: scale(1.35); opacity: .5; } }
.voice-status { flex: 1; font-size: 14px; color: var(--muted); }
.voice-time { font-variant-numeric: tabular-nums; color: var(--accent); }
audio { width: 100%; margin-top: 12px; }

/* ---------- galeri ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.card { border-radius: 12px; overflow: hidden; background: var(--paper); color: var(--ink); position: relative; }
.card button.open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.card img { display: block; width: 100%; height: auto; }
.card .meta { padding: 10px 12px 12px; }
.card .who { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 17px; }
.card .what { margin: 4px 0 0; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.card .when { margin: 6px 0 0; font-size: 11px; opacity: .6; }
.card.is-hidden img { opacity: .4; }
.card .badge { position: absolute; top: 8px; left: 8px; padding: 3px 9px; border-radius: 999px; font-size: 11px; background: rgba(0, 0, 0, .65); color: #fff; }
.card .toggle { margin-top: 8px; width: 100%; padding: 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); background: transparent; color: var(--ink); font: 500 12px var(--sans); cursor: pointer; }

/* ---------- ruang pengantin ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.stat { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 6px; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 28px; font-weight: 600; font-variant-numeric: lining-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-top: 16px; padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.tab { flex: 1; border: 0; border-radius: 999px; padding: 10px 6px; background: none; color: var(--on-bg); font: 500 13px var(--sans); cursor: pointer; }
.tab.active { background: var(--accent); color: var(--on-accent); }

/* ---------- lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100%; height: 100%; }
.lightbox::backdrop { background: rgba(0, 0, 0, .9); }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
#lbBody { max-width: 480px; width: 100%; padding: 60px 16px 24px; color: #fff; text-align: center; }
#lbBody img { max-width: 100%; max-height: 70dvh; border-radius: 6px; }
#lbBody .who { font-family: var(--serif); font-size: 22px; margin: 14px 0 4px; }
#lbBody .what { font-size: 15px; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
.lb-close { position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .screen.active, .rec-dot.on, .flash.go { animation: none; }
}

/* ============================================================
   Skin tema bergambar (dari template Undangan Digital):
   html[data-skin="drapery"|"photobox"], dipasang app.js → pasangSkin().
   Aset di /undangan-aset/<template>/. Animasi meniru undangannya:
   bunga masuk dari samping & berayun, segel berdenyut, kilau berkedip.
   ============================================================ */
.skin-deco, .skin-hero { display: none; }
[data-skin] .skin-deco { display: block; position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
[data-skin] .skin-deco img { position: absolute; display: block; height: auto; }
[data-skin] #s-welcome { position: relative; overflow: hidden; }
[data-skin] #s-welcome > :not(.skin-deco) { position: relative; z-index: 1; }
html[data-skin]:not(.ada-cover) .skin-hero { display: block; }
[data-skin] .cover { height: auto; min-height: 0; overflow: visible; margin: 34px auto 0; }
[data-skin] .cover::after { content: none; }
[data-skin] .cover + .skin-hero + .welcome-body, [data-skin] .skin-hero + .welcome-body { margin-top: 0; justify-content: flex-start; }
[data-skin] .cover .skin-bingkai { position: absolute; inset: 0; width: 100%; height: auto; z-index: 1; pointer-events: none; }
[data-skin] .welcome-body { justify-content: flex-start; padding-top: 18px; }

/* ---------- Drapery Emerald ---------- */
:root[data-skin='drapery'] {
  --serif: 'Cormorant Garamond', Georgia, serif;
  --script: 'Pinyon Script', 'Parisienne', cursive;
  --line: rgba(253, 249, 246, .28);
}
[data-skin='drapery'] body {
  background: url('/undangan-aset/drapery-emerald/beludru-hijau.webp') center top / 100% auto repeat-y, var(--bg);
}
[data-skin='drapery'] #app { background: url('/undangan-aset/drapery-emerald/beludru-hijau.webp') center top / 100% auto repeat-y, var(--bg); }
[data-skin='drapery'] #s-welcome { background: url('/undangan-aset/drapery-emerald/tirai.webp') center top / cover no-repeat, #0f1a0f; }
[data-skin='drapery'] .d-gantung { left: -4%; top: 42px; width: 38%; transform-origin: 50% 0; animation: skin-kiri 1.4s cubic-bezier(.16,.84,.3,1) .2s both, skin-ayun 5.5s ease-in-out 1.6s infinite alternate; }
[data-skin='drapery'] .d-berdiri { right: -14%; bottom: 46px; width: 54%; animation: skin-kanan 1.4s cubic-bezier(.16,.84,.3,1) .35s both; }
[data-skin='drapery'] .d-pojok { left: -5%; bottom: -8px; width: 32%; animation: skin-kiri 1.4s cubic-bezier(.16,.84,.3,1) .45s both; }
[data-skin='drapery'] .d-kupu { right: 7%; top: 31%; width: 11%; animation: skin-naik 1.2s ease .9s both, skin-kepak 3.2s ease-in-out 2s infinite; }
[data-skin='drapery'] .d-kilau { left: 76%; top: 33%; width: 9%; animation: skin-kilau 2.6s ease-in-out infinite; }
[data-skin='drapery'] .cover { width: 60%; aspect-ratio: 357.8 / 426.8; animation: skin-pop 1.3s cubic-bezier(.16,.84,.3,1) both; }
[data-skin='drapery'] .cover #coverImg { position: absolute; left: 11%; top: 2.4%; width: 78%; height: 95.2%; object-fit: cover; border-radius: 999px; }
[data-skin='drapery'] .skin-hero { position: relative; width: 66%; margin: 70px auto 6px; animation: skin-pop 1.3s cubic-bezier(.16,.84,.3,1) both; }
[data-skin='drapery'] .d-amplop { display: block; width: 100%; height: auto; }
[data-skin='drapery'] .d-segel { position: absolute; left: 41.2%; top: 40.2%; width: 17.8%; height: auto; animation: skin-denyut 2.4s ease-in-out infinite; }
[data-skin='drapery'] .names { font-size: clamp(44px, 13vw, 60px); text-shadow: 0 2px 14px rgba(0,0,0,.5); animation: skin-naik 1.3s cubic-bezier(.16,.84,.3,1) .3s both; }
[data-skin='drapery'] .date { font-family: var(--serif); text-transform: uppercase; letter-spacing: .22em; font-size: 16px; color: #e8d7b0; animation: skin-naik 1.3s cubic-bezier(.16,.84,.3,1) .45s both; }
[data-skin='drapery'] .tagline { color: var(--on-bg); text-shadow: 0 1px 10px rgba(0,0,0,.6); }
[data-skin='drapery'] .stack { animation: skin-naik 1.3s cubic-bezier(.16,.84,.3,1) .6s both; }
[data-skin='drapery'] .btn { font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: .08em; border-radius: 8px; }
[data-skin='drapery'] .btn-primary { box-shadow: 0 8px 20px -10px rgba(0,0,0,.7); }
[data-skin='drapery'] .btn-outline { background: rgba(15, 26, 15, .45); }
[data-skin='drapery'] .btn-link { color: var(--on-bg); text-shadow: 0 1px 8px rgba(0,0,0,.6); }
[data-skin='drapery'] .bar.light { background: rgba(29, 43, 27, .92); backdrop-filter: blur(6px); }
[data-skin='drapery'] .card { border: 2px solid #c9a45c; border-radius: 10px; }
[data-skin='drapery'] .card .who { font-family: var(--script); font-weight: 400; font-size: 24px; }
[data-skin='drapery'] .eyebrow, [data-skin='drapery'] .label { color: #e8d7b0; }

/* ---------- Photobox Archives ---------- */
:root[data-skin='photobox'] {
  --serif: 'Courier Prime', 'Courier New', monospace;
  --sans: 'Courier Prime', 'Courier New', monospace;
  --script: 'Mr Dafoe', 'Brush Script MT', cursive;
  --line: rgba(252, 249, 242, .3);
}
[data-skin='photobox'] .d-kilau-a { left: 10%; top: 26%; width: 4.5%; animation: skin-kilau 2.4s ease-in-out infinite; }
[data-skin='photobox'] .d-kilau-b { right: 8%; top: 50%; width: 6%; animation: skin-kilau 2.4s ease-in-out 1.1s infinite; }
[data-skin='photobox'] .cover { width: 66%; aspect-ratio: 480.8 / 627.8; margin-top: 46px; animation: skin-naik 1.2s cubic-bezier(.16,.84,.3,1) both; }
[data-skin='photobox'] .cover #coverImg { position: absolute; left: 4.89%; top: 4.94%; width: 89.85%; height: 92.47%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
[data-skin='photobox'] .cover .skin-selotip { position: absolute; z-index: 2; right: -16%; top: -7%; width: 46%; height: auto; animation: skin-pop 1s cubic-bezier(.34,1.56,.64,1) .6s both; }
[data-skin='photobox'] .skin-hero { width: 82%; margin: 64px 0 0 4%; animation: skin-naik 1.2s cubic-bezier(.16,.84,.3,1) both; }
[data-skin='photobox'] .d-invited { display: block; width: 100%; height: auto; }
[data-skin='photobox'] .names { font-size: clamp(42px, 12vw, 56px); line-height: 1.05; animation: skin-naik 1.2s cubic-bezier(.16,.84,.3,1) .25s both; }
[data-skin='photobox'] .date { font-family: var(--script); font-size: 34px; letter-spacing: 0; color: var(--on-bg); animation: skin-naik 1.2s cubic-bezier(.16,.84,.3,1) .4s both; }
[data-skin='photobox'] .tagline { font-family: var(--sans); font-style: normal; font-size: 15px; }
[data-skin='photobox'] .stack { animation: skin-naik 1.2s cubic-bezier(.16,.84,.3,1) .55s both; }
[data-skin='photobox'] .btn { font-family: var(--sans); font-weight: 700; font-size: 16px; letter-spacing: 0; border-radius: 12px; }
[data-skin='photobox'] .btn-primary { box-shadow: 0 10px 26px -10px rgba(0,0,0,.6); }
[data-skin='photobox'] .title, [data-skin='photobox'] .bar-title { font-family: var(--script); font-weight: 400; font-size: 34px; }
[data-skin='photobox'] .card { border-radius: 3px; padding: 7px 7px 0; background: #f7f6f2; color: #1d1b19; rotate: -1.2deg; box-shadow: 0 10px 18px -10px rgba(0,0,0,.6); overflow: visible; }
[data-skin='photobox'] .grid .card:nth-child(even) { rotate: 1.4deg; }
[data-skin='photobox'] .card::before {
  content: ''; position: absolute; z-index: 2; left: 50%; top: -10px; width: 48%; aspect-ratio: 207.8 / 87; translate: -50% 0;
  background: url('/undangan-aset/photobox-archives/selotip-b.webp') center / contain no-repeat;
}
[data-skin='photobox'] .card .who { font-family: var(--script); font-weight: 400; font-size: 24px; color: #7d1418; }

/* pratinjau layout memakai gambar frame (tema bergambar / frame kustom) */
.layout-prev.ada-frame { background: #b9b9b9; overflow: hidden; }
.layout-prev .layout-frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.layout-prev.ada-frame i { background: #8d8d8d; opacity: 1; }

@keyframes skin-kiri { from { opacity: 0; transform: translateX(-45%); } to { opacity: 1; transform: none; } }
@keyframes skin-kanan { from { opacity: 0; transform: translateX(45%); } to { opacity: 1; transform: none; } }
@keyframes skin-naik { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: none; } }
@keyframes skin-pop { from { opacity: 0; transform: scale(1.12); } to { opacity: 1; transform: none; } }
@keyframes skin-ayun { from { rotate: -1.4deg; } to { rotate: 1.4deg; } }
@keyframes skin-denyut { 0%, 20% { transform: scale(.85); } 35%, 80% { transform: scale(1); } 100% { transform: scale(.85); } }
@keyframes skin-kilau { 0%, 100% { opacity: .55; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes skin-kepak { 0%, 100% { translate: 0 0; rotate: -3deg; } 50% { translate: 0 -6px; rotate: 3deg; } }

@media (prefers-reduced-motion: reduce) {
  [data-skin] .skin-deco img, [data-skin] .cover, [data-skin] .skin-hero, [data-skin] .names,
  [data-skin] .date, [data-skin] .stack, [data-skin] .skin-selotip, [data-skin] .d-segel { animation: none; }
}

/* ---------- pesan telepon (Ruang Pengantin) ---------- */
.tele { margin-top: 8px; }
.sub { margin: 22px 0 4px; font-family: var(--serif); font-weight: 600; font-size: 22px; }
.sub span { font-family: var(--sans); font-size: 14px; color: var(--muted); font-weight: 400; }
.tele-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.tele-item { border-radius: 12px; overflow: hidden; background: var(--paper); color: var(--ink); }
.tele-item video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: contain; }
.tele-item .meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; font-size: 13px; }
.tele-item a { color: var(--ink); font-weight: 500; }
