/* =================================================================
   Invitation Emmett — interactive RSVP
   Palette inspired by the printed invitation: deep navy + cream + gold
   ================================================================= */

:root {
  --navy: #0b1f3d;
  --navy-2: #0d2548;
  --navy-deep: #06152b;
  --cream: #ede4c8;
  --cream-soft: #e1d6b4;
  --gold: #d4b673;
  --gold-deep: #b69553;
  --shadow: 0 30px 80px -20px rgba(0,0,0,.6), 0 10px 30px -10px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Cormorant Garamond", serif;
  color: var(--cream);
  background:
    radial-gradient(120% 80% at 50% 0%, #14315c 0%, #0a1f3d 40%, #050f1f 100%);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.04), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(212,182,115,.05), transparent 45%);
  pointer-events: none;
  z-index: 0;
}
.stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(237,228,200,.45), transparent 60%),
    radial-gradient(1px 1px at 78% 24%, rgba(237,228,200,.35), transparent 60%),
    radial-gradient(1px 1px at 35% 70%, rgba(237,228,200,.4), transparent 60%),
    radial-gradient(1px 1px at 88% 82%, rgba(237,228,200,.3), transparent 60%),
    radial-gradient(1px 1px at 60% 12%, rgba(237,228,200,.3), transparent 60%),
    radial-gradient(1px 1px at 5% 60%, rgba(237,228,200,.4), transparent 60%);
}
#root { position: relative; z-index: 1; }
button { font-family: inherit; cursor: pointer; }
input, button, textarea { font-family: inherit; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.page { position: relative; min-height: 100dvh; }

/* ============= LAYER MANAGEMENT =============
   The card scene mounts under the envelope so the handoff is a true
   cross-fade — no remount, no blink.  The flying invitation lives at
   App root with a fixed position and is repositioned via GSAP.       */

.card-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .9s cubic-bezier(.4,.0,.2,1);
  will-change: opacity;
}
.card-layer.is-visible { opacity: 1; pointer-events: auto; }
.card-layer.is-hidden  { display: none; }

.env-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 80px;
  position: relative;
}

/* ============================================================
   TWO INDEPENDENT CONCERNS — DO NOT MIX THEIR CSS.

   1. FLIP MECHANISM  (.flip-wrap / .flip-inner / .flip-face-*)
      A textbook W3Schools card-flip.  Knows nothing about
      envelopes; it just flips its two faces.

   2. ENVELOPE        (.envelope / .env-*)
      The CodePen 4-flap envelope, rendered as a single self-
      contained unit.  Used as the content of the flip's back
      face but works on its own too.
   ============================================================ */

.env-scene { gap: 28px; }

/* ---------- 1. FLIP MECHANISM ---------- */

.flip-wrap {
  width: min(82vw, 540px);
  aspect-ratio: 3 / 2;
  position: relative;
  perspective: 1800px;
  /* Drop-shadow lives on the wrap (not on .flip-inner) — .flip-inner
     has transform-style: preserve-3d, and `filter` would force the
     browser to rasterize it into a flat 2D layer, breaking the 3D
     chain for everything inside (the back face would stay hidden in
     both phases).  .flip-wrap has no preserve-3d, so it's safe here. */
  filter: drop-shadow(0 30px 40px rgba(0,0,0,.55));
  animation: env-float 6s ease-in-out infinite;
  transition: opacity 1s cubic-bezier(.4,.0,.2,1), transform 1.2s cubic-bezier(.4,.0,.2,1);
}
.flip-wrap.is-opening { animation: none; }
.flip-wrap.is-leaving {
  opacity: 0;
  transform: translateY(40px) scale(.92);
  pointer-events: none;
}
@keyframes env-float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}

.flip-inner {
  all: unset;
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(.5,.0,.3,1);
  cursor: pointer;
  /* NO filter / opacity / mask here — those force the browser to
     rasterize this element into a flat 2D layer, which kills
     preserve-3d for descendants.  Drop-shadow lives on .flip-wrap. */
}
.flip-inner:disabled { cursor: default; }
.flip-wrap.is-opening .flip-inner {
  transform: rotateY(180deg);
}

.flip-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 4px;
}
.flip-face-front { overflow: hidden; }
.flip-face-back {
  transform: rotateY(180deg);
  /* deliberately NO preserve-3d here.  Combining preserve-3d with the
     inherited backface-visibility: hidden makes Safari/Chrome flatten
     the element and compute backface from its OWN rotateY(180) alone
     — which keeps the back face hidden in both phases.  The envelope
     inside establishes its own perspective + preserve-3d so the
     top-flap's rotateX still renders in 3D. */
}

/* Belt-and-suspenders: snap the front face to opacity 0 the moment
   the flip crosses 90°, so its content can never leak through onto
   the back face if a browser fails to honour backface-visibility on
   a descendant. */
.flip-wrap.is-opening .flip-face-front {
  opacity: 0;
  transition: opacity 0.01s linear 0.425s;
}

/* Decoration for the addressed front of the flip card. */
.flip-face-front {
  background: linear-gradient(180deg, #102b54 0%, #0a1f3d 60%, #06152a 100%);
  box-shadow:
    inset 0 0 0 1px rgba(212,182,115,.22),
    inset 0 0 80px rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8% 10%;
  color: var(--cream);
  text-align: center;
}
.flip-face-front::before {
  content: "";
  position: absolute; inset: 14px;
  pointer-events: none;
  background:
    linear-gradient(var(--gold), var(--gold)) top left / 18px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top left / 1px 18px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top right / 18px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top right / 1px 18px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom left / 18px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom left / 1px 18px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom right / 18px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom right / 1px 18px no-repeat;
  opacity: .55;
}
.flip-front-to-label {
  font-family: "Pinyon Script", cursive;
  font-size: clamp(14px, 2.6vw, 22px);
  color: var(--gold);
  margin-bottom: 4px;
  line-height: 1;
}
.flip-front-to-name {
  font-family: "Pinyon Script", cursive;
  font-size: clamp(26px, 4.5vw, 42px);
  color: var(--cream);
  line-height: 1.15;
  max-width: 92%;
  margin: 0 auto;
  word-spacing: .15em;
}
.flip-front-rule {
  width: 60%; height: 1px;
  margin: 14px auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.flip-front-tagline {
  font-family: "Cormorant SC", serif;
  font-size: clamp(8px, 1.4vw, 12px);
  letter-spacing: .32em;
  color: var(--cream-soft);
  opacity: .85;
}

/* Stamp, upper-right corner of the front face. */
.flip-front-stamp {
  position: absolute;
  top: 5%;
  right: 5%;
  transform: rotate(6deg);
  pointer-events: none;
}
.flip-front-stamp-inner {
  width: 64px;
  height: 80px;
  border: 1.5px dashed rgba(212,182,115,.7);
  padding: 6px;
  font-family: "Cormorant SC", serif;
  font-size: 9px;
  letter-spacing: .14em;
  color: var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(20,49,92,.4);
}
.flip-front-stamp-inner .dot {
  font-size: 12px;
  margin: 2px 0;
}

/* ---------- 2. ENVELOPE ---------- */
/* Fills its container.  Used here as the content of .flip-face-back,
   but it has no knowledge of the flip — drop it anywhere of any size
   and it renders a sealed 4-flap envelope.

   The envelope has its OWN perspective + preserve-3d so the top-flap
   can rotate in 3D at Phase 2 even though .flip-face-back is flat
   (per the strict W3Schools recipe). */
.envelope {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  border-radius: 4px;
  perspective: 1000px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}
/* Because .envelope has its own preserve-3d, its children render
   independently in 3D and don't automatically hide together with
   .flip-face-back at Phase 0.  Give each child its own
   backface-visibility: hidden so they hide while their composed
   rotation (rotateY 180 from the back face) is back-facing.

   .env-top is the one exception — GSAP rotates it rotateX 180 at
   Phase 2 to fold it open, and we want it to stay visible after the
   rotation (its back is the same solid colour, like the CodePen).
   Excluding it via :not() keeps it visible through the open animation. */
.envelope > *:not(.env-top) {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* The card inside the envelope — sits BEHIND every flap (z:1).
   Aspect-ratio matches the invitation JPEG, so the image fills it
   with no cropping.  GSAP slides + scales it during the opening. */
.env-card {
  position: absolute;
  top: 6%;
  left: 6%;
  width: 88%;
  aspect-ratio: 1600 / 1126;
  background-color: #06152a;
  border-radius: 4px;
  z-index: 1;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(0,0,0,.55);
  pointer-events: none;
}
.env-card-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

/* Top flap (the opening one).  Triangle pointing DOWN whose apex
   meets the side flaps at the centre.  Rotates 180° forward on its
   top edge to fold open.  transform-origin is set in CSS so the
   pivot is locked the moment .env-top is first painted — GSAP
   manipulates the rotation only, not the origin. */
.env-top {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 65%;
  background: linear-gradient(180deg, #102b54 0%, #0a1f3d 100%);
  z-index: 10;
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  box-shadow: 0 6px 14px rgba(0,0,0,.4);
  pointer-events: none;
  transform-origin: top center;
}

/* Right side flap. */
.env-right {
  position: absolute;
  right: 0; top: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(180deg, #0d2549 0%, #06152a 100%);
  z-index: 5;
  clip-path: polygon(100% 0, 0 51%, 100% 100%);
  pointer-events: none;
}
/* Bottom flap. */
.env-bottom {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #0a1f3d 0%, #050f1f 100%);
  z-index: 5;
  clip-path: polygon(0 99%, 50% 0, 100% 100%);
  pointer-events: none;
}
/* Left side flap. */
.env-left {
  position: absolute;
  top: 0; left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(180deg, #0d2549 0%, #06152a 100%);
  z-index: 5;
  clip-path: polygon(0 0, 100% 50%, 0 101%);
  pointer-events: none;
}

/* Faint gold seam lines along the flap joins. */
.env-seam {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background:
    /* top-left → centre */
    linear-gradient(135deg, transparent calc(50% - 0.5px), rgba(212,182,115,.18) 50%, transparent calc(50% + 0.5px)) 0 0 / 50% 100% no-repeat,
    /* top-right → centre */
    linear-gradient(45deg,  transparent calc(50% - 0.5px), rgba(212,182,115,.18) 50%, transparent calc(50% + 0.5px)) 100% 0 / 50% 100% no-repeat;
  opacity: .8;
}

/* Wax seal — centred where the four flaps meet, sits ABOVE the top
   flap (z:11) so it reads as sealing it shut.  transform-origin
   matches the flap (top edge), so when both rotate rotateX 180 in
   parallel at Phase 2 the seal feels glued to the flap rather than
   flipping in place. */
.env-seal {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: top center;
  width: 17%;
  aspect-ratio: 1;
  z-index: 11;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.45));
  pointer-events: none;
}
.env-seal-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e7c789 0%, #c9a55b 35%, #8c6c2c 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: "Cormorant SC", serif;
  font-weight: 600;
  color: #3a2710;
  letter-spacing: .12em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), inset 0 -3px 6px rgba(0,0,0,.3);
  position: relative;
}
.env-seal-inner::before {
  content: "";
  position: absolute; inset: 6%;
  border: 1px dashed rgba(58,39,16,.45);
  border-radius: 50%;
}
.env-seal-inner span {
  position: relative;
  z-index: 1;
  font-size: clamp(6px, 0.95vw, 9px);
  letter-spacing: .04em;
  text-align: center;
  line-height: 1.15;
  padding: 0 14%;
  text-transform: uppercase;
}

/* The shadow under the envelope — GSAP scales it as the card lifts
   away to suggest the card has separated from the envelope. */
.env-shadow {
  position: absolute;
  bottom: -8%;
  left: 25%;
  width: 50%;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.55), transparent 65%);
  z-index: 0;
  pointer-events: none;
}

/* ---------- DEBUG STEP CONTROLS ---------- */
.env-debug {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 49, 92, .55);
  border: 1px solid rgba(212, 182, 115, .25);
  font-family: "Cormorant SC", serif;
  font-size: 12px;
  letter-spacing: .18em;
  color: var(--cream-soft);
}
.env-debug-btn {
  all: unset;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(212, 182, 115, .35);
  color: var(--cream);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: .22em;
  transition: background .2s, border-color .2s, color .2s, opacity .2s;
}
.env-debug-btn:hover:not(:disabled) {
  background: rgba(212, 182, 115, .12);
  border-color: var(--gold);
  color: var(--gold);
}
.env-debug-btn:disabled {
  cursor: default;
  opacity: .35;
}
.env-debug-phase {
  font-size: 11px;
  color: var(--gold);
  opacity: .85;
  white-space: nowrap;
}

.env-hint {
  display: flex; align-items: center; gap: 10px;
  font-family: "Cormorant SC", serif;
  font-size: 13px; letter-spacing: .25em;
  color: var(--cream-soft); opacity: .8;
  animation: hint-pulse 2.4s ease-in-out infinite;
  transition: opacity .35s ease;
}
.is-opening ~ .env-hint, .env-hint.is-gone { opacity: 0 !important; }
.env-hint-arrow { font-size: 18px; color: var(--gold); }
@keyframes hint-pulse {
  0%,100% { opacity: .55; transform: translateY(0); }
  50%     { opacity: 1;   transform: translateY(-3px); }
}

/* ============= FLYING INVITATION (App root) =============
   A single absolute-positioned image is repositioned via GSAP from
   the .env-card slot to the .card-frame slot.  Hidden until the
   GSAP timeline reveals it during the handoff.

   We use position: absolute (not fixed) so once the image lands in
   the card-frame slot it scrolls with the document.  Coordinates
   passed to GSAP are document-relative (rect.top + window.scrollY).

   Initial width/height are 0 so the image never flashes at its
   natural 1600×1126 size before GSAP has had a chance to size it.
   max-width/height clamp against viewport as a final safety net. */
.invitation-img {
  position: absolute;
  left: 0; top: 0;
  width: 0;
  height: 0;
  max-width: 100vw;
  max-height: 100dvh;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55), 0 4px 12px rgba(0,0,0,.35);
  pointer-events: none;
  z-index: 50;
  transform-origin: top left;
  opacity: 0;
  will-change: transform, width, height, opacity;
}

/* ============= CARD SCENE ============= */
.card-scene {
  gap: 36px;
  padding-top: 56px;
  max-width: 1200px;
  margin: 0 auto;
  perspective: 1800px;
  /* Repeat the body's radial gradient on the card-scene itself so the
     section reads as a fresh "top" — otherwise the body's gradient is
     anchored to the document top and the area where the card lands
     ends up in the darker tail of the radial. */
  background: radial-gradient(120% 80% at 50% 0%, #14315c 0%, #0a1f3d 40%, #050f1f 100%);
}
.card-scene > * { opacity: 0; transition: opacity .55s ease .05s; }
.card-layer.is-visible .card-scene > * { opacity: 1; }

.card-hello {
  display: flex; align-items: center; gap: 18px;
  font-family: "Pinyon Script", cursive;
  font-size: clamp(24px, 4vw, 38px);
  color: var(--cream);
}
.hello-line {
  display: block;
  width: clamp(40px, 8vw, 90px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* The card-frame is just a sized placeholder — the real image is the
   absolute-positioned .invitation-img above, snapped to match this
   slot.  aspect-ratio matches the source JPEG (1600×1126) exactly
   so there is zero cropping when the flying image lands. */
.card-frame {
  width: min(92vw, 920px);
  aspect-ratio: 1600 / 1126;
  position: relative;
  border-radius: 6px;
  background: transparent;
}

.rsvp-block {
  width: min(95vw, 1100px);
  text-align: center;
}
.rsvp-eyebrow {
  font-family: "Cormorant SC", serif;
  letter-spacing: .35em;
  font-size: 12px;
  color: var(--gold);
  opacity: .9;
  margin-bottom: 8px;
}
.rsvp-title {
  margin: 0 0 10px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-style: italic;
  font-size: clamp(28px, 4.4vw, 42px);
  color: var(--cream);
}
.rsvp-sub {
  margin: 0 auto 32px;
  max-width: 620px;
  color: var(--cream-soft);
  opacity: .8;
  font-size: clamp(15px, 1.6vw, 18px);
}

.rsvp-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
}
@media (max-width: 820px) {
  .rsvp-grid { flex-direction: column; align-items: stretch; }
}

.rsvp-card {
  all: unset;
  display: block;
  flex: 1 1 280px;
  max-width: 340px;
  cursor: pointer;
  text-align: left;
  padding: 26px 24px 22px;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(20,49,92,.55) 0%, rgba(10,31,61,.55) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(212,182,115,.28),
    0 12px 24px rgba(0,0,0,.35);
  position: relative;
  transition: transform .35s ease, box-shadow .35s ease, background .35s ease;
  opacity: 0;
  animation: rsvp-pop .7s cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes rsvp-pop {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.rsvp-card::before {
  content:""; position:absolute; inset: 8px;
  pointer-events:none;
  background:
    linear-gradient(var(--gold), var(--gold)) top left / 14px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top left / 1px 14px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top right / 14px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top right / 1px 14px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom left / 14px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom left / 1px 14px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom right / 14px 1px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom right / 1px 14px no-repeat;
  opacity: .55;
}
.rsvp-card:hover {
  transform: translateY(-4px);
  box-shadow:
    inset 0 0 0 1px rgba(212,182,115,.55),
    0 18px 40px rgba(0,0,0,.5);
  background:
    linear-gradient(180deg, rgba(28,62,110,.7), rgba(14,38,72,.7));
}
.rsvp-card.is-yes {
  background: linear-gradient(180deg, rgba(35,72,52,.55), rgba(20,52,40,.55));
  box-shadow: inset 0 0 0 1px rgba(212,182,115,.4), 0 12px 24px rgba(0,0,0,.35);
}
.rsvp-card.is-no {
  background: linear-gradient(180deg, rgba(60,30,30,.5), rgba(36,18,18,.5));
}

.rc-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: "Cormorant SC", serif;
  font-size: 11px; letter-spacing: .2em;
  color: var(--cream-soft); opacity: .85;
  margin-bottom: 14px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); opacity: .55;
}
.dot-yes { background: #6dd29c; opacity: 1; }
.dot-no  { background: #d97a7a; opacity: 1; }

.rc-day {
  font-family: "Cormorant SC", serif;
  font-size: 12px; letter-spacing: .26em;
  color: var(--gold);
}
.rc-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(22px, 2.6vw, 28px);
  color: var(--cream);
  margin: 6px 0 8px;
  line-height: 1.1;
}
.rc-date, .rc-time {
  font-size: 16px; color: var(--cream-soft); opacity: .9;
}
.rc-place { margin-top: 12px; font-style: italic; color: var(--cream); }
.rc-addr  { font-size: 13px; color: var(--cream-soft); opacity: .75; line-height: 1.4; }
.rc-cta {
  margin-top: 20px;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: "Cormorant SC", serif;
  font-size: 12px; letter-spacing: .28em;
  color: var(--gold);
  border-bottom: 1px solid rgba(212,182,115,.4);
  padding-bottom: 4px;
  transition: gap .25s ease, color .25s ease;
}
.rsvp-card:hover .rc-cta { gap: 14px; color: #f0d896; }

.card-foot {
  font-family: "Cormorant SC", serif;
  letter-spacing: .35em;
  font-size: 11px;
  color: var(--gold);
  opacity: .6;
  display: flex; align-items: center; gap: 14px;
  margin-top: 16px;
}

/* ============= FORM ============= */
.form-scene { gap: 18px; padding-top: 56px; }
.form-enter .form-card {
  animation: form-in .6s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes form-in {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.form-back {
  align-self: flex-start;
  margin-left: max(24px, 5vw);
  background: none; border: none; color: var(--cream-soft);
  font-family: "Cormorant SC", serif;
  font-size: 12px; letter-spacing: .25em;
  padding: 8px 4px;
  opacity: .8; transition: opacity .2s, transform .2s;
}
.form-back:hover { opacity: 1; transform: translateX(-3px); }

.form-card {
  width: min(92vw, 560px);
  background:
    linear-gradient(180deg, rgba(20,49,92,.6), rgba(10,31,61,.6));
  border-radius: 6px;
  padding: 38px clamp(22px, 4vw, 44px) 32px;
  box-shadow:
    inset 0 0 0 1px rgba(212,182,115,.32),
    0 30px 70px -20px rgba(0,0,0,.7);
  position: relative;
}
.form-card::before, .form-card::after {
  content:""; position:absolute; width: 26px; height: 26px;
  border: 1px solid var(--gold); opacity:.6;
}
.form-card::before { top: 8px; left: 8px;  border-right:none; border-bottom:none; }
.form-card::after  { bottom: 8px; right: 8px; border-left:none; border-top:none; }

.form-eyebrow {
  font-family: "Cormorant SC", serif;
  letter-spacing: .3em; font-size: 11px;
  color: var(--gold); opacity: .9;
  text-align: center;
}
.form-title {
  margin: 6px 0 4px;
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-style: italic;
  font-size: clamp(28px, 4vw, 38px);
  color: var(--cream);
}
.form-place {
  text-align: center;
  font-size: 14px;
  color: var(--cream-soft); opacity: .75;
  margin-bottom: 22px;
}

.form-body { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(212,182,115,.25);
  border-radius: 4px;
  padding: 4px;
  gap: 4px;
}
.seg-btn {
  all: unset;
  text-align: center;
  padding: 12px 10px;
  font-family: "Cormorant SC", serif;
  font-size: 12px; letter-spacing: .2em;
  color: var(--cream-soft); opacity: .7;
  cursor: pointer;
  border-radius: 3px;
  transition: background .25s, color .25s, opacity .25s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.seg-btn:hover { opacity: 1; }
.seg-btn.active {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: #1a1408; opacity: 1;
}
.seg-mark { font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: "Cormorant SC", serif;
  font-size: 11px; letter-spacing: .26em;
  color: var(--cream-soft); opacity: .85;
}
.field-label em { font-style: italic; opacity: .6; letter-spacing: .1em; }
.field-hint { font-size: 13px; color: var(--cream-soft); opacity: .65; font-style: italic; }
.field input, .field textarea {
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(212,182,115,.28);
  border-radius: 3px;
  padding: 12px 14px;
  color: var(--cream);
  font-size: 17px;
  font-family: "Cormorant Garamond", serif;
  transition: border-color .25s, background .25s;
}
.field input:focus, .field textarea:focus {
  border-color: var(--gold);
  background: rgba(0,0,0,.35);
}
.field textarea { resize: vertical; line-height: 1.4; }

.counter {
  display: inline-grid;
  grid-template-columns: 44px 64px 44px;
  align-items: center;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(212,182,115,.28);
  border-radius: 3px;
  width: max-content;
}
.counter button {
  all: unset;
  height: 44px; cursor: pointer;
  text-align: center;
  font-size: 22px; color: var(--gold);
  transition: background .2s;
}
.counter button:hover { background: rgba(212,182,115,.12); }
.counter-value {
  text-align: center;
  font-size: 22px; color: var(--cream);
  border-left: 1px solid rgba(212,182,115,.2);
  border-right: 1px solid rgba(212,182,115,.2);
  height: 44px; line-height: 44px;
}

.form-actions {
  display: flex; gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}
.btn {
  font-family: "Cormorant SC", serif;
  font-size: 12px; letter-spacing: .25em;
  padding: 13px 22px;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: transform .2s, background .25s, color .25s, box-shadow .25s;
}
.btn.primary {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: #1a1408;
  box-shadow: 0 8px 24px rgba(212,182,115,.18);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(212,182,115,.28); }
.btn.ghost {
  background: transparent;
  color: var(--cream-soft);
  border-color: rgba(212,182,115,.35);
}
.btn.ghost:hover { color: var(--cream); border-color: var(--gold); }

/* ============= THANKS ============= */
.thanks-scene { gap: 16px; padding-top: 80px; position: relative; }
.thanks-enter .thanks-card {
  animation: form-in .8s cubic-bezier(.2,.7,.2,1) both;
}
.thanks-card {
  width: min(92vw, 620px);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(20,49,92,.6), rgba(10,31,61,.6));
  border-radius: 6px;
  padding: 44px clamp(22px, 4vw, 50px) 36px;
  box-shadow:
    inset 0 0 0 1px rgba(212,182,115,.32),
    0 30px 70px -20px rgba(0,0,0,.7);
  position: relative;
  z-index: 1;
}
.thanks-mark {
  color: var(--gold);
  margin-bottom: 14px;
  display: inline-block;
}
.thanks-mark .check-path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw 1s ease forwards .3s;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.thanks-eyebrow {
  font-family: "Cormorant SC", serif;
  font-size: 12px; letter-spacing: .3em;
  color: var(--gold); opacity: .9;
  margin-bottom: 6px;
}
.thanks-headline {
  margin: 4px 0 12px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-style: italic;
  font-size: clamp(30px, 4.6vw, 44px);
  color: var(--cream);
  line-height: 1.15;
}
.thanks-sub {
  color: var(--cream-soft); opacity: .85;
  font-size: clamp(15px, 1.7vw, 17px);
  line-height: 1.55;
  margin: 0 auto 24px;
  max-width: 460px;
}

.thanks-recap {
  display: flex; flex-direction: column;
  gap: 8px;
  text-align: left;
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(212,182,115,.2);
  border-radius: 3px;
  padding: 16px 20px;
  margin-bottom: 22px;
}
.recap-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 15px;
  border-bottom: 1px dashed rgba(212,182,115,.15);
  padding-bottom: 6px;
}
.recap-row:last-child { border-bottom: none; padding-bottom: 0; }
.recap-row span {
  font-family: "Cormorant SC", serif;
  font-size: 11px; letter-spacing: .25em;
  color: var(--cream-soft); opacity: .7;
  align-self: center;
}
.recap-row strong { color: var(--cream); font-weight: 500; }

.thanks-next { margin-bottom: 18px; }
.next-label {
  font-family: "Cormorant SC", serif;
  font-size: 11px; letter-spacing: .25em;
  color: var(--cream-soft); opacity: .8;
  margin-bottom: 12px;
}
.next-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.next-pill {
  all: unset;
  cursor: pointer;
  padding: 10px 16px;
  border: 1px solid rgba(212,182,115,.4);
  border-radius: 999px;
  font-size: 14px; color: var(--cream);
  transition: background .25s, border-color .25s, transform .25s;
}
.next-pill:hover {
  background: rgba(212,182,115,.12);
  border-color: var(--gold);
  transform: translateY(-2px);
}
.next-pill span { color: var(--gold); margin-left: 6px; }
.thanks-next.done .next-label { color: var(--gold); opacity: .9; font-size: 13px; letter-spacing: .2em; }

.thanks-actions { display: flex; justify-content: center; }

/* confetti */
.confetti {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.confetti .bit {
  position: absolute; top: -10%;
  border-radius: 1px;
  animation-name: fall;
  animation-timing-function: ease-in;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
  opacity: 0;
}
.confetti .bit.gold  { background: var(--gold); }
.confetti .bit.cream { background: var(--cream); }
@keyframes fall {
  0%   { opacity: 0; top: -10%; }
  10%  { opacity: 1; }
  100% { opacity: 0; top: 110%; transform: rotate(540deg) translateX(40px); }
}

@media (prefers-reduced-motion: reduce) {
  .flip-wrap { animation: none; }
  .flip-inner { transition-duration: .01s; }
  .rsvp-card { animation-duration: .01s; }
}

/* loading + error */
.page-loading {
  display: grid; place-items: center;
  min-height: 100dvh;
  padding: 24px;
}
.loading-card {
  text-align: center;
  max-width: 460px;
  padding: 36px 28px;
  border: 1px solid rgba(212,182,115,.25);
  border-radius: 14px;
  background: rgba(11,31,61,.55);
  backdrop-filter: blur(6px);
}
.loading-spark {
  font-size: 28px; color: var(--gold);
  margin-bottom: 12px;
  animation: sparkPulse 2.4s ease-in-out infinite;
}
.loading-text {
  color: var(--cream-soft);
  font-size: 17px;
  line-height: 1.45;
}
@keyframes sparkPulse {
  0%,100% { opacity: .5; transform: scale(1); }
  50%     { opacity: 1;  transform: scale(1.15); }
}

.form-error {
  padding: 10px 14px;
  border: 1px solid rgba(220,80,80,.4);
  background: rgba(220,80,80,.12);
  color: #f3c0c0;
  border-radius: 8px;
  font-size: 15px;
}

