/* The Rajmahal Wedding — cinematic scroll experience */

:root {
  --ink: #070B14;
  --sapphire: #0C1220;
  --ivory: #F3EDE3;
  --ivory-soft: rgba(243, 237, 227, 0.78);
  --champagne: #C4A574;
  --champagne-dim: rgba(196, 165, 116, 0.55);
  --teal-mist: #1A3344;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.32, 0.72, 0, 1);
  --display: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Sora", system-ui, sans-serif;
}

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

html {
  background: var(--ink);
  color: var(--ivory);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

body {
  font-family: var(--sans);
  font-weight: 300;
  background: var(--ink);
  overflow-x: hidden;
  min-height: 100dvh;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ol,
ul {
  list-style: none;
}

/* —— Atmosphere —— */
.grain {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* —— Loader —— */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  gap: 1.5rem;
  justify-items: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, #142033 0%, var(--ink) 70%);
  transition: transform 0.9s var(--ease-out), opacity 0.6s ease;
}

.loader.is-done {
  transform: translateY(-105%);
  opacity: 0;
  pointer-events: none;
}

.loader-mark {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--champagne);
}

.loader-track {
  width: min(220px, 50vw);
  height: 1px;
  background: rgba(243, 237, 227, 0.15);
  overflow: hidden;
}

.loader-fill {
  width: 0%;
  height: 100%;
  background: var(--champagne);
}

.loader-pct {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--ivory-soft);
  font-variant-numeric: tabular-nums;
}

/* —— Chapter rail —— */
.rail {
  position: fixed;
  right: clamp(1rem, 3vw, 2.5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.rail-track {
  position: relative;
  width: 1px;
  height: 140px;
  background: rgba(243, 237, 227, 0.15);
}

.rail-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: var(--champagne);
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rail-dot {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: rgba(243, 237, 227, 0.35);
  transition: color 0.45s var(--ease-soft);
  line-height: 1;
}

.rail-dot.is-active,
.rail-dot:hover,
.rail-dot:focus-visible {
  color: var(--champagne);
  outline: none;
}

/* —— Chapters —— */
.chapter {
  position: relative;
  min-height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--sapphire);
}

.stage {
  position: absolute;
  inset: 0;
}

.film {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--sapphire);
}

.veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, transparent 20%, rgba(7, 11, 20, 0.55) 100%),
    linear-gradient(180deg, rgba(7, 11, 20, 0.35) 0%, transparent 28%, transparent 62%, rgba(7, 11, 20, 0.55) 100%);
  pointer-events: none;
}

.copy {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  width: 100%;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  display: flex;
  pointer-events: none;
}

.copy .btn,
.copy a {
  pointer-events: auto;
}

/* Typography */
.eyebrow {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--champagne);
  margin-bottom: 1rem;
}

.names {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(3.5rem, 12vw, 8.5rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15em 0.35em;
}

.names .amp {
  font-style: italic;
  font-weight: 300;
  font-size: 0.55em;
  color: var(--champagne);
  transform: translateY(-0.08em);
}

.headline {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(2.2rem, 5.5vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.headline--lg {
  font-size: clamp(2.8rem, 7vw, 5.5rem);
}

.lede {
  margin-top: 1.25rem;
  max-width: 28rem;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  line-height: 1.65;
  color: var(--ivory-soft);
  font-weight: 300;
}

.invite {
  font-family: var(--display);
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 300;
  line-height: 1.55;
  color: var(--ivory);
}

.meta {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--champagne-dim);
}

.meta-sep {
  opacity: 0.5;
}

/* Layout variants */
.copy--hero {
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding-bottom: clamp(3rem, 8vh, 6rem);
}

.scroll-hint {
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(243, 237, 227, 0.55);
}

.scroll-line {
  display: block;
  width: 48px;
  height: 1px;
  background: rgba(243, 237, 227, 0.35);
  transform-origin: left center;
  animation: pulse-line 2.4s var(--ease-soft) infinite;
}

@keyframes pulse-line {
  0%, 100% { transform: scaleX(0.4); opacity: 0.4; }
  50% { transform: scaleX(1); opacity: 1; }
}

.copy--split {
  flex-direction: column;
  justify-content: space-between;
}

.stack--bottom {
  align-self: flex-end;
  text-align: right;
  max-width: 28rem;
}

.copy--itinerary {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  padding-bottom: clamp(3rem, 8vh, 5rem);
}

.stack--left {
  max-width: 22rem;
}

.itinerary {
  width: min(100%, 22rem);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.35rem 0;
  border-top: 1px solid rgba(196, 165, 116, 0.35);
  border-bottom: 1px solid rgba(196, 165, 116, 0.35);
}

.itinerary li {
  display: grid;
  gap: 0.2rem;
}

.itinerary time {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--champagne);
}

.itinerary strong {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.35rem;
}

.itinerary span {
  font-size: 0.85rem;
  color: var(--ivory-soft);
  line-height: 1.45;
}

.copy--center {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.stack--center {
  max-width: 36rem;
}

.stack--center .lede {
  margin-inline: auto;
}

.copy--mehfil {
  justify-content: center;
  align-items: center;
}

.drift {
  position: absolute;
  font-family: var(--display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(2rem, 6vw, 4.5rem);
  color: var(--ivory);
  opacity: 0;
  will-change: transform, opacity;
}

.drift:nth-child(1) { top: 22%; left: 12%; }
.drift:nth-child(2) { top: 38%; right: 14%; }
.drift:nth-child(3) { top: 55%; left: 28%; }
.drift:nth-child(4) { top: 68%; right: 22%; }
.drift:nth-child(5) { top: 48%; left: 48%; }

.copy--finale {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0;
}

.finale-line {
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.6rem, 3.5vw, 2.75rem);
  position: absolute;
  opacity: 0;
  max-width: 28rem;
}

.rsvp {
  opacity: 0;
  transform: translateY(24px);
  max-width: 26rem;
}

.rsvp .lede {
  margin-inline: auto;
  margin-bottom: 1.75rem;
}

/* Buttons */
.btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1.35rem 0.95rem 1.6rem;
  border-radius: 999px;
  background: var(--ivory);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: transform 0.5s var(--ease-soft), background 0.4s ease, color 0.4s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--champagne);
  outline: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-icon {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  background: rgba(7, 11, 20, 0.08);
  transition: transform 0.45s var(--ease-soft);
}

.btn:hover .btn-icon {
  transform: translateX(2px);
}

.btn--full {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Reveal defaults (GSAP drives these) */
.reveal {
  opacity: 0;
  transform: translateY(28px);
}

/* —— Modal —— */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 11, 20, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-panel {
  position: relative;
  width: min(420px, 100%);
  padding: 2.25rem 1.75rem 1.75rem;
  background:
    linear-gradient(165deg, #121a2a 0%, var(--ink) 100%);
  border: 1px solid rgba(196, 165, 116, 0.22);
  border-radius: 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.modal-close {
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--ivory-soft);
  transition: color 0.3s ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  color: var(--champagne);
  outline: none;
}

.modal-panel h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: 0.08em;
}

.modal-sub {
  margin: 0.35rem 0 1.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--champagne-dim);
}

#rsvp-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#rsvp-form label,
#rsvp-form fieldset {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  border: none;
}

#rsvp-form label > span,
#rsvp-form legend {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--champagne);
}

#rsvp-form input[type="text"],
#rsvp-form select,
#rsvp-form textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  background: rgba(243, 237, 227, 0.05);
  border: 1px solid rgba(243, 237, 227, 0.14);
  border-radius: 0.55rem;
  outline: none;
  transition: border-color 0.3s ease;
}

#rsvp-form input:focus,
#rsvp-form select:focus,
#rsvp-form textarea:focus {
  border-color: var(--champagne-dim);
}

.choice {
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem !important;
  font-size: 0.9rem;
  color: var(--ivory-soft);
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  .scroll-line { animation: none; }
  .reveal,
  .finale-line,
  .rsvp,
  .drift {
    opacity: 1 !important;
    transform: none !important;
  }
  .loader { display: none; }
}

/* —— Mobile —— */
@media (max-width: 768px) {
  .rail {
    right: 0.65rem;
  }

  .rail-track {
    height: 100px;
  }

  .stack--bottom {
    align-self: stretch;
    text-align: left;
  }

  .copy--itinerary {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
  }

  .itinerary {
    width: 100%;
  }

  .names {
    font-size: clamp(3rem, 14vw, 4.5rem);
  }
}

/* Frame-based journey film */
.journey { height: 950svh; background: var(--ink); }
.journey-stage { position: sticky; top: 0; height: 100dvh; min-height: 560px; overflow: hidden; touch-action: none; }
.film-region { position: absolute; inset: 0; z-index: 0; background: #000; }
#journey-video { display: block; width: 100%; height: 100%; object-fit: cover; }

.copy-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.copy-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.copy-panel.copy {
  min-height: 100%;
  height: 100%;
  width: 100%;
  padding: clamp(1.5rem, 4vw, 3.5rem);
}

.copy-panel.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.copy-panel.is-visible .btn,
.copy-panel.is-visible a {
  pointer-events: auto;
}

.copy-panel.copy--mehfil .drift {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s var(--ease-soft), transform 0.45s var(--ease-soft);
}

.copy-panel.copy--mehfil.is-visible .drift {
  opacity: 1;
  transform: none;
}

.copy-panel.copy--mehfil.is-visible .drift:nth-child(1) { transition-delay: 0.05s; }
.copy-panel.copy--mehfil.is-visible .drift:nth-child(2) { transition-delay: 0.15s; }
.copy-panel.copy--mehfil.is-visible .drift:nth-child(3) { transition-delay: 0.25s; }
.copy-panel.copy--mehfil.is-visible .drift:nth-child(4) { transition-delay: 0.35s; }
.copy-panel.copy--mehfil.is-visible .drift:nth-child(5) { transition-delay: 0.45s; }

.chapter-nav { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); z-index: 12; display: flex; flex-direction: column; gap: 0.35rem; }
.chapter-nav button { border: 0; background: none; color: var(--champagne); font-size: 0.55rem; letter-spacing: 0.1em; min-height: 32px; cursor: pointer; }
.chapter-nav button[aria-current="step"] { color: var(--ivory); }
.journey-footer { position: absolute; bottom: max(8px, env(safe-area-inset-bottom)); left: 1.5rem; right: 1.5rem; z-index: 12; display: flex; justify-content: space-between; align-items: center; gap: 12px; pointer-events: none; }
.journey-footer .scroll-cue { pointer-events: auto; border: 0; background: none; font-size: 0.58rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--champagne); cursor: pointer; }
.chapter-caption { font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ivory-soft); }
.chapter-caption b { color: var(--champagne); margin-right: 0.5em; }
.media-status { font-size: 0.58rem; color: var(--champagne); }
.progress { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; z-index: 12; background: rgba(255,255,255,0.1); }
.progress span { display: block; height: 100%; transform: scaleX(0); transform-origin: left; background: var(--champagne); }
html.static-journey .journey { height: auto; }
html.static-journey .journey-stage { position: relative; }
html.static-journey .chapter-nav { visibility: hidden; }
