/* =========================================================================
   Mehndi · Barat · Walima — the supplied visuals as live scenes
   Every scene is one 941×1672 artwork ("plate"). Live text is placed on the
   plate in artwork pixels (--x, --y, --w, --fs) × --u (screen px per artwork px).
   ========================================================================= */

:root {
  --ease: cubic-bezier(.22, .75, .2, 1);

  /* type — matched to the lettering in the visuals */
  --f-serif: 'EB Garamond', Garamond, 'Times New Roman', serif;
  --f-script: 'Great Vibes', 'Snell Roundhand', cursive;

  /* palette sampled from the visuals */
  --ivory: #FBF4E6;
  --paper: #F3E6CF;
  --gold: #C9A55E;
  --gold-deep: #8E6A2E;
  --burgundy: #5A0A14;
  --mehndi: #3B4021;
  --slate: #445153;
  --ink: #3A2A1D;

  --col: 520px;
  --u: calc(min(100vw, 520px) / 941);   /* refined by JS */
  --page-bg: #EADBC0;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: auto; background: var(--page-bg); }
body {
  margin: 0; font-family: var(--f-serif); color: var(--ink);
  background: var(--page-bg); transition: background-color .9s var(--ease);
  -webkit-font-smoothing: antialiased; overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
body[data-theme="ivory"]  { --page-bg: #EADBC0; }
body[data-theme="mehndi"] { --page-bg: #E9C88A; }
body[data-theme="barat"]  { --page-bg: #3A0E18; }
body[data-theme="walima"] { --page-bg: #E3EAEE; }
html.is-locked, html.is-locked body { overflow: hidden; }
p, h1, h2 { margin: 0; font: inherit; }
button { font: inherit; color: inherit; }
a { color: inherit; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus { outline: none; }
:focus-visible { outline: 2px solid #B8893A; outline-offset: 3px; border-radius: 8px; }

.skip-link {
  position: fixed; z-index: 300; left: 50%; top: 8px; transform: translate(-50%, -160%);
  padding: 10px 18px; border-radius: 999px; background: #2B1D12; color: #FBF5EA; text-decoration: none;
  font-weight: 600; transition: transform .3s var(--ease);
}
.skip-link:focus-visible { transform: translate(-50%, 0); }

.app { position: relative; max-width: var(--col); margin: 0 auto; box-shadow: 0 0 90px rgba(40, 20, 10, .22); }

/* ---------- Scenes & plates ---------- */
.scene { position: relative; overflow: hidden; background: var(--paper); }
.plate { position: relative; width: 100%; aspect-ratio: 941 / 1672; }
.plate > picture, .plate > picture img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.plate > picture img { object-fit: cover; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }

/* live text placed in artwork pixels */
.ov {
  position: absolute; margin: 0;
  left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  translate: -50% -50%;
  font-size: calc(var(--fs, 30) * var(--u)); line-height: 1.2;
  text-align: center; color: var(--ink); text-wrap: balance;
}
.ov-serif { font-family: var(--f-serif); font-weight: 500; letter-spacing: .01em; }
.ov-ital  { font-family: var(--f-serif); font-style: italic; font-weight: 500; letter-spacing: .015em; }
.ov-serif, .ov-ital, .ov-block > p { text-shadow: 0 0 calc(9 * var(--u)) rgba(252, 244, 228, .95), 0 0 calc(3 * var(--u)) rgba(252, 244, 228, .9); }
.ov-strong { font-weight: 600; letter-spacing: .02em; }
.ov-hosts { font-weight: 600; letter-spacing: .04em; }
.ov .dot { color: var(--gold); padding: 0 .1em; }
.ov-stack { display: flex; flex-direction: column; align-items: center; line-height: 1.05; }
.ov-stack .note { font-size: .62em; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.ov-block { display: flex; flex-direction: column; align-items: center; gap: calc(5 * var(--u)); }
.ov-block > p { font-size: calc(var(--fs) * var(--u)); line-height: 1.2; color: var(--ink); }
.ov-contact { font-weight: 500; }

/* script names: Great Vibes, weighted and embossed like the printed lettering */
.couple-names { margin: 0; font: inherit; }
.ov-name {
  font-family: var(--f-script); font-weight: 400; line-height: 1.15; white-space: nowrap;
  color: #5E0B16;
  -webkit-text-stroke: calc(.9 * var(--u)) #5E0B16;
  text-shadow: 0 calc(1.6 * var(--u)) 0 rgba(255, 246, 230, .85), 0 calc(-.8 * var(--u)) calc(1.2 * var(--u)) rgba(55, 0, 8, .28);
  padding: .1em .2em .25em;
}

/* invisible hit areas over painted buttons (Tap to Open, Call, WhatsApp) */
.ov-hit { height: calc(var(--h) * var(--u)); min-height: 44px; display: block; background: transparent; border: 0; padding: 0; cursor: pointer; border-radius: calc(26 * var(--u)); }
.ov-hit:focus-visible { outline: 2px solid #FFF3D4; box-shadow: 0 0 0 5px rgba(122, 20, 36, .55); }

/* calendar chips on the venue scene */
.ov-actions { display: flex; flex-direction: column; align-items: center; gap: calc(10 * var(--u)); }
.ov-actions:empty { display: none; }
.ov-actions .cap { font-family: var(--f-serif); font-style: italic; font-size: calc(22 * var(--u)); color: #5A4A2E; }
.ov-actions .chips { display: flex; justify-content: center; gap: calc(14 * var(--u)); width: 100%; }
.chip {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: calc(8 * var(--u));
  min-height: max(40px, calc(66 * var(--u))); padding: 0 calc(10 * var(--u));
  border: calc(2 * var(--u)) solid var(--gold); border-radius: calc(16 * var(--u));
  background: linear-gradient(180deg, rgba(255, 252, 244, .96), rgba(246, 234, 210, .96));
  box-shadow: inset 0 0 0 calc(5 * var(--u)) rgba(255, 252, 244, .9), inset 0 0 0 calc(6.5 * var(--u)) rgba(201, 165, 94, .55), 0 calc(4 * var(--u)) calc(14 * var(--u)) rgba(90, 50, 10, .18);
  font-family: var(--f-serif); font-weight: 600; font-size: calc(22 * var(--u)); letter-spacing: .1em; text-transform: uppercase;
  color: var(--c, var(--burgundy)); cursor: pointer;
}
.chip svg { width: calc(26 * var(--u)); height: calc(26 * var(--u)); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.chip:active { transform: scale(.98); }

.ico { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Location / calendar plaques — drawn to match the visual's own "Location Link" plaque */
.ov-plaques { display: flex; justify-content: center; gap: calc(16 * var(--u)); }
.plaque {
  flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: calc(10 * var(--u));
  min-height: max(44px, calc(80 * var(--u))); padding: 0 calc(16 * var(--u));
  border: calc(2.2 * var(--u)) solid #C9A55E; border-radius: calc(18 * var(--u));
  background: linear-gradient(180deg, #FFFCF4, #F3E5CB);
  box-shadow: inset 0 0 0 calc(5 * var(--u)) #FFFBF0, inset 0 0 0 calc(6.5 * var(--u)) rgba(201, 165, 94, .7), 0 calc(5 * var(--u)) calc(16 * var(--u)) rgba(90, 50, 10, .22);
  font-family: var(--f-serif); font-weight: 500; font-size: calc(27 * var(--u)); color: #5E0B16;
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.plaque .ico { width: calc(32 * var(--u)); height: calc(32 * var(--u)); color: #7A1424; }
.plaque:active { transform: scale(.98); }
.no-js .plaque[data-sheet="calendar"] { display: none; }
.ov-link {
  display: inline-flex; align-items: center; justify-content: center; gap: calc(8 * var(--u));
  font-family: var(--f-serif); font-style: italic; font-weight: 500; color: #4F6175;
  text-decoration: underline; text-decoration-color: rgba(79, 97, 117, .45); text-underline-offset: .2em;
  min-height: 44px; text-shadow: 0 0 calc(9 * var(--u)) rgba(252, 244, 228, .95);
}
.ov-link .ico { width: 1.1em; height: 1.1em; }

/* Location & calendar sheet */
.sheet { position: fixed; inset: 0; z-index: 260; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(30, 14, 8, .45); opacity: 0; transition: opacity .35s var(--ease); }
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet-card {
  position: relative; width: min(100%, var(--col)); max-height: min(92vh, 880px); overflow: auto; overscroll-behavior: contain;
  padding: 30px max(22px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  border-radius: 26px 26px 0 0; text-align: center; color: var(--ink);
  background: radial-gradient(120% 70% at 50% 0%, #FFFDF7, #F5E8CF);
  box-shadow: 0 -10px 40px rgba(40, 20, 10, .28), inset 0 0 0 1px rgba(201, 165, 94, .85), inset 0 0 0 7px #FFFBF1, inset 0 0 0 8px rgba(201, 165, 94, .55);
  transform: translateY(104%); transition: transform .5s var(--ease);
}
.sheet.open .sheet-card { transform: none; }
.reduce .sheet-card, .reduce .sheet-backdrop { transition: none; }
.sheet-panel { display: none; }
.sheet-panel.on { display: block; }
.sheet-eyebrow { font-family: var(--f-script); font-size: 32px; line-height: 1.15; color: #8E6A2E; }
.sheet-title { font-family: var(--f-serif); font-weight: 600; font-size: 26px; line-height: 1.2; color: #5E0B16; text-wrap: balance; }
.sheet-addr { font-size: 17px; line-height: 1.4; color: #4F5338; margin-top: 4px; text-wrap: balance; }
.sheet-map { margin-top: 16px; height: 210px; border-radius: 14px; overflow: hidden; background: #EFE3CB; box-shadow: 0 0 0 2px #C9A55E, 0 6px 18px rgba(90, 50, 10, .15); }
.sheet-map iframe { display: block; width: 100%; height: 100%; border: 0; }
.sheet-map .fallback { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px; font-style: italic; font-size: 15px; line-height: 1.4; color: #6B4B22; }
.sheet-map .fallback .ico { width: 30px; height: 30px; color: #7A1424; }
.sheet-qr { display: flex; align-items: center; gap: 16px; margin-top: 16px; text-align: left; }
.sheet-qr img { width: 132px; height: 132px; flex: none; border-radius: 8px; background: #FFFBF2; box-shadow: 0 0 0 1.5px #C9A55E; }
.sheet-qr p { font-style: italic; font-size: 16px; line-height: 1.4; color: #5A4A2E; }
.sheet-btn {
  margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; border-radius: 999px;
  background: linear-gradient(180deg, #7A1424, #5A0A14); color: #FBEFD9; text-decoration: none;
  font-weight: 600; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; box-shadow: 0 6px 16px rgba(94, 11, 22, .3);
}
.sheet-btn .ico { width: 20px; height: 20px; }
.sheet-x { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(201, 165, 94, .85); background: #FFFBF1; cursor: pointer; }
.sheet-x span::before, .sheet-x span::after { content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 1.6px; margin: -.8px 0 0 -8px; background: #5E0B16; transform: rotate(45deg); }
.sheet-x span::after { transform: rotate(-45deg); }
.sheet-chips { display: grid; gap: 10px; margin-top: 16px; }
.sheet .chip { min-height: 54px; gap: 10px; padding: 0 16px; border-width: 1.5px; border-radius: 14px; font-size: 15px;
  box-shadow: inset 0 0 0 4px rgba(255, 252, 244, .9), inset 0 0 0 5px rgba(201, 165, 94, .55), 0 4px 12px rgba(90, 50, 10, .12); }
.sheet .chip svg { width: 20px; height: 20px; }
.sheet-note { margin-top: 12px; font-style: italic; font-size: 14px; color: #6B5A3E; }

/* reveals (JS only; stacked/reduced modes show everything at once) */
.js .scene .r { opacity: 0; transform: translate3d(0, calc(14 * var(--u)), 0); clip-path: inset(100% -20% -20% -20%);
  transition: opacity .8s var(--ease) var(--d, 0ms), transform 1s var(--ease) var(--d, 0ms), clip-path 1s var(--ease) var(--d, 0ms); }
.js .scene.is-in .r { opacity: 1; transform: none; clip-path: inset(-20% -20% -20% -20%); }

/* =========================================================================
   Motion mode: one sticky stage, scenes stacked and driven by scroll
   ========================================================================= */
.motion .track { height: var(--track-h, 1000vh); }
.motion .stage { position: -webkit-sticky; position: sticky; top: 0; height: 100vh; overflow: hidden; background: var(--paper); }
.motion .scene { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: transparent; contain: layout paint; }
.motion .scene.on { pointer-events: auto; will-change: opacity; }
.motion .scene.far .plate > picture { display: none; }
.motion .plate, .js .opening .plate {
  position: absolute; left: var(--ox); top: var(--oy); width: var(--pw); height: var(--ph); aspect-ratio: auto;
  transform-origin: 0 0; will-change: transform;
}

.tx-thread { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 20; pointer-events: none; opacity: 0; }
.tx-thread path { fill: none; stroke: #E2C68A; stroke-width: 2.2; stroke-dasharray: 0 1; filter: drop-shadow(0 0 3px rgba(255, 226, 160, .8)); }
.tx-petal { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 21; pointer-events: none; transform-origin: 0 0; opacity: 0; }
.tx-petal > div { position: absolute; }
.tx-drift { position: absolute; left: 0; top: 0; width: 26px; height: 30px; z-index: 22; pointer-events: none; opacity: 0; }
.stage.drift .tx-drift { animation: drift 6.5s cubic-bezier(.45, .05, .55, .95) .4s 1 both; }
@keyframes drift {
  0% { opacity: 0; transform: translate3d(var(--x0), var(--y0), 0) rotate(-30deg); }
  12% { opacity: .9; }
  50% { transform: translate3d(calc((var(--x0) + var(--x1)) / 2 + 26px), calc((var(--y0) + var(--y1)) / 2), 0) rotate(40deg); }
  88% { opacity: .85; }
  100% { opacity: 0; transform: translate3d(var(--x1), var(--y1), 0) rotate(110deg); }
}
.no-js .tx-thread, .no-js .tx-petal, .no-js .tx-drift, .no-js .hint, .reduce .hint { display: none; }

.hint {
  position: absolute; z-index: 25; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 16px 10px; border-radius: 999px; background: rgba(255, 250, 240, .78);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-style: italic; font-size: 15px; color: #6B4B22; pointer-events: none;
  opacity: 0; transition: opacity .6s var(--ease);
}
.hint.show { opacity: 1; }
.hint i { width: 10px; height: 10px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); animation: nudge 1.8s var(--ease) infinite; }
@keyframes nudge { 0%, 100% { transform: rotate(45deg) translate(0, 0); } 50% { transform: rotate(45deg) translate(3px, 3px); } }

/* =========================================================================
   Opening
   ========================================================================= */
.opening { display: none; }
.js .opening { display: block; position: fixed; inset: 0; z-index: 200; background: #2A1A10; }
.opening.is-gone { display: none !important; }
.op-stage { position: absolute; top: 0; bottom: 0; left: 50%; width: min(100%, var(--col)); transform: translateX(-50%); overflow: hidden; background: var(--paper); }
.op-stage .plate { animation: float 6s ease-in-out infinite; }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -2px; } }
.reduce .op-stage .plate { animation: none; }
.op-open { border-radius: calc(30 * var(--u)); animation: invite 3.2s ease-in-out 1.2s infinite; }
@keyframes invite { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 236, 196, 0); } 50% { box-shadow: 0 0 calc(30 * var(--u)) calc(4 * var(--u)) rgba(255, 236, 196, .55); } }
.reduce .op-open { animation: none; }
.seal-glint {
  position: absolute; left: calc(485 * var(--u)); top: calc(793 * var(--u)); width: calc(244 * var(--u)); height: calc(244 * var(--u));
  translate: -50% -50%; border-radius: 50%; overflow: hidden; pointer-events: none;
}
.seal-glint::after { content: ''; position: absolute; inset: -30%; background: linear-gradient(105deg, transparent 38%, rgba(255, 238, 205, .75) 50%, transparent 62%); transform: translateX(-130%); }
.seal-glint.go::after { animation: glint .42s cubic-bezier(.22, .75, .2, 1) forwards; }
@keyframes glint { to { transform: translateX(130%); } }
.op-bloom {
  position: absolute; width: 240px; height: 240px; margin: -120px 0 0 -120px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, rgba(255, 252, 242, 1) 0%, rgba(255, 244, 222, .96) 45%, rgba(250, 230, 190, .7) 70%, rgba(250, 230, 190, 0) 100%);
}
.op-skip {
  position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 10px 16px; border-radius: 999px; background: rgba(255, 250, 240, .82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-style: italic; font-size: 15px; color: #6B4B22; text-underline-offset: 3px; white-space: nowrap;
}

/* =========================================================================
   Chapter indicator
   ========================================================================= */
.chapters {
  position: fixed; z-index: 150; left: 50%; top: max(8px, env(safe-area-inset-top));
  transform: translate(-50%, -150%);
  display: flex; align-items: center; padding: 0 6px; border-radius: 999px;
  background: rgba(255, 249, 238, .76);
  -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 4px 18px rgba(40, 20, 10, .16), inset 0 0 0 1px rgba(201, 165, 94, .55);
  transition: transform .6s var(--ease), opacity .4s var(--ease); color: #6B4B22;
}
.chapters.is-shown { transform: translate(-50%, 0); }
.chapters.is-quiet { opacity: .35; }
.no-js .chapters, .reduce .chapters { display: none; }
.chapters a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  font-weight: 600; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; opacity: .62;
  transition: opacity .4s var(--ease);
}
.chapters a::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 10px; height: 1px; background: currentColor; transform: scaleX(0); transition: transform .5s var(--ease); }
.chapters a[aria-current="true"] { opacity: 1; }
.chapters a[aria-current="true"]::after { transform: scaleX(1); }
.chapters .nav-sep { border-left: 1px solid rgba(201, 165, 94, .6); }
body[data-theme="barat"] .chapters { background: rgba(70, 14, 26, .66); color: #F0DDB4; }
@media (max-width: 359px) { .chapters a { padding: 0 7px; letter-spacing: .08em; font-size: 12px; } }

/* =========================================================================
   Reduced motion: stacked scenes, everything visible, no scrubbing
   ========================================================================= */
.reduce .scene .r { opacity: 1 !important; transform: none !important; clip-path: none !important; transition: none !important; }

@media (min-width: 560px) {
  .app { border-left: 1px solid rgba(201, 165, 94, .3); border-right: 1px solid rgba(201, 165, 94, .3); }
}
