/* ═══════════════════════════════════════════════════════════
   أفراح الإبراهيم — دعوة حفل زفاف عمر
   Black silk · gold thread · IBM Plex Sans Arabic
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #070706;
  --ink: #f6f2e9;
  --ink-2: rgba(246, 242, 233, .68);
  --ink-3: rgba(246, 242, 233, .42);
  --gold-hi: #f9e4b0;
  --gold: #e3ad4e;
  --gold-deep: #a8732a;
  --hair: rgba(227, 173, 78, .3);
  --hair-soft: rgba(227, 173, 78, .14);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* The card is a 9:16 sheet that always fits the first screen.
     --W is its width, --u is 1% of it — every size on the card is in --u. */
  --W: min(100vw, max(300px, min(100vh * 9 / 16, 600px)));
  --u: calc(var(--W) / 100);
}
@supports (height: 100svh) {
  :root { --W: min(100vw, max(300px, min(100svh * 9 / 16, 600px))); }
}

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  min-height: 100vh;
  overflow-x: hidden;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
main { position: relative; z-index: 1; }
a { color: inherit; }
::selection { background: var(--gold); color: #120c03; }

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

/* ── atmosphere ─────────────────────────────────────────── */
#dust {
  position: fixed; inset: 0; z-index: 3;
  width: 100%; height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}
.grain {
  position: fixed; inset: -50%; z-index: 4;
  pointer-events: none;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); } 60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* ═══════════ THE CARD ═══════════ */
.card {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}
.card__glow {
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(55% 42% at 0% 10%, rgba(227, 173, 78, .15), transparent 70%),
    radial-gradient(46% 26% at 50% 47%, rgba(227, 173, 78, .085), transparent 72%),
    radial-gradient(90% 40% at 50% 100%, rgba(227, 173, 78, .05), transparent 70%);
}

/* giant calligraphy watermark, like the silk pattern on the printed card */
.card__pattern {
  position: absolute; inset: 0; z-index: -1;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .6) 28%, transparent 60%);
          mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .6) 28%, transparent 60%);
  translate: calc(var(--mx, 0) * -10px) calc(var(--my, 0) * -8px + var(--sy, 0) * .06px);
}
.card__pattern i {
  position: absolute;
  aspect-ratio: 2444 / 880;
  background: #fff;
  opacity: .042;
  -webkit-mask: url(assets/crest.svg) center / contain no-repeat;
          mask: url(assets/crest.svg) center / contain no-repeat;
}
.card__pattern i:nth-child(1) {
  width: max(calc(var(--u) * 250), 105vw);
  top: calc(var(--u) * -16); right: calc(var(--u) * -58);
  rotate: -13deg;
}
.card__pattern i:nth-child(2) {
  width: max(calc(var(--u) * 190), 80vw);
  top: calc(var(--u) * 44); left: calc(var(--u) * -52);
  rotate: 9deg;
  opacity: .028;
}

/* gold curtain — cut from the original artwork */
.curtain {
  position: absolute; top: 0; left: 0; z-index: 0;
  height: min(100%, 190vw);
  aspect-ratio: 236 / 2000;
  pointer-events: none;
  translate: calc(var(--mx, 0) * 5px) calc(var(--sy, 0) * .14px);
  -webkit-mask-image: linear-gradient(180deg, #000 90%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 90%, transparent 100%);
  filter: drop-shadow(calc(var(--u) * 2) 0 calc(var(--u) * 5) rgba(0, 0, 0, .65));
}
.curtain img {
  display: block; height: 100%; width: auto;
  transform-origin: 35% 0;
  animation: sway 9s ease-in-out infinite;
}
.curtain--r { left: auto; right: 0; scale: -1 1; display: none; }
.curtain--r img { animation-delay: -4.5s; }
@media (min-width: 900px) { .curtain--r { display: block; } }
@keyframes sway {
  0%, 100% { transform: rotate(-.3deg) skewX(.15deg); }
  50% { transform: rotate(.45deg) skewX(-.25deg); }
}

.card__inner {
  position: relative; z-index: 1;
  width: var(--W);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: calc(var(--u) * 9) 0 calc(var(--u) * 11);
}
.card__inner > * { margin-top: calc(var(--u) * var(--mt, 0)); }

.crest { width: calc(var(--u) * 52); filter: drop-shadow(0 calc(var(--u) * .6) calc(var(--u) * 1.4) rgba(0, 0, 0, .75)); }
.crest__ink {
  display: block; aspect-ratio: 2444 / 880;
  background: linear-gradient(180deg, #fff 25%, #e6dfd0);
  -webkit-mask: url(assets/crest.svg) center / contain no-repeat;
          mask: url(assets/crest.svg) center / contain no-repeat;
}

.line {
  font-size: calc(var(--u) * 4.3);
  line-height: 1.5;
  font-weight: 400;
  color: var(--ink);
}
.name {
  font-size: calc(var(--u) * 5);
  line-height: 1.5;
  font-weight: 600;
}
.name--wide { word-spacing: .12em; }
.date { unicode-bidi: isolate; font-variant-numeric: lining-nums; }

.gold {
  display: inline-block;
  padding: .08em .06em;
  color: var(--gold);
  background: linear-gradient(100deg, var(--gold) 0%, var(--gold) 40%, var(--gold-hi) 50%, var(--gold) 60%, var(--gold) 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: sheen 6.5s linear infinite;
}
@keyframes sheen {
  0% { background-position: 0% 0; }
  60%, 100% { background-position: 100% 0; }
}

.groom { width: calc(var(--u) * 39); }
.groom svg {
  display: block; width: 100%; height: auto; overflow: visible;
  filter: drop-shadow(0 0 calc(var(--u) * 3.5) rgba(227, 173, 78, .26));
}

.rule {
  display: block;
  width: calc(var(--u) * 34); height: 1px;
  background: linear-gradient(90deg, transparent, rgba(246, 242, 233, .9) 28%, rgba(246, 242, 233, .9) 72%, transparent);
}

.diamonds { display: grid; justify-items: center; gap: calc(var(--u) * 1.15); }
.diamonds i {
  display: block; aspect-ratio: 1;
  width: calc(var(--u) * 1.9);
  background: linear-gradient(135deg, #fff, #a39f95);
  transform: rotate(45deg);
}
.diamonds i:nth-child(2) { width: calc(var(--u) * 1.4); }
.diamonds i:nth-child(3) { width: calc(var(--u) * 1.05); }

.blessing { width: calc(var(--u) * 55); }
.blessing__ink {
  display: block; aspect-ratio: 2368 / 488;
  background: linear-gradient(180deg, #fff 30%, #e6dfd0);
  -webkit-mask: url(assets/blessing.svg) center / contain no-repeat;
          mask: url(assets/blessing.svg) center / contain no-repeat;
}

.hint {
  position: absolute; z-index: 2;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 50%; translate: -50% 0;
  display: grid; place-items: center;
  width: 44px; height: 34px;
  color: var(--gold);
  -webkit-tap-highlight-color: transparent;
}
.hint svg { animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { transform: translateY(-3px); opacity: .45; }
  50% { transform: translateY(4px); opacity: 1; }
}

/* ── card intro choreography ────────────────────────────── */
.js [data-a] { opacity: 0; }
.js .curtain { transform: translateY(-103%); }
.js .card__pattern, .js .card__glow { opacity: 0; }
.js .groom__fill, .js .groom__sheen { opacity: 0; }
.js .groom__line { stroke-dasharray: 1; stroke-dashoffset: 1; }
.no-js .groom__line { display: none; }

.js.ready [data-a] { animation-delay: calc(var(--d, 0) * 1ms); animation-fill-mode: both; }
.js.ready [data-a="up"]   { animation-name: a-up;   animation-duration: 1.2s; animation-timing-function: var(--ease); }
.js.ready [data-a="fade"] { animation-name: a-fade; animation-duration: 1.4s; animation-timing-function: ease; }
.js.ready [data-a="wipe"] { animation-name: a-wipe; animation-duration: 1.7s; animation-timing-function: cubic-bezier(.65, 0, .2, 1); }
.js.ready [data-a="grow"] { animation-name: a-grow; animation-duration: 1.3s; animation-timing-function: var(--ease); }
.js.ready [data-a="pop"]  { animation-name: a-pop;  animation-duration: .9s;  animation-timing-function: var(--ease); }

.js.ready .curtain { animation: a-drop 2.3s var(--ease) .15s both; }
.js.ready .curtain--r { animation-delay: .35s; }
.js.ready .card__glow { animation: a-fade 2.6s ease .2s both; }
.js.ready .card__pattern { animation: a-fade 3s ease .5s both; }
.js.ready .groom__line {
  animation: a-draw 2.1s cubic-bezier(.6, .05, .25, 1) 2s both, a-out .9s ease 3.75s forwards;
}
.js.ready .groom__fill  { animation: a-fade 1.2s ease 3.3s both; }
.js.ready .groom__sheen { animation: a-fade 1s ease 4.3s both; }

/* any scroll / touch during the intro fast-forwards it */
.js.ready.skip [data-a],
.js.ready.skip .curtain,
.js.ready.skip .card__glow,
.js.ready.skip .card__pattern,
.js.ready.skip .groom__fill,
.js.ready.skip .groom__sheen { animation-delay: 0s !important; animation-duration: .5s !important; }
.js.ready.skip .groom__line { animation: none; opacity: 0; }

@keyframes a-up   { from { opacity: 0; transform: translateY(calc(var(--u) * 3)); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes a-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes a-wipe {
  from { opacity: 1; clip-path: inset(-20% -6% -20% 106%); }
  to   { opacity: 1; clip-path: inset(-20% -6% -20% -6%); }
}
@keyframes a-grow { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: scaleX(1); } }
@keyframes a-pop  { from { opacity: 0; transform: rotate(45deg) scale(0); } to { opacity: 1; transform: rotate(45deg) scale(1); } }
@keyframes a-drop { from { transform: translateY(-103%); } to { transform: translateY(0); } }
@keyframes a-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes a-out  { to { opacity: 0; } }

/* ═══════════ SECTIONS ═══════════ */
.more {
  max-width: 604px;
  margin: 0 auto;
  padding: 0 22px calc(56px + env(safe-area-inset-bottom));
}
.sec { padding-top: 84px; }
.sec:first-child { padding-top: 56px; }

.sec__head {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-bottom: 30px;
}
.sec__head::before, .sec__head::after { content: ""; flex: 1; height: 1px; }
.sec__head::before { background: linear-gradient(to left, var(--hair), transparent); }
.sec__head::after  { background: linear-gradient(to right, var(--hair), transparent); }
.sec__head h2 {
  font-size: 15.5px; font-weight: 500; line-height: 1.4;
  color: var(--gold);
}
.dia {
  flex: none; display: block; width: 6px; height: 6px;
  background: var(--gold);
  transform: rotate(45deg);
}

/* hairline frame with a diamond set into the top and bottom edge */
.frame { position: relative; border: 1px solid var(--hair); }
.frame::before, .frame::after {
  content: ""; position: absolute; left: 50%; z-index: 2;
  width: 9px; height: 9px;
  background: var(--bg);
  border: 1px solid var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
}
.frame::before { top: -.5px; }
.frame::after  { top: calc(100% + .5px); }

/* countdown */
.count {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(180deg, rgba(227, 173, 78, .07), rgba(227, 173, 78, .012));
}
.count__cell { position: relative; padding: 26px 2px 20px; text-align: center; overflow: hidden; }
.count__cell + .count__cell::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 26%; bottom: 26%;
  width: 1px; background: var(--hair-soft);
}
.count__num {
  display: block;
  direction: ltr;
  font-size: clamp(36px, 11.5vw, 60px);
  font-weight: 200;
  line-height: 1.05;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--gold);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-deep));
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.count__lbl { display: block; margin-top: 8px; font-size: 13px; font-weight: 400; color: var(--ink-2); }
.count__done {
  padding: 34px 16px; text-align: center;
  font-size: 19px; font-weight: 500; color: var(--gold);
  border: 1px solid var(--hair);
}

/* date ticket */
.ticket { display: grid; grid-template-columns: 1fr 1.25fr 1fr; }
.ticket__cell { position: relative; padding: 20px 6px 18px; text-align: center; }
.ticket__cell + .ticket__cell::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 24%; bottom: 24%;
  width: 1px; background: var(--hair-soft);
}
.ticket dt { font-size: 12.5px; font-weight: 400; color: var(--gold); margin-bottom: 4px; }
.ticket dd { font-size: clamp(15.5px, 4.5vw, 18px); font-weight: 500; color: var(--ink); line-height: 1.5; }

/* buttons */
.btns { display: grid; gap: 14px; margin-top: 26px; padding: 0 4px; }
.btns__row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.btn {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 12px 20px;
  border: 1px solid var(--hair);
  background: rgba(227, 173, 78, .035);
  color: var(--ink);
  font: 500 15.5px/1.35 var(--font);
  text-decoration: none; text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none; appearance: none;
  border-radius: 0;
  transition: border-color .45s ease, background-color .45s ease, color .45s ease, transform .5s var(--ease);
}
.btn::before, .btn::after {
  content: ""; position: absolute; top: 50%;
  width: 7px; height: 7px;
  background: var(--bg);
  border: 1px solid var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
  transition: transform .7s var(--ease), background-color .45s ease;
}
.btn::before { left: -.5px; }
.btn::after  { left: calc(100% + .5px); }
.btn .ico {
  flex: none; width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
}
.btn:active { transform: scale(.985); }
.btn:focus-visible, .hint:focus-visible, .map__link:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 4px; }
@media (hover: hover) {
  .btn:hover { border-color: var(--gold); background-color: rgba(227, 173, 78, .1); }
  .btn:hover::before, .btn:hover::after { transform: translate(-50%, -50%) rotate(225deg); background-color: var(--gold); }
}
.btn--gold {
  border-color: transparent;
  color: #1b1205; font-weight: 600;
  background: linear-gradient(100deg, #c88d36 0%, #e9b95f 34%, #f8e0a4 50%, #e3ad4e 66%, #c88d36 100%);
  background-size: 240% 100%;
  background-position: 0% 0;
  animation: btn-sheen 5.5s ease-in-out infinite;
  box-shadow: 0 10px 34px -14px rgba(227, 173, 78, .55);
}
.btn--gold::before, .btn--gold::after { background: #f8e0a4; border-color: var(--bg); }
@media (hover: hover) {
  .btn--gold:hover { background-color: transparent; border-color: transparent; }
}
@keyframes btn-sheen {
  0%, 100% { background-position: 0% 0; }
  50% { background-position: 100% 0; }
}

/* map */
.map { height: clamp(250px, 66vw, 340px); background: #0c0b09; }
.map__clip { position: absolute; inset: 0; overflow: hidden; }
.map__tiles {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  filter: invert(1) grayscale(.35) sepia(.75) saturate(1.5) hue-rotate(-12deg) brightness(1.25) contrast(1.12);
  animation: map-drift 22s ease-in-out infinite alternate;
}
.map__tiles img {
  position: absolute; width: 256px; height: 256px; max-width: none;
  opacity: 0; transition: opacity 1.2s ease;
  user-select: none; -webkit-user-drag: none;
}
.map__tiles img.on { opacity: 1; }
@keyframes map-drift { from { transform: scale(1); } to { transform: scale(1.07); } }
.map__shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(75% 85% at 50% 50%, transparent 30%, rgba(7, 7, 6, .82) 100%),
    linear-gradient(180deg, rgba(7, 7, 6, .35), transparent 30%, transparent 70%, rgba(7, 7, 6, .55));
}
.map__pin { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.map__pin b {
  position: absolute; left: -8px; top: -8px; width: 16px; height: 16px;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold) 60%, var(--gold-deep));
  transform: rotate(45deg);
  box-shadow: 0 0 0 3px rgba(7, 7, 6, .85), 0 0 22px 4px rgba(227, 173, 78, .7);
}
.map__pin i {
  position: absolute; left: -34px; top: -34px; width: 68px; height: 68px;
  border: 1px solid var(--gold);
  transform: rotate(45deg) scale(.2); opacity: 0;
  animation: ping 3.2s cubic-bezier(.2, .6, .3, 1) infinite;
}
.map__pin i:nth-child(2) { animation-delay: 1.6s; }
@keyframes ping {
  0% { transform: rotate(45deg) scale(.2); opacity: .95; }
  100% { transform: rotate(45deg) scale(1.15); opacity: 0; }
}
.map__label {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, calc(-100% - 30px));
  display: grid; justify-items: center; gap: 0;
  padding: 9px 18px 8px;
  background: rgba(7, 7, 6, .82);
  border: 1px solid var(--hair);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  white-space: nowrap;
}
.map__label strong { font-size: 15px; font-weight: 600; color: var(--gold); line-height: 1.5; }
.map__label span { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.map__link { position: absolute; inset: 0; z-index: 1; }
.map__attr {
  position: absolute; z-index: 2; left: 8px; bottom: 5px;
  font-size: 10px; line-height: 1.4; color: var(--ink-3);
}
.map__attr a { text-decoration: none; }

/* ending */
.sec--end { padding-top: 96px; text-align: center; }
.end__crest {
  width: min(230px, 56vw); aspect-ratio: 2444 / 880; margin: 0 auto 8px;
  background: linear-gradient(100deg, var(--gold-deep), var(--gold) 35%, var(--gold-hi) 50%, var(--gold) 65%, var(--gold-deep));
  background-size: 260% 100%;
  animation: btn-sheen 7s ease-in-out infinite;
  -webkit-mask: url(assets/crest.svg) center / contain no-repeat;
          mask: url(assets/crest.svg) center / contain no-repeat;
}

/* scroll reveal */
.js [data-r] {
  opacity: 0; transform: translateY(26px);
  transition: opacity 1.1s var(--ease), transform 1.2s var(--ease);
  transition-delay: calc(var(--i, 0) * 110ms);
}
.js .in [data-r] { opacity: 1; transform: none; }

/* toast */
.toast {
  position: fixed; z-index: 10; left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translate(-50%, 24px);
  padding: 11px 22px;
  background: #15120c; color: var(--gold-hi);
  border: 1px solid var(--hair);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .4s ease, transform .6s var(--ease);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── older Safari without aspect-ratio ──────────────────── */
@supports not (aspect-ratio: 1) {
  .crest__ink, .end__crest { height: 0; padding-top: 36%; }
  .blessing__ink { height: 0; padding-top: 20.6%; }
  .diamonds i { height: calc(var(--u) * 1.9); }
  .diamonds i:nth-child(2) { height: calc(var(--u) * 1.4); }
  .diamonds i:nth-child(3) { height: calc(var(--u) * 1.05); }
}

/* ── calm mode ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-a], .js [data-r], .js .card__pattern, .js .card__glow,
  .js .groom__fill, .js .groom__sheen { opacity: 1 !important; transform: none; }
  .js .diamonds i { transform: rotate(45deg); }
  .js .curtain { transform: none; }
  .js .groom__line { display: none; }
  #dust { display: none; }
}
