:root {
  --bg: #3b0a12;
  --bg-2: #4a111b;
  --wine: #6e1d2b;
  --gold: #d2ab84;
  --gold-2: #ecd2ad;
  --cream: #f3e6d3;
  --olive: #56613a;
  --muted: #c9a99a;
  --serif: 'Cormorant Garamond', 'Amiri', Georgia, serif;
  --script: 'Pinyon Script', 'Aref Ruqaa', cursive;
}
html[lang="ar"] { --serif: 'Amiri', 'Cormorant Garamond', serif; --script: 'Aref Ruqaa', 'Pinyon Script', serif; }

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; height: 100vh; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

#petals { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

/* ---------- Envelope ---------- */
#envelope {
  position: fixed; inset: 0; z-index: 50; cursor: pointer; perspective: 1400px;
  background: var(--wine);
  transition: opacity 1s ease 1.2s, visibility 0s linear 2.2s;
  outline: none;
}
.env-body, .env-flap { position: absolute; inset: 0; }
.env-body {
  background:
    radial-gradient(ellipse at 30% 80%, rgba(255,255,255,.05), transparent 50%),
    radial-gradient(ellipse at 70% 20%, rgba(0,0,0,.18), transparent 60%),
    repeating-radial-gradient(circle at 20% 30%, rgba(0,0,0,.06) 0 2px, transparent 2px 9px),
    var(--wine);
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
}
.env-body::after { /* the lower V seams */
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), rgba(0,0,0,.25) 50%, transparent calc(50% + 1px)) left bottom / 50% 48% no-repeat,
    linear-gradient(to top left, transparent calc(50% - 1px), rgba(0,0,0,.25) 50%, transparent calc(50% + 1px)) right bottom / 50% 48% no-repeat;
}
.env-flap {
  height: 52%;
  background: linear-gradient(180deg, #5c1623, #7a2433);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform 1.1s cubic-bezier(.6,.05,.3,1) .35s;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
  z-index: 2;
}
.seal {
  position: absolute; left: 50%; top: 52%; z-index: 3;
  width: clamp(120px, 26vw, 180px); aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 35% 30%, #f6dfae, #c99a55 45%, #8f6428 80%, #6e4b1c);
  box-shadow: 0 10px 25px rgba(0,0,0,.45), inset 0 -6px 12px rgba(0,0,0,.35), inset 0 6px 10px rgba(255,255,255,.35);
  display: grid; place-items: center;
  transition: transform .6s ease, opacity .6s ease;
  animation: pulse 2.4s ease-in-out infinite;
}
.seal::before {
  content: ''; position: absolute; inset: 11%; border-radius: 50%;
  border: 2px solid rgba(90,60,20,.45); box-shadow: inset 0 0 0 4px rgba(255,240,200,.2);
}
.seal-text { font-family: 'Pinyon Script', cursive; font-size: clamp(38px, 8vw, 58px); color: #6b4718; text-shadow: 0 1px 0 rgba(255,235,190,.6); letter-spacing: -2px; }
.seal-text small { font-size: .5em; margin: 0 2px; }
.env-hint {
  position: absolute; bottom: 12%; width: 100%; text-align: center;
  color: var(--gold-2); letter-spacing: .25em; text-transform: uppercase; font-size: 14px;
  animation: blink 2s ease-in-out infinite;
}
html[lang="ar"] .env-hint { letter-spacing: 0; font-size: 18px; }
#envelope.open .env-flap { transform: rotateX(180deg); }
#envelope.open .seal { transform: scale(1.6) rotate(-20deg); opacity: 0; animation: none; }
#envelope.open .env-hint { opacity: 0; }
#envelope.open { opacity: 0; visibility: hidden; }
@keyframes pulse { 50% { transform: scale(1.05); } }
@keyframes blink { 50% { opacity: .45; } }

.lang {
  position: fixed; top: 14px; inset-inline-end: 14px; z-index: 40;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(210,171,132,.5); background: rgba(59,10,18,.7); backdrop-filter: blur(6px);
  color: var(--gold-2); font: 600 18px var(--serif); cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh; display: grid; place-items: center;
  padding: 90px 20px 70px; overflow: hidden; text-align: center;
}
.tulip { position: absolute; pointer-events: none; user-select: none; }
.tulip.tr { top: 0; right: 0; width: clamp(150px, 30vw, 360px); transform-origin: top right; }
.tulip.bl { bottom: 0; left: 0; width: clamp(160px, 32vw, 400px); transform-origin: bottom left; }
body.opened .tulip.tr { animation: bloom 2s ease-out .4s both, sway 7s ease-in-out 2.4s infinite; }
body.opened .tulip.bl { animation: bloom 2s ease-out .7s both, sway 8s ease-in-out 2.7s infinite reverse; }
@keyframes bloom { from { opacity: 0; transform: scale(.85) rotate(-4deg); } to { opacity: 1; transform: none; } }
@keyframes sway { 50% { transform: rotate(1.6deg); } }

.lace { position: absolute; inset: 4% 8%; width: 84%; height: 92%; opacity: .35; }
.lace ellipse { fill: none; stroke: #7a2836; stroke-width: 6; stroke-dasharray: 1 11; stroke-linecap: round; }
.lace ellipse:nth-child(2) { stroke-width: 10; stroke-dasharray: 2 18; opacity: .7; }
.lace ellipse:nth-child(3) { stroke-width: 3; stroke-dasharray: 14 6 2 6; }
.lace ellipse:nth-child(4) { stroke-width: 1.5; stroke-dasharray: none; opacity: .6; }
body.opened .lace { animation: spin 120s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero-inner { position: relative; z-index: 2; max-width: 760px; }
.bismillah { font-family: 'Aref Ruqaa', serif; font-size: clamp(30px, 6vw, 46px); color: var(--gold-2); line-height: 1.3; margin-bottom: 8px; }
.lead { font-size: clamp(18px, 3.4vw, 24px); color: var(--cream); opacity: .92; }
.lead.strong { font-weight: 600; margin-top: 10px; }

.names { position: relative; font-weight: 400; margin: 18px 0 10px; display: grid; justify-items: center; line-height: .95; }
.orb {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: clamp(150px, 32vw, 300px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #6a7647, var(--olive) 60%, #485230);
  opacity: .95; z-index: -1;
}
body.opened .orb { animation: orbIn 1.6s cubic-bezier(.2,.8,.2,1) .3s both, breathe 6s ease-in-out 2s infinite; }
@keyframes orbIn { from { transform: scale(0); } }
@keyframes breathe { 50% { transform: scale(1.04); } }
.name {
  font-family: var(--script); color: var(--gold); font-size: clamp(76px, 17vw, 170px);
  text-shadow: 0 2px 18px rgba(0,0,0,.25);
}
html[lang="ar"] .name { font-size: clamp(70px, 15vw, 140px); line-height: 1.25; }
.n1 { margin-inline-end: 1.2em; }
.n2 { margin-inline-start: .8em; }
.amp { font-family: var(--serif); font-size: clamp(22px, 4vw, 34px); color: var(--cream); margin: -.2em 0; }
body.opened .n1 { animation: write 1.8s ease-out .9s both; }
body.opened .amp { animation: fadeUp 1s ease-out 1.9s both; }
body.opened .n2 { animation: write 1.8s ease-out 2.1s both; }
@keyframes write { from { clip-path: inset(0 100% 0 0); opacity: .3; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
html[dir="rtl"] body.opened .name { animation-name: writeRtl; }
@keyframes writeRtl { from { clip-path: inset(0 0 0 100%); opacity: .3; } to { clip-path: inset(0 0 0 0); opacity: 1; } }

.hero-date { margin-top: 12px; font-size: clamp(19px, 3.6vw, 26px); color: var(--gold-2); }
.sep { opacity: .6; margin: 0 6px; }
.scroll-cue { display: block; width: 26px; height: 42px; border: 1.5px solid var(--gold); border-radius: 14px; margin: 34px auto 0; position: relative; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--gold); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 60% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- Sections ---------- */
.section { position: relative; padding: 90px 16px; text-align: center; max-width: 980px; margin: 0 auto; }
.section + .section::before {
  content: '❦'; position: absolute; top: 0; left: 50%; translate: -50% -50%;
  color: var(--gold); font-size: 26px; opacity: .7;
}
.eyebrow { text-transform: uppercase; letter-spacing: .35em; font-size: 13px; color: var(--gold); margin-bottom: 14px; }
html[lang="ar"] .eyebrow { letter-spacing: 0; font-size: 18px; }
.script-title { font-family: var(--script); font-weight: 400; color: var(--gold-2); font-size: clamp(40px, 8vw, 64px); line-height: 1.2; margin: 36px 0 22px; }
.script-title.small { font-size: clamp(32px, 6vw, 48px); margin: 0 0 10px; }
.sub { max-width: 520px; margin: -8px auto 28px; color: var(--muted); }

/* Date feature */
.date-feature {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center;
  max-width: 760px; margin: 0 auto; padding: 34px;
  border: 1px solid rgba(210,171,132,.35); border-radius: 220px 220px 24px 24px;
  background: linear-gradient(180deg, rgba(110,29,43,.35), rgba(59,10,18,.1));
}
.big-date { display: grid; justify-items: center; }
.bd-day, .bd-month { text-transform: uppercase; letter-spacing: .3em; font-size: 15px; color: var(--gold); }
html[lang="ar"] .bd-day, html[lang="ar"] .bd-month { letter-spacing: 0; font-size: 22px; }
.bd-num {
  font-size: clamp(110px, 20vw, 170px); line-height: 1; font-weight: 500;
  background: linear-gradient(180deg, var(--gold-2), #a97e52); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(236,210,173,.15));
}
.bd-time { margin-top: 6px; font-style: italic; color: var(--cream); }
.calendar { background: rgba(243,230,211,.05); border: 1px solid rgba(210,171,132,.25); border-radius: 16px; padding: 16px; }
.cal-head { font-size: 18px; color: var(--gold-2); margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; font-size: 15px; }
.cal-grid .wd { color: var(--gold); font-size: 12px; text-transform: uppercase; opacity: .8; }
.cal-grid span { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; opacity: .75; }
.cal-grid .day-hl { position: relative; opacity: 1; color: var(--bg); font-weight: 700; background: var(--gold); }
.cal-grid .day-hl::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid var(--gold-2);
  animation: ring 2s ease-out infinite;
}
@keyframes ring { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }

.countdown { display: flex; justify-content: center; gap: clamp(8px, 2.5vw, 22px); }
.countdown div {
  width: clamp(72px, 19vw, 128px); padding: 16px 4px 12px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(110,29,43,.6), rgba(74,17,27,.6));
  border: 1px solid rgba(210,171,132,.35); box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.countdown b { display: block; font-size: clamp(34px, 8vw, 60px); line-height: 1; font-weight: 500; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.countdown b.tick { animation: tick .45s ease; }
@keyframes tick { 0% { transform: translateY(-30%); opacity: 0; } 100% { transform: none; opacity: 1; } }
.countdown span { display: block; margin-top: 8px; font-size: 13px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
html[lang="ar"] .countdown span { letter-spacing: 0; font-size: 16px; }
.married { font-family: var(--script); font-size: 48px; color: var(--gold-2); }

.btns { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 30px; }
.btn {
  display: inline-block; padding: 13px 26px; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--bg);
  font: 600 17px var(--serif); text-decoration: none; border: 1px solid var(--gold);
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(210,171,132,.25); }
.btn.ghost { background: transparent; color: var(--gold-2); }
.btn.wide { width: 100%; margin-top: 8px; font-size: 19px; }
.btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: 0; color: var(--gold); font: inherit; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

/* Venue */
.venue-name { font-family: var(--script); font-weight: 400; font-size: clamp(48px, 10vw, 84px); color: var(--gold-2); line-height: 1.2; }
.venue-ar { font-family: 'Amiri', serif; font-size: 22px; color: var(--cream); margin-bottom: 28px; }
.map-frame {
  position: relative; max-width: 720px; margin: 0 auto; aspect-ratio: 4 / 3;
  border-radius: 360px 360px 22px 22px; overflow: hidden;
  border: 2px solid var(--gold); padding: 8px; background: var(--bg-2);
  box-shadow: 0 0 0 8px rgba(210,171,132,.08), 0 20px 50px rgba(0,0,0,.35);
}
.map-frame iframe { width: 100%; height: 100%; border: 0; border-radius: 352px 352px 16px 16px; filter: sepia(.35) saturate(.9); }

/* Guestbook */
.wish-form {
  max-width: 560px; margin: 0 auto; text-align: start; padding: 24px;
  border: 1px solid rgba(210,171,132,.35); border-radius: 22px; background: rgba(110,29,43,.28);
}
.tabs { display: flex; gap: 6px; padding: 4px; border-radius: 999px; background: rgba(0,0,0,.2); margin-bottom: 18px; }
.tab { flex: 1; padding: 9px; border: 0; border-radius: 999px; background: none; color: var(--gold-2); font: 600 16px var(--serif); cursor: pointer; }
.tab.active { background: var(--gold); color: var(--bg); }
.wish-form label { display: block; margin-bottom: 14px; color: var(--gold); font-size: 15px; }
.wish-form input, .wish-form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(210,171,132,.35); background: rgba(59,10,18,.6); color: var(--cream);
  font: 18px var(--serif); resize: vertical;
}
.wish-form input:focus, .wish-form textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
#pad { width: 100%; aspect-ratio: 600 / 320; border-radius: 12px; background: rgba(59,10,18,.8); border: 1px dashed rgba(210,171,132,.5); touch-action: none; cursor: crosshair; }
.pad-tools { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 14px; }
.swatches { display: flex; gap: 8px; }
.sw { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid transparent; cursor: pointer; }
.sw.active { border-color: var(--cream); box-shadow: 0 0 0 2px var(--bg); }
.form-msg { min-height: 1.4em; margin-top: 10px; text-align: center; color: var(--gold-2); }

.wall-title { font-weight: 500; font-size: 26px; color: var(--gold-2); margin: 60px 0 22px; }
.wall-title small { font-size: 16px; color: var(--muted); }
.wall { columns: 3 260px; column-gap: 16px; text-align: start; }
.wish {
  break-inside: avoid; margin-bottom: 16px; padding: 18px 18px 14px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(243,230,211,.08), rgba(110,29,43,.35));
  border: 1px solid rgba(210,171,132,.25); position: relative;
}
.wish::before { content: '“'; position: absolute; top: -6px; inset-inline-end: 14px; font-size: 64px; color: var(--gold); opacity: .25; line-height: 1; }
.wish p { white-space: pre-wrap; word-break: break-word; }
.wish img { border-radius: 10px; margin-bottom: 8px; background: rgba(59,10,18,.6); }
.wish h4 { margin-top: 10px; font-weight: 600; color: var(--gold); font-size: 16px; }
.wish.new { animation: pop .7s cubic-bezier(.2,1.4,.4,1); }
.wish-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.wish-foot h4 { margin: 0; }
.love {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(210,171,132,.35); background: rgba(0,0,0,.18);
  color: var(--gold-2); font: 600 15px var(--serif); transition: background .2s, border-color .2s;
}
.love:hover { border-color: var(--gold); }
.love .heart { font-size: 18px; line-height: 1; }
.love.on { background: rgba(217,98,122,.18); border-color: #d9627a; color: #f3c2cc; }
.love.on .heart { color: #e0566f; animation: beat .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes beat { 0% { transform: scale(.4); } 60% { transform: scale(1.35); } }
.float-heart {
  position: fixed; z-index: 60; pointer-events: none; color: #e0566f; font-size: 18px;
  translate: -50% 0; animation: rise 1.2s ease-out both;
}
@keyframes rise { to { transform: translate(var(--dx), -90px) scale(1.4); opacity: 0; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.empty { color: var(--muted); text-align: center; column-span: all; }

.footer { position: relative; text-align: center; padding: 80px 16px 60px; overflow: hidden; }
.tulip.foot { right: -40px; bottom: -20px; left: auto; width: 200px; transform: scaleX(-1); opacity: .5; }
.foot-names { letter-spacing: .25em; color: var(--gold); margin-bottom: 16px; }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s ease, transform .9s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .date-feature { grid-template-columns: 1fr; padding: 28px 18px; border-radius: 160px 160px 22px 22px; }
  .map-frame { aspect-ratio: 3 / 4; }
  .wish-form { padding: 18px; }
  .section { padding: 70px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
