/* =========================================================
   Salim & Sandrella — Wedding
   Soft romantic editorial + 3D wow
   ========================================================= */

:root {
  --cream:        #FBF6EF;
  --cream-deep:   #F3EBDE;
  --blush:        #F4DCD0;
  --blush-warm:   #E8C2B0;
  --ink:          #2A2622;
  --ink-soft:     #5A524A;
  --gold:         #C9A86B;
  --gold-deep:    #A8853E;
  --line:         rgba(42, 38, 34, 0.12);

  --serif:  "Cormorant Garamond", "Times New Roman", serif;
  --caps:   "Italiana", serif;
  --sans:   "Inter", system-ui, -apple-system, sans-serif;

  /* Arabic counterparts — used when html[lang="ar"] */
  --serif-ar: "Amiri", "Cormorant Garamond", serif;
  --caps-ar:  "Amiri", "Italiana", serif;
  --sans-ar:  "Tajawal", "Inter", system-ui, sans-serif;

  --maxw: 1180px;
  --gutter: clamp(20px, 4vw, 48px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 300;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.container.narrow { max-width: 780px; }

/* ---------- Shared section bits ---------- */
section { padding: clamp(80px, 12vw, 140px) 0; position: relative; }

.section-overline {
  font-family: var(--caps);
  letter-spacing: 0.4em;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0 0 18px;
  text-align: center;
}

.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 4.2vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
  text-align: center;
}

.section-lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 auto 44px;
  text-align: center;
}

/* Reveal animation (handled by GSAP, but set initial state) */
.reveal { opacity: 0; transform: translateY(20px); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: background .25s ease, color .25s ease, border-color .25s ease, transform .25s ease;
  background: transparent;
  color: var(--ink);
}
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: var(--gold-deep); transform: translateY(-1px); }
.btn-ghost { border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--cream); }
.btn-big { padding: 22px 44px; font-size: 1rem; }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 0;
  background:
    radial-gradient(ellipse at 50% 30%, var(--blush) 0%, transparent 55%),
    var(--cream);
  overflow: hidden;
}

#hero-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 var(--gutter);
}

.hero-overline {
  font-family: var(--caps);
  letter-spacing: 0.6em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--gold-deep);
  margin: 0 0 32px;
}

.hero-names {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 1;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.2em 0.4em;
  letter-spacing: -0.02em;
}
.hero-names .name { font-style: italic; }
.hero-names .ampersand {
  display: inline-flex;
  color: var(--gold);
  width: 0.7em;
  height: 0.7em;
  animation: ringSpin 30s linear infinite;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
.hero-names .ampersand svg { width: 100%; height: 100%; }

.hero-date {
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.8rem, 3.8vw, 3rem);
  letter-spacing: 0.04em;
  margin: 36px 0 14px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  font-variant-numeric: tabular-nums;
}
.hero-date .date-sep {
  color: var(--gold);
  font-style: normal;
  font-size: 0.7em;
  transform: translateY(-0.05em);
}
html[lang="ar"] .hero-date { font-family: var(--serif-ar); font-style: normal; }

.hero-place {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--ink-soft);
  margin: 0 0 56px;
}

/* Countdown */
.countdown {
  display: flex;
  width: fit-content;
  margin: 0 auto;
  gap: clamp(20px, 4vw, 56px);
  padding: 24px clamp(24px, 4vw, 48px);
  background: rgba(251, 246, 239, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}
.cd-unit { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cd-val {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cd-lbl {
  font-family: var(--caps);
  letter-spacing: 0.3em;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.scroll-hint {
  display: flex;
  width: fit-content;
  margin: clamp(40px, 7vh, 80px) auto 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--caps);
  letter-spacing: 0.3em;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  animation: floatY 2.4s ease-in-out infinite;
}
.scroll-hint:hover { color: var(--gold-deep); }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

/* On very short screens, hide the scroll hint entirely to keep the hero clean */
@media (max-height: 680px) {
  .scroll-hint { display: none; }
}

/* =========================================================
   STORY
   ========================================================= */
.story { background: var(--cream); }

.story-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
  margin-top: 40px;
}

.story-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  /* Watercolor blob edge */
  border-radius: 58% 42% 50% 50% / 50% 50% 56% 44%;
  box-shadow: 0 30px 60px -30px rgba(168, 133, 62, 0.35);
}
.story-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.2s ease;
}
.story-photo:hover img { transform: scale(1.04); }

.story-text p {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 1.3em;
}

@media (max-width: 760px) {
  .story-grid { grid-template-columns: 1fr; }
  .story-photo { max-width: 420px; margin: 0 auto; }
}

/* =========================================================
   THE DAY
   ========================================================= */
.theday {
  background:
    linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
}

.day-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin: 40px 0 60px;
}

.day-card {
  background: var(--cream);
  border: 1px solid var(--line);
  padding: clamp(28px, 4vw, 44px);
  position: relative;
  transition: transform .4s ease, box-shadow .4s ease;
}
.day-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 50px -28px rgba(42, 38, 34, 0.25);
}
.day-card::before {
  content: "";
  position: absolute; top: 0; left: 0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.card-eyebrow {
  font-family: var(--caps);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold-deep);
  margin: 0 0 14px;
}
.day-card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.2vw, 1.9rem);
  margin: 0 0 6px;
  line-height: 1.2;
}
.card-time {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--gold-deep);
  margin: 0 0 4px;
}
.card-place { color: var(--ink-soft); margin: 0 0 18px; }
.card-note { font-family: var(--serif); font-style: italic; color: var(--ink-soft); margin: 18px 0 0; }
.card-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

/* The procession card spans the full row */
.day-card-wide { grid-column: 1 / -1; }

/* Two-sides layout inside the procession card */
.tal3a-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: clamp(20px, 4vw, 48px);
  align-items: start;
  margin-top: 18px;
}
.tal3a-side { display: flex; flex-direction: column; gap: 6px; }
.tal3a-divider {
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--gold), transparent);
  align-self: stretch;
  min-height: 80px;
}
.tal3a-label {
  font-family: var(--caps);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold-deep);
  margin: 0;
}
.tal3a-place {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink);
  margin: 4px 0 2px;
  font-style: italic;
}
.tal3a-sub {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0 0 12px;
}
.btn-sm { padding: 10px 18px; font-size: 0.8rem; align-self: flex-start; }

@media (max-width: 640px) {
  .tal3a-grid { grid-template-columns: 1fr; }
  .tal3a-divider { height: 1px; min-height: 0; width: 100%; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
  .btn-sm { align-self: center; }
}

html[lang="ar"] .tal3a-label { letter-spacing: 0; }
html[lang="ar"] .tal3a-place { font-style: normal; font-family: var(--serif-ar); }


/* =========================================================
   GALLERY (shuffled grid — all photos visible at once)
   ========================================================= */
.gallery {
  background: var(--cream);
  perspective: 1600px;
}

.photo-stack {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: clamp(14px, 1.6vw, 22px);
  margin-top: 60px;
}

.photo {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  cursor: zoom-in;
  transform-style: preserve-3d;
  will-change: transform;
  border-radius: 3px;
  box-shadow:
    0 20px 40px -28px rgba(168, 133, 62, 0.40),
    0 4px 10px -8px rgba(42, 38, 34, 0.12);
  transition: box-shadow .4s ease, transform .4s ease;
}
/* Random tilt for editorial feel — subtle, no two cards identical */
.photo:nth-child(3n+1) { transform: rotate(-1.2deg); }
.photo:nth-child(3n+2) { transform: rotate(0.8deg); }
.photo:nth-child(3n+3) { transform: rotate(-0.4deg); }

.photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.2s ease;
}
.photo:hover {
  z-index: 2;
  transform: rotate(0deg) scale(1.04);
  box-shadow: 0 30px 60px -28px rgba(168, 133, 62, 0.55);
}
.photo:hover img { transform: scale(1.04); }

@media (max-width: 520px) {
  .photo-stack { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(20, 18, 16, 0.92);
  display: grid; place-items: center;
  z-index: 100;
  padding: 30px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 4px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.lb-close {
  position: absolute;
  top: 18px; right: 22px;
  width: 44px; height: 44px;
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(251,246,239,0.4);
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}
.lb-close:hover { background: rgba(251,246,239,0.1); }

/* =========================================================
   GIFT (Whish)
   ========================================================= */
.gift {
  background: linear-gradient(180deg, var(--cream) 0%, var(--blush) 100%);
  text-align: center;
}

.gift-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
  background: var(--cream);
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid var(--line);
  text-align: left;
  margin: 24px 0 32px;
  box-shadow: 0 30px 60px -40px rgba(168, 133, 62, 0.35);
  position: relative;
}
.gift-card::before {
  content: "";
  position: absolute; inset: 8px;
  border: 1px solid var(--gold);
  opacity: 0.25;
  pointer-events: none;
}

.gift-qr { text-align: center; }
#whishQr {
  display: inline-block;
  padding: 14px;
  background: var(--cream);
  border: 1px solid var(--line);
}
#whishQr img, #whishQr canvas {
  display: block;
  width: 160px; height: 160px;
}
.qr-cap {
  font-family: var(--caps);
  letter-spacing: 0.3em;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 12px 0 0;
}

.gift-label {
  font-family: var(--caps);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--gold-deep);
  margin: 0 0 10px;
}
.gift-number {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 0 0 20px;
  color: var(--ink);
}
.gift-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.gift-note { color: var(--ink-soft); font-size: 0.92rem; margin: 0; }
.gift-foot {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
}

@media (max-width: 600px) {
  .gift-card { grid-template-columns: 1fr; text-align: center; }
  .gift-actions { justify-content: center; }
}

/* =========================================================
   RSVP
   ========================================================= */
.rsvp {
  background: var(--cream);
  text-align: center;
}
.rsvp-form {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 560px;
  margin: 0 auto 28px;
}
.rsvp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 220px;
  text-align: left;
}
.rsvp-field-small { flex: 0 1 120px; }
.rsvp-label {
  font-family: var(--caps);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--gold-deep);
}
.rsvp-form input {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink);
  background: var(--cream);
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 10px 4px;
  outline: none;
  transition: border-color .2s ease;
  width: 100%;
}
.rsvp-form input:focus { border-bottom-color: var(--gold-deep); }
.rsvp-form input:invalid { box-shadow: none; }
html[lang="ar"] .rsvp-form input { font-family: var(--serif-ar); }
html[lang="ar"] .rsvp-label { letter-spacing: 0; }

.rsvp-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin: 8px 0;
}
.rsvp-foot {
  margin-top: 28px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-foot {
  background: var(--ink);
  color: var(--cream);
  padding: 60px 0 50px;
  text-align: center;
}
.monogram {
  width: 130px; height: 65px;
  color: var(--gold);
  margin: 0 auto 18px;
  display: block;
}
.foot-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  margin: 0 0 8px;
}
.foot-mini {
  font-family: var(--caps);
  letter-spacing: 0.3em;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: rgba(251,246,239,0.55);
  margin: 0;
}

/* =========================================================
   Music button (floating, bottom-right)
   ========================================================= */
.music-btn {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--gold-deep);
  border: 1px solid var(--gold);
  cursor: pointer;
  z-index: 90;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px -12px rgba(168, 133, 62, 0.6);
  transition: transform .25s ease, background .25s ease, color .25s ease;
}
.music-btn:hover { transform: translateY(-2px); background: var(--gold); color: var(--cream); }
.music-btn.playing { background: var(--gold); color: var(--cream); }
.music-btn.playing::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  opacity: 0.6;
  animation: musicPulse 1.8s ease-out infinite;
}
@keyframes musicPulse {
  0%   { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}
@media (max-width: 480px) {
  .music-btn { width: 50px; height: 50px; bottom: 16px; right: 16px; }
}

/* =========================================================
   Toast (clipboard feedback)
   ========================================================= */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--cream);
  padding: 12px 22px;
  font-family: var(--caps);
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 200;
  border-radius: 2px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* =========================================================
   Language toggle + Arabic / RTL support
   ========================================================= */

/* Toggle button — top-right, mirrors music button styling */
.lang-btn {
  position: fixed;
  top: 18px;
  right: 18px;
  min-width: 56px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(251, 246, 239, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  border: 1px solid var(--gold);
  cursor: pointer;
  z-index: 95;
  font-family: var(--caps);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: transform .25s ease, background .25s ease, color .25s ease;
}
.lang-btn:hover { background: var(--gold); color: var(--cream); transform: translateY(-1px); }

/* Show only the active-language span inside the toggle */
.lang-btn [data-show-when="ar"] { display: none; }
html[lang="ar"] .lang-btn [data-show-when="en"] { display: none; }
html[lang="ar"] .lang-btn [data-show-when="ar"] { display: inline; font-family: var(--sans-ar); letter-spacing: 0; font-size: 0.95rem; }

/* The lang-specific blocks: show only the active one */
.lang-ar { display: none; }
html[lang="ar"] .lang-en { display: none; }
html[lang="ar"] .lang-ar { display: block; }
/* For inline spans inside footers etc. */
html[lang="ar"] span.lang-ar { display: inline; }
html[lang="ar"] span.lang-en { display: none; }

/* When Arabic active — swap font families globally */
html[lang="ar"] body { font-family: var(--sans-ar); }
html[lang="ar"] .section-title,
html[lang="ar"] .section-lead,
html[lang="ar"] .story-text p,
html[lang="ar"] .day-card h3,
html[lang="ar"] .card-time,
html[lang="ar"] .card-note,
html[lang="ar"] .foot-line,
html[lang="ar"] .gift-number,
html[lang="ar"] .cd-val {
  font-family: var(--serif-ar);
}
html[lang="ar"] .section-overline,
html[lang="ar"] .hero-overline,
html[lang="ar"] .hero-meta,
html[lang="ar"] .card-eyebrow,
html[lang="ar"] .cd-lbl,
html[lang="ar"] .foot-mini,
html[lang="ar"] .qr-cap,
html[lang="ar"] .scroll-hint,
html[lang="ar"] .gift-label {
  font-family: var(--caps-ar);
  letter-spacing: 0;       /* Arabic doesn't take letter-spacing well */
}
html[lang="ar"] .btn {
  font-family: var(--sans-ar);
  letter-spacing: 0;
  text-transform: none;
}
html[lang="ar"] .hero-names {
  font-family: var(--serif-ar);
  letter-spacing: 0;
}
html[lang="ar"] .hero-names .name { font-style: normal; }

/* Slightly larger Arabic body text to match optical weight of the Latin serif */
html[lang="ar"] .hero-place,
html[lang="ar"] .section-lead,
html[lang="ar"] .story-text p {
  font-size: 1.08em;
  line-height: 1.85;
}

/* RTL — flip the lang-toggle position so it stays in the corner that reads as "near" */
html[lang="ar"] .lang-btn { right: auto; left: 18px; }
html[lang="ar"] .music-btn { right: auto; left: 22px; }

@media (max-width: 480px) {
  .lang-btn { top: 12px; right: 12px; height: 36px; min-width: 48px; padding: 0 12px; font-size: 0.75rem; }
  html[lang="ar"] .lang-btn { right: auto; left: 12px; }
}
