/* =========================================================================
   Wedding RSVP — styles.css
   Colour scheme (see CLAUDE.md → "Colour scheme"):
     60% Ivory #F7F1E3 · 20% Burgundy #59000A · 10% Olive #625F04
      7% Champagne Gold #C9A55C · 3% Dusty Rose #C99A96
   Burgundy envelope, champagne-gold wax seal.
   ========================================================================= */

:root {
  /* Core palette */
  --ivory: #F7F1E3;
  --burgundy: #59000A;
  --olive: #625F04;
  --gold: #C9A55C;   /* champagne gold */
  --rose: #C99A96;   /* dusty rose */

  /* Roles derived from the palette */
  --cream: var(--ivory);
  --blush: #efe4d0;               /* deeper ivory for the background gradient */
  --paper: #6d0512;              /* envelope front — lighter burgundy */
  --paper-shade: var(--burgundy); /* envelope flap */
  --paper-back: #40000a;          /* envelope back — darker burgundy */
  --gold-light: #dcc088;          /* lighter champagne highlight */
  --ink: #45141b;                /* readable dark-burgundy text */
  --ink-soft: var(--olive);       /* muted secondary text in olive */
  --seal: var(--gold);           /* wax seal — champagne gold on burgundy */
  --seal-dark: #a5813d;
  --white: #FFFDF9;
  --shadow: rgba(89, 0, 10, 0.22);

  --font-script: "Great Vibes", cursive;
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Montserrat", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #e6dac4; }

body {
  margin: 0;
  font-family: var(--font-serif);
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 50% -10%, #fff8ef 0%, transparent 60%),
    linear-gradient(160deg, var(--cream) 0%, var(--blush) 55%, #e6dac4 100%);
  /* Pin the gradient to the viewport so it always covers the full screen,
     even when the opened invitation scrolls past one screen height. */
  background-attachment: fixed;
  background-size: cover;
  min-height: 100dvh;
  overflow-x: hidden;
}

.stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  position: relative;
}

/* ============================ ENVELOPE ================================== */

.envelope-scene {
  position: relative;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 22px;
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  outline: none;
}
.envelope-scene:focus-visible .envelope { box-shadow: 0 0 0 3px var(--gold-light); }

.envelope {
  --w: clamp(300px, 82vmin, 480px);
  --h: calc(var(--w) * 0.66);
  position: relative;
  width: var(--w);
  height: var(--h);
  perspective: 1400px;
  filter: drop-shadow(0 24px 34px var(--shadow));
}

/* Back sheet of the envelope */
.envelope__back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--paper-back), #4d000b);
  z-index: 1;
}

/* The letter that peeks out and rises when opened */
.envelope__letter {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 8%;
  height: 84%;
  background: linear-gradient(180deg, var(--white), #fbf3e6);
  border-radius: 6px;
  box-shadow: 0 6px 14px rgba(90, 74, 63, 0.18);
  z-index: 2;
  display: grid;
  place-items: center;
  transform: translateY(0);
  transition: transform 1s var(--ease) 0.35s;
}
.envelope__letter-names {
  margin: 0;
  width: 100%;
  padding: 0 8%;
  font-family: var(--font-script);
  font-size: clamp(1.2rem, 4.6vw, 1.9rem);
  line-height: 1.15;
  color: var(--gold);
  text-align: center;
}

/* Front pocket — rectangle with a V notch cut from the top-center */
.envelope__front {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--paper) 0%, var(--paper-shade) 100%);
  clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 0, 50% 58%);
}
/* subtle diagonal seams of the pocket */
.envelope__front::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 2%, 50% 60%, 0 2%);
  background: rgba(201, 165, 92, 0.5);
}

/* Top triangular flap */
.envelope__flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  z-index: 4;
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 0.9s var(--ease), z-index 0s linear 0.45s;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(160deg, #6d0512 0%, var(--paper-shade) 100%);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

/* Wax seal sitting where the flap tip meets the pocket */
.wax-seal {
  position: absolute;
  top: 46%;
  left: 50%;
  width: clamp(48px, 14%, 72px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 6;
  display: grid;
  place-items: center;
  color: var(--burgundy);
  font-family: var(--font-script);
  font-size: clamp(1.4rem, 5vw, 2rem);
  background: radial-gradient(circle at 35% 30%, #e2c589, var(--seal) 55%, var(--seal-dark));
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.35),
    inset 0 -3px 8px rgba(0, 0, 0, 0.4), 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
}

.envelope__hint {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  animation: hint-bob 2.4s var(--ease) infinite;
}
@keyframes hint-bob {
  0%, 100% { transform: translateY(0); opacity: 0.65; }
  50% { transform: translateY(5px); opacity: 1; }
}

/* Idle "breathing" on the seal to invite a click */
.wax-seal { animation: seal-pulse 2.8s ease-in-out infinite; }
@keyframes seal-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.05); }
}

/* ----- OPEN STATE ----- */
.envelope-scene.is-open .wax-seal {
  animation: none;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
}
.envelope-scene.is-open .envelope__flap {
  transform: rotateX(180deg);
  z-index: 0;
  transition: transform 0.9s var(--ease), z-index 0s linear 0.45s;
}
.envelope-scene.is-open .envelope__letter {
  transform: translateY(-78%) scale(1.02);
}
.envelope-scene.is-open .envelope__hint { opacity: 0; animation: none; }

/* ----- GONE STATE (zoom + fade the envelope away, handing off to the card) -----
   Pin to the viewport centre so it stays put (no jump) while it fades/zooms out. */
.envelope-scene.is-gone {
  position: fixed;
  inset: 0;
  align-content: center;
  opacity: 0;
  transform: scale(1.12);
  pointer-events: none;
}

/* ============================ INVITATION =============================== */

.invitation {
  width: min(92vw, 620px);
  /* Kept out of flow until opened so the landing page is just the envelope. */
  display: none;
  align-self: start;
  pointer-events: none;
}
.invitation.is-visible {
  display: block;
  pointer-events: auto;
  animation: inviteIn 0.9s var(--ease) 0.15s both;
}
@keyframes inviteIn {
  from { opacity: 0; transform: translateY(22px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

.invitation__inner {
  background:
    linear-gradient(180deg, var(--white), #fbf4e8);
  border-radius: 18px;
  padding: clamp(24px, 5vw, 46px);
  box-shadow: 0 30px 60px -22px var(--shadow);
  border: 1px solid rgba(201, 165, 92, 0.35);
  position: relative;
}
.invitation__inner::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(201, 165, 92, 0.35);
  border-radius: 12px;
  pointer-events: none;
}

/* Staggered reveal for each block */
.reveal {
  opacity: 0;
  transform: translateY(16px);
}
.invitation.is-visible .reveal {
  animation: rise 0.7s var(--ease) forwards;
  animation-delay: calc(0.25s + var(--i) * 0.18s);
}
@keyframes rise {
  to { opacity: 1; transform: none; }
}

.invitation__header { text-align: center; }
.eyebrow {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.couple {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(2.6rem, 11vw, 4.4rem);
  line-height: 1.05;
  color: var(--gold);
  margin: 0 0 10px;
}
.event-line {
  font-size: clamp(1rem, 3.4vw, 1.3rem);
  letter-spacing: 0.04em;
  margin: 2px 0;
}
.event-line--muted { color: var(--ink-soft); font-style: italic; }

.divider {
  text-align: center;
  color: var(--gold-light);
  font-size: 1.1rem;
  margin: 22px 0;
  position: relative;
}
.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light));
}
.divider::before { left: 4%; }
.divider::after { right: 4%; transform: scaleX(-1); }

/* -------- Bible verse -------- */
.verse {
  margin: 0 auto 22px;
  max-width: 34rem;
  text-align: center;
  position: relative;
  padding: 6px 18px 0;
}
.verse__text {
  margin: 0 0 10px;
  font-style: italic;
  font-size: clamp(1.05rem, 3.4vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink);
}
.verse__text::before { content: "\201C"; }
.verse__text::after { content: "\201D"; }
.verse__ref {
  display: block;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

/* -------- Video -------- */
.video { margin: 0 0 8px; }
.video__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #efe4d4;
  box-shadow: 0 12px 26px -12px var(--shadow);
}
.video__frame iframe,
.video__el {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video__el { object-fit: cover; background: #000; }

.video__unmute {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--white);
  background: rgba(89, 0, 10, 0.82);
  border: 1px solid rgba(201, 165, 92, 0.6);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: transform 0.15s var(--ease), background 0.2s;
}
.video__unmute:hover { transform: translateY(-1px); background: rgba(89, 0, 10, 0.95); }
.video__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.video__caption {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 10px;
  font-size: 0.98rem;
}

/* -------- Details (location, QR, dress code) -------- */
.details {
  margin-top: 30px;
  padding: 22px clamp(16px, 4vw, 28px);
  border: 1px solid rgba(201, 165, 92, 0.4);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(201, 165, 92, 0.06), transparent);
}
.details__heading {
  text-align: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.3rem, 4.4vw, 1.7rem);
  color: var(--ink);
  margin: 0 0 20px;
}
.details__label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--olive);
  margin: 0 0 8px;
}

/* Two location cards (church + reception) */
.venues {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 560px) {
  .venues { grid-template-columns: 1fr; }
}
.venue-card {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 9px;
  padding: 20px 16px;
  border: 1px solid rgba(201, 165, 92, 0.4);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(201, 165, 92, 0.05));
}
.venue-card__label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--olive);
  margin: 0;
}
.venue-card__name {
  font-size: clamp(1.05rem, 3.2vw, 1.22rem);
  color: var(--ink);
  margin: 0;
  min-height: 2.7em;
  display: grid;
  align-content: center;
}
.venue-card__time {
  margin: 0 0 2px;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.venue-card__qr {
  width: 140px;
  height: 140px;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 16px -8px var(--shadow);
}
.venue-card__caption {
  margin: 0 0 4px;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.details__map-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--white);
  background: linear-gradient(135deg, #7a0512, var(--burgundy));
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 16px -8px rgba(89, 0, 10, 0.55);
  transition: transform 0.15s var(--ease), filter 0.2s;
}
.details__map-btn:hover { transform: translateY(-2px); filter: brightness(1.06); }

.details__dress {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(201, 165, 92, 0.35);
  text-align: center;
}
.details__dress p {
  margin: 0;
  font-size: clamp(1rem, 3.4vw, 1.2rem);
  font-style: italic;
  color: var(--ink);
}

/* -------- RSVP form -------- */
.rsvp { margin-top: 26px; }
.rsvp__title {
  font-family: var(--font-serif);
  font-weight: 600;
  text-align: center;
  font-size: clamp(1.5rem, 5vw, 2rem);
  margin: 0 0 4px;
}
.rsvp__deadline {
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 22px;
}

.rsvp__form { display: grid; gap: 18px; }

.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; }
.field label,
.field legend {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  padding: 0;
}
.field .optional { color: var(--ink-soft); font-weight: 400; }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"] {
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid rgba(201, 165, 92, 0.5);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 106, 0.25);
}
.field input.invalid { border-color: #b3564f; box-shadow: 0 0 0 3px rgba(179, 86, 79, 0.18); }

.field--choice legend { margin-bottom: 10px; }
.choice { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 420px) { .choice { grid-template-columns: 1fr; } }
.choice__option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  text-align: center;
  padding: 14px 12px;
  min-height: 52px;
  border: 1px solid rgba(201, 165, 92, 0.5);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.choice__option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice__option:has(input:checked) {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: var(--white);
}
.choice__option:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(201, 168, 106, 0.35); }

.field__error {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  color: #b3564f;
  min-height: 0;
}

.btn {
  position: relative;
  margin-top: 6px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white);
  background: linear-gradient(135deg, #7a0512, var(--burgundy));
  border: 0;
  border-radius: 999px;
  padding: 15px 22px;
  min-height: 52px;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 10px 20px -8px rgba(89, 0, 10, 0.55);
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.04); }
.btn:active { transform: translateY(0); }
.btn:disabled { cursor: progress; filter: grayscale(0.1) brightness(0.98); }

.btn__spinner {
  display: none;
  width: 16px;
  height: 16px;
  margin-left: 10px;
  vertical-align: -3px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn.is-loading .btn__spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-status {
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  margin: 4px 0 0;
  min-height: 1.2em;
}
.form-status.is-error { color: #b3564f; }
.form-status.is-ok { color: #4c7a4c; }

/* ============================ THANK YOU ================================= */

.thankyou {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1000px 700px at 50% 20%, #fff8ef, var(--blush));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease), visibility 0s linear 0.6s;
  z-index: 20;
}
.thankyou.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s var(--ease);
}
.thankyou__card {
  text-align: center;
  max-width: 460px;
  transform: translateY(14px);
  transition: transform 0.7s var(--ease);
}
.thankyou.is-visible .thankyou__card { transform: none; }
.thankyou__heart {
  font-size: 3rem;
  color: var(--burgundy);
  animation: heartbeat 1.4s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.18); }
  45% { transform: scale(1); }
}
.thankyou__card h2 {
  font-family: var(--font-script);
  font-weight: 400;
  color: var(--gold);
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  margin: 6px 0 10px;
}
.thankyou__card p {
  font-size: clamp(1.05rem, 3.6vw, 1.25rem);
  color: var(--ink);
  margin: 0;
}

/* ============================ PETALS =================================== */
.petals { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.petal {
  position: absolute;
  top: -6vh;
  width: 12px;
  height: 12px;
  background: radial-gradient(circle at 30% 30%, #e3c3bf, var(--rose));
  border-radius: 60% 0 60% 0;
  opacity: 0.55;
  animation: fall linear infinite;
}
@keyframes fall {
  0% { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(112vh) rotate(360deg); }
}

/* ======================= REDUCED MOTION =============================== */
@media (prefers-reduced-motion: reduce) {
  .envelope__flap,
  .envelope__letter,
  .wax-seal,
  .envelope-scene,
  .invitation,
  .reveal,
  .thankyou,
  .thankyou__card { transition-duration: 0.001s !important; animation: none !important; }
  .invitation.is-visible .reveal { opacity: 1; transform: none; }
  .petals { display: none; }
  .envelope__hint { animation: none; }
}
