/* =========================================================
   Tokens
   ========================================================= */
:root {
  --ivory: #e7e7e0;          /* matches the hero illustration's paper */
  --ivory-light: #efeee8;
  --crimson: #a3141c;
  --maroon: #6a0d12;
  --gold: #c8962e;
  --gold-light: #f0cf7a;
  --gold-deep: #9a6f1f;
  --indigo: #2c3a86;
  --ink: #3b2420;
  --ink-soft: #6e5a52;

  --script: "Pinyon Script", "Snell Roundhand", cursive;
  --serif: "Cormorant Garamond", "Garamond", "Times New Roman", serif;
  --ruqaa: "Aref Ruqaa", "Amiri", serif;
  --naskh: "Amiri", "Geeza Pro", serif;

  --col: 460px;

  /* Garmasis cloth, after the traditional weave: a red body crossed by
     tight clusters of fine cream / blue / gold weft threads, a few faint
     warp threads running down, and a metallic gold border with blue bands. */
  --g-cream: #f7e8c6;
  --g-blue: #2448a6;
  --g-gold: #f0b93a;
  --g-red: #a51b1f;
  --warp-stops:
      transparent 0 30px,
      rgba(250, 234, 200, .42) 30px 31.5px,
      transparent 31.5px 35px,
      rgba(250, 234, 200, .28) 35px 36px,
      transparent 36px 74px;
  --weft-stops:
      transparent 0 22px,
      rgba(250, 234, 200, .4) 22px 23px,
      transparent 23px 46px,
      var(--g-cream) 46px 47px, transparent 47px 49px,
      var(--g-blue) 49px 50px, var(--g-cream) 50px 51px, transparent 51px 53px,
      var(--g-gold) 53px 54px, var(--g-cream) 54px 55px, var(--g-blue) 55px 56px, transparent 56px 58px,
      var(--g-cream) 58px 59px, var(--g-blue) 59px 60px, var(--g-cream) 60px 61px, transparent 61px 63px,
      var(--g-gold) 63px 64px, var(--g-cream) 64px 65px, var(--g-blue) 65px 66px, transparent 66px 68px,
      var(--g-cream) 68px 69px,
      transparent 69px 104px;
  /* Stripes running across (default) */
  --garmasis:
    repeating-linear-gradient(90deg, var(--warp-stops)),
    repeating-linear-gradient(180deg, var(--weft-stops)),
    linear-gradient(180deg, #a71c20, #931519);
  /* Same cloth turned 90°, stripes running down */
  --garmasis-v:
    repeating-linear-gradient(180deg, var(--warp-stops)),
    repeating-linear-gradient(90deg, var(--weft-stops)),
    linear-gradient(90deg, #a71c20, #931519);

  --border-stops:
      transparent 0 10px,
      var(--g-red) 10px 12px, transparent 12px 16px,
      var(--g-cream) 16px 17px, transparent 17px 28px,
      var(--g-blue) 28px 30px, transparent 30px 33px,
      var(--g-blue) 33px 45px, rgba(140, 170, 230, .8) 45px 46px, transparent 46px 48px,
      var(--g-cream) 48px 49px, transparent 49px 60px,
      var(--g-red) 60px 62px, transparent 62px 66px,
      var(--g-red) 66px 68px, transparent 68px 80px,
      var(--g-cream) 80px 81px, transparent 81px 84px,
      var(--g-blue) 84px 86px, transparent 86px 90px,
      var(--g-blue) 90px 102px, transparent 102px 105px,
      var(--g-red) 105px 106px,
      transparent 106px 120px;
  --sheen-stops: #e39a22, #ffd65a 22%, #f0ad2e 45%, #ffe07a 68%, #e9a127 88%, #ffd35a;
  --garmasis-border:
    repeating-linear-gradient(90deg, var(--warp-stops)),
    repeating-linear-gradient(180deg, var(--border-stops)),
    linear-gradient(90deg, var(--sheen-stops));
  --garmasis-border-v:
    repeating-linear-gradient(180deg, var(--warp-stops)),
    repeating-linear-gradient(90deg, var(--border-stops)),
    linear-gradient(180deg, var(--sheen-stops));

  /* Woven tabag band */
  --weave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='22'%3E%3Crect width='24' height='22' fill='%233b2420'/%3E%3Crect y='3' width='24' height='16' fill='%23c8962e'/%3E%3Cpath d='M0 19L6 5l6 14z' fill='%236a0d12'/%3E%3Cpath d='M12 3l6 14 6-14z' fill='%236a0d12'/%3E%3Ccircle cx='6' cy='14' r='1.4' fill='%23f0cf7a'/%3E%3Ccircle cx='18' cy='8' r='1.4' fill='%23f0cf7a'/%3E%3C/svg%3E");

  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .3 0 0 0 0 .25 0 0 0 0 .2 0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  background: linear-gradient(rgba(40, 6, 8, .55), rgba(40, 6, 8, .55)), var(--garmasis);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body.is-sealed { overflow: hidden; }

:focus-visible { outline: 2px solid var(--crimson); outline-offset: 3px; }
img { max-width: 100%; }
button { font: inherit; }

.stage {
  position: relative;
  max-width: var(--col);
  margin: 0 auto;
  min-height: 100vh;
  box-shadow: 0 0 80px rgba(0, 0, 0, .45);
}

.invite {
  position: relative;
  overflow: hidden;
  background: var(--noise), var(--ivory);
}

/* =========================================================
   Opening: embossed burgundy envelope lined with garmasis
   ========================================================= */
.veil {
  position: fixed;
  inset: 0 auto 0 50%;
  width: min(100vw, var(--col));
  height: 100vh;
  height: 100dvh;
  transform: translateX(-50%);
  z-index: 50;
  overflow: hidden;
  perspective: 1200px;
  background: #3e0c13;
  transition: opacity .6s ease 1.7s;
}
/* Inside of the envelope, seen as the flaps open */
.veil__lining {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 48%, #f6dc9a 0%, #b9783a 22%, #6a1b24 55%, #3e0c13 100%);
}

/* Motif colouring (used inside SVG <use> trees) */
.m-fill { fill: var(--c); }
.m-stroke { fill: none; stroke: var(--c); stroke-width: 1.4; stroke-linecap: round; }
.vein { fill: none; stroke: var(--v); stroke-width: .7; }

/* Each flap: a full-size layer. The cloth is cut to the scalloped shape with a
   mask, the SVG on top draws the gold piping and perforations, and the
   drop-shadow lifts the flap off the one beneath it. */
.flaps { position: absolute; inset: 0; }
.flap {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 2px 3px rgba(30, 0, 5, .55)) drop-shadow(0 8px 14px rgba(30, 0, 5, .3));
  transition: transform 1.05s cubic-bezier(.55, 0, .3, 1) .85s;
  backface-visibility: visible;
}
.flap__cloth {
  position: absolute;
  inset: 0;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.flap__trim { position: absolute; }
.flap__edge { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* --- Flap cloth -------------------------------------------------------------
   Top and bottom flaps carry the full garmasis weave with the gold border on
   their outer edge. Side flaps are plain red silk with a gold border down the
   outer edge, so only one direction of stripes ever shows. */
.flap--top .flap__cloth,
.flap--bottom .flap__cloth { background: var(--flap-shade), var(--garmasis); }
.flap--left .flap__cloth,
.flap--right .flap__cloth {
  background: var(--flap-shade), repeating-linear-gradient(180deg, var(--warp-stops)), linear-gradient(90deg, #a71c20, #931519);
}

.flap--top .flap__trim,
.flap--bottom .flap__trim { left: 0; right: 0; height: 56px; background: var(--garmasis-border); }
.flap--top .flap__trim { top: 0; }
.flap--bottom .flap__trim { bottom: 0; }
.flap--left .flap__trim,
.flap--right .flap__trim { top: 0; bottom: 0; width: 40px; background: var(--garmasis-border-v); }
.flap--left .flap__trim { left: 0; }
.flap--right .flap__trim { right: 0; }

.flap--top { --flap-shade: linear-gradient(180deg, rgba(255, 235, 200, .05) 30%, rgba(40, 0, 5, .2)); }
.flap--bottom { --flap-shade: linear-gradient(0deg, rgba(0, 0, 0, 0) 40%, rgba(40, 0, 5, .22)); }
.flap--left { --flap-shade: linear-gradient(90deg, rgba(0, 0, 0, 0) 45%, rgba(40, 0, 5, .26)); }
.flap--right { --flap-shade: linear-gradient(270deg, rgba(0, 0, 0, 0) 45%, rgba(40, 0, 5, .26)); }

/* Fold order: sides first, then bottom, then top */
.flap--left, .flap--right { z-index: 1; }
.flap--bottom { z-index: 2; }
.flap--top { z-index: 3; transition-delay: .25s; transition-duration: .9s; }
.flap--left { transform-origin: 0 50%; }
.flap--right { transform-origin: 100% 50%; }
.flap--bottom { transform-origin: 50% 100%; }
.flap--top { transform-origin: 50% 0; }

.veil__seal {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform: translate(-50%, -50%);
  margin-top: 22px;
  transition: transform .5s cubic-bezier(.5, 0, .3, 1), opacity .4s ease .1s;
}
.veil__seal svg {
  width: clamp(104px, 30vw, 124px);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 5px 6px rgba(30, 0, 5, .55)) drop-shadow(0 1px 1px rgba(30, 0, 5, .4));
}
.veil__hint {
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(58, 12, 18, .82);
  font-style: italic;
  font-size: 1rem;
  letter-spacing: .03em;
  color: #f3dcae;
}

.veil.is-open { opacity: 0; pointer-events: none; }
.veil.is-open .flap--top { transform: rotateX(165deg); }
.veil.is-open .flap--bottom { transform: rotateX(-165deg); }
.veil.is-open .flap--left { transform: rotateY(-165deg); }
.veil.is-open .flap--right { transform: rotateY(165deg); }
.veil.is-open .veil__seal { opacity: 0; transform: translate(-50%, -50%) scale(1.15); }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 640px;
  max-height: 1000px;
  overflow: hidden;
  background: var(--ivory);
}
.hero__couple {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 100%;
}

/* The chandelier hangs from the top edge and swings side to side */
.chandelier {
  --w: min(50vw, 216px);
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  width: var(--w);
  margin-left: calc(var(--w) / -2);
  transform-origin: 50% 0;
  animation: swing 4.2s ease-in-out infinite alternate;
}
.chandelier__chain {
  display: block;
  width: 2px;
  height: 22px;
  margin: 0 auto;
  background: linear-gradient(var(--gold-deep), var(--gold));
}
.chandelier img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: -2px;
  filter: drop-shadow(0 0 18px rgba(255, 205, 120, .55)) drop-shadow(0 8px 10px rgba(60, 30, 10, .18));
}
@keyframes swing {
  from { transform: rotate(-14deg); }
  to { transform: rotate(14deg); }
}

.hero__text {
  position: absolute;
  top: calc(min(50vw, 216px) * 1.28 + 34px);
  left: 0;
  right: 0;
  z-index: 3;
  padding: 0 24px;
  text-align: center;
}
.hero__lead {
  margin: 0;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink-soft);
}
.hero__names {
  margin: .1rem 0 0;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(3rem, 14vw, 3.7rem);
  line-height: 1.15;
  color: var(--crimson);
}
.hero__amp { font-size: .7em; color: var(--gold); }
.hero__ar {
  margin: -.2rem 0 0;
  font-family: var(--ruqaa);
  font-size: clamp(1.7rem, 7vw, 2rem);
  line-height: 1.4;
  color: var(--gold-deep);
}
.hero__date {
  margin: .3rem 0 0;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--maroon);
}

/* =========================================================
   Sections + woven band
   ========================================================= */
.band {
  height: 22px;
  background: var(--weave) repeat-x center / auto 22px;
}

.sec {
  position: relative;
  padding: 64px 32px;
  text-align: center;
}

.script {
  margin: 0 0 .7rem;
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(2.1rem, 9.4vw, 2.5rem);
  line-height: 1.2;
  color: var(--crimson);
}
.script--light { color: var(--gold-light); font-size: clamp(1.8rem, 7.8vw, 2.2rem); }
.body {
  max-width: 31ch;
  margin: 0 auto;
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink);
}
.body--small { font-size: 1rem; color: var(--ink-soft); }

/* Welcome */
.bismillah {
  margin: 0 0 1.4rem;
  font-family: var(--naskh);
  font-size: 1.6rem;
  color: var(--maroon);
}
.ayah { margin: 0 auto; max-width: 34ch; }
.ayah p[lang="ar"] {
  margin: 0;
  font-family: var(--naskh);
  font-size: 1.35rem;
  line-height: 2;
  color: var(--crimson);
}
.ayah__en {
  margin: .8rem 0 0;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.ayah cite {
  display: block;
  margin-top: .4rem;
  font-style: normal;
  font-size: .95rem;
  color: var(--gold-deep);
}
.ornament { display: block; width: 46px; height: auto; margin: 1.8rem auto; }

/* Countdown on garmasis cloth */
.cloth { background: var(--garmasis); }
.gold-border {
  height: 40px;
  background: var(--garmasis-border);
  box-shadow: inset 0 1px 0 rgba(255, 240, 200, .6), inset 0 -1px 0 rgba(120, 60, 0, .4);
}
.cloth::before {
  content: "";
  position: absolute;
  inset: 26px 22px;
  border: 1px solid rgba(240, 207, 122, .7);
  outline: 1px solid rgba(240, 207, 122, .35);
  outline-offset: 4px;
  background: rgba(110, 10, 16, .82);
  pointer-events: none;
}
.cloth > * { position: relative; }
.countdown {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  margin-top: 1rem;
}
.countdown__unit { display: grid; justify-items: center; min-width: 3.1rem; }
.countdown__num {
  font-size: clamp(2.3rem, 10.5vw, 2.8rem);
  font-weight: 500;
  line-height: 1;
  color: var(--gold-light);
  font-variant-numeric: tabular-nums lining-nums;
}
.countdown__colon { font-size: clamp(2rem, 9vw, 2.4rem); line-height: 1; color: var(--gold); }
.countdown__label { margin-top: .45rem; font-size: .92rem; color: #f6e3d6; }
.countdown__done { margin: 1rem 0 0; font-size: 1.3rem; color: var(--gold-light); }

/* Schedule */
.script--flourished {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: clamp(1.8rem, 8vw, 2.2rem);
}
.fl { width: 42px; height: 13px; flex: none; color: var(--gold); }
.fl--r { transform: scaleX(-1); }

.timeline {
  position: relative;
  max-width: 310px;
  margin: 2rem auto 0;
  padding: 10px 0;
  list-style: none;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(180deg, transparent, var(--gold) 6%, var(--gold) 94%, transparent);
}
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  align-items: center;
  padding: 15px 0;
}
.timeline li::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--crimson);
  border: 1px solid var(--gold-light);
  transform: translate(-50%, -50%) rotate(45deg);
}
.timeline time {
  grid-column: 1;
  text-align: right;
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--maroon);
  font-variant-numeric: lining-nums;
}
.timeline span {
  grid-column: 3;
  display: grid;
  text-align: left;
  font-size: 1.08rem;
  line-height: 1.25;
  color: var(--ink);
}
.timeline small {
  font-family: var(--naskh);
  font-size: .9rem;
  color: var(--gold-deep);
}
.timeline__flower {
  position: absolute;
  left: 50%;
  top: var(--flower-y, 10px);
  z-index: 1;
  width: 40px;
  height: auto;
  transform: translate(-50%, -50%) rotate(var(--flower-r, 0deg));
  filter: drop-shadow(0 2px 3px rgba(60, 0, 0, .35));
}

/* Location */
.venue-ar {
  margin: 0;
  font-family: var(--ruqaa);
  font-size: clamp(1.7rem, 7.4vw, 2rem);
  line-height: 1.5;
  color: var(--maroon);
}
.venue { margin: 0 0 .2rem; font-size: 1.3rem; font-weight: 600; color: var(--ink); }
.map { margin: 2rem auto 0; max-width: 360px; }
.map__frame {
  padding: 6px;
  border: 2px solid var(--gold);
  outline: 1px solid var(--crimson);
  outline-offset: 4px;
  background: var(--ivory-light);
}
.map__frame iframe { display: block; width: 100%; height: 260px; border: 0; }
.link {
  display: inline-block;
  margin-top: 1.2rem;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--crimson);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* Dress code */
.dress__img { display: block; width: 200px; height: auto; margin: 0 auto 1.2rem; }

/* Closing */
.sec--closing { padding-bottom: 0; }
.closing {
  margin: 0;
  font-family: var(--script);
  font-size: clamp(1.9rem, 8.4vw, 2.3rem);
  line-height: 1.25;
  color: var(--crimson);
}
.closing-ar {
  margin: .4rem 0 0;
  font-family: var(--ruqaa);
  font-size: 1.7rem;
  color: var(--gold-deep);
}
.signature { margin: .4rem 0 0; font-size: 1.35rem; letter-spacing: .03em; color: var(--ink-soft); }
.closing__couple {
  display: block;
  width: calc(100% + 64px);
  max-width: none;
  height: auto;
  margin: 1.6rem -32px 0;
}

/* =========================================================
   Music toggle
   ========================================================= */
.music {
  position: fixed;
  right: max(16px, calc(50vw - var(--col) / 2 + 16px));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #c01d26, var(--maroon));
  color: var(--gold-light);
  box-shadow: 0 4px 12px rgba(60, 0, 0, .4);
  cursor: pointer;
}
.music[hidden] { display: none; }
.music svg { width: 18px; height: 18px; }
.music__pause { display: none; }
.music[aria-pressed="true"] .music__pause { display: block; }
.music[aria-pressed="true"] .music__play { display: none; }

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
  .chandelier { animation: none; }
}
