:root {
  --ivory: #F8F1E5;
  --champagne: #F5E9D6;
  --espresso: #59351D;
  --brown: #765334;
  --gold: #C7953D;
  --pearl: #FFFDF7;
  --paper: #F7E8D5; /* sampled from the silk backdrop so edges blend */

  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --script: "Great Vibes", "Snell Roundhand", cursive;
  --arabic: "Amiri", "Noto Naskh Arabic", "Geeza Pro", serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --vh: 100vh;
}
@supports (height: 100svh) { :root { --vh: 100svh; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--paper); }
body {
  margin: 0;
  color: var(--espresso);
  font-family: var(--serif);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, p, dl, dd { margin: 0; font-weight: inherit; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

/* Until the invitation is opened: just the cover, no scrolling. */
html.is-locked, html.is-locked body { overflow: hidden; overscroll-behavior: none; }
html.is-locked main > section:not(.hero), html.is-locked .dots { display: none; }

/* One continuous silk-and-floral backdrop filling the whole screen; content scrolls over it.
   Uses lvh so it still covers the screen when mobile browser bars collapse. */
.backdrop {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  background: var(--paper) url("media/page-open.webp") center / cover no-repeat;
}

/* ---------- Hero: the opening invitation ---------- */
.hero {
  position: relative;
  height: var(--vh);
  min-height: 480px;
  display: flex; /* flex centring overflows evenly, so a cover-sized card trims both sides */
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card {
  position: relative;
  /* Phones: the artwork covers the whole screen, top to bottom and edge to edge. */
  flex: none;
  width: max(100vw, calc(var(--vh) * .5641));
  aspect-ratio: 942 / 1670;
  container-type: inline-size;
}
.card__art, .intro {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* soften the bottom edge into the backdrop so the page flows on */
  -webkit-mask-image: linear-gradient(to bottom, #000 86%, transparent);
  mask-image: linear-gradient(to bottom, #000 86%, transparent);
}
/* Wide screens: a portrait card can't cover a landscape screen without heavy cropping,
   so it sits centred on the full-screen silk backdrop. */
@media (min-aspect-ratio: 3/4) and (min-width: 700px) {
  .card {
    width: min(calc(100vw - 64px), calc((var(--vh) - 56px) * .5641), 540px);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 40px 70px -40px rgba(89, 53, 29, .5), 0 2px 8px rgba(89, 53, 29, .08);
  }
  .card__art, .intro { -webkit-mask-image: none; mask-image: none; }
}
/* Landscape phones: give the card a readable width and let the hero scroll. */
@media (orientation: landscape) and (max-height: 560px) {
  .hero { height: auto; padding: 24px 0 64px; }
  .card { width: min(calc(100vw - 32px), 420px); }
}

.card__content {
  position: absolute;
  inset: 25cqw 18cqw 33cqw;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.card__content > *, .section__inner > * { flex-shrink: 0; }

.intro { z-index: 1; transition: opacity .5s linear; }
.intro.is-done { opacity: 0; pointer-events: none; }

.cover__title { margin-top: 3.4cqw; font-size: 4.6cqw; font-weight: 500; letter-spacing: .1em; }
.cover__names { display: flex; flex-direction: column; align-items: center; margin: 5cqw 0 4cqw; }
.cover__names .name {
  font-family: var(--script);
  font-size: 9cqw;
  line-height: 1.2;
  word-spacing: .14em;
  white-space: nowrap;
}
.cover__names .and { margin: .6cqw 0 1cqw; font-size: 7.4cqw; }

/* ---------- Scratch-to-reveal date ---------- */
.js .hero:not(.is-in) .card__content { pointer-events: none; }
.scratch { display: flex; flex-direction: column; align-items: center; margin-top: 4.4cqw; }
.scratch__hint {
  margin-bottom: 3cqw;
  font-size: 3.8cqw;
  font-style: italic;
  letter-spacing: .06em;
  color: var(--brown);
}
.is-revealed .scratch__hint { font-family: var(--script); font-style: normal; font-size: 6.4cqw; letter-spacing: 0; word-spacing: .14em; color: var(--gold); line-height: 1; }
.scratch__discs { position: relative; display: flex; gap: 3cqw; }
.disc {
  position: relative;
  width: 15.6cqw;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(199, 149, 61, .85);
  border-radius: 50%;
  background: var(--pearl);
  box-shadow: 0 0 0 .9cqw rgba(255, 253, 247, .7), 0 2.4cqw 4cqw -2cqw rgba(89, 53, 29, .55);
  overflow: hidden;
  cursor: grab;
  touch-action: none; /* scratching a disc must not scroll the page */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  animation: bob 2.6s var(--ease) infinite;
}
.disc:nth-child(2) { animation-delay: .25s; }
.disc:nth-child(3) { animation-delay: .5s; }
.is-touched .disc, .disc.is-done { animation: none; }
@keyframes bob { 0%, 70%, 100% { transform: scale(1); } 35% { transform: scale(1.07); } }
.disc canvas { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .7s var(--ease); }
.disc::after { /* light sweeping across the foil */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .6) 50%, transparent 65%) 0 0 / 260% 100%;
  animation: sheen 2.8s linear infinite;
  pointer-events: none;
}
.disc.is-touched::after, .disc.is-done::after { display: none; }
@keyframes sheen { from { background-position: 130% 0; } to { background-position: -130% 0; } }
.disc.is-done { cursor: default; }
.disc.is-done canvas { opacity: 0; }
.disc__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--espresso);
  font-family: var(--serif);
  line-height: 1;
}
.disc__face b { font-size: 6.4cqw; font-weight: 600; }
.disc__face sup { font-size: .42em; vertical-align: .9em; line-height: 0; margin-left: .05em; }
.disc__face .disc__month { font-size: 5.2cqw; font-style: italic; }
.disc__face .disc__year { font-size: 4.4cqw; letter-spacing: .02em; }
.disc.is-done .disc__face b { animation: pop .6s var(--ease); }
@keyframes pop { 0% { transform: scale(.7); opacity: .3; } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
.scratch__after {
  margin-top: 3.4cqw;
  font-size: 4cqw;
  font-weight: 600;
  letter-spacing: .12em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .8s var(--ease) .3s, transform .8s var(--ease) .3s;
}
.is-revealed .scratch__after { opacity: 1; transform: none; }
html:not(.js) .scratch__after { opacity: 1; transform: none; }
.spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFF6DA 0 30%, var(--gold) 70%);
  pointer-events: none;
  animation: spark 1.1s var(--ease) forwards;
}
@keyframes spark { from { opacity: 1; transform: translate(0, 0) scale(1); } to { opacity: 0; transform: translate(var(--x), var(--y)) scale(.3); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.open-btn, .skip {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(199, 149, 61, .7);
  border-radius: 999px;
  background: rgba(255, 253, 247, .85);
  color: var(--espresso);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .4s var(--ease), background-color .3s var(--ease);
}
.open-btn { top: 64%; padding: .8em 1.8em; min-height: 50px; font-size: max(15px, 4.4cqw); font-weight: 600; letter-spacing: .06em; display: none; box-shadow: 0 10px 30px -14px rgba(89, 53, 29, .55); }
.open-btn::after { /* a slow breathing ring that invites the tap */
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--gold);
  border-radius: inherit;
  animation: breathe 2.6s var(--ease) infinite;
  pointer-events: none;
}
@keyframes breathe { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(1.18, 1.45); } }
.needs-tap { cursor: pointer; }
.skip { bottom: max(28px, 7cqw); min-height: 36px; padding: .3em 1.1em; font-size: max(12px, 3.2cqw); letter-spacing: .06em; opacity: 0; pointer-events: none; }
.open-btn:hover, .skip:hover { background: var(--pearl); }
.is-playing .skip { opacity: .9; pointer-events: auto; }
.needs-tap .open-btn { display: block; }
html:not(.js) .intro, html:not(.js) .skip, html:not(.js) .open-btn { display: none; }

.scroll-cue {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-style: italic;
  letter-spacing: .08em;
  color: var(--brown);
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s var(--ease) 3.6s;
}
.scroll-cue i { position: relative; width: 1px; height: 30px; background: rgba(199, 149, 61, .35); overflow: hidden; }
.scroll-cue i::after {
  content: "";
  position: absolute;
  left: 0; top: -40%;
  width: 1px; height: 40%;
  background: var(--gold);
  animation: drip 2.2s var(--ease) infinite;
}
@keyframes drip { to { top: 100%; } }
.is-in .scroll-cue, html:not(.js) .scroll-cue { opacity: 1; pointer-events: auto; }

/* ---------- Content sections: an ordinary flowing page ---------- */
.section { position: relative; padding: clamp(56px, 12vw, 104px) 0; }
.section::before { /* soft paper veil keeps text crisp where it crosses the backdrop florals */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse 72% 58% at 50% 50%, rgba(250, 238, 222, .82) 45%, rgba(250, 238, 222, 0) 100%);
  pointer-events: none;
}
.section:last-child { padding-bottom: max(96px, calc(env(safe-area-inset-bottom) + 72px)); }
.section__inner {
  /* a size container, so type keeps the same proportions as on the invitation card */
  width: min(100vw, 500px);
  margin: 0 auto;
  padding: 0 22px;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.divider { margin-bottom: 7cqw; }

/* ---------- Shared typographic pieces (cqw = % of the column / card width) ---------- */
.orn { display: block; width: 30cqw; aspect-ratio: 10 / 1; color: var(--gold); }
.orn--small { width: 26cqw; }
.orn--crest { width: 34cqw; aspect-ratio: 160 / 26; }
.card .orn--crest { width: 30cqw; }

.and { font-family: var(--script); color: var(--gold); font-size: 7cqw; line-height: 1; }
.and--ruled { display: flex; align-items: center; gap: 3cqw; }
.and--ruled span { padding-top: .1em; }
.rule { display: block; width: 15cqw; height: 1px; background: currentColor; opacity: .8; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 46px;
  padding: .55em 1.6em;
  border: 1px solid rgba(199, 149, 61, .75);
  border-radius: 999px;
  background: rgba(255, 253, 247, .78);
  color: var(--espresso);
  font-size: max(14px, 3.8cqw);
  font-weight: 600;
  letter-spacing: .04em;
  text-decoration: none;
  transition: background-color .3s var(--ease), border-color .3s var(--ease), color .3s var(--ease);
}
.btn svg { width: 1.15em; height: 1.15em; color: var(--gold); transition: color .3s var(--ease); }
.btn:hover { background: var(--gold); border-color: var(--gold); color: var(--pearl); }
.btn:hover svg { color: var(--pearl); }
.btn:active { background: #B5842F; }

/* ---------- Reveal choreography ---------- */
.js .r {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition:
    opacity 1s var(--ease) calc(var(--d, 0) * 1ms),
    transform 1.2s var(--ease) calc(var(--d, 0) * 1ms);
}
.js .is-in .r, .js .r.in { opacity: 1; transform: none; }
.js .r .rule { transform: scaleX(0); transition: transform 1.3s var(--ease) calc(var(--d, 0) * 1ms + 250ms); }
.js .is-in .r .rule, .js .r.in .rule { transform: scaleX(1); }
.js .r .rule:first-child { transform-origin: right; }
.js .r .rule:last-child { transform-origin: left; }

/* ---------- From the family ---------- */
.bismillah { font-family: var(--arabic); font-size: 7.4cqw; line-height: 1.7; }
.translation { margin: 2cqw 0 4cqw; font-size: 4.4cqw; font-style: italic; line-height: 1.4; }
.parents { display: flex; flex-direction: column; align-items: center; margin: 5cqw 0 4.6cqw; }
.parents > span:not(.and) { font-size: 8cqw; font-style: italic; font-weight: 500; line-height: 1.15; }
.parents .and { font-size: 6.6cqw; margin: .8cqw 0; }
.parents .rule { width: 12cqw; }
.contact { display: flex; flex-direction: column; align-items: center; gap: 1.4cqw; font-style: normal; font-size: 4.2cqw; }
.contact__row { display: inline-flex; align-items: center; gap: .55em; text-decoration: none; }
.contact__row svg { width: 1.3em; height: 1.3em; color: var(--gold); flex: none; }
a.contact__row { min-height: 44px; padding: 0 .4em; letter-spacing: .06em; }
a.contact__row:hover { color: var(--gold); }
.message { margin-top: 7cqw; max-width: 34em; font-size: max(15px, 4.2cqw); line-height: 1.6; text-wrap: pretty; }

/* ---------- Bride and groom ---------- */
.person { display: flex; flex-direction: column; align-items: center; }
.person__role { font-size: 3.9cqw; font-style: italic; letter-spacing: .08em; color: var(--gold); }
.person__name {
  font-family: var(--script);
  font-size: 10.4cqw;
  line-height: 1.2;
  word-spacing: .14em;
  white-space: nowrap;
  margin: .4cqw 0 1.6cqw;
}
.person__family { font-size: max(14px, 4cqw); line-height: 1.45; color: var(--brown); }
.person__family--grand { margin-top: 1cqw; font-style: italic; }
.couple .and { margin: 6cqw 0 5cqw; font-size: 7.6cqw; }
.couple .rule { width: 12cqw; }
.date-band {
  display: flex;
  align-items: center;
  gap: 2.4cqw;
  margin: 9cqw 0 6cqw;
  font-size: 4.8cqw;
  font-weight: 600;
  letter-spacing: .06em;
  white-space: nowrap;
}
.date-band .rule { width: 8cqw; color: var(--gold); }

/* ---------- Ceremony + countdown ---------- */
.insha { font-family: var(--script); font-size: 8cqw; line-height: 1.1; word-spacing: .14em; color: var(--gold); }
.ceremony__title { margin-top: 1.8cqw; font-size: 7.4cqw; font-weight: 600; letter-spacing: .06em; }
.ceremony__couple { margin-top: 1.2cqw; font-size: 4.6cqw; font-style: italic; color: var(--brown); }
.ceremony__couple span { font-family: var(--script); font-style: normal; font-size: 1.25em; color: var(--gold); padding: 0 .1em; }

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 420px;
  margin: 8cqw 0 7cqw;
  padding: 3cqw 0;
  border-block: 1px solid rgba(199, 149, 61, .55);
}
.countdown__cell { display: flex; flex-direction: column; align-items: center; }
.countdown__cell + .countdown__cell { border-left: 1px solid rgba(199, 149, 61, .4); }
.countdown__num {
  font-size: 10cqw;
  font-weight: 500;
  line-height: 1.05;
  font-variant-numeric: lining-nums tabular-nums;
}
.countdown__num.tick { animation: tick .55s var(--ease); }
@keyframes tick { from { opacity: .15; transform: translateY(-.18em); } }
.countdown__label { font-size: max(12px, 3.4cqw); font-style: italic; letter-spacing: .06em; color: var(--brown); }
.countdown__done { margin: 8cqw 0 7cqw; font-size: 5cqw; font-style: italic; line-height: 1.4; }

.details { margin-bottom: 7cqw; display: grid; gap: 4cqw; }
.details dt { font-size: max(12px, 3.6cqw); font-style: italic; letter-spacing: .08em; color: var(--gold); }
.details dd { font-size: max(15px, 4.6cqw); line-height: 1.4; }
.details strong { font-weight: 600; font-size: 1.1em; letter-spacing: .02em; }
.compliments { margin-top: 10cqw; }
.compliments__lead { font-size: max(13px, 3.9cqw); font-style: italic; letter-spacing: .04em; color: var(--brown); }
.compliments__names { margin-top: 1.2cqw; font-size: 4.8cqw; font-weight: 600; line-height: 1.4; }

/* ---------- Find us ---------- */
.find__icon { width: 9cqw; height: 9cqw; color: var(--gold); }
.find__title { margin-top: 1cqw; font-family: var(--script); font-size: 12cqw; line-height: 1.15; word-spacing: .14em; }
.find__venue { margin-top: 2cqw; font-size: 5.2cqw; font-weight: 600; letter-spacing: .03em; }
.find__place { margin-top: .8cqw; font-size: 4.4cqw; font-style: italic; color: var(--brown); }
.map {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 7cqw 0;
  border: 1px solid rgba(199, 149, 61, .7);
  border-radius: 6px;
  overflow: hidden;
  background: var(--champagne);
  box-shadow: 0 0 0 6px rgba(255, 253, 247, .55), 0 24px 40px -28px rgba(89, 53, 29, .45);
}
.map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; filter: sepia(.22) saturate(.85); }
.signoff { margin-top: 14cqw; font-family: var(--script); font-size: 9cqw; line-height: 1.2; color: var(--brown); }
.signoff span { color: var(--gold); padding: 0 .1em; }

/* ---------- Fixed chrome ---------- */
.controls {
  position: fixed;
  z-index: 10;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
}
.control {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(199, 149, 61, .5);
  border-radius: 50%;
  background: rgba(255, 253, 247, .82);
  color: var(--espresso);
  cursor: pointer;
  box-shadow: 0 4px 14px -8px rgba(89, 53, 29, .5);
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.control[hidden] { display: none; }
.control svg { width: 20px; height: 20px; }
.control:hover { background: var(--gold); color: var(--pearl); }
#sound .wave { display: none; }
#sound[aria-pressed="true"] .wave { display: block; }
#sound[aria-pressed="true"] .mute { display: none; }

.dots { display: none; }
@media (min-width: 900px) {
  .dots {
    position: fixed;
    z-index: 10;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .dots a { display: grid; place-items: center; width: 24px; height: 24px; }
  .dots a::before {
    content: "";
    width: 7px; height: 7px;
    border: 1px solid var(--gold);
    border-radius: 50%;
    transition: background-color .4s var(--ease), transform .4s var(--ease);
  }
  .dots a:hover::before { transform: scale(1.3); }
  .dots a[aria-current="true"]::before { background: var(--gold); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .r { transform: none; transition: opacity .5s linear calc(var(--d, 0) * .25ms); }
  .js .r .rule { transform: none; }
  .scroll-cue { transition-delay: 0s; }
  .scroll-cue i::after { animation: none; top: 0; height: 100%; }
  .countdown__num.tick { animation: none; }
  .open-btn::after { animation: none; opacity: 0; }
  .disc, .disc::after, .disc.is-done .disc__face b { animation: none; }
}
