/* ==========================================================================
   Pakistani Wedding Invitation — interactive envelope + parallax invite
   ========================================================================== */

:root {
  --maroon: #7a0c1e;
  --maroon-dark: #5c0f1d;
  --maroon-light: #a52236;
  --gold: #c9a227;
  --gold-light: #f1d78c;
  --cream: #fff8ec;
  --ivory: #fdf6e9;
  --green: #2f7d4f;
  --ink: #2b1810;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Poppins', system-ui, sans-serif;
  --font-urdu: 'Noto Nastaliq Urdu', serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--ivory);
  overflow-x: hidden;
}

body.pre-open {
  height: 100vh;
  overflow: hidden;
}

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

a { color: inherit; }

/* ---------------------------------------------------------------------- */
/* Petals (shared falling-flower layer)                                    */
/* ---------------------------------------------------------------------- */

.petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  overflow: hidden;
}

.petal {
  position: absolute;
  top: -10%;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 30% 30%, var(--maroon-light), var(--maroon));
  border-radius: 60% 0 60% 0;
  opacity: 0.85;
  animation: fall linear infinite;
  will-change: transform;
}

.petal.gold {
  background: radial-gradient(circle at 30% 30%, var(--gold-light), var(--gold));
  border-radius: 50%;
}

@keyframes fall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  8%   { opacity: 0.9; }
  100% { transform: translateY(115vh) translateX(var(--drift, 40px)) rotate(360deg); opacity: 0; }
}

/* ---------------------------------------------------------------------- */
/* SCREEN 1 — Envelope                                                     */
/* ---------------------------------------------------------------------- */

.envelope-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.2rem, 4vh, 2.5rem);
  padding: 5vh 1.5rem;
  background: radial-gradient(circle at 50% 20%, #7a0c1e 0%, #5c0f1d 55%, #3c0a13 100%);
  transition: opacity 0.7s ease, visibility 0.7s ease;
  overflow: hidden;
}

.envelope-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(201,162,39,0.18), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(201,162,39,0.16), transparent 40%);
  pointer-events: none;
}

.envelope-screen.closing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-kicker {
  font-family: var(--font-urdu);
  color: var(--gold-light);
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  margin: 0;
  text-align: center;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

.envelope-scene {
  perspective: 1400px;
}

.envelope {
  --w: min(78vw, 320px);
  --h: calc(var(--w) * 0.66);
  position: relative;
  width: var(--w);
  height: var(--h);
  cursor: pointer;
  outline: none;
}

.envelope:focus-visible .envelope-body {
  outline: 2px solid var(--gold-light);
  outline-offset: 4px;
}

.envelope-shadow {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -18px;
  height: 22px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.45), transparent 70%);
  filter: blur(2px);
}

.envelope-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, var(--cream), #f3e6c8);
  border-radius: 6px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  z-index: 2;
}

.envelope-back {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: #ecd9a8;
  z-index: 0;
}

.envelope-pocket-left,
.envelope-pocket-right {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(135deg, #f3e6c8, #e6cf9c);
  z-index: 3;
}

.envelope-pocket-left {
  left: 0;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.envelope-pocket-right {
  right: 0;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.letter {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 6%;
  height: 78%;
  background: var(--ivory);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem;
  transition: transform 1s cubic-bezier(.2,.8,.2,1);
  transition-delay: 0s;
}

.letter-monogram {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--maroon);
  font-size: clamp(1rem, 4vw, 1.3rem);
  letter-spacing: 0.06em;
}

.letter-line {
  width: 40%;
  height: 2px;
  background: var(--gold);
}

.letter-text {
  font-family: var(--font-display);
  color: var(--ink);
  text-align: center;
  font-size: clamp(0.85rem, 3vw, 1rem);
  line-height: 1.3;
  margin: 0;
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 55%;
  background: linear-gradient(155deg, #f3e6c8, #dcc286);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 0.9s cubic-bezier(.4,0,.2,1);
  z-index: 4;
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 6%;
}

.wax-seal {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--maroon-light), var(--maroon-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-light);
  font-size: 1.1rem;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 0 0 2px rgba(201,162,39,0.5);
  transform: translateY(50%);
}

/* opened state */
.envelope.open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 1;
  transition-duration: 0.8s;
}

.envelope.open .letter {
  transform: translateY(-135%);
  z-index: 5;
  transition-delay: 0.35s;
}

.envelope.open .envelope-pocket-left,
.envelope.open .envelope-pocket-right {
  z-index: 5;
}

.tap-prompt {
  color: var(--gold-light);
  font-size: clamp(0.85rem, 2.6vw, 1rem);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: pulse 2s ease-in-out infinite;
  text-align: center;
}

.tap-hand {
  display: inline-block;
  animation: point 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

@keyframes point {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

/* ---------------------------------------------------------------------- */
/* Main scrollable content                                                 */
/* ---------------------------------------------------------------------- */

.main-content {
  position: relative;
  z-index: 1;
}

.section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: clamp(2.5rem, 8vh, 5rem) 1.25rem;
}

.section-inner {
  position: relative;
  z-index: 2;
  max-width: 720px;
  width: 100%;
  text-align: center;
}

.parallax-layer {
  position: absolute;
  inset: -10% -10%;
  z-index: 0;
  pointer-events: none;
  will-change: transform;
}

/* ---- Hero / reveal ---- */

.hero-section {
  background: linear-gradient(180deg, var(--ivory), var(--cream));
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 1rem;
}

.couple-illustration {
  width: min(78vw, 300px);
  margin: 0 0 0.5rem;
  position: relative;
  opacity: 0;
  transform: translateY(30px) scale(0.92);
  transition: opacity 1.1s ease, transform 1.1s cubic-bezier(.2,.8,.2,1);
}

.couple-illustration.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.couple-svg .figure {
  transform-origin: 50% 100%;
}

.couple-illustration.show .groom {
  animation: sway 5s ease-in-out infinite;
}

.couple-illustration.show .bride .dupatta,
.couple-illustration.show .bride .dupatta-2 {
  animation: dupatta-sway 4.5s ease-in-out infinite;
  transform-origin: 60% 0%;
}

@keyframes sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(0.8deg); }
}

@keyframes dupatta-sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-1.4deg); }
}

.sparkles { position: absolute; inset: 0; pointer-events: none; }

.sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--gold-light);
  border-radius: 50%;
  box-shadow: 0 0 6px 1px var(--gold-light);
  animation: twinkle 2.4s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.4); }
  50% { opacity: 1; transform: scale(1.1); }
}

.reveal-item {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-item.show {
  opacity: 1;
  transform: translateY(0);
}

.hero-kicker {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--maroon-light);
  font-size: clamp(0.9rem, 2.6vw, 1.05rem);
  margin: 0.25rem 0 0.4rem;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--maroon-dark);
  font-size: clamp(1.7rem, 6vw, 2.6rem);
  line-height: 1.15;
  margin: 0 0 0.6rem;
}

.hero-names {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 0.9rem;
  letter-spacing: 0.03em;
}

.hero-names .amp {
  color: var(--maroon-light);
  font-style: italic;
  margin: 0 0.35rem;
}

.hero-sub {
  color: #6b5347;
  font-size: clamp(0.9rem, 2.4vw, 1.02rem);
  line-height: 1.6;
  max-width: 34em;
  margin: 0 0 1.75rem;
}

.scroll-cue {
  width: 26px;
  height: 42px;
  border: 2px solid var(--maroon-light);
  border-radius: 20px;
  position: relative;
  display: block;
}

.scroll-cue-dot {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  background: var(--maroon-light);
  border-radius: 50%;
  animation: scrollcue 1.8s ease-in-out infinite;
}

@keyframes scrollcue {
  0% { top: 6px; opacity: 1; }
  70% { top: 24px; opacity: 0; }
  71% { top: 6px; opacity: 0; }
  100% { top: 6px; opacity: 1; }
}

/* ---- decorative motifs ---- */

.mandala {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  border: 2px dashed rgba(201,162,39,0.35);
  opacity: 0.5;
}

.mandala::before,
.mandala::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(122,12,30,0.18);
}

.mandala::after { inset: 16%; }

.mandala-left { top: -18vmax; left: -22vmax; }
.mandala-right { bottom: -18vmax; right: -22vmax; }

.jaali-border {
  position: absolute;
  left: 0;
  right: 0;
  height: 60px;
  background-image: repeating-linear-gradient(135deg, rgba(201,162,39,0.35) 0 8px, transparent 8px 16px);
  opacity: 0.6;
}

.jaali-border.top { top: 0; }
.jaali-border.bottom { bottom: 0; }

.paisley {
  position: absolute;
  width: 220px;
  height: 220px;
  opacity: 0.15;
  border-radius: 45% 55% 60% 40% / 55% 45% 55% 45%;
  background: var(--maroon);
}

.paisley-a { top: 6%; left: -60px; transform: rotate(20deg); }
.paisley-b { bottom: 8%; right: -60px; transform: rotate(-30deg); background: var(--gold); }

/* ---- Details ---- */

.details-section {
  background: linear-gradient(180deg, var(--cream), var(--ivory));
}

.section-kicker {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--maroon-light);
  margin: 0 0 0.3rem;
  font-size: clamp(0.9rem, 2.4vw, 1.05rem);
}

.section-title {
  font-family: var(--font-display);
  color: var(--maroon-dark);
  font-weight: 800;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  margin: 0 0 1.75rem;
}

.date-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: var(--gold-light);
  padding: 1rem 1.75rem;
  border-radius: 16px;
  margin: 0 auto 2.25rem;
  box-shadow: 0 14px 30px rgba(122,12,30,0.25);
}

.date-day {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  font-weight: 800;
  line-height: 1;
}

.date-rest {
  display: flex;
  flex-direction: column;
  text-align: left;
  font-size: clamp(0.85rem, 2.4vw, 1rem);
}

.date-month { font-weight: 600; letter-spacing: 0.04em; }
.date-year { opacity: 0.8; font-size: 0.85em; }

.detail-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.detail-card {
  background: #fff;
  border: 1px solid rgba(201,162,39,0.35);
  border-radius: 14px;
  padding: 1.5rem 1rem;
  box-shadow: 0 10px 24px rgba(122,12,30,0.06);
}

.detail-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 0.6rem;
  color: var(--maroon-light);
}

.detail-card h3 {
  font-family: var(--font-display);
  color: var(--maroon-dark);
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.detail-card p {
  margin: 0;
  color: #6b5347;
  font-size: 0.92rem;
}

.cta-button {
  display: inline-block;
  background: var(--gold);
  color: var(--maroon-dark);
  font-weight: 600;
  text-decoration: none;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(201,162,39,0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cta-button:hover,
.cta-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(201,162,39,0.45);
}

/* ---- Blessing / footer ---- */

.blessing-section {
  background: linear-gradient(180deg, var(--maroon-dark), var(--maroon));
  color: var(--cream);
}

.urdu-blessing {
  font-family: var(--font-urdu);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  color: var(--gold-light);
  margin: 0 0 1rem;
}

.blessing-text {
  max-width: 32em;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
  font-size: clamp(0.92rem, 2.4vw, 1.05rem);
  color: rgba(255,248,236,0.9);
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 1.25rem;
}

.divider span {
  width: 60px;
  height: 2px;
  background: var(--gold);
}

.regards {
  margin: 0;
  font-style: italic;
  opacity: 0.85;
  font-size: 0.95rem;
}

.families {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.6vw, 1.5rem);
  color: var(--gold-light);
  margin: 0.35rem 0 0;
}

/* ---------------------------------------------------------------------- */
/* Responsive tweaks                                                       */
/* ---------------------------------------------------------------------- */

@media (max-width: 560px) {
  .detail-cards {
    grid-template-columns: 1fr;
  }
  .date-banner {
    padding: 0.85rem 1.25rem;
  }
}

@media (min-width: 900px) {
  .hero-inner { max-width: 760px; }
  .couple-illustration { width: min(30vw, 340px); }
}

/* ---------------------------------------------------------------------- */
/* Reduced motion                                                          */
/* ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .petal,
  .tap-prompt,
  .tap-hand,
  .scroll-cue-dot,
  .sparkle,
  .couple-illustration.show .groom,
  .couple-illustration.show .bride .dupatta,
  .couple-illustration.show .bride .dupatta-2 {
    animation: none !important;
  }
  .envelope-flap,
  .letter,
  .couple-illustration,
  .reveal-item {
    transition-duration: 0.2s !important;
  }
}
