/* Hurray design system — see DESIGN.md for the class vocabulary.
   Order: tokens → themes → base → chrome components → flyer → print. */

/* ============ 1. Tokens ============ */

:root {
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* neutrals (light app chrome) */
  --paper: #F5F3FA;
  --white: #FFFFFF;
  --plum: #1F1538;        /* text */
  --plum-2: #5A5272;      /* secondary text, 6.6:1 on --paper */
  --edge: #D9D4E7;        /* hairlines */
  --edge-strong: #8D86A3; /* field borders, 3:1 on white */
  --sticker-yellow: #FFD84D;
  --danger: #B3182A;
  --danger-soft: #FDE7EA;
  --ok: #14532D;
  --ok-soft: #DDF3E4;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 40px;
  --radius-field: 12px; --radius-card: 20px; --radius-pill: 999px;
  --tap: 48px; /* default control height; never below 44px */
}

/* ============ 2. Themes ============
   A theme only sets --t-* custom properties. :root carries confetti so an
   unknown or missing theme class falls back to it. */

:root, .theme-confetti {
  --t-font: var(--font-display);
  --t-font-weight: 800;
  --t-title-adj: 1; --t-title-lh: .96; --t-title-ls: -.015em; --t-title-shadow: none;
  --t-sky: #FF7B54; --t-ground: #FF7B54; --t-floor: #FF7B54;
  --t-ink: #2A1650; --t-title: #2A1650;
  --t-card: rgb(255 255 255 / .3); --t-card-line: rgb(255 255 255 / .55);
  --t-accent: #3B1F7A;                       /* on light chrome, white text on it */
  --t-btn: #2A1650; --t-on-btn: #FFFFFF;     /* primary button on the immersive page */
  --t-sticker: #FFFFFF; --t-sticker-ink: #2A1650; --t-tape: rgb(42 22 80 / .22);
  --t-art-ink: #2A1650; --t-star: #FFE9A3; --t-outline: transparent; --t-cloud: #EFEAFF;
  --t-a1: #FFD84D; --t-a2: #FFFFFF; --t-a3: #2A1650; --t-a4: #8DEBEF; --t-a5: #C2185B; --t-a6: #FFD84D;
}
.theme-splash {
  --t-font: "Baloo 2", "Arial Rounded MT Bold", var(--font-display);
  --t-title-adj: 1.08; --t-title-lh: .92; --t-title-ls: -.01em;
  --t-sky: #BDEFFA; --t-ground: #0A5AA6; --t-floor: #0A5AA6;
  --t-ink: #FFFFFF; --t-title: #FFFFFF;
  --t-card: rgb(255 255 255 / .12); --t-card-line: rgb(255 255 255 / .32);
  --t-accent: #0A5AA6;
  --t-btn: #FFD84D; --t-on-btn: #0A2E55;
  --t-sticker: #FFD84D; --t-sticker-ink: #0A2E55; --t-tape: rgb(255 255 255 / .55);
  --t-art-ink: #0A2E55;
  --t-a1: #74D3F6; --t-a2: #1E96D8; --t-a3: #FF5B4D; --t-a4: #FFD23F; --t-a5: #FFFFFF; --t-a6: #FFD23F;
}
.theme-dino {
  --t-font: "Rammetto One", "Cooper Black", Georgia, serif;
  --t-font-weight: 400;
  --t-title-adj: .8; --t-title-lh: 1.04; --t-title-ls: 0;
  --t-sky: #E6F5B0; --t-ground: #17603A; --t-floor: #17603A;
  --t-ink: #F8FCEA; --t-title: #FFFFFF;
  --t-card: rgb(255 255 255 / .11); --t-card-line: rgb(255 255 255 / .3);
  --t-accent: #17603A;
  --t-btn: #FFB53D; --t-on-btn: #33210A;
  --t-sticker: #FFD84D; --t-sticker-ink: #1D3A16; --t-tape: rgb(255 255 255 / .5);
  --t-art-ink: #143D25;
  --t-a1: #9AD468; --t-a2: #35A85F; --t-a3: #B8562B; --t-a4: #FF8A3D; --t-a5: #1C7C45; --t-a6: #FFC53D;
}
.theme-space {
  --t-font: "Unbounded", "Arial Black", var(--font-display);
  --t-title-adj: .7; --t-title-lh: 1.06; --t-title-ls: -.02em;
  --t-sky: #14103D; --t-ground: #2A2175; --t-floor: #2A2175;
  --t-ink: #FFFFFF; --t-title: #FFFFFF;
  --t-card: rgb(255 255 255 / .11); --t-card-line: rgb(255 255 255 / .26);
  --t-accent: #4B3BD6;
  --t-btn: #FFD84D; --t-on-btn: #1B1552;
  --t-sticker: #FFD84D; --t-sticker-ink: #1B1552; --t-tape: rgb(255 255 255 / .5);
  --t-art-ink: #1B1552; --t-star: #FFE9A3;
  --t-a1: #FF7A59; --t-a2: #FFD23F; --t-a3: #7CE0D6; --t-a4: #FFFFFF; --t-a5: #1F185C; --t-a6: #E5484D;
}
.theme-rainbow {
  --t-font: "Fredoka", "Arial Rounded MT Bold", var(--font-display);
  --t-font-weight: 700;
  --t-title-adj: 1; --t-title-lh: .98; --t-title-ls: -.005em;
  --t-sky: #DCD6FF; --t-ground: #FFFFFF; --t-floor: #FFFFFF;
  --t-ink: #3B1D6E; --t-title: #6D35D9;
  --t-card: #F4F0FF; --t-card-line: #DCD3F7;
  --t-accent: #6D35D9;
  --t-btn: #6D35D9; --t-on-btn: #FFFFFF;
  --t-sticker: #FFD84D; --t-sticker-ink: #3B1D6E; --t-tape: rgb(109 53 217 / .2);
  --t-art-ink: #3B1D6E; --t-cloud: #EFEAFF;
  --t-a1: #FF4F6D; --t-a2: #FF9F1C; --t-a3: #FFD23F; --t-a4: #2EC47A; --t-a5: #3D8BFF; --t-a6: #8E5BE8;
}
.theme-superhero {
  --t-font: "Bangers", Impact, "Arial Narrow Bold", sans-serif;
  --t-font-weight: 400;
  --t-title-adj: 1.3; --t-title-lh: .98; --t-title-ls: .02em;
  --t-title-shadow: .05em .06em 0 #D8202A;
  --t-sky: #FFD60A; --t-ground: #1B2A8A; --t-floor: #1B2A8A;
  --t-ink: #FFFFFF; --t-title: #FFE14A;
  --t-card: rgb(255 255 255 / .12); --t-card-line: rgb(255 255 255 / .3);
  --t-accent: #C81E28;
  --t-btn: #FFD84D; --t-on-btn: #141E63;
  --t-sticker: #FFD84D; --t-sticker-ink: #141E63; --t-tape: rgb(255 255 255 / .5);
  --t-art-ink: #141E63;
  --t-a1: #FFB300; --t-a2: #E5262B; --t-a3: #FFFFFF; --t-a4: #FFD60A; --t-a5: #141E63; --t-a6: #E5262B;
}

/* Semantic tokens the chrome components use. Re-declared on every theme scope
   so they pick up that scope's --t-* values. */
:root, [class*="theme-"] {
  --bg: var(--paper);
  --surface: var(--white);
  --surface-line: var(--edge);
  --ink: var(--plum);
  --ink-2: var(--plum-2);
  --accent: var(--t-accent);
  --on-accent: #FFFFFF;
  --track: color-mix(in srgb, var(--t-accent) 9%, var(--white));
  --focus: var(--plum);
}

/* The guest page: the whole page takes the event's colours. Put on <body>
   together with the theme class: <body class="theme-splash immersive">. */
.immersive {
  --bg: var(--t-ground);
  --surface: var(--t-card);
  --surface-line: var(--t-card-line);
  --ink: var(--t-ink);
  --ink-2: color-mix(in srgb, var(--t-ink) 92%, var(--t-ground)); /* ≥4.5:1 on ground and on cards in every theme */
  --accent: var(--t-btn);
  --on-accent: var(--t-on-btn);
  --track: var(--t-card);
  --focus: var(--t-ink);
}

/* ============ 3. Base ============ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, figure, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: .18em; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.print-only { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ============ 4. Chrome components ============ */

/* --- page shell --- */
.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: var(--space-4) var(--space-4) var(--space-6); }
.page--narrow { max-width: 560px; }
.page--flush { padding-left: 0; padding-right: 0; padding-top: 0; }

.app-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 56px; margin-bottom: var(--space-4); }
.brand {
  display: inline-block; padding: .2em .65em .25em; border-radius: var(--radius-pill);
  background: var(--sticker-yellow); color: var(--plum);
  font: 800 1.25rem/1.2 var(--font-display); letter-spacing: -.02em; text-decoration: none;
  transform: rotate(-3deg); box-shadow: 2px 3px 0 rgb(31 21 56 / .18);
}

.page__title { font: 800 clamp(1.9rem, 6vw, 2.75rem)/1.02 var(--font-display); letter-spacing: -.025em; text-wrap: balance; }
.section-title { font: 700 1.3rem/1.15 var(--font-display); letter-spacing: -.015em; }
.lede { font-size: 1.0625rem; color: var(--ink-2); max-width: 60ch; }
.muted { color: var(--ink-2); }

.stack > * + * { margin-top: var(--gap, var(--space-4)); }
.stack--lg { --gap: var(--space-5); }
.stack--sm { --gap: var(--space-2); }

/* form beside live preview; stacks on phones */
.split { display: grid; gap: var(--space-5); }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: var(--space-6); align-items: start; }
  .split__aside { position: sticky; top: var(--space-4); }
}

/* rounded window around a screen flyer (live preview, styleguide) */
.flyer-frame {
  max-width: 400px; margin-inline: auto; border-radius: 28px; overflow: hidden;
  box-shadow: 0 0 0 1px rgb(31 21 56 / .08), 0 24px 48px -24px rgb(31 21 56 / .45);
}

/* --- card --- */
.card { background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--radius-card); padding: var(--space-5) var(--space-4); }
.card__title { font: 700 1.15rem/1.2 var(--font-display); letter-spacing: -.01em; margin-bottom: var(--space-3); }
@media (min-width: 560px) { .card { padding: var(--space-5); } }

/* --- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap); padding: 0 22px; border: 2px solid transparent; border-radius: var(--radius-pill);
  background: transparent; color: var(--ink);
  font: 700 1rem/1.1 var(--font-body); text-decoration: none; text-align: center; cursor: pointer;
  transition: transform .08s ease, filter .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(.94); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--secondary { border-color: currentColor; }
.btn--ghost { padding-inline: 12px; text-decoration: underline; text-underline-offset: .2em; }
.btn--danger { color: var(--danger); border-color: currentColor; background: var(--white); }
.btn--sm { min-height: 44px; padding-inline: 16px; font-size: .9375rem; }
.btn--block { display: flex; width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.btn[aria-busy="true"] { cursor: progress; opacity: .75; }

/* --- fields --- */
.field { display: grid; gap: 6px; }
.field__label { font-weight: 700; font-size: .9375rem; }
.field__label .optional { font-weight: 500; color: var(--ink-2); }
.field__hint { font-size: .875rem; color: var(--ink-2); }
.field__control {
  width: 100%; min-height: var(--tap); padding: 10px 14px;
  background: var(--white); color: var(--plum);
  border: 1.5px solid var(--edge-strong); border-radius: var(--radius-field);
  font-size: 1rem; line-height: 1.35; /* 16px stops iOS zooming on focus */
  -webkit-appearance: none; appearance: none;
}
.field__control::placeholder { color: #736C8A; opacity: 1; }
.field__control:focus-visible { border-color: var(--plum); outline-offset: 1px; }
textarea.field__control { min-height: 104px; resize: vertical; }
input[type="date"].field__control, input[type="time"].field__control { display: block; min-width: 0; }
input.field__control::-webkit-date-and-time-value { text-align: left; }
select.field__control {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231F1538' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.field__error {
  justify-self: start; padding: 3px 9px; border-radius: 7px;
  background: var(--danger-soft); color: var(--danger); font-size: .875rem; font-weight: 700;
}
.field--error .field__control, .field__control[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }

.field-row { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); align-items: start; }

/* --- segmented control (native radios) --- */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--track); border: 1px solid var(--surface-line); border-radius: 18px; }
.segmented__option { position: relative; display: block; cursor: pointer; }
.segmented__option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented__option span {
  display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 4px;
  border-radius: 14px; font-weight: 700; text-align: center; line-height: 1.1;
  transition: background-color .12s ease, color .12s ease;
}
.segmented__option input:checked + span { background: var(--accent); color: var(--on-accent); }
.segmented__option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* --- number stepper (native number input) --- */
.stepper { display: inline-flex; align-items: center; padding: 3px; background: var(--white); border: 1.5px solid var(--edge-strong); border-radius: var(--radius-pill); }
.stepper__btn {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--t-accent) 12%, var(--white)); color: var(--plum);
  font: 700 1.375rem/1 var(--font-body); cursor: pointer;
}
.stepper__btn:active { transform: scale(.94); }
.stepper__btn:disabled { opacity: .4; cursor: not-allowed; }
.stepper__input {
  width: 3.25rem; height: 44px; padding: 0; border: 0; background: none; color: var(--plum);
  font: 800 1.25rem/1 var(--font-display); text-align: center;
  -moz-appearance: textfield; appearance: textfield;
}
.stepper__input::-webkit-outer-spin-button, .stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* --- theme picker (native radios) --- */
.theme-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
@media (min-width: 560px) { .theme-picker { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.theme-swatch { position: relative; display: grid; gap: 6px; justify-items: center; cursor: pointer; font-size: .875rem; font-weight: 600; text-align: center; }
.theme-swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.theme-swatch__chip {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 5 / 4; min-height: 56px; overflow: hidden;
  border-radius: 14px; font-size: 1.5rem; line-height: 1;
  background: linear-gradient(var(--t-sky) 0 62%, var(--t-ground) 62%);
  box-shadow: inset 0 0 0 1px rgb(31 21 56 / .14);
}
.theme-swatch__chip::after { /* the floor's curve */
  content: ""; position: absolute; left: -10%; right: -10%; bottom: -18%; height: 62%;
  border-radius: 50% 50% 0 0; background: var(--t-ground); z-index: 0;
}
.theme-swatch__chip > * { position: relative; z-index: 1; }
.theme-swatch input:checked + .theme-swatch__chip { outline: 3px solid var(--plum); outline-offset: 3px; }
.theme-swatch input:checked ~ .theme-swatch__name { font-weight: 800; }
.theme-swatch input:focus-visible + .theme-swatch__chip { outline: 3px solid var(--plum); outline-offset: 6px; }

/* --- headcount stat tiles --- */
.stats { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.stat { flex: 1 1 84px; display: grid; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--surface-line); border-radius: 16px; }
.stat__value { font: 800 2rem/1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat__label { font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.stat--main { flex-basis: 100%; display: flex; align-items: baseline; gap: 10px; background: var(--sticker-yellow); border-color: transparent; color: var(--plum); }
.stat--main .stat__value { font-size: 2.5rem; }
.stat--main .stat__label { color: var(--plum); }

/* --- RSVP list --- */
.rsvp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--space-3); align-items: center; padding: 14px 0; border-top: 1px solid var(--surface-line); }
.rsvp:first-child { border-top: 0; }
.rsvp__name { font-weight: 700; overflow-wrap: anywhere; }
.rsvp__meta { display: block; font-size: .875rem; color: var(--ink-2); }
.rsvp__note { grid-column: 1 / -1; padding: 8px 12px; border-radius: 10px; background: var(--track); font-size: .9375rem; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 4px 10px; border-radius: var(--radius-pill); font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.badge--yes { background: var(--ok-soft); color: var(--ok); }
.badge--maybe { background: #FFF0BF; color: #5F4100; }
.badge--no { background: #ECE9F3; color: #4A4360; }

/* --- notices and toast --- */
.notice { padding: 12px 16px; border-radius: 14px; background: var(--track); border: 1px solid var(--surface-line); font-size: .9375rem; }
.notice--ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice--error { background: var(--danger-soft); border-color: transparent; color: #8C1220; }
.notice--sticker { background: var(--sticker-yellow); border-color: transparent; color: var(--plum); transform: rotate(-.6deg); box-shadow: 3px 4px 0 rgb(31 21 56 / .16); }
.notice strong { font-weight: 800; }

.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  max-width: calc(100vw - 32px); padding: 12px 20px; border-radius: var(--radius-pill);
  background: var(--plum); color: #FFFFFF; font-weight: 700; font-size: .9375rem; text-align: center;
  box-shadow: 0 10px 30px -10px rgb(0 0 0 / .5);
  transform: translateX(-50%); animation: toast-in .18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* --- copy-link row --- */
.copy-row { display: flex; gap: var(--space-2); align-items: center; }
.copy-row__value { flex: 1; min-width: 0; text-overflow: ellipsis; }

/* --- sticky action bar (phones) --- */
.action-bar {
  position: sticky; bottom: 0; z-index: 20; display: flex; gap: var(--space-2);
  margin-inline: calc(-1 * var(--space-4));
  padding: 12px var(--space-4) calc(12px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--surface-line);
}
.action-bar > .btn { flex: 1; }
@media (min-width: 720px) {
  .action-bar { position: static; margin-inline: 0; padding: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; border: 0; }
  .action-bar > .btn { flex: none; }
}

/* --- empty state --- */
.empty { padding: var(--space-6) var(--space-5); border: 2px dashed var(--surface-line); border-radius: var(--radius-card); text-align: center; color: var(--ink-2); }
.empty__title { font: 700 1.15rem/1.2 var(--font-display); color: var(--ink); margin-bottom: 6px; }

/* ============ 5. Flyer ============
   Built by renderFlyer(). .flyer is a size container; everything inside is in em
   (type) or cqw (art, QR), so it scales with whatever box you put it in. */

.flyer {
  container-type: inline-size;
  display: grid;
  overflow: hidden;
  background: var(--t-ground);
  color: var(--t-ink);
  font-family: var(--font-body);
  text-align: left;
}
.flyer__page { display: flex; flex-direction: column; min-width: 0; min-height: 0; font-size: calc(100cqw / 24); line-height: 1.4; }
:where(.flyer) :where(p, h1, h2, h3, h4, h5, h6) { margin: 0; }

.flyer__art { position: relative; flex: none; height: 60cqw; overflow: hidden; background: var(--t-sky); color: var(--t-art-ink); }
.flyer__art svg { position: absolute; display: block; height: auto; max-width: none; overflow: visible; fill: currentColor; }
.flyer__art .flyer__fill { inset: 0; width: 100%; height: 100%; }
.flyer__art .flyer__floor { left: 0; bottom: -1px; width: 100%; }
.flyer__art .flyer__prop { max-height: calc(96% - var(--offset, 0px)); } /* shrinks to fit when the print panel is short */
.fa1 { color: var(--t-a1); } .fa2 { color: var(--t-a2); } .fa3 { color: var(--t-a3); }
.fa4 { color: var(--t-a4); } .fa5 { color: var(--t-a5); } .fa6 { color: var(--t-a6); }
.faw { color: #FFFFFF; } .fai { color: var(--t-art-ink); }
.fa-floor { color: var(--t-floor); } .fa-star { color: var(--t-star); } .fa-cloud { color: var(--t-cloud); }
.fa-outlined { stroke: var(--t-outline); stroke-width: 2.5; }
.fa-inked { stroke: var(--t-art-ink); stroke-width: 3.5; stroke-linejoin: round; }

.flyer__body { display: flex; flex-direction: column; gap: .95em; padding: 0 1.5em 1.9em; min-width: 0; }
.flyer--screen .flyer__body { position: relative; box-shadow: 0 -1px 0 var(--t-ground); } /* seals the seam under the art */

/* the "You're invited" sticker straddles the art's bottom edge */
.flyer__invite {
  position: relative; align-self: flex-start; margin: -1.15em 0 -.1em -.2em; padding: .5em .95em .55em;
  border-radius: 99em; background: var(--t-sticker); color: var(--t-sticker-ink);
  font-weight: 800; font-size: .88em; line-height: 1;
  transform: rotate(-3deg); box-shadow: .14em .2em 0 rgb(0 0 0 / .2);
}

.flyer__title {
  font-family: var(--t-font); font-weight: var(--t-font-weight);
  font-size: calc(3.3em * var(--title-scale, 1) * var(--t-title-adj));
  line-height: calc(var(--t-title-lh) + (1 - var(--title-scale, 1)) * .24); /* small type needs more air */
  letter-spacing: var(--t-title-ls);
  color: var(--t-title); text-shadow: var(--t-title-shadow);
  text-wrap: balance; overflow-wrap: anywhere;
}
.flyer__host { font-weight: 700; font-size: 1.08em; line-height: 1.25; margin-top: -.35em; overflow-wrap: anywhere; }

.flyer__facts { display: grid; gap: .9em; padding: 1em 1.1em; border-radius: 1.15em; background: var(--t-card); border: 1px solid var(--t-card-line); }
.flyer__fact { display: grid; grid-template-columns: 1.5em minmax(0, 1fr); gap: .7em; align-items: start; min-width: 0; }
.flyer__icon { width: 1.5em; height: 1.5em; margin-top: .05em; }
.flyer__fact-main { font-weight: 800; font-size: 1.16em; line-height: 1.2; overflow-wrap: anywhere; }
.flyer__fact-sub { line-height: 1.3; margin-top: .15em; overflow-wrap: anywhere; }

.flyer__desc { white-space: pre-line; overflow-wrap: anywhere; text-wrap: pretty; }

/* "What to wear or bring" — a note taped onto the invitation */
.flyer__bring {
  position: relative; margin: .5em .15em .3em; padding: 1em 1.15em .95em;
  border-radius: .35em; background: var(--t-sticker); color: var(--t-sticker-ink);
  transform: rotate(-1.3deg); box-shadow: .22em .3em 0 rgb(0 0 0 / .2);
}
.flyer__bring::before {
  content: ""; position: absolute; top: -.6em; left: 50%; width: 5.2em; height: 1.25em;
  background: var(--t-tape); transform: translateX(-50%) rotate(-2.5deg);
}
.flyer__bring-label { font-weight: 800; font-size: .82em; line-height: 1.2; opacity: .82; }
.flyer__bring-text { font-weight: 700; font-size: 1.12em; line-height: 1.28; margin-top: .2em; overflow-wrap: anywhere; }

.flyer__foot { font-size: .95em; line-height: 1.35; overflow-wrap: anywhere; }
.flyer__by { font-weight: 800; }
.flyer .is-placeholder { opacity: .55; }

/* --- print variant: white paper, one framed scene, bold accents --- */
.flyer--print {
  aspect-ratio: 7.7 / 10.2; /* Letter minus margins; .sheet overrides */
  --t-ground: #FFFFFF; --t-ink: #1F1538; --t-title: var(--t-accent); --t-title-shadow: none;
  --t-card: transparent; --t-card-line: var(--t-accent);
  --t-sticker: #FFD84D; --t-sticker-ink: #1F1538; --t-tape: rgb(31 21 56 / .14);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.flyer--print.theme-confetti { --t-sky: #FFE3D6; --t-a2: #FF7B54; --t-floor: #FFE3D6; }
.flyer--print.theme-space {
  --t-sky: #E7E3FF; --t-floor: #B9AFF5; --t-a5: #9D91EA; --t-star: #4B3BD6; --t-outline: #2A2175;
}
.flyer--print.theme-superhero { --t-sky: #FFF0A0; --t-a1: #FFD60A; --t-title-shadow: .05em .06em 0 #FFD60A; }
.flyer--print.theme-rainbow { --t-title: #6D35D9; }

.flyer--print .flyer__page { font-size: calc(100cqw / 36 * var(--fit, 1)); }
.flyer--print .flyer__art { flex: 1 1 0; height: auto; min-height: 20cqw; border-radius: 2.4cqw; }
.flyer--print .flyer__body { flex: none; gap: .8em; padding: 0 .3em; }
.flyer--print .flyer__title { font-size: calc(4.2em * var(--title-scale, 1) * var(--t-title-adj)); }
.flyer--print .flyer__invite { margin-left: 1em; box-shadow: .12em .16em 0 rgb(31 21 56 / .22); }
.flyer--print .flyer__facts {
  grid-template-columns: max-content minmax(0, 1fr); gap: 1.8em;
  padding: .8em 0; border: solid var(--t-accent); border-width: .14em 0; border-radius: 0;
}
.flyer--print .flyer__fact--when .flyer__fact-main { max-width: 14em; }
.flyer--print .flyer__icon { color: var(--t-accent); }
.flyer--print .flyer__bring { align-self: flex-start; min-width: 55%; max-width: calc(100% - 1.4em); padding-right: 2em; box-shadow: .18em .24em 0 rgb(31 21 56 / .22); margin-bottom: .5em; }

.flyer__rsvp {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.2em; align-items: center;
  padding: 2.2cqw 2.2cqw 2.2cqw 3cqw; border-radius: 2.4cqw;
  background: color-mix(in srgb, var(--t-accent) 9%, #FFFFFF);
}
.flyer__scan { font-family: var(--t-font); font-weight: var(--t-font-weight); font-size: calc(2em * var(--t-title-adj)); line-height: 1.05; letter-spacing: var(--t-title-ls); color: var(--t-accent); }
.flyer__scan-how { font-weight: 700; line-height: 1.3; margin-top: .3em; }
.flyer__rsvp .flyer__contact { margin-top: .3em; font-size: .92em; overflow-wrap: anywhere; }
/* QR: sized in cqw so --fit never shrinks it. 24cqw ≈ 1.85in full page, 0.85in on the 4-up. */
.flyer__qr { display: block; width: 24cqw; height: 24cqw; padding: 1.3cqw; border-radius: 1.4cqw; background: #FFFFFF; image-rendering: pixelated; }
.flyer__qr--empty { border: .3cqw dashed var(--edge-strong); }

/* ============ 6. Print sheets ============
   .sheet is one US Letter page. On screen it is a paper preview with the 0.4in
   margin drawn as padding; in print the @page margin takes over. */

.sheet {
  position: relative; container-type: inline-size; display: grid;
  width: 100%; max-width: 8.5in; aspect-ratio: 8.5 / 11; margin: 0 auto var(--space-5);
  padding: 4.706%; /* 0.4in of 8.5in */
  background: #FFFFFF; box-shadow: 0 0 0 1px rgb(31 21 56 / .1), 0 20px 44px -22px rgb(31 21 56 / .4);
}
.sheet .flyer--print { aspect-ratio: auto; min-height: 0; }
.sheet--quad { grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr)); }
/* 0.17in of white each side of a cut line; outer edges already have the page margin */
.sheet--quad > :nth-child(odd) { margin-right: 2.2cqw; }
.sheet--quad > :nth-child(even) { margin-left: 2.2cqw; }
.sheet--quad > :nth-child(-n + 2) { margin-bottom: 2.2cqw; }
.sheet--quad > :nth-child(n + 3) { margin-top: 2.2cqw; }
.sheet--quad::before, .sheet--quad::after { content: ""; position: absolute; pointer-events: none; }
.sheet--quad::before { top: 0; bottom: 0; left: 50%; border-left: 1px dashed #A9A3BC; }
.sheet--quad::after { left: 0; right: 0; top: 50%; border-top: 1px dashed #A9A3BC; }

@page { size: letter portrait; margin: 0.4in; }

@media print {
  html, body { background: #FFFFFF !important; }
  body { margin: 0; padding: 0; }
  .no-print { display: none !important; }
  .print-only { display: revert; }
  .page { max-width: none; padding: 0; }
  .sheet {
    width: 7.7in; max-width: none; height: 10.1in; aspect-ratio: auto;
    margin: 0; padding: 0; box-shadow: none; break-inside: avoid; break-after: page;
  }
  .sheet:last-child { break-after: auto; }
  .sheet, .sheet * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* pages */
.row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
legend.field__label { margin-bottom: 6px; } /* a fieldset's grid gap doesn't apply after its legend */
/* Guest page: the bar is a phone affordance; on wide screens the cards' own buttons are right there. */
@media (min-width: 720px) { .immersive .action-bar { display: none; } }

/* guest list — spec: docs/guest-list-ux.md. Light chrome only (manage page). No sticker yellow here. */

/* --- the two statuses .badge--yes/maybe/no don't cover --- */
.badge--unsent { padding: 2.5px 8.5px; border: 1.5px dashed var(--edge-strong); color: var(--ink-2); }
.badge--sent { background: var(--track); color: var(--ink); box-shadow: inset 0 0 0 1px var(--surface-line); }

/* --- "18 guests  12 sent  7 replied" --- */
.guest-summary { display: flex; flex-wrap: wrap; gap: 2px var(--space-4); color: var(--ink-2); font-weight: 600; }
.guest-summary b { margin-right: 5px; color: var(--ink); font: 800 1.375rem/1.2 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* --- filter chips (native radios) --- */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { position: relative; display: block; cursor: pointer; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip > span {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  background: var(--surface); border: 1.5px solid var(--edge-strong); border-radius: var(--radius-pill);
  font-size: .9375rem; font-weight: 700; white-space: nowrap;
}
.chip__count { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip input:checked + span .chip__count { color: inherit; }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* --- the list. Columns live on the <ul> and rows are subgrids, so badges line up. --- */
.guest-list { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; column-gap: var(--space-2); }
.guest-list > * { grid-column: 1 / -1; }
.guest {
  display: grid; grid-template-columns: subgrid; align-items: center;
  grid-template-areas: "name badge more" "meta meta meta" "note note note" "acts acts acts";
  padding: 10px 0 14px; border-top: 1px solid var(--surface-line);
}
.guest:first-child { border-top: 0; }
.guest__name { grid-area: name; font-weight: 700; overflow-wrap: anywhere; }
.guest > .badge { grid-area: badge; justify-self: end; }
.guest__meta { grid-area: meta; font-size: .875rem; color: var(--ink-2); overflow-wrap: anywhere; }
.guest__meta > span { display: block; }
.guest__note { grid-area: note; margin-top: var(--space-2); }
.guest__actions { grid-area: acts; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: 10px; }
.guest__sentnote { font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.guest--editing { display: block; padding: var(--space-4) 0; }

@media (min-width: 720px) {
  .guest-list { grid-template-columns: minmax(0, 1fr) auto auto 44px; column-gap: var(--space-4); }
  .guest { grid-template-areas: "name badge acts more" "meta badge acts more" "note note note note"; padding: 10px 0; }
  .guest__name { align-self: end; }
  .guest__meta { align-self: start; }
  .guest__actions { margin-top: 0; justify-content: flex-end; }
}

/* --- "More" menu: <details class="guest__more"><summary aria-label="More for Jo"></summary><div class="menu">… --- */
.guest__more { grid-area: more; position: relative; }
.guest__more > summary {
  display: block; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; list-style: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231F1538'%3E%3Ccircle cx='5' cy='12' r='2'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Ccircle cx='19' cy='12' r='2'/%3E%3C/svg%3E") center / 22px no-repeat;
}
.guest__more > summary::-webkit-details-marker { display: none; }
.guest__more > summary:hover, .guest__more[open] > summary { background-color: var(--track); }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; display: grid; width: max-content; min-width: 13rem; max-width: 80vw; padding: 6px;
  background: var(--white); color: var(--plum); border: 1px solid var(--surface-line); border-radius: 16px;
  box-shadow: 0 16px 36px -14px rgb(31 21 56 / .45);
}
.menu__item {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer;
}
.menu__item:hover { background: var(--track); }
.menu__item--danger { color: var(--danger); }

/* --- add guests: two native disclosures, one form each --- */
.guest-add { background: var(--track); border: 1px solid var(--surface-line); border-radius: 14px; }
.guest-add > summary {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 var(--space-4);
  border-radius: 14px; font-weight: 700; cursor: pointer; list-style: none;
}
.guest-add > summary::-webkit-details-marker { display: none; }
.guest-add > summary::before {
  content: "+"; flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--surface); font: 700 1.125rem/1 var(--font-body);
}
.guest-add[open] > summary::before { content: "\2212"; }
.guest-add__body { padding: var(--space-1) var(--space-4) var(--space-4); }

.guest-form { display: grid; gap: var(--space-3); max-width: 36rem; }
.guest-form__contact { display: grid; gap: var(--space-3); align-items: start; }
@media (min-width: 560px) { .guest-form__contact { grid-template-columns: 1fr 1fr; } }

/* --- paste several: what we understood from each line --- */
.guest-preview { max-height: 22rem; overflow: auto; background: var(--white); border: 1px solid var(--surface-line); border-radius: var(--radius-field); }
.guest-preview__row { display: grid; gap: 2px; padding: 10px 14px; border-top: 1px solid var(--surface-line); overflow-wrap: anywhere; }
.guest-preview__row:first-child { border-top: 0; }
.guest-preview__row b { font-weight: 700; }
.guest-preview__row span { font-size: .875rem; color: var(--ink-2); }
.guest-preview__row--error { box-shadow: inset 4px 0 0 var(--danger); }

/* --- "See the text message": read-only bubbles --- */
.guest-message > summary { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.message-previews { display: grid; gap: var(--space-4); padding-top: var(--space-2); }
@media (min-width: 720px) { .message-previews { grid-template-columns: 1fr 1fr; } }
.message-preview__label { margin-bottom: 6px; font-size: .875rem; font-weight: 700; color: var(--ink-2); }
.message-preview__body {
  padding: 12px 16px; border-radius: 18px 18px 6px 18px; background: var(--track); border: 1px solid var(--surface-line);
  font-size: .9375rem; white-space: pre-line; overflow-wrap: anywhere;
}

.guest-privacy { font-size: .875rem; color: var(--ink-2); }

/* --- dialog: send emails (confirm → sending → results) and the copy fallback --- */
.dialog {
  width: min(100% - 32px, 32rem); max-height: calc(100dvh - 32px); padding: var(--space-5) var(--space-4); overflow: auto;
  background: var(--white); color: var(--plum); border: 1px solid var(--surface-line); border-radius: var(--radius-card);
  box-shadow: 0 30px 60px -24px rgb(31 21 56 / .6);
}
.dialog::backdrop { background: rgb(31 21 56 / .55); }
@media (min-width: 560px) { .dialog { padding: var(--space-5); } }

/* who gets the email: one native checkbox per guest */
.pick-list { max-height: 15rem; overflow: auto; border: 1px solid var(--surface-line); border-radius: var(--radius-field); }
.pick { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 0 var(--space-3); align-items: center; min-height: var(--tap); padding: 6px 14px; border-top: 1px solid var(--surface-line); cursor: pointer; }
li:first-child > .pick { border-top: 0; }
.pick input { grid-row: span 2; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.pick__name { font-weight: 700; overflow-wrap: anywhere; }
.pick__meta { grid-column: 2; font-size: .875rem; color: var(--ink-2); overflow-wrap: anywhere; }

.send-progress { display: block; width: 100%; height: 12px; accent-color: var(--accent); }

/* who was not emailed, and why */
.send-result { display: grid; gap: 0 var(--space-3); padding: 10px 0; border-top: 1px solid var(--surface-line); overflow-wrap: anywhere; }
.send-result:first-child { border-top: 0; }
.send-result b { font-weight: 700; }
.send-result span { font-size: .875rem; color: var(--ink-2); }
.send-result--failed span { color: var(--danger); font-weight: 700; }
