/* =========================================================
   Devansh & Bhoomi - Wedding Invitation
   ========================================================= */

:root {
  --cream: hsl(37 75% 86%);
  --cream-70: hsl(37 75% 86% / .7);
  --ink: hsl(25 30% 18%);
  --ink-80: hsl(25 30% 18% / .8);
  --red: #7f1d1d;
  --rose-deep: hsl(348 65% 35%);
  --sage-deep: hsl(95 25% 45%);
  --gold: hsl(36 55% 55%);
  --gold-soft: hsl(36 60% 75%);
  --gold-soft-40: hsl(36 60% 75% / .4);
  --envelope-bg: #ffedd5;

  --gradient-gold: linear-gradient(135deg, hsl(36 55% 60%), hsl(36 45% 45%));
  --shadow-elegant: 0 20px 60px -20px hsl(95 25% 25% / .25);
  --shadow-soft: 0 8px 30px -10px hsl(25 30% 18% / .15);
  --shadow-gold: 0 10px 40px -10px hsl(36 55% 45% / .4);
  --ease-elegant: cubic-bezier(.22, 1, .36, 1);

  --font-body: "Fraunces", serif;
  --font-script: "Gilda Display", serif;
  --font-heading: "Sail", cursive;
  --font-devanagari: "Amita", serif;
  --font-names: "Great Vibes", cursive;
  --font-cinzel: "Cinzel", serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: normal;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; font-size: inherit; font-weight: inherit; }
img, svg, canvas, iframe { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

/* ---------- Helpers ---------- */
.center { text-align: center; }
.script { font-family: var(--font-script); line-height: 1.15; letter-spacing: .01em; }
h1, h2, h3, .shubh-vivah { font-family: var(--font-heading); line-height: 1.2; letter-spacing: .01em; }
.cinzel { font-family: var(--font-cinzel); letter-spacing: .15em; }
.container-3xl { position: relative; max-width: 48rem; margin: 0 auto; }

.divider {
  margin: 1.5rem 0;
  display: flex; align-items: center; justify-content: center; gap: .75rem;
}
.divider span { height: 1px; width: 4rem; background: var(--gold-soft); }
.divider b { font-weight: 400; color: var(--gold); font-size: 1.125rem; line-height: 1.75rem; }

.corner { position: absolute; pointer-events: none; opacity: .35; }

/* ---------- SVG flowers ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.flower { display: inline-block; width: 1em; height: 1em; vertical-align: -.15em; }
.flower.flip { transform: scaleX(-1); }
.divider b .flower { color: var(--gold); }
.fc-flower .flower { width: 1.2em; height: 1.2em; }

/* ---------- Flower rain ---------- */
.flower-rain { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.rain-item {
  position: absolute; top: 0; left: var(--x);
  width: var(--size); height: var(--size);
  opacity: 0;
  animation: rain-fall var(--fall) linear var(--wait) infinite;
  will-change: transform;
}
.rain-item svg {
  display: block; width: 100%; height: 100%;
  animation: rain-sway var(--sway) ease-in-out infinite alternate;
}
@keyframes rain-fall {
  0%   { transform: translateY(-12vh) rotate(0); opacity: 0; }
  8%   { opacity: .9; }
  88%  { opacity: .9; }
  100% { transform: translateY(112vh) rotate(var(--spin)); opacity: 0; }
}
@keyframes rain-sway {
  from { transform: translateX(-18px) rotate(-14deg); }
  to   { transform: translateX(18px) rotate(14deg); }
}

/* ---------- Animations ---------- */
@keyframes drift { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(8deg); } }
@keyframes envelope-open {
  0%   { transform: scale(1) rotateX(0); }
  50%  { transform: scale(1.05) rotateX(-15deg); }
  100% { transform: scale(1.4) rotateX(-90deg); opacity: 0; }
}
@keyframes fade-up { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes butterfly-fly {
  0%   { transform: translate(-10vw, 60vh) rotate(-8deg) scale(1); }
  20%  { transform: translate(20vw, 35vh) rotate(6deg) scale(1.05); }
  40%  { transform: translate(45vw, 55vh) rotate(-4deg) scale(.95); }
  60%  { transform: translate(65vw, 25vh) rotate(8deg) scale(1.1); }
  80%  { transform: translate(85vw, 45vh) rotate(-6deg) scale(1); }
  100% { transform: translate(110vw, 30vh) rotate(4deg) scale(1); }
}
@keyframes butterfly-flap { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.55); } }

.drift { position: absolute; opacity: .7; animation: drift 6s ease-in-out infinite; }
.fade-up { animation: fade-up 1s var(--ease-elegant) .3s both; }

/* Scroll reveal (JS adds .visible) */
.reveal, .reveal-card {
  opacity: 0;
  transition: opacity .8s ease-out, transform .8s ease-out;
  transition-delay: var(--delay, 0s);
}
.reveal { transform: translateY(40px); }
.reveal-card { transform: translateY(50px) scale(.96); transition-duration: .7s; }
.reveal.visible, .reveal-card.visible { opacity: 1; transform: none; }

/* ---------- Butterfly ---------- */
.butterfly {
  position: fixed; top: 0; left: 0; z-index: 40;
  pointer-events: none;
  animation: butterfly-fly 18s linear infinite;
  will-change: transform;
}
.butterfly-wings { display: inline-block; animation: butterfly-flap .25s ease-in-out infinite; }

/* ---------- Music button ---------- */
.music-toggle {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 50;
  width: 2.75rem; height: 2.75rem; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-80); color: var(--cream);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-elegant);
  transition: transform .15s;
}
.music-toggle:hover { transform: scale(1.05); }
.music-toggle svg {
  width: 1.25rem; height: 1.25rem;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.music-toggle .icon-off, .music-toggle.muted .icon-on { display: none; }
.music-toggle.muted .icon-off { display: block; }

/* =========================================================
   1. Envelope screen
   ========================================================= */
.envelope-screen {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 12vh 1.5rem 0;
  background: var(--envelope-bg);
}
.envelope {
  position: relative;
  perspective: 1000px;
  transition: transform .5s;
}
.envelope:hover { transform: scale(1.05); }
.envelope img {
  width: 280px; height: auto;
  filter: drop-shadow(0 25px 25px rgb(0 0 0 / .15));
}
/* Centred on the wax seal (measured from images/envelope.webp) */
.envelope-seal {
  position: absolute; left: 50.2%; top: 54.8%;
  transform: translate(-50%, -50%);
  font-family: var(--font-script);
  color: var(--red);
  font-size: 15px;
  line-height: 1; white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .6);
  pointer-events: none;
}
.envelope-text { display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--red); }
.shubh-vivah { margin: 3rem 0 1.5rem; font-size: 1.875rem; line-height: 1; }
.envelope-text h2 { font-size: 1.45rem; }
.tap-hint { margin-top: .5rem; letter-spacing: .025em; }

/* Opening state */
.envelope-screen.opening .envelope { animation: envelope-open 1s var(--ease-elegant) forwards; }
.envelope-screen.opening .envelope-text { opacity: 0; transition: opacity .3s; }

@media (min-width: 640px) {
  .envelope img { width: 360px; }
  .envelope-seal { font-size: 19px; }
  .shubh-vivah { font-size: 2.25rem; }
  .envelope-text h2 { font-size: 2.1rem; }
}
@media (min-width: 768px) {
  .envelope img { width: 420px; }
  .envelope-seal { font-size: 22px; }
}

/* =========================================================
   2. Invitation
   ========================================================= */
.invitation { position: relative; animation: fade-in 1.2s ease-out both; }
.section { position: relative; background: var(--cream); }
.section-cards { padding: 2.5rem 1rem; }
.section-save-date { padding: 0 1.5rem 2rem; }
.section-events { padding: 2.5rem .5rem; }

.section-title { font-size: 2.1rem; color: var(--rose-deep); }

/* ---------- Framed invitation cards ----------
   Font sizes use cqw (1% of the card width), so text scales
   with the card and always stays inside the printed frame. */
.frame-card {
  position: relative;
  max-width: 36rem; margin: 0 auto;
  display: flex; flex-direction: column;
  text-align: center;
  line-height: normal;
  color: var(--red);
  border-radius: 1rem;
  box-shadow: var(--shadow-elegant);
  background: center / 100% 100% no-repeat;
  container-type: inline-size;
}
.frame-content { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
.frame-card p { font-family: var(--font-body); text-wrap: balance; }

.frame-floral { aspect-ratio: 941 / 1672; margin-bottom: 2.5rem; background-image: url(../images/floral-frame.webp); }
.frame-floral .frame-content { padding: 34cqw 21cqw 31cqw; }
.ganesha { width: 26cqw; height: auto; margin: 0 auto 2cqw; }
.fc-shri, .fc-text { font-size: 4.4cqw; }
.fc-shlok { font-size: 3.7cqw; }
.frame-card .fc-shri, .frame-card .fc-shlok { font-family: var(--font-devanagari); }
.frame-card .fc-shri { font-weight: 700; }
.fc-flower { font-size: 4.5cqw; margin: 3cqw 0; color: var(--gold); }
.fc-family { font-size: 7.5cqw; line-height: 1.15; }

.frame-parchment { aspect-ratio: 937 / 1678; background-image: url(../images/parchment-frame.webp); }
.frame-parchment .frame-content { padding: 21cqw 17cqw 20cqw; }
.frame-card .pc-shri { font-family: var(--font-devanagari); font-weight: 700; font-size: 3.6cqw; line-height: 1.5; color: #8b1538; }
.pc-shri + .pc-emoji { margin-top: 2cqw; }
.pc-emoji { font-size: 6cqw; line-height: 1.2; margin-bottom: 2cqw; }
.frame-parchment { --pc-green: #33502a; }
.pc-intro, .pc-elders, .pc-parents { font-size: 3.4cqw; color: var(--pc-green); }
.pc-intro, .pc-parents { font-style: italic; }
.pc-elders { font-weight: 700; margin-top: .5cqw; }
.frame-card .pc-name {
  font-family: var(--font-names);
  font-size: 9.4cqw; line-height: 1.15; letter-spacing: 0; word-spacing: .1em;
  color: #a3271c;
  margin: 3.5cqw 0 1cqw;
}
.pc-with { font-size: 5.4cqw; color: #8b1538; margin-top: 3cqw; }
.pc-diyas { font-size: 5cqw; line-height: 1.2; margin-top: 3cqw; }

/* ---------- Scratch card ---------- */
.scratch {
  position: relative;
  width: 100%; max-width: 28rem; height: 8rem;
  margin: 0 auto 2.5rem;
  border: 2px solid var(--gold-soft);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-elegant);
  user-select: none; -webkit-user-select: none;
}
.scratch-under {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--cream);
}
.scratch-label { font-size: 1rem; letter-spacing: .35em; color: var(--sage-deep); }
.scratch-date { font-size: 2.1rem; color: var(--rose-deep); margin-top: .25rem; }
#scratch-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  cursor: grab; touch-action: none;
}
#scratch-canvas:active { cursor: grabbing; }

/* ---------- Countdown ---------- */
.countdown {
  display: flex; justify-content: center; gap: .75rem;
  height: 0; overflow: hidden; opacity: 0; transform: translateY(1rem);
  pointer-events: none;
  transition: opacity .7s, transform .7s;
}
.countdown.show { height: auto; overflow: visible; opacity: 1; transform: none; pointer-events: auto; }
.cd-item { display: flex; flex-direction: column; align-items: center; min-width: 68px; }
.cd-box {
  width: 100%; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream);
  border: 1px solid var(--gold-soft);
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
}
.cd-box span {
  font-family: var(--font-cinzel); letter-spacing: .15em;
  font-size: 1.5rem; line-height: 2rem;
  color: var(--rose-deep);
  font-variant-numeric: tabular-nums;
}
.cd-label { margin-top: .5rem; font-size: .75rem; line-height: 1rem; letter-spacing: .1em; text-transform: uppercase; color: var(--sage-deep); }

@media (min-width: 640px) {
  .countdown { gap: 1.5rem; }
  .cd-item { min-width: 90px; }
  .cd-box span { font-size: 2.25rem; line-height: 2.5rem; }
  .cd-label { font-size: .875rem; line-height: 1.25rem; }
}

/* ---------- Events ----------
   The card images already contain all the event text, so they are shown whole. */
.section-events .center { margin-bottom: 2rem; }
.events-grid {
  display: grid; grid-template-columns: 1fr; gap: 2.5rem;
  max-width: 56rem; margin: 0 auto; padding: 0 1rem;
}
.event-card { display: flex; flex-direction: column; align-items: center; }
.event-img {
  width: 100%; height: auto;
  border: 1px solid var(--gold-soft);
  border-radius: 1rem;
  box-shadow: var(--shadow-elegant);
}

.event-location {
  display: inline-flex; align-items: center; gap: .5rem;
  margin-top: 1rem; padding: .6rem 1.25rem;
  font-family: var(--font-cinzel); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--cream);
  background: var(--red);
  border-radius: 9999px;
  box-shadow: var(--shadow-gold);
  transition: transform .15s, background .15s;
}
.event-location:hover { transform: translateY(-2px); background: #991b1b; }
.event-location svg { width: 1.1rem; height: 1.1rem; animation: pin-bounce 2.2s ease-in-out infinite; }
.event-location path { fill: currentColor; }
.event-location circle { fill: var(--red); }
@keyframes pin-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

@media (min-width: 640px) {
  .events-grid { grid-template-columns: 1fr 1fr; }
  .section-title { font-size: 3rem; }
}

/* ---------- RSVP ---------- */
.section-rsvp { padding: 2.5rem 1rem 4rem; }
.rsvp-intro { font-style: italic; color: var(--sage-deep); margin-top: -.5rem; }
.rsvp-card {
  max-width: 32rem; margin: 2rem auto 0; padding: 2rem 1.5rem;
  background: #fdf6e8;
  border: 1px solid var(--gold-soft);
  border-radius: 1rem;
  box-shadow: var(--shadow-elegant);
}
.rsvp-field { margin: 0 0 1.25rem; padding: 0; border: 0; min-width: 0; }
.rsvp-field label, .rsvp-field legend {
  display: block; padding: 0; margin-bottom: .4rem;
  font-family: var(--font-cinzel); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--rose-deep);
}
.rsvp-field em { text-transform: none; letter-spacing: 0; font-family: var(--font-body); color: var(--sage-deep); }
.rsvp-field input[type="text"], .rsvp-field input[type="tel"], .rsvp-field select, .rsvp-field textarea {
  width: 100%; padding: .7rem .85rem;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: #fffaf0;
  border: 1px solid var(--gold-soft);
  border-radius: .6rem;
  transition: border-color .15s, box-shadow .15s;
}
.rsvp-field textarea { resize: vertical; }
.rsvp-field input:focus, .rsvp-field select:focus, .rsvp-field textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px hsl(36 55% 55% / .25);
}
.rsvp-field [aria-invalid="true"] { border-color: #b91c1c; }

.rsvp-choices { display: flex; flex-direction: column; gap: .6rem; }
.rsvp-pill { position: relative; margin: 0 !important; cursor: pointer; }
.rsvp-pill input { position: absolute; opacity: 0; pointer-events: none; }
.rsvp-pill span {
  display: block; padding: .65rem .75rem; text-align: center;
  font-family: var(--font-body); font-size: .95rem; letter-spacing: 0; text-transform: none;
  color: var(--ink);
  background: #fffaf0;
  border: 1px solid var(--gold-soft);
  border-radius: 9999px;
  transition: background .15s, color .15s, border-color .15s;
}
.rsvp-pill input:checked + span { background: var(--red); border-color: var(--red); color: var(--cream); }
.rsvp-pill input:focus-visible + span { box-shadow: 0 0 0 3px hsl(36 55% 55% / .45); }

.rsvp-status { min-height: 1.25rem; margin-bottom: .75rem; text-align: center; font-size: .9rem; color: #b91c1c; }
.rsvp-submit {
  display: block; width: 100%; padding: .85rem 1rem;
  font-family: var(--font-cinzel); font-size: .95rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--cream);
  background: var(--gradient-gold);
  border-radius: 9999px;
  box-shadow: var(--shadow-gold);
  transition: transform .15s, opacity .15s;
}
.rsvp-submit:hover { transform: translateY(-2px); }
.rsvp-submit:disabled { opacity: .6; cursor: wait; transform: none; }

.rsvp-thanks { text-align: center; color: var(--red); outline: none; }
.rsvp-thanks .pc-diyas { font-size: 2rem; margin: 0 0 .5rem; }
.rsvp-thanks-title { font-size: 2.1rem; color: var(--rose-deep); margin-bottom: .5rem; }

/* ---------- Footer ---------- */
.footer { padding: 4rem 1.5rem; text-align: center; background: var(--red); color: var(--cream); }
.footer-eyebrow { font-size: .75rem; line-height: 1rem; letter-spacing: .4em; color: var(--gold-soft); }
.footer-names { margin-top: .75rem; font-size: 2.1rem; }
.footer-divider { margin: 1.25rem 0; display: flex; align-items: center; justify-content: center; gap: .75rem; }
.footer-divider span { height: 1px; width: 3rem; background: var(--gold-soft-40); }
.footer-divider b { font-weight: 400; font-size: 1.5rem; line-height: 2rem; }
.footer-date { font-size: 1.125rem; line-height: normal; }
.footer-family { margin-top: .75rem; font-size: .75rem; line-height: normal; letter-spacing: .1em; color: var(--cream-70); }

@media (min-width: 640px) {
  .footer-names { font-size: 3rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .butterfly, .flower-rain { display: none; }
}
