/* ==========================================================================
   NIKAH INVITATION — SCROLL-DRIVEN STORY (2026)
   Sticky stacking scenes · GSAP ScrollTrigger · Lenis smooth scroll
   ========================================================================== */

:root {
  --ink: #5E121E;
  --ink-soft: #3B1B1F;
  --gold: #C9A66B;
  --gold-deep: #9E6E22;
  --ivory: #F5EBDD;
  --paper: #FFFCF6;
  --night: #1E1012;
  --stage-h: 100vh;
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
}
@supports (height: 100svh) {
  :root { --stage-h: 100svh; }
}

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

html { background: var(--night); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
html.is-locked, html.is-locked body { overflow: hidden; height: 100%; }

body {
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  background: radial-gradient(circle at 50% 20%, #3a2024 0%, var(--night) 70%);
  -webkit-tap-highlight-color: transparent;
}

img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Petals ---------- */
#petals { position: fixed; inset: 0; z-index: 40; pointer-events: none; }

/* ==========================================================================
   SCENES — sticky stacking
   Each scene is tall; its .stage sticks. The following scene overlaps the
   last screen of the previous one and slides up over it.
   ========================================================================== */
.scene {
  position: relative;
  height: calc(var(--stage-h) * 4);
}
.scene + .scene { margin-top: calc(var(--stage-h) * -1); }
.scene:nth-child(1) { z-index: 1; height: calc(var(--stage-h) * 3); }
.scene:nth-child(2) { z-index: 2; }
.scene:nth-child(3) { z-index: 3; }
.scene:nth-child(4) { z-index: 4; }
.scene:nth-child(5) { z-index: 5; }
.scene:nth-child(6) { z-index: 6; height: calc(var(--stage-h) * 3.5); }
.scene-outro { z-index: 70; height: calc(var(--stage-h) * 2.2); }

.stage {
  position: sticky;
  top: 0;
  height: var(--stage-h);
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* Blurred ambient copy of the art (visible on wide screens) */
.backdrop {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(36px) saturate(1.1) brightness(0.72);
  transform: scale(1.1);
}

/* The 9:16 art card */
.card {
  position: relative;
  height: var(--stage-h);
  width: 100%;
  overflow: hidden;
  background: var(--ivory);
  will-change: transform;
  transform-origin: 50% 40%;
}
@media (min-width: 640px) {
  .card {
    height: min(94vh, 960px);
    width: auto;
    aspect-ratio: 9 / 16;
    border-radius: 28px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(201, 166, 107, 0.4);
  }
}

.art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}
.shade {
  position: absolute;
  inset: 0;
  background: #120708;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

/* ---------- Content layouts ---------- */
.content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-left: 13%;
  padding-right: 13%;
}
.content.framed {
  justify-content: center;
  gap: clamp(6px, 1.3vh, 12px);
  padding-top: 15%;
  padding-bottom: 27%;
}
.content.framed.tight { gap: clamp(3px, 0.8vh, 8px); }
.content.couple-top {
  justify-content: flex-start;
  padding-top: 21%;
}
.content.dua-layout {
  justify-content: space-between;
  padding-top: 11%;
  padding-bottom: 9%;
  padding-left: 7%;
  padding-right: 7%;
}

/* ---------- Typography ---------- */
.ar { font-family: 'Amiri', serif; font-weight: 700; direction: rtl; line-height: 1.5; }
.bismillah { font-size: clamp(1.45rem, 6.4vw, 2rem); color: var(--ink); }
.verse { font-size: clamp(2.1rem, 9.5vw, 2.9rem); color: var(--gold-deep); line-height: 1.35; }
.ar-md { font-size: clamp(1.6rem, 7vw, 2.1rem); color: var(--gold-deep); }
.ar-lg { font-size: clamp(1.7rem, 7.6vw, 2.3rem); color: var(--ink); }

.script { font-family: 'Great Vibes', cursive; font-weight: 400; color: var(--ink); line-height: 1.12; }
.tagline { font-size: clamp(1.75rem, 7.6vw, 2.3rem); }
.title { font-size: clamp(2.5rem, 11vw, 3.3rem); }
.name {
  font-size: clamp(2.2rem, 9.6vw, 2.9rem);
  background: linear-gradient(100deg, #5E121E 0%, #8a3a2a 35%, #b68a45 50%, #8a3a2a 65%, #5E121E 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0 0.15em;
}

.serif-lg { font-size: clamp(1.3rem, 5.6vw, 1.65rem); font-style: italic; font-weight: 700; line-height: 1.25; }
.serif-md { font-size: clamp(1.08rem, 4.6vw, 1.3rem); font-style: italic; font-weight: 700; line-height: 1.3; }
.serif-sm { font-size: clamp(1rem, 4.3vw, 1.18rem); font-style: italic; font-weight: 600; line-height: 1.35; color: var(--ink-soft); }
.strong { color: var(--ink); }
.parents { font-size: clamp(0.95rem, 4vw, 1.1rem); font-weight: 700; color: var(--ink-soft); line-height: 1.3; }
.joiner { font-size: clamp(1rem, 4.2vw, 1.15rem); font-style: italic; font-weight: 700; color: var(--gold-deep); }
.label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(0.72rem, 3vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.label.light { color: var(--gold); }
.month {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
  font-size: clamp(1.35rem, 6vw, 1.75rem);
  letter-spacing: 0.18em;
  color: var(--ink);
}
.rule {
  display: block;
  width: 64px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ---------- Glass panels ---------- */
.glass {
  background: rgba(255, 252, 246, 0.82);
  border: 1px solid rgba(158, 110, 34, 0.4);
  border-radius: 22px;
  padding: 12px 20px 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px -12px rgba(94, 18, 30, 0.25);
}
.glass-chip {
  background: rgba(255, 252, 246, 0.86);
  border: 1px solid rgba(158, 110, 34, 0.4);
  border-radius: 999px;
  padding: 2px 26px 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dua-note { width: 100%; max-width: 340px; display: grid; gap: 6px; }

/* ---------- Calendar ---------- */
.calendar {
  width: 100%;
  max-width: 300px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(158, 110, 34, 0.35);
  border-radius: 18px;
  padding: 10px 10px 8px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px;
  font-variant-numeric: tabular-nums;
}
.calendar .dow {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-deep);
  padding-bottom: 4px;
}
.calendar .day {
  position: relative;
  font-family: 'Playfair Display', serif;
  font-size: clamp(0.88rem, 3.7vw, 1rem);
  font-weight: 700;
  color: var(--ink);
  height: clamp(24px, 3.4vh, 30px);
  display: grid;
  place-items: center;
}
.calendar .day.fest { color: var(--gold-deep); }
.calendar .day.fest::before {
  content: "";
  position: absolute;
  inset: 2px 4px;
  border-radius: 8px;
  background: rgba(201, 166, 107, 0.16);
}
.calendar .day.nikah { color: var(--ink); font-weight: 800; }
.calendar .heart {
  position: absolute;
  width: 175%;
  height: 175%;
  left: -37.5%;
  top: -40%;
  overflow: visible;
  pointer-events: none;
}
.calendar .heart path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}

/* ---------- Detail rows ---------- */
.detail {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255, 252, 246, 0.8);
  border: 1px solid rgba(201, 166, 107, 0.45);
  border-radius: 16px;
}
.detail svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--gold-deep);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.detail p {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(0.78rem, 3.4vw, 0.9rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.4;
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.pill {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: rgba(255, 253, 248, 0.95);
  transition: background 0.3s, color 0.3s, transform 0.3s;
}
.pill:hover, .pill:focus-visible { background: var(--ink); color: var(--ivory); transform: translateY(-2px); }
.pill.solid { background: rgba(255, 253, 248, 0.96); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ==========================================================================
   CURTAINS
   ========================================================================== */
.curtain, .outro-doors {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.curtain { z-index: 100; pointer-events: auto; cursor: pointer; }
.outro-doors { z-index: 60; }
.door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
  background: var(--ivory);
  will-change: transform;
}
.door-left { left: 0; box-shadow: 6px 0 24px rgba(0,0,0,0.18); }
.door-right { right: 0; box-shadow: -6px 0 24px rgba(0,0,0,0.18); }
.door img { width: 100%; height: 100%; object-fit: cover; }
.door-left img { object-position: right center; }
.door-right img { object-position: left center; }

.curtain-tap {
  position: absolute;
  left: 50%;
  bottom: calc(9% + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: grid;
  place-items: center;
}
.tap-label {
  position: relative;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(255, 252, 246, 0.92);
  border: 1px solid var(--gold);
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 30px -10px rgba(94, 18, 30, 0.4);
}
.tap-ring {
  position: absolute;
  inset: -8px -10px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  animation: ring 2.2s var(--ease) infinite;
}
@keyframes ring {
  0% { transform: scale(0.9); opacity: 0.9; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* ==========================================================================
   OUTRO
   ========================================================================== */
.outro-stage { background: transparent; }
.outro-content {
  position: relative;
  z-index: 70;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  padding: 26px 30px 24px;
  border-radius: 26px;
  background: rgba(30, 16, 18, 0.62);
  border: 1px solid rgba(201, 166, 107, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
}
.outro-title { font-size: clamp(2.6rem, 11vw, 3.4rem); color: #F3E3C3; }
.toast { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 0.75rem; color: #F3E3C3; min-height: 1em; }

/* ==========================================================================
   FIXED UI
   ========================================================================== */
.ui { opacity: 0; pointer-events: none; transition: opacity 0.6s ease; }
body.is-open .ui { opacity: 1; pointer-events: auto; }
body.is-open.is-idle .ui { opacity: 0.25; }
body.is-open.is-idle .ui:hover { opacity: 1; }
body.is-ended .ui:not(.music-btn) { opacity: 0 !important; pointer-events: none; }

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 90;
  background: rgba(201, 166, 107, 0.15);
}
.progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
}

.music-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: 14px;
  z-index: 90;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 252, 246, 0.8);
  border: 1px solid rgba(201, 166, 107, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
}
.eq { display: flex; align-items: flex-end; gap: 2px; height: 13px; }
.eq i { width: 2.5px; height: 100%; background: var(--ink); border-radius: 2px; transform-origin: bottom; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.35s; }
.eq i:nth-child(3) { animation-delay: -0.7s; }
.music-btn.is-muted .eq i { animation: none; height: 3px; }
@keyframes eq { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } transform-origin: bottom; }

.scene-nav {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: grid;
  gap: 12px;
}
.scene-nav button {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(201, 166, 107, 0.45);
  transition: transform 0.4s var(--ease), background 0.4s;
}
.scene-nav button::after { content: ""; position: absolute; inset: -8px; }
.scene-nav button.active { background: var(--gold); transform: scale(1.6); }
.scene-nav button span {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ivory);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.scene-nav button:hover span, .scene-nav button:focus-visible span { opacity: 1; }
@media (max-width: 639px) { .scene-nav { right: 6px; gap: 10px; } .scene-nav button { width: 6px; height: 6px; } }

.scroll-cue {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  justify-items: center;
  gap: 6px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(255, 252, 246, 0.82);
  padding: 8px 14px 10px;
  border-radius: 999px;
  border: 1px solid rgba(201, 166, 107, 0.5);
}
.cue-line { width: 1px; height: 22px; background: var(--ink); transform-origin: top; animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
body.scrolled .scroll-cue { opacity: 0 !important; pointer-events: none; }

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .tap-ring, .eq i, .cue-line { animation: none; }
}
