/* ═══════════════════════════════════════════════
   Paola & Lazare — Fiançailles · 14.11.2026
   ═══════════════════════════════════════════════ */

:root {
  --paper: #f6ede3;
  --paper-2: #f0e0d0;
  --paper-3: #fbf5ec;
  --blush: #e9c8bb;
  --rose: #c9917f;
  --gold: #b08d57;
  --gold-2: #d3ac74;
  --gold-text: #806138; /* readable gold: >=4.4:1 on all paper tones */
  --sage: #9caf97;
  --ink: #54453d;
  --ink-soft: #85736a;

  --serif: 'Cormorant Garamond', 'Amiri', Georgia, serif;
  --script: 'Great Vibes', 'Aref Ruqaa', cursive;

  --env-w: min(88vw, 480px, 62vh);
  --env-ratio: 0.68;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Viewport-framing wash: a fixed layer instead of background-attachment: fixed,
   which iOS Safari ignores */
body::before {
  content: "";
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 15% 8%, rgba(233, 200, 187, 0.35), transparent 60%),
    radial-gradient(110% 80% at 88% 90%, rgba(156, 175, 151, 0.16), transparent 55%),
    radial-gradient(100% 100% at 50% 45%, var(--paper-3), var(--paper) 70%, var(--paper-2));
}

body.locked {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100vh; /* fallback for pre-dvh engines */
  height: 100dvh;
  overflow: hidden;
}

.opener, .btn-gold, .lang-toggle { touch-action: manipulation; }

/* Arabic mode typography */
html[dir="rtl"] body { font-family: 'Amiri', var(--serif); }
html[dir="rtl"] .hero-eyebrow,
html[dir="rtl"] .section-title,
html[dir="rtl"] .cd-label,
html[dir="rtl"] .env-card-top,
html[dir="rtl"] .invite-lead,
html[dir="rtl"] .invite-formal,
html[dir="rtl"] .btn-gold,
html[dir="rtl"] .footer { letter-spacing: 0 !important; }
html[dir="rtl"] .hero-names,
html[dir="rtl"] .invite-names,
html[dir="rtl"] .closing-names,
html[dir="rtl"] .env-front-names,
html[dir="rtl"] .env-card-names { font-family: 'Aref Ruqaa', 'Amiri', serif; }

/* ── Grain overlay ─────────────────────────── */
.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: 0.05; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ── Language toggle ───────────────────────── */
.lang-toggle {
  position: fixed; top: max(14px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); z-index: 90;
  border: 1px solid rgba(176, 141, 87, 0.5);
  background: rgba(251, 245, 236, 0.82);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: var(--gold-text); font-family: var(--serif);
  font-size: 15px; line-height: 1;
  padding: 9px 8px 9px; min-width: 58px; border-radius: 999px;
  cursor: pointer; transition: all 0.3s ease;
}
.lang-toggle:hover { background: var(--gold-text); color: #fff; }
.lang-toggle .lang-ar { display: none; }
html[dir="rtl"] .lang-toggle { right: auto; left: max(16px, env(safe-area-inset-left)); font-family: var(--serif); }
html[dir="rtl"] .lang-toggle .lang-fr { display: none; }
html[dir="rtl"] .lang-toggle .lang-ar { display: inline; }
.lang-toggle .lang-fr { font-family: 'Amiri', serif; }

/* ═══════════════ ENVELOPE SCENE ═══════════════ */
.opener {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; outline: none;
  transition: opacity 1s ease 0.2s, visibility 1s ease 0.2s;
}
.opener:focus-visible .envelope { outline: 2px solid var(--gold); outline-offset: 12px; }
.opener.gone { opacity: 0; visibility: hidden; pointer-events: none; }

.opener-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(90% 70% at 50% 42%, transparent 40%, rgba(160, 120, 100, 0.14));
}

.envelope-stage {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  animation: stageFloat 5.5s ease-in-out infinite;
}
@keyframes stageFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.env-holder {
  position: relative;
  width: var(--env-w);
  height: calc(var(--env-w) * var(--env-ratio));
}

.bouquet-behind {
  position: absolute;
  bottom: 76%;
  left: 50%; transform: translateX(-50%);
  width: 118%;
  z-index: 0; opacity: 0;
  animation: bloomIn 1.6s ease 0.5s forwards;
}
@keyframes bloomIn {
  from { opacity: 0; transform: translateX(-50%) translateY(26px) scale(0.94); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.svg-bouquet { width: 100%; height: auto; display: block; }

.envelope {
  position: absolute; inset: 0; z-index: 1;
  perspective: 1400px;
  filter: drop-shadow(0 26px 34px rgba(110, 80, 60, 0.28));
}

.env-back {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(160deg, #efe0cf, #e6d2bd);
  border-radius: 6px;
}

.env-liner {
  position: absolute; inset: 0 0 30% 0; z-index: 2;
  border-radius: 6px 6px 0 0;
  background:
    radial-gradient(circle at 25% 30%, rgba(233, 200, 187, 0.75) 0 8%, transparent 9%),
    radial-gradient(circle at 55% 18%, rgba(233, 200, 187, 0.75) 0 7%, transparent 8%),
    radial-gradient(circle at 80% 35%, rgba(233, 200, 187, 0.75) 0 8%, transparent 9%),
    radial-gradient(circle at 40% 55%, rgba(211, 172, 116, 0.4) 0 5%, transparent 6%),
    radial-gradient(circle at 70% 60%, rgba(211, 172, 116, 0.4) 0 5%, transparent 6%),
    linear-gradient(180deg, #e8d3bd, #dfc6ab);
}

/* The card inside */
.env-card {
  position: absolute; z-index: 3;
  left: 6%; right: 6%; top: 7%; bottom: 12%;
  background: linear-gradient(170deg, var(--paper-3), #f4e9db);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(110, 80, 60, 0.18);
  display: flex; align-items: center; justify-content: center;
  transition: transform 1s cubic-bezier(0.22, 0.9, 0.3, 1) 0.55s;
}
.env-card-inner { text-align: center; padding: 12px; }
.env-card-orn { color: var(--gold-2); font-size: 11px; }
.env-card-top {
  font-size: clamp(10px, 2.6vw, 13px); letter-spacing: 0.32em;
  text-transform: uppercase; color: var(--ink-soft); margin: 8px 0 4px;
}
.env-card-names {
  font-family: var(--script);
  font-size: clamp(30px, 8.5vw, 46px);
  color: var(--rose); line-height: 1.25;
}
.env-card-date {
  font-size: clamp(13px, 3.4vw, 17px); letter-spacing: 0.24em;
  color: var(--gold-text); margin: 4px 0 8px;
}
.envelope.open .env-card { transform: translateY(-68%) scale(1.04); }

/* Front pocket */
.env-front {
  position: absolute; inset: 0; z-index: 4;
  border-radius: 6px;
  background:
    linear-gradient(200deg, rgba(255, 255, 255, 0.5), transparent 45%),
    linear-gradient(160deg, #f7ecdd, #eddcc6 60%, #e7d2b8);
  clip-path: polygon(0 0, 50% 34%, 100% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 -2px 8px rgba(255, 255, 255, 0.6), inset 0 3px 8px rgba(120, 90, 65, 0.12);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 9%;
}
.env-front::before, .env-front::after {
  content: ""; position: absolute; top: 0; width: 50%; height: 100%; opacity: 0.5;
}
.env-front::before { left: 0; background: linear-gradient(115deg, rgba(120, 90, 65, 0.1), transparent 35%); }
.env-front::after { right: 0; background: linear-gradient(245deg, rgba(120, 90, 65, 0.1), transparent 35%); }

.env-front-names {
  font-family: var(--script);
  font-size: clamp(28px, 7.5vw, 42px);
  color: var(--ink); opacity: 0.85; line-height: 1.3;
}
.env-front-sub {
  font-size: clamp(11px, 3vw, 14px);
  color: var(--ink-soft); letter-spacing: 0.14em; margin-top: 2px;
  font-style: italic;
}
html[dir="rtl"] .env-front-sub { font-style: normal; letter-spacing: 0; }

/* Flap */
.env-flap {
  position: absolute; left: 0; right: 0; top: 0; height: 46%;
  z-index: 5;
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.6, 0.05, 0.3, 1);
}
.env-flap-inner {
  position: absolute; inset: 0;
  background: linear-gradient(190deg, #f3e6d4, #e9d5bc 70%, #e2cbae);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 -4px 10px rgba(120, 90, 65, 0.14);
}
.envelope.open .env-flap { transform: rotateX(-180deg); }
.envelope.flap-behind .env-flap { z-index: 2; }

/* Wax seal */
.wax-seal {
  position: absolute; z-index: 6;
  top: 46%; left: 50%;
  width: clamp(64px, 17vw, 84px); height: clamp(64px, 17vw, 84px);
  transform: translate(-50%, -50%);
  border-radius: 47% 53% 51% 49% / 52% 48% 52% 48%;
  background:
    radial-gradient(circle at 34% 30%, #d9a08c, #b56a56 55%, #94503f);
  box-shadow:
    inset 0 3px 6px rgba(255, 235, 220, 0.5),
    inset 0 -4px 8px rgba(90, 40, 28, 0.45),
    0 4px 10px rgba(110, 60, 45, 0.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.4s ease, opacity 0.4s ease;
}
.wax-seal::before {
  content: ""; position: absolute; inset: 10%;
  border-radius: inherit;
  border: 1.5px solid rgba(255, 235, 220, 0.4);
}
.seal-monogram {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(20px, 5.2vw, 26px);
  color: #f7e3d6; text-shadow: 0 -1px 2px rgba(90, 40, 28, 0.6);
  letter-spacing: 0.04em;
}
.seal-monogram i { font-style: normal; font-size: 0.7em; vertical-align: 0.12em; opacity: 0.85; }
.envelope.open .wax-seal { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }

.opener-hint {
  margin-top: 34px;
  font-size: clamp(14px, 3.6vw, 17px);
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-soft);
  animation: hintPulse 2.4s ease-in-out infinite;
}
html[dir="rtl"] .opener-hint { letter-spacing: 0; font-size: clamp(16px, 4vw, 19px); text-transform: none; }
@keyframes hintPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
.opener.opening .opener-hint { opacity: 0; animation: none; transition: opacity 0.4s; }
.opener.opening { cursor: default; }

/* ── Petals canvas ─────────────────────────── */
#petals {
  position: fixed; inset: 0; z-index: 50;
  pointer-events: none;
  opacity: 0; transition: opacity 2s ease;
}
#petals.on { opacity: 1; }

/* ═══════════════ INVITATION PAGE ═══════════════ */
.invitation {
  opacity: 0; transform: scale(1.03);
  filter: blur(6px);
  visibility: hidden;
  transition: opacity 1.2s ease 0.35s, transform 1.4s ease 0.3s, filter 1.2s ease 0.35s,
    visibility 0s linear 0.35s;
}
.invitation.shown { opacity: 1; transform: none; filter: none; visibility: visible; }
#invitation:focus { outline: none; }

.section {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(70px, 14vh, 120px) 28px;
  text-align: center;
}

.section-title {
  font-size: clamp(15px, 3.6vw, 19px);
  letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--gold-text); font-weight: 500;
  margin-bottom: 22px;
}

/* Reveal on scroll */
.reveal {
  opacity: 0; transform: translateY(26px);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 0.8, 0.3, 1);
}
.reveal.visible { opacity: 1; transform: none; }
.reveal.visible:nth-child(2) { transition-delay: 0.1s; }
.reveal.visible:nth-child(3) { transition-delay: 0.2s; }
.reveal.visible:nth-child(4) { transition-delay: 0.3s; }
.reveal.visible:nth-child(5) { transition-delay: 0.4s; }
.reveal.visible:nth-child(6) { transition-delay: 0.5s; }
.reveal.visible:nth-child(7) { transition-delay: 0.6s; }
.reveal.visible:nth-child(8) { transition-delay: 0.7s; }

/* ── Hero ──────────────────────────────────── */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 100px 24px 80px;
  position: relative;
}

.hero-arch {
  position: absolute; top: 0; left: 50%;
  width: min(115vw, 760px);
  transform: translateX(-50%);
  opacity: 0.95; pointer-events: none;
}
.svg-arch { width: 100%; height: auto; max-height: 32vh; display: block; }

.hero-eyebrow {
  font-size: clamp(14px, 3.8vw, 18px);
  letter-spacing: 0.5em; text-transform: uppercase;
  color: var(--gold-text); padding-left: 0.5em;
}
html[dir="rtl"] .hero-eyebrow { padding-left: 0; font-size: clamp(18px, 4.6vw, 24px); }

.hero-rule {
  display: flex; align-items: center; gap: 14px;
  width: min(260px, 60vw); margin: 26px auto;
  color: var(--gold-2);
}
.hero-rule span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); }
.hero-rule i { font-style: normal; font-size: 15px; }

.hero-names {
  font-family: var(--script); font-weight: 400;
  font-size: clamp(52px, 13vw, 92px);
  line-height: 1.3; color: var(--ink);
  text-shadow: 0 2px 24px rgba(201, 145, 128, 0.25);
}
html[dir="rtl"] .hero-names { font-size: clamp(44px, 11vw, 76px); }

.hero-verse {
  margin-top: 18px;
  font-style: italic; font-size: clamp(17px, 4.4vw, 22px);
  color: var(--ink-soft);
}
html[dir="rtl"] .hero-verse { font-style: normal; }

.hero-date {
  margin-top: 30px;
  font-size: clamp(16px, 4.2vw, 21px);
  letter-spacing: 0.22em; color: var(--gold-text);
  border-top: 1px solid rgba(176, 141, 87, 0.4);
  border-bottom: 1px solid rgba(176, 141, 87, 0.4);
  padding: 12px 22px;
}
html[dir="rtl"] .hero-date { letter-spacing: 0; }

.scroll-cue {
  position: absolute; bottom: max(26px, env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%);
}
.scroll-cue-line {
  display: block; width: 1px; height: 54px;
  background: linear-gradient(180deg, var(--gold), transparent);
  animation: cueDrop 2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes cueDrop {
  0% { transform: scaleY(0); opacity: 0; }
  35% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1) translateY(18px); opacity: 0; }
}

/* ── Invite text ───────────────────────────── */
.corner {
  position: absolute; width: clamp(70px, 16vw, 110px); opacity: 0.8;
  pointer-events: none;
}
.corner svg { width: 100%; height: auto; }
.corner-tl { top: 26px; left: 22px; transform: rotate(180deg); }
.corner-br { bottom: 26px; right: 22px; }

.invite-lead {
  font-style: italic; font-size: clamp(17px, 4.4vw, 22px);
  color: var(--ink-soft);
}
html[dir="rtl"] .invite-lead { font-style: normal; }

.invite-names {
  font-family: var(--script);
  font-size: clamp(40px, 10vw, 62px);
  color: var(--rose); margin: 18px 0; line-height: 1.3;
}

.invite-body {
  font-size: clamp(18px, 4.8vw, 24px);
  line-height: 1.75; color: var(--ink);
  max-width: 30ch; margin: 0 auto;
}

.gold-divider {
  width: 120px; height: 1px; margin: 30px auto;
  background: linear-gradient(90deg, transparent, var(--gold-2) 20% 80%, transparent);
  position: relative; overflow: visible;
}
.gold-divider::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 246, 224, 0.95), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: shimmer 3.2s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: -60% 0; }
  60%, 100% { background-position: 160% 0; }
}

.invite-formal {
  font-size: clamp(14px, 3.8vw, 17px);
  letter-spacing: 0.16em; color: var(--ink-soft);
  text-transform: uppercase;
}
html[dir="rtl"] .invite-formal { text-transform: none; font-size: clamp(16px, 4.2vw, 20px); }

/* ── Countdown ─────────────────────────────── */
.big-date {
  font-size: clamp(22px, 6vw, 32px);
  color: var(--ink); margin-bottom: 40px;
  font-weight: 500;
}

.countdown {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(8px, 2.6vw, 18px);
}
.cd-cell {
  display: flex; flex-direction: column; align-items: center;
  min-width: clamp(58px, 16vw, 86px);
  padding: clamp(12px, 3vw, 18px) 4px;
  border: 1px solid rgba(176, 141, 87, 0.35);
  border-radius: 10px;
  background: rgba(251, 245, 236, 0.6);
  box-shadow: 0 4px 16px rgba(150, 110, 80, 0.08);
}
.cd-num {
  font-size: clamp(26px, 7.5vw, 44px);
  font-weight: 500; color: var(--ink);
  line-height: 1.1;
}
.cd-label {
  margin-top: 6px;
  font-size: clamp(9px, 2.4vw, 12px);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-soft);
}
.cd-sep { color: var(--gold-2); font-size: 20px; }
.cd-bigday {
  font-family: var(--script); font-size: clamp(30px, 8vw, 46px);
  color: var(--rose); margin-top: 26px;
}

.btn-gold {
  margin-top: 42px;
  font-family: var(--serif); font-size: clamp(13px, 3.4vw, 15px);
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-text); background: transparent;
  border: 1px solid var(--gold-text);
  padding: 15px 34px; border-radius: 999px;
  cursor: pointer;
  transition: all 0.35s ease;
}
.btn-gold:hover { background: var(--gold-text); color: #fff; box-shadow: 0 8px 24px rgba(176, 141, 87, 0.35); }

/* ── Details ───────────────────────────────── */
.detail-card {
  border: 1px solid rgba(176, 141, 87, 0.35);
  border-radius: 14px;
  padding: clamp(36px, 8vw, 56px) clamp(22px, 6vw, 44px);
  background: rgba(251, 245, 236, 0.65);
  box-shadow: 0 10px 40px rgba(150, 110, 80, 0.1);
  position: relative;
}
.detail-card::before {
  content: ""; position: absolute; inset: 7px;
  border: 1px solid rgba(176, 141, 87, 0.2);
  border-radius: 9px; pointer-events: none;
}
.detail-orn { width: 130px; margin: 0 auto 8px; color: var(--gold); }
.detail-orn.flipped { transform: scaleY(-1); margin: 14px auto 0; }
.detail-orn svg { width: 100%; height: auto; }
.detail-text {
  font-size: clamp(17px, 4.4vw, 21px);
  line-height: 1.8; color: var(--ink-soft);
  max-width: 34ch; margin: 0 auto;
}

/* ── RSVP ──────────────────────────────────── */
.rsvp-text {
  font-size: clamp(17px, 4.4vw, 21px);
  line-height: 1.85; color: var(--ink);
  max-width: 36ch; margin: 0 auto;
}

/* ── Closing ───────────────────────────────── */
.closing-section { padding-bottom: 40px; }
.closing-floral {
  width: min(88vw, 430px); margin: 0 auto -30px;
  opacity: 0.9;
}
.closing-note {
  font-style: italic; font-size: clamp(16px, 4.2vw, 20px);
  color: var(--ink-soft);
}
html[dir="rtl"] .closing-note { font-style: normal; }
.closing-names {
  font-family: var(--script);
  font-size: clamp(46px, 12vw, 74px);
  color: var(--ink); line-height: 1.3; margin: 10px 0 6px;
}
.closing-date {
  letter-spacing: 0.3em; color: var(--gold-text);
  font-size: clamp(13px, 3.6vw, 16px);
}

.footer {
  text-align: center; padding: 30px 20px calc(34px + env(safe-area-inset-bottom));
  font-size: 12.5px; letter-spacing: 0.14em;
  color: rgba(133, 115, 106, 0.75);
}
html[dir="rtl"] .footer { letter-spacing: 0; font-size: 14px; }

/* ── Motion preferences ────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.2s !important;
  }
  .reveal { transition-delay: 0s !important; }
  #petals { display: none; }
}

@media (max-width: 380px) {
  .cd-sep { display: none; }
  .countdown { gap: 6px; }
}

@media (max-height: 480px) {
  .opener-hint { margin-top: 18px; }
}

@media (max-height: 560px) {
  .hero-arch { opacity: 0.45; }
}
