/* =========================================================
   Kiran & Magda — Surprise Engagement Invitation
   ========================================================= */

:root {
  /* ----- Palette ----- */
  --cream: #FAF6F0;
  --blush: #EDD5C0;
  --rose:  #C4856A;
  --deep:  #3A2820;
  --gold:  #C9A96E;
  --gold-light: #EFE0C0;
  --text:  #4A3228;
  --muted: #8C6B5C;

  /* ----- Type ----- */
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans:  "Jost", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;

  /* ----- Layout ----- */
  --maxw: 1180px;
  --readw: 640px;
  --pad-x: clamp(20px, 5vw, 56px);

  /* ----- Motion ----- */
  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================================
   Reset + base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-weight: 400;
  color: var(--text);
  background: var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, figure { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
input, textarea, select, button { font: inherit; color: inherit; }

/* =========================================================
   Reusable bits
   ========================================================= */
.kicker {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0 0 18px;
}

.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 4.4vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--deep);
  margin: 0 0 28px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   HERO — typographic
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px var(--pad-x) 72px;
  overflow: hidden;
  isolation: isolate;
}

/* Warm layered background: linen base + two soft vignettes */
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse at 18% 22%, rgba(237, 213, 192, 0.85) 0%, transparent 52%),
    radial-gradient(ellipse at 82% 78%, rgba(239, 224, 192, 0.75) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 110%, rgba(196, 133, 106, 0.18) 0%, transparent 60%),
    linear-gradient(178deg, #FBF7F1 0%, #F4E7D8 60%, #EDD5C0 100%);
}

/* SVG paper grain — subtle, very slow drift for life */
.hero__grain {
  position: absolute;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.23  0 0 0 0 0.16  0 0 0 0 0.13  0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 320px 320px;
  animation: grain-drift 24s ease-in-out infinite alternate;
}

@keyframes grain-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-12px, 8px, 0); }
}

.hero__inner {
  text-align: center;
  max-width: 1040px;
  position: relative;
}

.hero__eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0 0 36px;
}

.hero__title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(68px, 16vw, 196px);
  line-height: 0.92;
  letter-spacing: -0.01em;
  color: var(--deep);
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.hero__name {
  display: block;
}

.hero__amp {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--gold);
  font-size: 0.58em;
  line-height: 1;
  margin: -0.06em 0 -0.02em;
  display: block;
}

/* Ornamental rule — hairline / dot / hairline */
.hero__ornament {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 6px 0 28px;
}
.hero__rule {
  display: block;
  width: clamp(48px, 9vw, 92px);
  height: 1px;
  background: var(--gold);
  opacity: 0.7;
}
.hero__dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  transform: rotate(45deg);
  border-radius: 1px;
}

.hero__subtitle {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--deep);
  opacity: 0.78;
  margin: 0 0 18px;
}

.hero__date {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(17px, 2vw, 20px);
  color: var(--muted);
  margin: 0 0 60px;
}

.hero__scroll {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--deep);
  text-decoration: none;
  padding: 13px 24px;
  border: 1px solid rgba(58, 40, 32, 0.28);
  border-radius: 999px;
  background: rgba(250, 246, 240, 0.5);
  backdrop-filter: blur(4px);
  transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}
.hero__scroll:hover {
  background: rgba(250, 246, 240, 0.85);
  border-color: rgba(58, 40, 32, 0.45);
  transform: translateY(-2px);
}
.hero__scroll svg { transition: transform 0.3s ease; }
.hero__scroll:hover svg { transform: translateY(3px); }

@media (prefers-reduced-motion: reduce) {
  .hero__grain { animation: none; }
}

/* =========================================================
   MESSAGE
   ========================================================= */
.message {
  padding: 104px var(--pad-x) 92px;
  text-align: center;
}

.message__inner {
  max-width: 620px;
  margin: 0 auto;
}

.message__title {
  font-style: italic;
  margin: 0 0 32px;
}

.message__body {
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.75;
  color: var(--text);
  margin: 0 auto 8px;
  max-width: 520px;
}

.message__names {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 3.6vw, 32px);
  font-weight: 500;
  color: var(--deep);
  letter-spacing: -0.005em;
  line-height: 1.3;
  margin: 36px auto 36px;
}

.message__names em {
  font-style: italic;
  color: var(--gold);
  font-weight: 400;
}

/* =========================================================
   DETAILS
   ========================================================= */
.details {
  padding: 80px var(--pad-x);
  background: var(--gold-light);
}

.details__inner {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.details__grid {
  margin: 12px 0 0;
  padding: 0;
  text-align: left;
}

.details__row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px solid rgba(58, 40, 32, 0.12);
}
.details__row:last-child { border-bottom: none; }

.details__row dt {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0;
}
.details__row dd {
  font-family: var(--serif);
  font-size: clamp(20px, 2.4vw, 24px);
  color: var(--deep);
  margin: 0;
  line-height: 1.35;
}

.details__note {
  display: inline;
  font-family: var(--sans);
  font-size: 14px;
  font-style: normal;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}

@media (max-width: 640px) {
  .details__row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 20px 0;
  }
}

/* =========================================================
   RSVP
   ========================================================= */
.rsvp {
  padding: 96px var(--pad-x);
}

.rsvp__inner {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.rsvp__lede {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--muted);
  margin: 0 0 40px;
}

.rsvp__form {
  text-align: left;
  display: grid;
  gap: 22px;
}
.rsvp__form[hidden] { display: none; }

.rsvp__honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.field { display: grid; gap: 8px; }
.field--toggle { border: none; padding: 0; margin: 0; }
.field--toggle legend {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0 0 10px;
  padding: 0;
}

.field label,
.field > legend {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rose);
}
.field__opt {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: none;
  font-size: 11px;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--cream);
  border: 1px solid rgba(58, 40, 32, 0.18);
  border-radius: 3px;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--deep);
  transition: border-color 0.2s ease, background 0.2s ease;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--rose);
  background: #fff;
}
textarea { resize: vertical; min-height: 100px; }

/* Custom radio toggle */
.toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.toggle input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.toggle label {
  display: block;
  text-align: center;
  padding: 14px 16px;
  border: 1px solid rgba(58, 40, 32, 0.18);
  border-radius: 3px;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--muted);
  background: var(--cream);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.25s ease;
}
.toggle label:hover { border-color: var(--rose); color: var(--deep); }
.toggle input:checked + label {
  background: var(--deep);
  border-color: var(--deep);
  color: var(--cream);
}
.toggle input:focus-visible + label {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Conditional fields reveal */
.conditional {
  display: grid;
  gap: 22px;
  overflow: hidden;
  transition: grid-template-rows 0.45s ease, opacity 0.35s ease, margin 0.35s ease;
}
.conditional[hidden] {
  display: none;
}
.conditional.is-opening,
.conditional.is-open {
  display: grid;
}
.conditional.is-opening {
  animation: slideOpen 0.45s ease forwards;
}

@keyframes slideOpen {
  from { opacity: 0; transform: translateY(-6px); max-height: 0; }
  to   { opacity: 1; transform: translateY(0);     max-height: 600px; }
}

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 28px;
  border: none;
  border-radius: 3px;
  background: var(--deep);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  transition: background 0.25s ease, transform 0.2s ease;
  margin-top: 8px;
}
.btn:hover { background: #2a1c16; transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

.rsvp__status {
  margin: 4px 0 0;
  min-height: 1.2em;
  font-size: 14px;
  color: var(--rose);
  text-align: center;
}
.rsvp__status.is-error { color: #a13a2a; }

/* Thank-you state */
.rsvp__thanks {
  text-align: center;
  padding: 16px 0;
  animation: fadeUp 0.6s ease both;
}
.rsvp__thanks h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(26px, 3.4vw, 34px);
  color: var(--deep);
  margin: 0 0 14px;
}
.rsvp__thanks p {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--muted);
  max-width: 440px;
  margin: 0 auto;
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  padding: 80px var(--pad-x);
  text-align: center;
  background: var(--deep);
  color: var(--cream);
}
.footer__quote {
  font-family: var(--serif);
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--gold-light);
  margin: 0 0 32px;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}
.footer__names {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: 0.02em;
  color: var(--gold);
  margin: 0 0 8px;
}
.footer__date {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.4em;
  color: rgba(239, 224, 192, 0.6);
  margin: 0;
}

/* =========================================================
   Scroll reveal animation
   ========================================================= */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.95s var(--ease-out-expo),
    transform 0.95s var(--ease-out-expo);
  transition-delay: var(--d, 0s);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Details rows: enter as a list being set down — slight horizontal nudge */
.details__row.reveal {
  transform: translate(-10px, 18px);
}
.details__row.reveal.is-visible {
  transform: translate(0, 0);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Hero curtain — continuous hand-off from envelope
   ========================================================= */
/* Hero curtain elements stay hidden until <body> drops the .envelope-pending
   class (set on load if the envelope is mounted, removed at the hand-off
   moment in main.js). If JS fails or the envelope is absent, they're
   visible by default — no broken page. */
.curtain {
  transition:
    opacity 1.15s var(--ease-out-expo) var(--d, 0s),
    transform 1.15s var(--ease-out-expo) var(--d, 0s);
}
body.envelope-pending .curtain {
  opacity: 0;
  transform: translateY(22px);
}
/* The big italic names get a bigger gesture so the rise is felt at scale */
body.envelope-pending .curtain.hero__name {
  transform: translateY(52px);
}
/* The ampersand drifts in slightly differently — softer, almost weightless */
body.envelope-pending .curtain.hero__amp {
  transform: translateY(14px) scale(0.92);
}
.curtain.hero__amp {
  transition:
    opacity 1.4s var(--ease-out-expo) var(--d, 0s),
    transform 1.4s var(--ease-out-expo) var(--d, 0s);
}

/* Ornament — hairlines draw outward from the center, diamond pops last */
.hero__ornament .hero__rule {
  transform-origin: center;
  transform: scaleX(0);
  transition: transform 1s var(--ease-out-expo) calc(var(--d, 0s) + 0.35s);
}
.hero__ornament .hero__rule:first-child { transform-origin: right center; }
.hero__ornament .hero__rule:last-child  { transform-origin: left center; }

.hero__ornament .hero__dot {
  transform: rotate(45deg) scale(0);
  transition: transform 0.55s var(--ease-out-expo) calc(var(--d, 0s) + 0.75s);
}

body:not(.envelope-pending) .hero__ornament.is-visible .hero__rule {
  transform: scaleX(1);
}
body:not(.envelope-pending) .hero__ornament.is-visible .hero__dot {
  transform: rotate(45deg) scale(1);
}

/* Hero scroll button — gentle idle breath once the entrance has landed.
   3.6s loop; near-imperceptible amplitude. Invites scroll, doesn't nag. */
@keyframes scrollBreath {
  0%, 100% { opacity: 0.85; transform: translateY(0); }
  50%      { opacity: 1;    transform: translateY(2px); }
}
body:not(.envelope-pending) .hero__scroll.is-visible {
  animation: scrollBreath 3.6s ease-in-out 2.4s infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* =========================================================
   ENVELOPE INTRO OVERLAY
   ========================================================= */
.is-envelope-locked { overflow: hidden; }

.env-screen {
  position: fixed;
  inset: 0;
  background: var(--deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.8s ease;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
.env-screen:focus-visible { outline: 1px solid var(--gold); outline-offset: -6px; }
.env-screen--out { opacity: 0; pointer-events: none; }

.env-bg-glow {
  position: absolute;
  top: 46%;
  left: 50%;
  width: 700px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(201, 169, 110, 0.10) 0%, transparent 65%);
  transform: translate(-50%, -50%);
  animation: envGlowPulse 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes envGlowPulse {
  0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) scale(1); }
  50%      { opacity: 0.85; transform: translate(-50%, -50%) scale(1.06); }
}

.env-float { animation: envFloat 4s ease-in-out infinite; }
.env-float--stop { animation: none; }
@keyframes envFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

.env-perspective {
  position: relative;
  width: min(448px, 88vw);
  height: min(292px, 57vw);
  perspective: 1400px;
  perspective-origin: center -10%;
}

.env-shadow {
  position: absolute;
  inset: 16px -8px -20px -8px;
  background: rgba(0, 0, 0, 0.55);
  filter: blur(28px);
  border-radius: 4px;
  transform: translateY(12px);
  z-index: 0;
  pointer-events: none;
}

.env-body {
  position: absolute;
  inset: 0;
  background: var(--cream);
  border: 1px solid rgba(201, 169, 110, 0.35);
  border-radius: 2px;
  z-index: 2;
  overflow: hidden;
}

.env-fold {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.env-fold--l { clip-path: polygon(0 0, 50% 50%, 0 100%); background: rgba(196, 133, 106, 0.08); }
.env-fold--r { clip-path: polygon(100% 0, 50% 50%, 100% 100%); background: rgba(196, 133, 106, 0.08); }
.env-fold--b { clip-path: polygon(0 100%, 50% 50%, 100% 100%); background: rgba(58, 40, 32, 0.06); }

.env-address {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1;
  width: 88%;
}
.env-address-eyebrow {
  font-family: var(--sans);
  font-size: clamp(7px, 1.5vw, 9.5px);
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0 0 9px;
}
.env-address-rule {
  display: block;
  width: 36px;
  height: 1px;
  background: rgba(201, 169, 110, 0.45);
  margin: 0 auto 11px;
}
.env-address-to {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(10px, 2vw, 13px);
  color: var(--muted);
  margin: 0 0 5px;
}
.env-address-name {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(13px, 2.5vw, 17px);
  font-weight: 500;
  color: var(--deep);
  line-height: 1.5;
  margin: 0;
}

/* Flap — triangular, hinged at top, rotates open */
.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 53%;
  clip-path: polygon(0 0, 100% 0, 50% 96%);
  background: linear-gradient(168deg, var(--cream) 30%, var(--blush) 100%);
  border-top: 1px solid rgba(201, 169, 110, 0.3);
  transform-origin: top center;
  transform: rotateX(0);
  transition: transform 0.92s cubic-bezier(0.55, 0.04, 0.45, 0.96);
  backface-visibility: hidden;
  z-index: 6;
  will-change: transform;
}
.env-flap--open { transform: rotateX(-180deg); }

.env-crease {
  position: absolute;
  left: 0; right: 0;
  top: 46.5%;
  height: 2px;
  background: linear-gradient(
    to right,
    transparent 5%,
    rgba(0, 0, 0, 0.10) 25%,
    rgba(0, 0, 0, 0.22) 50%,
    rgba(0, 0, 0, 0.10) 75%,
    transparent 95%
  );
  z-index: 7;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0.42s;
}
.env-crease--show { opacity: 1; }

/* Wax seal */
.env-seal {
  position: absolute;
  top: 49.5%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 8;
  transition: transform 0.28s cubic-bezier(0.6, 0, 0.4, 1), opacity 0.22s ease;
}
.env-seal-disc {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 33%, #D89B7E 0%, var(--rose) 70%);
  border: 1.5px solid rgba(201, 169, 110, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sealGlow 3s ease-in-out infinite;
}
@keyframes sealGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 133, 106, 0.5), 0 8px 24px rgba(0,0,0,0.45), inset 0 1px rgba(255,255,255,0.1); }
  50%      { box-shadow: 0 0 0 8px rgba(196, 133, 106, 0),   0 8px 24px rgba(0,0,0,0.45), inset 0 1px rgba(255,255,255,0.1); }
}
.env-seal--broken {
  transform: translate(-50%, -50%) scale(0.15) rotate(25deg);
  opacity: 0;
}

.env-seal-ripple {
  position: absolute;
  top: 49.5%;
  left: 50%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1.5px solid rgba(201, 169, 110, 0.45);
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
  z-index: 7;
  opacity: 0;
}
.env-seal-ripple--go {
  animation: sealRipple 1.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes sealRipple {
  0%   { transform: translate(-50%, -50%) scale(1);   opacity: 0; }
  14%  { transform: translate(-50%, -50%) scale(1.15); opacity: 0.55; }
  100% { transform: translate(-50%, -50%) scale(2.9); opacity: 0; }
}

/* Mini card that springs out of the envelope */
.env-card {
  position: absolute;
  bottom: 7%;
  left: 50%;
  width: 80%;
  height: 76%;
  transform: translateX(-50%) translateY(4%);
  background: #FDFAF4;
  border: 1px solid rgba(201, 169, 110, 0.35);
  z-index: 4;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.env-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(201, 169, 110, 0.18);
  pointer-events: none;
}
.env-card--up { animation: cardSpring 1.05s cubic-bezier(0.22, 0, 0.15, 1) forwards; }
@keyframes cardSpring {
  0%   { transform: translateX(-50%) translateY(4%);    opacity: 0; }
  18%  { opacity: 1; }
  55%  { transform: translateX(-50%) translateY(-69%); }
  70%  { transform: translateX(-50%) translateY(-61%); }
  82%  { transform: translateX(-50%) translateY(-66%); }
  91%  { transform: translateX(-50%) translateY(-63.5%); }
  100% { transform: translateX(-50%) translateY(-65%);  opacity: 1; }
}

.env-card-inner { text-align: center; padding: 6px 20px; }
.env-card-eyebrow {
  font-family: var(--sans);
  font-size: clamp(7px, 1.3vw, 9px);
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0 0 9px;
}
.env-card-div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 5px 0 10px;
}
.ecd-line { display: block; width: 26px; height: 1px; background: rgba(201, 169, 110, 0.5); }
.ecd-gem  { display: block; width: 4px; height: 4px; background: var(--gold); transform: rotate(45deg); flex-shrink: 0; }
.env-card-heading {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(14px, 2.8vw, 20px);
  font-weight: 400;
  color: var(--deep);
  line-height: 1.25;
  margin: 0 0 9px;
}
.env-card-heading em { font-style: italic; color: var(--gold); font-weight: 400; }
.env-card-date {
  font-family: var(--sans);
  font-size: clamp(7px, 1.1vw, 9px);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(201, 169, 110, 0.75);
  margin: 0;
}

/* Tap-to-open prompt */
.env-prompt {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: clamp(28px, 4.5vw, 44px);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(201, 169, 110, 0.65);
  animation: promptPulse 2.8s ease-in-out infinite;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.env-prompt--hide { opacity: 0; }
.env-prompt-gem {
  display: block;
  width: 5px;
  height: 5px;
  background: rgba(201, 169, 110, 0.5);
  transform: rotate(45deg);
}
@keyframes promptPulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .env-float, .env-bg-glow, .env-seal-disc, .env-prompt { animation: none; }
  .env-card--up { animation: none; transform: translateX(-50%) translateY(-65%); opacity: 1; }
  .env-flap { transition: none; }
  .env-crease { transition: none; }
}

/* =========================================================
   CONFIRMED PAGE — post-RSVP follow-up microsite
   ========================================================= */

/* --- Top strip --- */
.cf-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--pad-x);
  border-bottom: 1px solid rgba(58, 40, 32, 0.08);
  background: var(--cream);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.cf-strip__mark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--deep);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.cf-strip__mark em { color: var(--gold); font-style: italic; }
.cf-strip__date {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Hero --- */
.cf-hero {
  position: relative;
  min-height: 88svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px var(--pad-x) 72px;
  overflow: hidden;
  isolation: isolate;
}
.cf-hero__bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse at 22% 30%, rgba(237, 213, 192, 0.7) 0%, transparent 55%),
    radial-gradient(ellipse at 78% 70%, rgba(239, 224, 192, 0.65) 0%, transparent 58%),
    linear-gradient(178deg, #FBF7F1 0%, #F4E7D8 70%, #EDD5C0 100%);
}
.cf-hero__grain {
  position: absolute;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.45;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.23  0 0 0 0 0.16  0 0 0 0 0.13  0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 320px 320px;
}
.cf-hero__inner {
  text-align: center;
  max-width: 880px;
  position: relative;
}
.cf-hero__eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0 0 32px;
}
.cf-hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  color: var(--deep);
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.cf-hero__greet {
  font-size: clamp(28px, 5vw, 56px);
  color: var(--muted);
}
.cf-hero__name {
  font-size: clamp(56px, 12vw, 144px);
  color: var(--deep);
  margin-top: 4px;
  word-break: break-word;
  max-width: 100%;
}

/* Hero ornament — diamond between hairlines */
.cf-ornament {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 28px;
}
.cf-rule {
  display: block;
  width: clamp(40px, 8vw, 80px);
  height: 1px;
  background: var(--gold);
  opacity: 0.7;
}
.cf-dot {
  display: block;
  width: 5px;
  height: 5px;
  background: var(--gold);
  transform: rotate(45deg);
}

.cf-hero__lede {
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.65;
  color: var(--text);
  margin: 0 auto 44px;
  max-width: 540px;
}

.cf-hero__scroll {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--deep);
  text-decoration: none;
  padding: 13px 24px;
  border: 1px solid rgba(58, 40, 32, 0.28);
  border-radius: 999px;
  background: rgba(250, 246, 240, 0.5);
  backdrop-filter: blur(4px);
  transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}
.cf-hero__scroll:hover {
  background: rgba(250, 246, 240, 0.9);
  border-color: rgba(58, 40, 32, 0.45);
  transform: translateY(-2px);
}
.cf-hero__scroll svg { transition: transform 0.3s ease; }
.cf-hero__scroll:hover svg { transform: translateY(3px); }

/* --- Secret section --- */
.cf-secret {
  padding: 104px var(--pad-x) 92px;
  background: var(--cream);
}
.cf-secret__inner {
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
}
.cf-secret__body {
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.75;
  color: var(--text);
  margin: 0 auto 36px;
}
.cf-secret__body em {
  font-style: italic;
  color: var(--rose);
}
.cf-secret__rules {
  list-style: none;
  padding: 0;
  margin: 0 auto 40px;
  max-width: 480px;
  text-align: left;
  display: grid;
  gap: 14px;
}
.cf-secret__rules li {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--deep);
  padding: 16px 20px;
  background: var(--gold-light);
  border-left: 2px solid var(--rose);
  line-height: 1.5;
}
.cf-secret__aside {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 460px;
  margin: 0 auto 28px;
  padding: 14px 18px;
  border-top: 1px solid rgba(58, 40, 32, 0.12);
  border-bottom: 1px solid rgba(58, 40, 32, 0.12);
  letter-spacing: 0.01em;
}

.cf-secret__sign {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--muted);
  margin: 0;
}
.cf-secret__sign em { font-style: italic; color: var(--rose); }

/* --- Countdown --- */
.cf-count {
  padding: 96px var(--pad-x);
  background: var(--gold-light);
  text-align: center;
}
.cf-count__inner {
  max-width: 780px;
  margin: 0 auto;
}
.cf-count__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 2vw, 24px);
  margin: 16px auto 24px;
  max-width: 640px;
}
.cf-count__cell {
  background: var(--cream);
  border: 1px solid rgba(201, 169, 110, 0.35);
  padding: clamp(18px, 3vw, 28px) clamp(6px, 1.5vw, 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.cf-count__num {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(36px, 7vw, 64px);
  line-height: 1;
  color: var(--deep);
  font-variant-numeric: tabular-nums;
}
.cf-count__label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--rose);
}
.cf-count__note {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--muted);
  margin: 8px 0 0;
}
.cf-count__note em { color: var(--deep); font-style: italic; font-weight: 500; }

@media (max-width: 520px) {
  .cf-count__grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- The plan / running order --- */
.cf-plan {
  padding: 104px var(--pad-x);
  background: var(--cream);
}
.cf-plan__inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.cf-plan__list {
  list-style: none;
  padding: 0;
  margin: 16px 0 24px;
  text-align: left;
  display: grid;
  gap: 0;
}
.cf-plan__item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 28px;
  align-items: baseline;
  padding: 24px 0;
  border-bottom: 1px solid rgba(58, 40, 32, 0.12);
}
.cf-plan__item:last-child { border-bottom: none; }
.cf-plan__time {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--rose);
}
.cf-plan__body h3 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(22px, 2.6vw, 28px);
  color: var(--deep);
  margin: 0 0 6px;
  line-height: 1.2;
}
.cf-plan__body p {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}
.cf-plan__note {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 24px 0 0;
  font-style: italic;
}
@media (max-width: 640px) {
  .cf-plan__item {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 22px 0;
  }
}

/* --- Final details (reuses details__grid from invite) --- */
.cf-details {
  padding: 80px var(--pad-x);
  background: var(--gold-light);
}
.cf-details__inner {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.cf-link {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rose);
  text-decoration: none;
  border-bottom: 1px solid var(--rose);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.cf-link:hover { color: var(--deep); border-color: var(--deep); }

/* --- Payment placeholder --- */
.cf-pay {
  padding: 96px var(--pad-x);
  background: var(--cream);
  text-align: center;
}
.cf-pay__inner {
  max-width: 560px;
  margin: 0 auto;
}
.cf-pay__body {
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 28px;
}
.cf-pay__placeholder {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 18px 20px;
  border: 1px dashed rgba(58, 40, 32, 0.25);
  border-radius: 3px;
  margin: 0;
}
.cf-pay__placeholder em { font-style: italic; }

/* --- Help / questions --- */
.cf-help {
  padding: 96px var(--pad-x);
  background: var(--cream);
  text-align: center;
  border-top: 1px solid rgba(58, 40, 32, 0.08);
}
.cf-help__inner {
  max-width: 560px;
  margin: 0 auto;
}
.cf-help__body {
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 22px;
}
.cf-help__contact {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--muted);
  margin: 0;
}
.cf-help__contact em { font-style: italic; }

/* =========================================================
   UNLOCK PAGE — email gate before confirmed.html
   ========================================================= */
body.unlock {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 22% 30%, rgba(237, 213, 192, 0.7) 0%, transparent 55%),
    radial-gradient(ellipse at 78% 70%, rgba(239, 224, 192, 0.65) 0%, transparent 58%),
    linear-gradient(178deg, #FBF7F1 0%, #F4E7D8 70%, #EDD5C0 100%);
  padding: 48px var(--pad-x);
}

.ul-stage {
  width: 100%;
  max-width: 520px;
}

.ul-card {
  background: var(--cream);
  border: 1px solid rgba(201, 169, 110, 0.3);
  padding: clamp(36px, 6vw, 56px) clamp(28px, 5vw, 48px);
  text-align: center;
  animation: ulFade 0.55s var(--ease-out-expo) both;
}
.ul-card[hidden] { display: none; }

@keyframes ulFade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ul-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--deep);
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.98;
}
.ul-greet {
  font-size: clamp(20px, 3vw, 28px);
  color: var(--muted);
}
.ul-name {
  font-size: clamp(40px, 8vw, 72px);
  color: var(--deep);
  margin-top: 4px;
  word-break: break-word;
}

.ul-lede {
  font-family: var(--serif);
  font-size: clamp(16px, 1.9vw, 19px);
  line-height: 1.65;
  color: var(--text);
  margin: 8px auto 28px;
  max-width: 380px;
}
.ul-lede em {
  font-style: italic;
  color: var(--rose);
}

.ul-form {
  display: grid;
  gap: 18px;
  text-align: left;
  margin: 0 auto 18px;
  max-width: 380px;
}

.ul-form .btn { width: 100%; margin-top: 4px; }

.ul-status {
  margin: 4px 0 0;
  min-height: 1.2em;
  font-size: 13px;
  color: var(--rose);
  text-align: center;
  font-family: var(--sans);
}
.ul-status.is-error { color: #a13a2a; }

.ul-note {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 18px 0 0;
}

.ul-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: var(--rose);
  text-decoration: none;
  border-bottom: 1px solid var(--rose);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.ul-link:hover { color: var(--deep); border-color: var(--deep); }

/* =========================================================
   GATE — confirmed.html while verifying token
   ========================================================= */
body.confirmed.is-gating { overflow: hidden; }

.cf-gate {
  position: fixed;
  inset: 0;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.4s ease;
}
.cf-gate--out { opacity: 0; pointer-events: none; }

.cf-gate__inner {
  text-align: center;
  max-width: 380px;
  padding: 0 var(--pad-x);
}
.cf-gate__spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(196, 133, 106, 0.2);
  border-top-color: var(--rose);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: cfSpin 0.8s linear infinite;
}
@keyframes cfSpin { to { transform: rotate(360deg); } }

.cf-gate__msg {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--muted);
  margin: 0 0 8px;
}
.cf-gate__sub {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}
.cf-gate__sub a {
  color: var(--rose);
  text-decoration: none;
  border-bottom: 1px solid var(--rose);
}
