:root {
  --paper: #f4ead9;
  --paper-2: #ecdfc9;
  --ink: #5a4628;
  --ink-soft: #7d6a4a;
  --gold: #b48a3f;
  --gold-deep: #8c6724;
  --gold-light: #e3c27a;
  --line: rgba(180, 138, 63, .38);
  --ease: cubic-bezier(.22, .8, .2, 1);
  --grain: 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='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; }
html { background: #1b1712; -webkit-text-size-adjust: 100%; }
body {
  font-family: "Amiri", "Noto Naskh Arabic", serif;
  color: var(--ink);
  line-height: 1.9;
  font-size: 18px;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ============ فتح الكرت بالسكرول ============ */
#opening {
  position: relative;
  height: 460svh;
  max-width: 520px; margin: 0 auto;
}
.stage {
  position: sticky; top: 0;
  height: 100svh; overflow: hidden;
  background: var(--paper);
}
.stage > .poster, .stage > canvas, .stage > .final {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
#seq { opacity: 0; transition: opacity .4s; }
#seq.ready { opacity: 1; }
.final, .final-halo, .cover-text { opacity: var(--end, 0); }
.final-halo {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 66% 40% at 50% 42%, rgba(255, 250, 238, .86), rgba(255, 250, 238, 0) 72%);
}

#seal-tap {
  position: absolute; left: 50%; top: 47.5%;
  width: 40%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 0; border-radius: 50%; background: none; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
#seal-tap::after {
  content: ""; position: absolute; inset: 4%; border-radius: 50%;
  border: 1px solid rgba(214, 170, 85, .8);
  animation: ring 2.6s ease-out infinite;
}
@keyframes ring { 0% { transform: scale(.8); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }

.hint {
  position: absolute; left: 0; right: 0; bottom: 9svh;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; transition: opacity .5s;
}
.hint-text {
  font-family: "Aref Ruqaa", serif; font-size: 1.2rem; color: var(--gold-deep);
  padding: 2px 16px; border-radius: 30px;
  background: rgba(250, 244, 230, .72); backdrop-filter: blur(4px);
}
.hint-arrow {
  width: 14px; height: 14px; border-left: 1.5px solid var(--gold-deep); border-top: 1.5px solid var(--gold-deep);
  transform: rotate(45deg); animation: nudge 1.6s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translateY(-8px) rotate(45deg); opacity: .4; } }
.started .hint, .started #seal-tap { opacity: 0; pointer-events: none; }

.cover-text {
  position: absolute; left: 0; right: 0; top: 19svh;
  padding: 0 24px; text-align: center;
  transform: translateY(calc((1 - var(--end, 0)) * 22px));
}
.eyebrow { font-family: "Aref Ruqaa", serif; font-size: 1.7rem; color: var(--gold-deep); line-height: 1.3; }
.names {
  margin-top: 1.6svh;
  font-family: "Aref Ruqaa", serif; font-weight: 700;
  font-size: clamp(3.2rem, 16vw, 4.8rem); line-height: 1.2;
  color: var(--gold-deep);
  display: flex; flex-direction: column; align-items: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .8), 0 0 26px rgba(255, 248, 230, .9);
}
.ring { width: 62px; margin: 0 0 -4px; filter: drop-shadow(0 4px 6px rgba(90, 65, 20, .3)); }
.ring.sm { width: 46px; margin: 6px auto; }
.mono { width: 104px; height: 104px; object-fit: contain; margin: 1.4svh auto 0; display: block; filter: drop-shadow(0 3px 5px rgba(120, 85, 20, .22)); }
.mono.lg { width: 132px; height: 132px; margin: 0 auto 12px; }
.cover-date {
  font-family: "Cormorant Garamond", serif; font-size: 1.3rem; letter-spacing: .22em;
  color: var(--ink-soft); direction: ltr; margin-top: .8svh;
}

/* ============ البطاقة ============ */
#card {
  position: relative; z-index: 2;
  max-width: 520px; margin: 0 auto;
  background: var(--grain), #efe4d0;
  border: 46px solid transparent;
  border-image: url(/img/frame.jpg) 13% round;
  background-clip: padding-box, padding-box;
  overflow: hidden;
  color: var(--ink);
}
.block { position: relative; padding: 40px 12px; text-align: center; }
h2 {
  font-family: "Aref Ruqaa", serif; font-weight: 700; font-size: 2.1rem; line-height: 1.4;
  color: var(--gold-deep); margin-bottom: 14px;
}
h2::after {
  content: ""; display: block; width: 54px; height: 1px; margin: 10px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.body { max-width: 31ch; margin: 0 auto; }
.bismillah { font-family: "Aref Ruqaa", serif; font-size: 1.4rem; color: var(--gold-deep); margin-bottom: 14px; }
.verse { font-size: 1.08rem; line-height: 2.3; color: var(--ink-soft); max-width: 31ch; margin: 0 auto 26px; }

/* أصحاب الدعوة */
.host { padding-top: 30px; }
.lead { font-family: "Aref Ruqaa", serif; font-size: 1.7rem; color: var(--gold-deep); line-height: 1.5; }
.lead.small { font-size: 1.3rem; margin: 22px auto 14px; max-width: 22ch; color: var(--ink-soft); }
.fathers { display: grid; gap: 4px; margin-top: 10px; }
.fathers small { display: block; font-size: .95rem; color: var(--ink-soft); line-height: 1.4; }
.fathers strong { display: block; font-family: "Aref Ruqaa", serif; font-weight: 700; font-size: 1.5rem; line-height: 1.6; }
.orn { display: block; width: 7px; height: 7px; margin: 10px auto; transform: rotate(45deg); background: var(--gold); box-shadow: 16px -16px 0 -2px var(--gold-light), -16px 16px 0 -2px var(--gold-light); }
.couple-names p { font-family: "Aref Ruqaa", serif; font-weight: 700; font-size: 1.55rem; color: var(--gold-deep); line-height: 1.6; }

.tear {
  height: 22px; margin: 6px 0;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold-light) 50%, var(--gold) 80%, transparent) center / 100% 1.5px no-repeat;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 22' preserveAspectRatio='none'%3E%3Cpath d='M0 11 C30 3 52 18 84 10 S140 4 172 12 228 17 262 9 318 5 348 12 384 15 400 10' fill='none' stroke='%23000' stroke-width='22'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 22' preserveAspectRatio='none'%3E%3Cpath d='M0 11 C30 3 52 18 84 10 S140 4 172 12 228 17 262 9 318 5 348 12 384 15 400 10' fill='none' stroke='%23000' stroke-width='22'/%3E%3C/svg%3E");
}
.divider { width: 92%; margin: 0 auto; mix-blend-mode: multiply; filter: brightness(1.05); }

/* الموعد */
.date-long { font-family: "Aref Ruqaa", serif; font-weight: 700; font-size: 1.55rem; line-height: 1.5; }
.time-range { color: var(--ink-soft); font-size: 1.1rem; }
.time-range b { font-family: "Cormorant Garamond", serif; font-weight: 600; font-size: 1.45rem; color: var(--gold-deep); }

.calendar {
  max-width: 320px; margin: 22px auto 30px; padding: 16px 14px 14px;
  border: 1px solid var(--line); border-radius: 18px;
  background: rgba(255, 252, 244, .55);
  box-shadow: 0 10px 26px rgba(90, 70, 40, .1);
}
.cal-head {
  font-family: "Aref Ruqaa", serif; font-weight: 700; font-size: 1.35rem; color: var(--gold-deep);
  padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.cal-grid span {
  aspect-ratio: 1; display: grid; place-items: center;
  font-family: "Cormorant Garamond", serif; font-size: 1.2rem; font-weight: 500; color: var(--ink);
}
.cal-grid .wd { font-family: "Amiri", serif; font-size: .82rem; color: var(--ink-soft); aspect-ratio: auto; padding: 2px 0 6px; }
.cal-grid .the-day {
  position: relative; color: #fff8e6; font-weight: 600; z-index: 0;
}
.cal-grid .the-day::before {
  content: ""; position: absolute; inset: 8%; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e3c27a, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 4px 10px rgba(140, 103, 36, .4);
}
.cal-grid .the-day::after {
  content: ""; position: absolute; inset: -6%; border-radius: 50%; border: 1px solid var(--gold);
  animation: ring 2.6s ease-out infinite;
}

.cd-title { font-family: "Aref Ruqaa", serif; font-size: 1.3rem; color: var(--ink-soft); }
.countdown { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.countdown div {
  flex: 1; max-width: 78px; padding: 12px 0 8px;
  border: 1px solid var(--line); border-radius: 40px 40px 10px 10px;
  background: rgba(255, 252, 244, .55);
}
.countdown b {
  display: block; font-family: "Cormorant Garamond", serif; font-weight: 500;
  font-size: 2.1rem; line-height: 1; color: var(--gold-deep);
  font-variant-numeric: tabular-nums; direction: ltr;
}
.countdown i { font-style: normal; font-size: .85rem; color: var(--ink-soft); }

/* الموقع */
.venue-art { width: 88%; margin: 0 auto 6px; mix-blend-mode: multiply; filter: brightness(1.05); }
.venue-name { font-family: "Aref Ruqaa", serif; font-weight: 700; font-size: 1.7rem; color: var(--gold-deep); line-height: 1.5; }
.map {
  margin: 20px auto 18px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: 0 10px 26px rgba(90, 70, 40, .14);
  aspect-ratio: 4 / 3; background: #e9e2d2;
}
.map iframe { width: 100%; height: 100%; border: 0; filter: sepia(.25) saturate(.85); }
.btn {
  display: inline-block; padding: 9px 28px;
  font-family: "Aref Ruqaa", serif; font-size: 1.15rem; text-decoration: none;
  color: var(--gold-deep); border: 1px solid var(--gold); border-radius: 40px;
  transition: background .25s, color .25s, transform .15s;
}
.btn:active { transform: scale(.97); }
@media (hover: hover) { .btn:hover { background: var(--gold); color: #fff8e6; } }
.btn:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.foot { padding-bottom: 70px; }
.waiting { font-family: "Aref Ruqaa", serif; font-weight: 700; font-size: 2.3rem; color: var(--gold-deep); line-height: 1.4; }
.sign { font-family: "Aref Ruqaa", serif; font-size: 1.25rem; color: var(--ink-soft); }

/* ظهور مع السكرول */
.rv { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform 1s var(--ease); }
.rv.on { opacity: 1; transform: none; }

/* زر الموسيقى */
#music-btn {
  position: fixed; z-index: 20; bottom: 16px; left: max(16px, calc(50vw - 244px));
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--gold);
  background: rgba(250, 244, 230, .85); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 0;
  box-shadow: 0 6px 16px rgba(90, 70, 40, .25);
}
.bars { display: flex; align-items: flex-end; gap: 3px; height: 16px; }
.bars i { width: 3px; height: 4px; border-radius: 2px; background: var(--gold-deep); }
#music-btn[aria-pressed="true"] .bars i { animation: bar 1s ease-in-out infinite; }
#music-btn[aria-pressed="true"] .bars i:nth-child(2) { animation-delay: .2s; }
#music-btn[aria-pressed="true"] .bars i:nth-child(3) { animation-delay: .45s; }
#music-btn[aria-pressed="true"] .bars i:nth-child(4) { animation-delay: .1s; }
#music-btn[aria-pressed="false"]::after {
  content: ""; position: absolute; width: 26px; height: 1.5px; background: var(--gold-deep); transform: rotate(-45deg);
}
@keyframes bar { 0%, 100% { height: 4px; } 50% { height: 16px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .rv { transform: none; transition-duration: .2s; }
}
