/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --page: #d9cdb6;
  --paper: #f3eee5;
  --ink: #612700;
  --ink-soft: rgba(97, 39, 0, 0.62);
  --dock-bg: #ece2d3;
  --dock-ink: #45372a;
  --danger: #a8321f;
  --w: 430px;
  --dock-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --f-body: 'Abhaya Libre', Georgia, serif;
  --f-script: 'Imperial Script', 'Alex Brush', cursive;
  --f-brush: 'Alex Brush', cursive;
  --f-deco: 'Cinzel Decorative', 'Prata', serif;
  --f-prata: 'Prata', Georgia, serif;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .34 0 0 0 0 .2 .13 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --emboss: drop-shadow(-1px -1px 0.4px rgba(255, 255, 255, 0.95)) drop-shadow(1.4px 1.8px 1.4px rgba(110, 70, 30, 0.24));
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--page); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font: 500 16px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; height: 100svh; }

p { margin: 0 0 4px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.emboss { filter: var(--emboss); }

/* Layers pinned to the card column */
.frame { position: fixed; top: 0; bottom: 0; left: 50%; width: min(100%, var(--w)); transform: translateX(-50%); }
.frame-x { position: fixed; left: 50%; width: min(100%, var(--w)); transform: translateX(-50%); }

/* ─── Paper + fixed side florals ─────────────────────────── */
.decor {
  z-index: 0;
  overflow: hidden;
  background: var(--paper) var(--noise);
  box-shadow: 0 0 60px rgba(70, 48, 20, 0.22);
}
/* Soft centre wash keeps the text column clean; florals read as a border */
.decor::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 9%; right: 9%;
  background: linear-gradient(90deg, rgba(243, 238, 229, 0), rgba(243, 238, 229, 0.88) 22%, rgba(243, 238, 229, 0.92) 50%, rgba(243, 238, 229, 0.88) 78%, rgba(243, 238, 229, 0));
}
.decor .spray, .cover-florals .spray { position: absolute; height: auto; }
.d-tr { top: -40px; right: -62px; width: 250px; transform: scaleX(-1); }
.d-tl { top: 18%; left: -150px; width: 210px; transform: rotate(-70deg); }
.d-ml { top: 44%; left: -128px; width: 210px; transform: rotate(-55deg); }
.d-mr { top: 30%; right: -140px; width: 220px; transform: scaleX(-1) rotate(-60deg); }
.d-br { bottom: calc(var(--dock-h) + 10px); right: -120px; width: 220px; transform: scale(-1, -1) rotate(-20deg); }
.d-bl { bottom: calc(var(--dock-h) - 50px); left: -64px; width: 240px; transform: scaleY(-1); }

/* ─── Card ───────────────────────────────────────────────── */
.card { position: relative; z-index: 2; max-width: var(--w); margin: 0 auto; }

/* ─── Gate (closed envelope) ─────────────────────────────── */
.gate { z-index: 60; overflow: hidden; }
.gate.gone { display: none; }
.door {
  position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden;
  background: var(--paper) var(--noise);
  transition: transform 1.3s cubic-bezier(0.7, 0, 0.25, 1) 0.45s;
}
.door-l { left: 0; box-shadow: 2px 0 6px rgba(90, 60, 25, 0.12); z-index: 1; }
.door-r { right: 0; }
.door-in { position: absolute; top: 0; bottom: 0; width: 200%; }
.door-l .door-in { left: 0; }
.door-r .door-in { right: 0; }
.gate-field { position: absolute; inset: 0; width: 100%; height: 100%; }

.ribbon-wrap { position: absolute; inset: 0; z-index: 2; pointer-events: none; transition: opacity 0.7s ease, transform 1s ease; }
.ribbon { width: 100%; height: 100%; display: block; filter: drop-shadow(0 7px 10px rgba(90, 65, 30, 0.22)) drop-shadow(0 1px 1px rgba(90, 65, 30, 0.14)); }

.seal {
  position: absolute; z-index: 3; left: 50%; top: 50%;
  width: 128px; height: 128px; margin: -64px 0 0 -64px;
  padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  filter: drop-shadow(0 6px 10px rgba(80, 60, 30, 0.3));
  animation: sealBreath 3s ease-in-out infinite;
  transition: transform 0.55s ease, opacity 0.55s ease;
}
.seal-art, .seal-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.seal-names {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--f-script); font-size: 21px; line-height: 1.02; color: #6b3a16;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}
.seal-names span:first-child { margin-right: 8px; }
.seal-names span:last-child { margin-left: 2px; }
.gate-hint {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: calc(34px + var(--safe-b)); margin: 0;
  text-align: center; font-size: 13px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-soft); text-shadow: 0 0 8px #fff, 0 0 2px #fff;
  animation: hint 2.6s ease-in-out infinite;
  transition: opacity 0.4s ease;
}
.gate.opening .seal { transform: scale(1.18); opacity: 0; animation: none; pointer-events: none; }
.gate.opening .ribbon-wrap { opacity: 0; transform: scale(1.08); }
.gate.opening .gate-hint { opacity: 0; animation: none; }
.gate.opening .door-l { transform: translateX(-101%); }
.gate.opening .door-r { transform: translateX(101%); }

@keyframes sealBreath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes hint { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ─── Sparkles ───────────────────────────────────────────── */
.sparkles { z-index: 30; pointer-events: none; height: 100%; }

/* ─── Cover ──────────────────────────────────────────────── */
.cover {
  position: relative; height: 100svh; min-height: 580px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper) var(--noise);
}
.cover-arch {
  position: absolute; left: 11%; right: 11%; top: 9%; bottom: 13%;
  border: 10px solid #f7f2ea;
  border-radius: 999px 999px 999px 999px / 999px 999px 380px 380px;
  box-shadow:
    -2px -2px 2px rgba(255, 255, 255, 0.95), 2px 3px 4px rgba(110, 70, 30, 0.2),
    inset -2px -2px 2px rgba(255, 255, 255, 0.9), inset 2px 3px 4px rgba(110, 70, 30, 0.17);
}
.cover-arch::after {
  content: ''; position: absolute; inset: 10px; border-radius: inherit;
  box-shadow:
    -1px -1px 1px rgba(255, 255, 255, 0.95), 1px 1.5px 2px rgba(110, 70, 30, 0.15),
    inset -1px -1px 1px rgba(255, 255, 255, 0.9), inset 1px 1.5px 2px rgba(110, 70, 30, 0.13);
}
.cover-florals { position: absolute; inset: 0; pointer-events: none; }
.cf-tr { top: -3%; right: -16%; width: 64%; transform: scaleX(-1); }
.cf-bl { bottom: -2%; left: -14%; width: 62%; transform: scaleY(-1); }
.cf-br { bottom: -6%; right: -18%; width: 56%; transform: scale(-1, -1) rotate(-12deg); }
.cf-ml { top: 30%; left: -34%; width: 52%; transform: rotate(-58deg); }

.cover-text { position: relative; z-index: 1; text-align: center; padding: 0 16%; margin-top: -5vh; }
.eyebrow { font-size: 17px; font-weight: 600; letter-spacing: 0.02em; margin: 0 0 20px; }
.names {
  margin: 0; display: flex; flex-direction: column; align-items: center;
  font-family: var(--f-script); font-weight: 400; font-size: clamp(54px, 15.5vw, 66px); line-height: 1;
}
.names .amp { font-size: 0.48em; margin: 0.12em 0 0.06em; }
.cover-date { font-size: 16px; font-weight: 600; letter-spacing: 0.03em; margin: 24px 0 0; }
.scroll-hint { position: absolute; left: 50%; bottom: calc(15% + 18px); width: 28px; margin-left: -14px; color: var(--ink-soft); }
.scroll-hint svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

.cv { opacity: 0; transform: translateY(14px); transition: opacity 1.2s ease, transform 1.2s ease; }
.cover.revealed .cv { opacity: 1; transform: none; }
.cover.revealed .cv-1 { transition-delay: 0.15s; }
.cover.revealed .cv-2 { transition-delay: 0.7s; }
.cover.revealed .cv-3 { transition-delay: 1.35s; }
.cover.revealed .cv-4 { transition-delay: 2s; }

/* ─── Body ───────────────────────────────────────────────── */
.body { position: relative; padding: 56px 15% calc(var(--dock-h) + 56px + var(--safe-b)); text-align: center; }
.block { margin: 0 0 46px; }

.script-title { font-family: var(--f-brush); font-size: 36px; line-height: 1.2; margin-bottom: 14px; }
.parents { font-family: var(--f-prata); font-size: 17px; line-height: 1.7; }
.invite p { margin-bottom: 6px; }
.honorifics { font-weight: 600; }
.guest { font-family: var(--f-deco); font-weight: 700; font-size: 22px; line-height: 1.3; margin: 10px 0 12px !important; }
.full-names { margin: 0; display: flex; flex-direction: column; font-family: var(--f-deco); font-weight: 400; font-size: 24px; line-height: 1.3; }
.amp-sm { font-family: var(--f-script); font-size: 34px; line-height: 1.15; }

.label { margin: 0 0 6px; font-size: 17px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.label.lg { font-size: 19px; margin-bottom: 20px; }
.venue-name { font-family: var(--f-deco); font-size: 17px; margin-bottom: 4px; }
.address { line-height: 1.55; }
.hijri { font-style: italic; }

.swatches { display: flex; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.swatches span { width: 40px; height: 40px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(90, 60, 25, 0.12); }

.timeline { list-style: none; margin: 0 auto; padding: 0; display: inline-block; text-align: left; position: relative; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 12px; bottom: 34px; width: 1.5px; background: rgba(97, 39, 0, 0.45); }
.timeline li { position: relative; padding-left: 28px; margin-bottom: 20px; }
.timeline li:last-child { margin-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: 0; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: #8a5d45; }
.timeline .t { display: block; font-size: 17px; font-weight: 600; }
.timeline .d { display: block; font-size: 17px; }

.doa p:first-child { line-height: 1.75; margin-bottom: 22px; }
.hashtag { font-family: var(--f-deco); font-size: 21px; }

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.countdown b { display: block; font-size: 30px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.countdown span { font-size: 15px; }
.cd-done { margin-top: 8px; }

.gallery { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -12%; padding: 0 12%; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: 0 0 100%; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 26px; scroll-snap-align: center; box-shadow: 0 8px 20px rgba(70, 45, 15, 0.18); }

.stats { display: grid; grid-template-columns: 1fr 1fr; }
.stats b { display: block; font-size: 46px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { font-size: 16px; }

.wishes {
  height: 300px; overflow-y: auto; scrollbar-width: none; margin-bottom: 22px;
  -webkit-mask-image: linear-gradient(transparent, #000 13%, #000 87%, transparent);
  mask-image: linear-gradient(transparent, #000 13%, #000 87%, transparent);
}
.wishes::-webkit-scrollbar { display: none; }
.wishes.empty { display: none; }
.wishes-track { padding: 30px 0; }
.wish { padding: 10px 0 14px; }
.wish q { display: block; font-style: italic; quotes: '“' '”'; overflow-wrap: anywhere; }
.wish b { display: block; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.wishes-empty { margin-bottom: 22px; color: var(--ink-soft); }

.credit { font-size: 14px; color: var(--ink-soft); }
.credit-names { font-family: var(--f-script); font-size: 30px; color: var(--ink); line-height: 1.2; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 22px;
  border: 1.5px solid rgba(97, 39, 0, 0.6); border-radius: 12px;
  background: rgba(255, 255, 255, 0.28); color: var(--ink);
  font: 600 16px/1.2 var(--f-body); letter-spacing: 0.02em; text-decoration: none; cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.6); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn-solid { background: var(--ink); border-color: var(--ink); color: #fbf4ea; }
.btn-solid:hover { background: #742f02; }
.btn-ghost { border-color: transparent; background: none; }
.btn-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-row { display: flex; gap: 10px; justify-content: center; }
.btn-row .btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.body .btn-row { margin: 0 -10%; }
.body .btn-row .btn { font-size: 15px; }

/* ─── Dock ───────────────────────────────────────────────── */
.dock {
  bottom: 0; z-index: 40;
  height: calc(var(--dock-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; align-items: stretch;
  background: var(--dock-bg); box-shadow: 0 -6px 16px rgba(80, 55, 25, 0.13);
  transform: translate(-50%, 110%); transition: transform 0.7s ease 1.2s;
}
body.opened .dock { transform: translate(-50%, 0); }
.dock button { flex: 1; display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--dock-ink); cursor: pointer; }
.dock button[hidden] { display: none; }
.dock svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
#musicBtn .ic-pause { display: none; }
#musicBtn.playing .ic-play { display: none; }
#musicBtn.playing .ic-pause { display: block; }

/* ─── Sheets ─────────────────────────────────────────────── */
.backdrop { z-index: 45; background: rgba(50, 32, 14, 0.3); opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s; }
.backdrop.show { opacity: 1; visibility: visible; }

.sheet {
  position: fixed; left: 50%; z-index: 50;
  bottom: calc(var(--dock-h) + var(--safe-b) + 10px);
  width: calc(min(100%, var(--w)) - 20px);
  max-height: calc(100svh - var(--dock-h) - var(--safe-b) - 30px); overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 20px 22px; text-align: center;
  background: #f2ece2 var(--noise); border-radius: 18px;
  box-shadow: 0 12px 40px rgba(60, 40, 15, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  opacity: 0; visibility: hidden; transform: translate(-50%, 24px);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s ease, visibility 0.35s;
}
.sheet.open { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.sheet-title { margin: 0 32px 16px; font-size: 18px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.sheet-x { position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.sheet-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.sheet-strong { font-weight: 700; font-size: 17px; }
.sheet-note { margin: 0 0 16px; line-height: 1.55; }
.sheet .btn-row { margin-top: 18px; }

.map-frame { margin: 16px 0 0; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #e7dfd1; box-shadow: inset 0 0 0 1px rgba(97, 39, 0, 0.15); }
.map-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

.contact-list, .gift-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.contact-list li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid rgba(97, 39, 0, 0.14); }
.contact-list li:last-child { border-bottom: 0; }
.contact-list .who { flex: 1; min-width: 0; }
.contact-list .who b { display: block; font-size: 17px; }
.contact-list .who span { font-size: 14px; color: var(--ink-soft); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 1.5px solid rgba(97, 39, 0, 0.5); border-radius: 50%; color: var(--ink); background: rgba(255, 255, 255, 0.3); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.gift-list li { padding: 14px 16px; margin-bottom: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.45); box-shadow: inset 0 0 0 1px rgba(97, 39, 0, 0.12); display: flex; align-items: center; gap: 12px; }
.gift-list .acct { flex: 1; min-width: 0; }
.gift-list .acct b { display: block; font-size: 17px; }
.gift-list .acct span { display: block; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

/* ─── Forms ──────────────────────────────────────────────── */
.form { text-align: left; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 600; }
.field i { margin-left: 2px; font-style: normal; color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; appearance: none; -webkit-appearance: none;
  border: 1.5px solid rgba(97, 39, 0, 0.45); border-radius: 10px;
  background: rgba(255, 255, 255, 0.62); color: #2c1a0c;
  font: 500 16px/1.3 var(--f-body);
}
.field select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='12'%3E%3Cpath fill='%23612700' d='M5 0 0 5h10zm0 12 5-5H0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(97, 39, 0, 0.12); }
.field .invalid { border-color: var(--danger); }
.pax { display: grid; grid-template-columns: 1fr; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { margin: 2px 0 0; color: var(--danger); font-size: 15px; }
.form-error:empty { display: none; }
.form-status { margin: 0 0 14px; text-align: center; font-weight: 700; font-size: 17px; }

.done-mark { display: grid; place-items: center; margin: 4px 0 10px; }
.done-mark svg { width: 54px; height: 54px; padding: 12px; border-radius: 50%; background: var(--ink); fill: none; stroke: #fbf4ea; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + var(--safe-b) + 20px); z-index: 70;
  max-width: calc(min(100%, var(--w)) - 40px); padding: 10px 18px; border-radius: 999px;
  background: #3e2511; color: #fbf4ea; font-size: 15px; text-align: center;
  opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ─── Scroll reveal ──────────────────────────────────────── */
.rv { opacity: 0; transform: translateY(18px); transition: opacity 1s ease, transform 1s ease; }
.rv.in { opacity: 1; transform: none; }

@media (max-width: 360px) {
  .body { padding-left: 12%; padding-right: 12%; }
  .btn-row { flex-wrap: wrap; }
  .btn-row .btn { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .rv, .cv { opacity: 1; transform: none; }
}
