:root {
  --bg: #07070a;
  --panel: #111114;
  --panel-2: #16161a;
  --ink: #f3eee4;
  --muted: #9a9488;
  --line: #2a2721;
  --gold: #d4af37;
  --gold-soft: #ecdca8;
  --gold-dim: #8d7228;
  --ok: #7fd6a2;
  --bad: #e88a8a;
  --radius: 18px;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 28px 16px 72px;
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(212, 175, 55, 0.10), transparent 70%),
    linear-gradient(180deg, #07070a 0%, #100e0a 60%, #07070a 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- shell */

.invite {
  max-width: 640px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(212, 175, 55, 0.07);
}

.invite[aria-busy="true"] .panel { opacity: 0.25; }
.panel { padding: 34px 32px 30px; transition: opacity 0.25s ease; }

/* ----------------------------------------------------------------- hero */

.hero {
  position: relative;
  padding: 40px 24px 30px;
  text-align: center;
  background-color: #0b0b0d;
  background-image: url("assets/silk-confetti.jpg");
  background-size: cover;
  background-position: center 30%;
  isolation: isolate;
}

/* Glitter particles are now rendered by glitter.js canvas */

.hero-inner { position: relative; z-index: 1; }

/* Real transparency is baked into this asset by tools/prepare-assets.py, so it
   composites cleanly over the silk without any blend-mode trickery. */
.hero-script {
  display: block;
  width: min(330px, 82%);
  height: auto;
  margin: 0 auto -4px;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.55));
}

/* Scrim so the headline and date stay legible over busy confetti. */
.hero-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62%;
  background: linear-gradient(180deg, rgba(7, 7, 10, 0) 0%, rgba(7, 7, 10, 0.72) 55%, rgba(17, 17, 20, 0.95) 100%);
  pointer-events: none;
  z-index: 0;
}

.hero-when {
  margin: 10px 0 0;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-soft);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
}

h1, .eyebrow { text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85); }

/* Blends the hero into the panel below so the join is not a hard edge. */
.hero-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 90px;
  background: linear-gradient(180deg, rgba(17, 17, 20, 0) 0%, var(--panel) 92%);
  pointer-events: none;
  z-index: 1;
}

.eyebrow {
  margin: 14px 0 6px;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 5.6vw, 2.3rem);
  font-weight: 500;
  line-height: 1.15;
  color: var(--gold-soft);
}

.error-title { margin-bottom: 12px; }

h2 {
  margin: 0 0 12px;
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.greeting { margin: 0 0 8px; font-family: var(--serif); font-size: 1.1rem; color: var(--gold-soft); }
.lede { margin: 0 0 26px; color: #c9c2b4; }
.muted, .note { color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.note { display: block; margin-top: 5px; }
.tz { color: var(--muted); font-size: 0.8rem; }

/* -------------------------------------------------------------- details */

.details {
  position: relative;
  margin: 0;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  overflow: hidden;
}

/* Gold ribbon down the right edge. Screened so only the gold shows, and masked
   so the image's rectangular edge dissolves instead of forming a visible box. */
.details::after {
  content: "";
  position: absolute;
  top: -30px;
  right: -80px;
  width: 210px;
  height: 300px;
  background-image: url("assets/ribbon.jpg");
  background-size: cover;
  mix-blend-mode: screen;
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side at 60% 50%, #000 35%, transparent 85%);
  mask-image: radial-gradient(closest-side at 60% 50%, #000 35%, transparent 85%);
}

.details > div { position: relative; z-index: 1; display: grid; grid-template-columns: 82px 1fr; gap: 14px; }
.details dt { font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); padding-top: 5px; }
.details dd { margin: 0; }
#venue-known strong, #venue-known span, #venue-locked span { display: block; }
/* Keep the venue in the same visual register as When / Dress / Notes — it was reading
   as a heading because of the bold weight, which made the block feel oversized. */
#venue-known strong { color: var(--gold-soft); font-weight: 500; }
#venue-address { color: var(--muted); font-size: 0.85rem; margin-top: 3px; }

/* -------------------------------------------------------------- divider */

.divider { display: flex; align-items: center; gap: 16px; margin: 26px 0 4px; }
.divider .rule { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-dim), transparent); }
.divider .badge {
  width: 58px;
  height: 50px;
  flex: none;
  /* Transparent PNG produced by prepare-assets.py — no mask or blend needed. */
  background-image: url("assets/badge-40.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

/* ------------------------------------------------------- rsvp / reveal */

.rsvp, .reveal {
  position: relative;
  margin-top: 26px;
  padding-top: 24px;
}

/* Section textures, screened and masked to a soft glow. No overflow clipping —
   that cut the mask off and produced visible rectangular seams. */
.rsvp::before, .reveal::before {
  content: "";
  position: absolute;
  inset: -8% -6% 10% -6%;
  background-size: cover;
  background-position: center;
  mix-blend-mode: screen;
  opacity: 0.42;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 78% 62% at 50% 34%, #000 0%, transparent 72%);
  mask-image: radial-gradient(ellipse 78% 62% at 50% 34%, #000 0%, transparent 72%);
}

.rsvp::before { background-image: url("assets/starfield.jpg"); }
.reveal::before { background-image: url("assets/glitter-swirl.jpg"); opacity: 0.34; }

.rsvp > *, .reveal > * { position: relative; z-index: 1; }

.reveal { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.reveal-intro { margin: -4px 0 16px; color: var(--gold-soft); font-size: 0.95rem; }
.deadline { margin: -6px 0 18px; color: var(--muted); font-size: 0.86rem; }

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 20px;
  border: 1px solid transparent;
  border-radius: 11px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.btn-primary, .btn-map {
  width: 100%;
  background: linear-gradient(180deg, #efd581 0%, var(--gold) 55%, #b8912c 100%);
  color: #191408;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.18);
}

.btn-primary:hover:not(:disabled), .btn-map:hover { filter: brightness(1.07); }
.btn-primary:disabled { background: #33312b; color: #7f7a6e; box-shadow: none; cursor: not-allowed; }
.btn-map { margin-bottom: 12px; }
.btn-map svg { width: 20px; height: 20px; fill: currentColor; flex: none; }

.btn-ghost {
  flex: 1 1 auto;
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line);
  color: var(--gold-soft);
  font-weight: 500;
}

.btn-ghost:hover { border-color: var(--gold-dim); background: rgba(212, 175, 55, 0.08); }
.cal-links { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.cal-hint { margin: 0; font-size: 0.82rem; line-height: 1.45; opacity: 0.72; }
.cal-hint a { color: var(--gold); text-decoration: underline; }
.cal-hint-fallback { opacity: 0.55; font-style: italic; }

/* --------------------------------------------------------------- choices */

.choices { display: grid; gap: 10px; margin-bottom: 20px; }

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.choice-mark {
  width: 17px;
  height: 17px;
  flex: none;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  position: relative;
}

.choice[aria-checked="true"] .choice-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--gold);
}

.choice:hover { border-color: var(--gold-dim); }
.choice[aria-checked="true"] { border-color: var(--gold); background: rgba(212, 175, 55, 0.10); color: var(--gold-soft); font-weight: 600; }
.choice:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------------------------------------------------------------- fields */

.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: 0.9rem; font-weight: 500; }

input[type="number"], input[type="text"], textarea, select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #000;
  font: inherit;
  color: var(--ink);
  resize: vertical;
}

input[type="number"]:focus, input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4af37' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.status { min-height: 1.4em; margin: 14px 0 0; font-size: 0.9rem; }
.status.ok { color: var(--ok); font-weight: 600; }
.status.bad { color: var(--bad); font-weight: 600; }
.status.busy { color: var(--muted); }

/* ----------------------------------------------------------------- foot */

.foot { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.83rem; }
.foot p { margin: 0; }
.foot a { color: var(--gold); }

.card-error { text-align: center; }

/* --------------------------------------------------------------- mobile */

@media (max-width: 520px) {
  body { padding: 0 0 40px; }
  .invite { border-radius: 0; border-left: 0; border-right: 0; max-width: 100%; }
  .hero { padding: 32px 18px 26px; }
  .panel { padding: 26px 20px 24px; }
  .details > div { grid-template-columns: 1fr; gap: 3px; }
  .details::after { opacity: 0.28; right: -90px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
