/* ───────── Tokens ───────── */
:root {
  --lapis-950: #0a1129;
  --lapis-900: #0e1736;
  --lapis-800: #16245a;
  --lapis-700: #1f3175;
  --gold-200: #f6e7bd;
  --gold-300: #f0dca6;
  --gold-500: #c9a55a;
  --gold-700: #8a6a2f;
  --turquoise: #46b3a8;
  --paper: #f3ecdc;
  --paper-soft: rgba(243, 236, 220, 0.74);
  --paper-faint: rgba(243, 236, 220, 0.5);
  --line: rgba(201, 165, 90, 0.45);

  --font: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  --gold-text: linear-gradient(100deg, #9c7a35 0%, #f0dca6 28%, #c29d55 48%, #f6e7bd 68%, #a8853c 100%);
  --ease-door: cubic-bezier(0.62, 0.02, 0.22, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* 8-point star lattice (khatam), drawn very faintly */
  --girih: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23c9a55a' stroke-width='.7'%3E%3Crect x='20' y='20' width='24' height='24'/%3E%3Cpath d='M32 15 49 32 32 49 15 32Z'/%3E%3Cpath d='M32 0v15M32 49v15M0 32h15M49 32h15'/%3E%3C/g%3E%3C/svg%3E");
  --girih-faint: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23c9a55a' stroke-opacity='.11' stroke-width='.7'%3E%3Crect x='20' y='20' width='24' height='24'/%3E%3Cpath d='M32 15 49 32 32 49 15 32Z'/%3E%3Cpath d='M32 0v15M32 49v15M0 32h15M49 32h15'/%3E%3C/g%3E%3C/svg%3E");

  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.95;
  color: var(--paper);
  background-color: var(--lapis-900);
  background-image:
    radial-gradient(120% 70% at 50% 0%, rgba(42, 64, 150, 0.55) 0%, rgba(14, 23, 54, 0) 60%),
    radial-gradient(90% 60% at 50% 100%, rgba(10, 17, 41, 0.9) 0%, rgba(10, 17, 41, 0) 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--girih);
  background-size: 64px 64px;
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

.js body.is-locked { overflow: hidden; }

p { margin: 0; }

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--gold-300);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ───────── Doors (cover) ───────── */
.doors { display: none; }

.js .doors {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 50;
  perspective: 1600px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.doors:focus-visible { outline: none; }
.doors:focus-visible .seal { box-shadow: 0 0 0 3px var(--lapis-900), 0 0 0 5px var(--gold-300); }

.door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
  transition: transform 1.7s var(--ease-door), opacity 0.6s ease 1.15s;
  will-change: transform;
  backface-visibility: hidden;
}

.door--a { left: 0; transform-origin: left center; }
.door--b { right: 0; transform-origin: right center; }

/* seam between the two leaves */
.door--a::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 1px;
  /* gap in the middle so the seam never crosses the seal or the guest name */
  background: linear-gradient(to bottom,
    transparent 4%, var(--gold-500) 12%, var(--gold-500) 28%, transparent 33%,
    transparent 67%, var(--gold-500) 72%, var(--gold-500) 88%, transparent 96%);
  opacity: 0.5;
  z-index: 2;
}

.doors.is-opening { pointer-events: none; }
.doors.is-opening .door--a { transform: rotateY(104deg); opacity: 0; }
.doors.is-opening .door--b { transform: rotateY(-104deg); opacity: 0; }

/* Each leaf holds a full-viewport copy of the cover, clipped to its half,
   so the artwork splits exactly down the middle. */
.door-face {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 200%;
  display: grid;
  place-items: center;
  background-color: var(--lapis-900);
  background-image:
    radial-gradient(70% 55% at 50% 48%, rgba(40, 62, 148, 0.75) 0%, rgba(14, 23, 54, 0) 72%),
    var(--girih-faint);
  background-size: auto, 64px 64px;
  background-position: center, center;
}

.door--a .door-face { left: 0; }
.door--b .door-face { right: 0; }

.door-face::before,
.door-face::after {
  content: '';
  position: absolute;
  pointer-events: none;
  border: 1px solid var(--line);
}
.door-face::before { inset: 14px; }
.door-face::after { inset: 20px; border-color: rgba(201, 165, 90, 0.2); }

.door-arch {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(80vw, 42vh, 420px);
  height: auto;
  transform: translate(-50%, -50%);
  overflow: visible;
}

.door-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  padding: 0 2rem;
  text-align: center;
}

.door-guest {
  font-weight: 300;
  font-size: 1.15rem;
  color: var(--paper);
  max-width: 16rem;
  line-height: 1.7;
}

.seal {
  position: relative;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: transform 0.5s var(--ease-out);
}

.doors:hover .seal { transform: scale(1.03); }

.seal__art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.seal__mono {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 1.9rem;
  font-weight: 300;
  line-height: 1;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.seal__mono small { font-size: 0.95rem; font-weight: 200; }

.door-hint {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--gold-300);
  animation: hint 2.6s ease-in-out infinite;
}

@keyframes hint {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* ───────── Gold dust ───────── */
.dust {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* ───────── Page ───────── */
.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(2.5rem + env(safe-area-inset-top)) 1.25rem calc(4rem + env(safe-area-inset-bottom));
  text-align: center;
}

.divider {
  display: block;
  width: min(15rem, 70%);
  height: 1.5rem;
  margin: 3.25rem auto;
}

.section-title {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--gold-500);
}

/* ───────── Hero ───────── */
.hero {
  min-height: calc(100vh - 4rem);
  min-height: calc(100svh - 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.hero__opening {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--gold-300);
}

.toranj {
  position: relative;
  width: min(86vw, 22rem, 52vh);
  aspect-ratio: 2 / 3;
}

.toranj__art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.toranj__names {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  font-weight: 300;
  font-size: clamp(2.3rem, 11vw, 3.3rem);
  line-height: 1.35;
}

.toranj__names > span:not(.toranj__and) {
  background: var(--gold-text);
  background-size: 220% 100%;
  background-position: 0% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0 0.1em;
}

.toranj__and {
  font-size: 0.42em;
  font-weight: 200;
  color: var(--paper-soft);
}

.hero__date {
  font-size: 1rem;
  font-weight: 300;
  color: var(--paper-soft);
}

/* Reveal sequence (only when JS runs) */
.js .hero__opening,
.js .hero__date,
.js .toranj__names { opacity: 0; }

.js .toranj__names { transform: scale(0.96); filter: blur(6px); }

.hero.is-revealed .hero__opening { opacity: 1; transition: opacity 1s ease 0.2s; }
.hero.is-revealed .toranj__names {
  opacity: 1;
  transform: none;
  filter: none;
  transition: opacity 1.4s ease 1.3s, transform 1.6s var(--ease-out) 1.3s, filter 1.4s ease 1.3s;
}
.hero.is-revealed .toranj__names > span:not(.toranj__and) {
  animation: sheen 2.8s var(--ease-out) 2.2s both;
}
.hero.is-revealed .hero__date { opacity: 1; transition: opacity 1s ease 2.4s; }

@keyframes sheen {
  from { background-position: 100% 0; }
  to { background-position: 0% 0; }
}

.toranj-fill { opacity: 0; transition: opacity 1.6s ease 0.9s; }
.toranj-dots { opacity: 0; transition: opacity 1.2s ease 1.6s; }
.hero.is-revealed .toranj-fill { opacity: 1; }
.hero.is-revealed .toranj-dots { opacity: 1; }

/* ───────── Poem ───────── */
.poem {
  max-width: 21rem;
  margin: 0 auto;
  font-weight: 300;
  font-size: clamp(1rem, 4.3vw, 1.15rem);
  line-height: 2.2;
}

.poem__line:nth-of-type(1) { text-align: right; }
.poem__line:nth-of-type(2) { text-align: left; }

.poem__poet {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--gold-500);
}

/* ───────── Invite ───────── */
.invite {
  margin-top: 3rem;
  max-width: 26rem;
  margin-inline: auto;
}

.invite__guest {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--gold-300);
  margin-bottom: 0.75rem;
}

.invite__message {
  color: var(--paper-soft);
  font-weight: 300;
}

.invite__families {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--paper);
}

/* ───────── When ───────── */
.when__weekday {
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--paper-soft);
}

.when__date {
  font-size: clamp(2rem, 9vw, 2.6rem);
  font-weight: 200;
  line-height: 1.5;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.when__time {
  font-size: 1.05rem;
  font-weight: 400;
}

.countdown {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 2rem 0 0.25rem;
  direction: rtl;
}

.countdown__unit {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 4.6rem;
}

/* small gold lozenge between units */
.countdown__unit + .countdown__unit::before {
  content: '';
  position: absolute;
  right: -3px;
  top: 1.15rem;
  width: 6px;
  height: 6px;
  background: var(--gold-500);
  transform: rotate(45deg);
  opacity: 0.7;
}

.countdown__num {
  font-size: 2rem;
  font-weight: 200;
  line-height: 1.3;
  color: var(--paper);
}

.countdown__label {
  font-size: 0.8rem;
  color: var(--paper-faint);
}

.countdown__done {
  margin-top: 1.5rem;
  color: var(--gold-300);
}

/* ───────── Where ───────── */
.where__name {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--paper);
}

.where__address {
  margin-top: 0.4rem;
  max-width: 24rem;
  margin-inline: auto;
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--paper-soft);
}

/* ───────── Buttons ───────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.55rem 1.3rem;
  font: inherit;
  font-size: 0.925rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--gold-300);
  text-decoration: none;
  background: rgba(201, 165, 90, 0.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { background: rgba(201, 165, 90, 0.16); border-color: var(--gold-500); }
.btn:active { background: rgba(201, 165, 90, 0.24); }

.btn--solid {
  color: var(--lapis-950);
  font-weight: 600;
  border-color: transparent;
  background: linear-gradient(100deg, #b8924a, #f0dca6 45%, #c9a55a);
}

.btn--solid:hover { background: linear-gradient(100deg, #c9a55a, #f6e7bd 45%, #d6b46c); border-color: transparent; }

/* ───────── RSVP ───────── */
.rsvp__lead {
  color: var(--paper-soft);
  font-weight: 300;
}

.rsvp__form {
  max-width: 22rem;
  margin: 1.75rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  text-align: right;
}

.field { display: flex; flex-direction: column; gap: 0.35rem; }

.field__label {
  font-size: 0.875rem;
  color: var(--paper-faint);
}

.field__input {
  font: inherit;
  font-size: 1rem;
  color: var(--paper);
  background: rgba(10, 17, 41, 0.55);
  border: 1px solid rgba(201, 165, 90, 0.3);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  transition: border-color 0.2s ease;
}

.field__input:focus { outline: none; border-color: var(--gold-300); }
.field__input[aria-invalid='true'] { border-color: #e08a7a; }

.field__error {
  font-size: 0.875rem;
  color: #f0a898;
}

.choice {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.5rem;
}

.choice__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(201, 165, 90, 0.22);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.choice__item input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  border: 1px solid var(--gold-500);
  transform: rotate(45deg);
  transition: background-color 0.2s ease;
}

.choice__item input:checked { background: var(--gold-300); box-shadow: inset 0 0 0 3px var(--lapis-900); }
.choice__item input:focus-visible { outline: 2px solid var(--gold-300); outline-offset: 3px; }
.choice__item:has(input:checked) { border-color: var(--gold-500); background: rgba(201, 165, 90, 0.08); }

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: opacity 0.25s ease;
}

.stepper.is-disabled { opacity: 0.35; pointer-events: none; }

.stepper__ctrl { display: flex; align-items: center; gap: 0.5rem; }

.stepper__btn {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--gold-300);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

.stepper__btn:hover { background: rgba(201, 165, 90, 0.12); }
.stepper__btn:disabled { opacity: 0.35; cursor: default; }

.stepper__val {
  min-width: 2rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 300;
}

.rsvp__form .actions { margin-top: 0.25rem; }
.rsvp__form .actions .btn { flex: 1 1 9rem; }

/* ───────── Closing ───────── */
.closing { margin-top: 4.5rem; }

.closing__line {
  font-size: 1.35rem;
  font-weight: 300;
  color: var(--paper);
}

.closing__names {
  margin-top: 0.25rem;
  font-size: 1rem;
  color: var(--gold-500);
}

.closing__finial {
  display: block;
  width: 26px;
  height: 39px;
  margin: 1.5rem auto 0;
}

/* ───────── Music + toast ───────── */
.music {
  position: fixed;
  left: max(1rem, env(safe-area-inset-left));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 30;
  width: 2.9rem;
  height: 2.9rem;
  display: grid;
  place-items: center;
  color: var(--gold-300);
  background: rgba(14, 23, 54, 0.8);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.music svg { width: 1.25rem; height: 1.25rem; }
.music[aria-pressed='false'] { color: var(--paper-faint); }
.music[aria-pressed='false']::after {
  content: '';
  position: absolute;
  width: 1.6rem;
  height: 1px;
  background: currentColor;
  transform: rotate(-45deg);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  z-index: 60;
  width: max-content;
  max-width: calc(100% - 2.5rem);
  padding: 0.7rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.7;
  text-align: center;
  color: var(--paper);
  background: rgba(10, 17, 41, 0.94);
  border: 1px solid var(--line);
  border-radius: 12px;
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ───────── Reduced motion ───────── */
@media (prefers-reduced-motion: reduce) {
  .door { transition: opacity 0.6s ease; }
  .doors.is-opening .door--a,
  .doors.is-opening .door--b { transform: none; }
  .door-hint { animation: none; opacity: 0.85; }
  .hero.is-revealed .hero__opening,
  .hero.is-revealed .hero__date,
  .hero.is-revealed .toranj__names,
  .toranj-fill,
  .toranj-dots { transition-duration: 0.4s; transition-delay: 0s; }
  .hero.is-revealed .toranj__names > span:not(.toranj__and) { animation: none; }
}
