:root {
  --mogra: #FFF8F3;
  --blush: #F6D9D2;
  --rose: #D98A95;
  --rani: #B5476C;
  --kumkum: #8E1F3B;
  --ink: #4A1630;
  --ink-soft: #6E3A50;
  --gold-text: #8A5E1A;
  --gold: #C9A04A;
  --leaf: #2E5E45;
  --script: "Imperial Script", "Pinyon Script", "Brush Script MT", cursive;
  --serif: "Yrsa", "Iowan Old Style", Georgia, serif;
  --guj: "Rasa", "Noto Serif Gujarati", "Shruti", serif;
  --stage-h: 100vh;
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --spring-dur: 900ms;
  --spring-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-pop-dur: 700ms;
  --spring-door: cubic-bezier(0.5, 1.25, 0.4, 1);
  --spring-door-dur: 1900ms;
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  background: var(--mogra);
  -webkit-font-smoothing: antialiased;
}

html.is-locked,
html.is-locked body { overflow: hidden; overscroll-behavior: none; }

p, h1, h2, ul, address { margin: 0; padding: 0; }
ul { list-style: none; }
address { font-style: normal; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 1.4em;
  border: 0;
  border-radius: 999px;
  background: var(--kumkum);
  color: var(--mogra);
  font: 600 16px/1 var(--serif);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px rgba(243, 223, 162, 0.55), 0 6px 16px -8px rgba(90, 20, 50, 0.6);
  transition: transform var(--spring-pop-dur) var(--spring-pop), background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #7A1832; }
.btn:active { transform: scale(0.95); transition-duration: 0.08s; }
.btn:focus-visible,
.music:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.btn-quiet {
  background: transparent;
  color: var(--kumkum);
  box-shadow: inset 0 0 0 1.5px var(--gold);
}
.btn-quiet:hover { background: rgba(201, 160, 74, 0.12); }

/* ---------- Experience (JS) ---------- */
.js,
.js body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.js .experience { position: fixed; inset: 0; }

.js .stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
  background:
    radial-gradient(60% 45% at 50% 52%, #FFFDF9 0%, #FFF6EF 45%, #F7E0D8 100%);
}
/* a polished floor that catches the light from the far doorway */
.layer-floor {
  top: var(--vpy, 55%);
  background:
    radial-gradient(50% 60% at 50% 0%, rgba(255, 252, 244, 0.95), rgba(255, 252, 244, 0) 70%),
    linear-gradient(180deg, #F6E3DA 0%, #EECDC6 100%);
}

.world {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  isolation: isolate;
}

.layer {
  position: absolute;
  inset: 0;
  transform-origin: var(--vpx, 50%) var(--vpy, 55%);
  will-change: transform, opacity;
  pointer-events: none;
}
.layer img.paper {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  display: block;
}
.layer.is-hidden { visibility: hidden; }
.layer-floor,
.layer-glow { z-index: 0; }

/* glow at the end of the passage */
.layer-glow {
  background: radial-gradient(40% 30% at var(--vpx, 50%) var(--vpy, 55%), rgba(255, 252, 240, 0.95), rgba(255, 246, 236, 0) 70%);
}

/* ---------- Cards ---------- */
.js .cards { display: contents; }

.card {
  position: absolute;
  left: var(--cx, 20px);
  top: var(--cy, 120px);
  width: var(--cw, 320px);
  height: var(--ch, 600px);
  pointer-events: none;
  text-align: center;
}
.layer-card.is-current .card { pointer-events: auto; }

.card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 18px rgba(90, 20, 50, 0.22));
}

.card-inner {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--ctop, 22%);
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 24px 30px;
}
.fit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform-origin: 50% 50%;
}

/* reveal choreography, driven by .is-current on the card layer */
.reveal {
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.55s ease-out, transform var(--spring-dur) var(--spring);
  transition-delay: calc(var(--i, 0) * 110ms + 120ms);
}
.is-current .reveal { opacity: 1; transform: none; }

.emblem { flex: none; }

/* Invocation */
.medallion-wrap {
  position: relative;
  width: 112px;
  height: 112px;
  margin-bottom: 2px;
}
.medallion-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.med-petal {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scale(0.2);
  opacity: 0;
  transition: transform var(--spring-pop-dur) var(--spring-pop), opacity 0.3s ease;
  transition-delay: calc(var(--i, 0) * 32ms + 260ms);
}
.is-current .med-petal { transform: none; opacity: 1; }
.om {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 600 40px/1 var(--guj);
  color: var(--gold-text);
  padding-top: 4px;
}
.invocation {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--guj);
  font-weight: 600;
  font-size: 25px;
  line-height: 1.45;
  color: var(--kumkum);
}
.invocation span + span { font-weight: 500; font-size: 22px; color: var(--rani); }

.rule {
  width: 120px;
  height: 12px;
  background:
    radial-gradient(circle, var(--gold) 0 3px, transparent 3.5px) center / 12px 12px no-repeat,
    linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold) 70%, transparent) center / 100% 1px no-repeat;
}

.message {
  font-size: 20px;
  line-height: 1.55;
  color: var(--ink);
  max-width: 19em;
  text-wrap: balance;
}

/* Names */
.names {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-weight: inherit;
}
.person { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.name {
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(56px, 17vw, 88px);
  line-height: 1.05;
  color: var(--kumkum);
  padding: 0 0.15em;
  clip-path: inset(-20% 100% -30% 0);
  transition: clip-path 1.5s cubic-bezier(0.45, 0.05, 0.25, 1);
}
.person-bride .name { transition-delay: 1.7s; }
.is-current .name { clip-path: inset(-20% -10% -30% 0); }
.parents {
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  max-width: 17em;
  text-wrap: balance;
}
.joiner { display: flex; flex-direction: column; align-items: center; margin: 4px 0 0; }
.joiner-rings { width: 118px; height: 90px; display: block; }
.joiner-rings svg,
.seal-rings svg,
.closing-rings svg { width: 100%; height: 100%; display: block; overflow: visible; }
.joiner-and {
  font-style: italic;
  font-size: 17px;
  color: var(--gold-text);
  margin-top: -2px;
}

/* ring draw */
.rings .ring-l,
.rings .ring-r { stroke-dasharray: 100 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1.2s cubic-bezier(0.5, 0, 0.2, 1); }
.rings .ring-l { transform: rotate(-90deg); transform-box: fill-box; transform-origin: center; }
.rings .ring-r { transform: rotate(90deg) scaleX(-1); transform-box: fill-box; transform-origin: center; transition-delay: 0.35s; }
.rings .ring-r-over,
.rings .ring-stone,
.rings .ring-spark { opacity: 0; transition: opacity 0.4s ease 1.2s; }
.rings .ring-spark { transform-box: fill-box; transform-origin: center; }
.rings .ring-stone path:first-child { transform-box: fill-box; transform-origin: center; transform: scale(0); transition: transform var(--spring-pop-dur) var(--spring-pop) 1.25s; }
.rings-on .rings .ring-stone path:first-child { transform: none; }
.joiner .rings .ring-stone path:first-child { transition-delay: 2.15s; }
.rings-on .rings .ring-l,
.rings-on .rings .ring-r { stroke-dashoffset: 0; }
.rings-on .rings .ring-r-over,
.rings-on .rings .ring-stone,
.rings-on .rings .ring-spark { opacity: 1; }
.rings-on .rings .ring-spark { animation: spark 2.8s ease-in-out 1.6s infinite; }
@keyframes spark {
  0%, 100% { transform: scale(0.6) rotate(0deg); opacity: 0.5; }
  50% { transform: scale(1.15) rotate(45deg); opacity: 1; }
}
/* in the names card the rings wait for the groom's name to be written */
.joiner .rings .ring-l { transition-delay: 0.9s; }
.joiner .rings .ring-r { transition-delay: 1.2s; }
.joiner .rings .ring-r-over,
.joiner .rings .ring-stone,
.joiner .rings .ring-spark { transition-delay: 2.1s; }

/* Date */
.function-name {
  font-family: var(--script);
  font-weight: 400;
  font-size: 40px;
  white-space: nowrap;
  line-height: 1.1;
  color: var(--kumkum);
}
.date {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.date-day,
.date-month {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.date-num {
  position: relative;
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  margin: 6px 0;
  font-size: 76px;
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: lining-nums;
  color: var(--kumkum);
}
.date-num span {
  position: relative;
  top: -2px;
  transform: scale(0.6);
  opacity: 0;
  transition: transform var(--spring-pop-dur) var(--spring-pop) 0.55s, opacity 0.3s ease 0.55s;
}
.is-current .date-num span { transform: none; opacity: 1; }
.date-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.date-ring circle {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.6;
  stroke-dasharray: 100 100;
  stroke-dashoffset: 100;
  transform: rotate(-90deg);
  transform-origin: 50px 50px;
  transition: stroke-dashoffset 1.6s cubic-bezier(0.5, 0, 0.2, 1) 0.4s;
}
.is-current .date-ring circle { stroke-dashoffset: 0; }
.time {
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
}
.countdown {
  font-style: italic;
  font-size: 16px;
  color: var(--gold-text);
  margin-top: -6px;
}

/* Venue */
.pin { width: 54px; height: 68px; }
.pin svg { width: 100%; height: 100%; display: block; }
.card-venue .pin.reveal { transform: translateY(-34px); transition: opacity 0.25s ease 0.15s, transform var(--spring-pop-dur) var(--spring-pop) 0.15s; }
.is-current .card-venue .pin.reveal { transform: none; }
.venue-label {
  font-family: var(--script);
  font-weight: 400;
  font-size: 48px;
  line-height: 1;
  color: var(--kumkum);
}
.venue-name {
  font-size: 25px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}
.venue-address {
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* Invitees */
.card-family .card-inner { padding-left: 14px; padding-right: 14px; }
.family-lotus { width: 84px; height: 58px; }
.family-lotus svg { width: 100%; height: 100%; display: block; overflow: visible; }
.family-title {
  font-family: var(--script);
  font-weight: 400;
  font-size: 50px;
  line-height: 1;
  color: var(--kumkum);
  margin-bottom: 2px;
}
.family-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
  line-height: 1.4;
  text-wrap: balance;
  color: var(--ink);
}
.family-kids {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--kumkum);
}
.family-kids span { color: var(--gold); font-weight: 400; padding: 0 0.3em; }

/* ---------- Gate ---------- */
.gate {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.doors {
  position: absolute;
  inset: 0;
  perspective: 1100px;
  perspective-origin: 50% 45%;
}
.door {
  position: absolute;
  top: 0;
  height: 100%;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  transition: transform var(--spring-door-dur) var(--spring-door) 0.4s, filter 1.4s ease 0.4s;
  backface-visibility: hidden;
}
.door-l { transform-origin: 0 50%; }
.door-r { transform-origin: 100% 50%; }
.is-open .door-l { transform: rotateY(78deg); filter: brightness(0.78); }
.is-open .door-r { transform: rotateY(-78deg); filter: brightness(0.78); }

.seal {
  position: absolute;
  left: 50%;
  top: var(--seal-top, 32%);
  width: min(78vw, 300px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  transition: opacity 0.45s ease, transform var(--spring-dur) var(--spring);
}
.is-open .seal { opacity: 0; transform: translate(-50%, -56px) scale(0.96); pointer-events: none; }
.seal-rings {
  width: 92px;
  height: 92px;
  padding: 14px 10px 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #FFFDF8, #F8EBDD);
  box-shadow: 0 0 0 2px var(--gold), 0 0 0 6px rgba(255, 248, 243, 0.65), 0 0 0 7px var(--gold), 0 10px 22px -8px rgba(70, 10, 30, 0.6);
  position: relative;
  z-index: 1;
}
.tag {
  position: relative;
  margin-top: -6px;
  padding: 26px 22px 22px;
  width: 100%;
  background: var(--mogra);
  border-radius: 999px 999px 18px 18px / 140px 140px 18px 18px;
  box-shadow: inset 0 0 0 1.5px var(--gold), inset 0 0 0 6px var(--mogra), inset 0 0 0 7px rgba(201, 160, 74, 0.6), 0 14px 30px -12px rgba(70, 10, 30, 0.6);
  text-align: center;
}
.tag::before {
  content: "";
  position: absolute;
  top: -30px;
  left: 50%;
  width: 1.5px;
  height: 34px;
  background: var(--gold);
}
.tag-names {
  font-family: var(--script);
  font-size: 46px;
  line-height: 1.05;
  color: var(--kumkum);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tag-names .amp { font-size: 30px; color: var(--gold-text); line-height: 0.9; }
.tag-line {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.tag-date {
  font-size: 17px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

/* ---------- Hint ---------- */
.hint {
  position: absolute;
  left: 50%;
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 66px);
  max-width: calc(100% - 32px);
  padding: 9px 16px;
  border-radius: 14px;
  background: rgba(74, 22, 48, 0.88);
  color: var(--mogra);
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.3s ease, transform var(--spring-dur) var(--spring);
  pointer-events: none;
  z-index: 3;
  width: max-content;
}
.hint.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Control bar: Pause / Play, the card timer, music ---------- */
.bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  max-width: 460px;
  margin: 0 auto;
  height: 54px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  background: rgba(255, 248, 243, 0.95);
  box-shadow: inset 0 0 0 1px rgba(201, 160, 74, 0.75), 0 12px 26px -14px rgba(70, 10, 30, 0.6);
  z-index: 4;
  visibility: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.35s ease, transform var(--spring-pop-dur) var(--spring-pop), visibility 0s linear 0.35s;
}
.bar.is-shown { visibility: visible; opacity: 1; transform: none; transition-delay: 1.1s, 1.1s, 0s; }
.bar-play {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--kumkum);
  color: var(--mogra);
  font: 600 16px/1 var(--serif);
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--spring-pop-dur) var(--spring-pop), background-color 0.2s ease;
}
.bar-play:active { transform: scale(0.93); transition-duration: 0.08s; }
.bar-play svg { width: 18px; height: 18px; fill: currentColor; display: none; }
.bar-play[data-state="pause"] .i-pause,
.bar-play[data-state="play"] .i-play,
.bar-play[data-state="replay"] .i-replay { display: block; }
.bar-play[data-state="play"] { background: #2E5E45; }
.bar-play:focus-visible,
.bar-step:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.bar-steps { flex: 1; min-width: 0; display: flex; gap: 5px; align-items: center; }
.bar-step {
  position: relative;
  flex: 1;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bar-step::before,
.bar-fill {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
}
.bar-step::before { background: rgba(74, 22, 48, 0.16); }
.bar-fill { background: var(--kumkum); transform-origin: 0 50%; transform: scaleX(0); }
.bar-step.is-current::before { height: 6px; margin-top: -3px; border-radius: 3px; }
.bar-step.is-current .bar-fill { height: 6px; margin-top: -3px; border-radius: 3px; }

/* ---------- Closing card ---------- */
.closing-rings { width: 104px; height: 80px; }
.closing-names {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--script);
  font-size: 52px;
  line-height: 1.05;
  color: var(--kumkum);
}
.closing-names .amp { font-size: 32px; color: var(--gold-text); line-height: 0.9; }
.closing-date { display: flex; flex-direction: column; font-size: 18px; color: var(--ink); }
.closing-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.share-status { min-height: 1.4em; font-size: 15px; color: var(--ink-soft); }

/* ---------- Music ---------- */
.music {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 248, 243, 0.94);
  box-shadow: inset 0 0 0 1.5px var(--gold);
  color: var(--kumkum);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--spring-pop-dur) var(--spring-pop);
}
.music:active { transform: scale(0.9); transition-duration: 0.08s; }
.music[hidden] { display: none; }
.music svg { width: 22px; height: 22px; }
.music .music-note { fill: currentColor; }
.music .music-off { stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.music[aria-pressed="true"] .music-off { display: none; }
.music[aria-pressed="true"] .music-note { animation: beat 1.3s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes beat { 50% { transform: scale(1.08); } }

/* ---------- Larger screens ---------- */
@media (min-width: 720px) {
  .card-inner { padding: 4px 34px 38px; }
  .fit { gap: 16px; }
  .message { font-size: 20px; }
  .name { font-size: 96px; }
  .function-name { font-size: 52px; }
  .parents { font-size: 16.5px; }
  .family-list { font-size: 17px; }
}

/* ---------- Without JavaScript: a plain, readable invitation ---------- */
.no-js .stage { display: none; }
.no-js .cards { display: flex; flex-direction: column; gap: 24px; padding: 32px 16px; max-width: 520px; margin: 0 auto; }
.no-js .card { position: relative; left: auto; top: auto; width: auto; height: auto; padding: 36px 20px; background: var(--mogra); border: 1.5px solid var(--gold); border-radius: 160px 160px 16px 16px / 90px 90px 16px 16px; }
.no-js .card-inner { position: static; }
.no-js .fit,
.no-js .card-inner { gap: 14px; }
.no-js .name { clip-path: none; }
.no-js .date-ring circle { stroke-dashoffset: 0; }
.no-js .date-num span { transform: none; opacity: 1; }
.no-js .closing-actions { display: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .name,
  .date-ring circle,
  .rings .ring-l,
  .rings .ring-r,
  .door,
  .seal { transition-duration: 0.01s !important; transition-delay: 0s !important; }
  .med-petal,
  .date-num span,
  .rings .ring-stone path:first-child,
  .card-venue .pin.reveal,
  .bar,
  .hint { transition-duration: 0.01s !important; transition-delay: 0s !important; }
  .rings-on .rings .ring-spark,
  .music[aria-pressed="true"] .music-note { animation: none; }
  .is-open .door-l,
  .is-open .door-r { transform: none; opacity: 0; transition: opacity 0.6s ease; }
}
