/* ============================================================
   POLLR — Design System (adapted from designpattern/p3)
   Bold editorial / brutalist look for an online poll tool.
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   0. FONTS — served locally from /static/fonts/
   ───────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/SpaceGrotesk-Regular.otf') format('opentype');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/SpaceGrotesk-Medium.otf') format('opentype');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/SpaceGrotesk-Bold.otf') format('opentype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/JetBrainsMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/JetBrainsMono-Bold.woff2') format('woff2');
}

/* ─────────────────────────────────────────────────────────────
   1. DESIGN TOKENS
   ───────────────────────────────────────────────────────────── */

:root {
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --fs-xs:    0.75rem;
  --fs-sm:    0.875rem;
  --fs-base:  1rem;
  --fs-md:    1.125rem;
  --fs-lg:    1.5rem;
  --fs-xl:    2rem;
  --fs-2xl:   3rem;
  --fs-3xl:   4.5rem;
  --fs-4xl:   6.5rem;

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;

  --r-none: 0;
  --r-sm:   2px;
  --r-md:   4px;
  --r-pill: 999px;

  --bw-1: 1px;
  --bw-2: 2px;
  --bw-3: 3px;

  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-snap: cubic-bezier(.7, 0, .2, 1.2);
  --dur-fast:  120ms;
  --dur-base:  220ms;
  --dur-slow:  420ms;

  --container: 1120px;
  --grain-opacity: 0.06;

  /* Shared accents */
  --accent:        #D7FF3A;
  --accent-deep:   #B8E000;
  --secondary:     #FF5C3A;
  --secondary-deep:#E83A18;
}

/* ─────────────────────────────────────────────────────────────
   2. COLOR SCHEMES — PAPER (light) and CARBON (dark)
   ───────────────────────────────────────────────────────────── */

:root {
  --bg:           #F5F1E8;
  --bg-grain:     #EDE8DB;
  --surface:      #FFFFFF;
  --surface-alt:  #FAF7EE;
  --ink:          #0F0F12;
  --ink-soft:     #2A2A2E;
  --muted:        #6B6A60;
  --line:         #1A1A1F;
  --line-soft:    rgba(15, 15, 18, 0.14);
  --shadow:       0 4px 0 0 var(--ink);
  --shadow-press: 0 1px 0 0 var(--ink);
  --highlight:    var(--accent);
  --on-accent:    var(--ink);
  --danger:       var(--secondary);
  --on-danger:    #FFFFFF;
  --selection:    rgba(215, 255, 58, 0.55);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg:           #0A0A0C;
  --bg-grain:     #111114;
  --surface:      #15151A;
  --surface-alt:  #1C1C22;
  --ink:          #F2EDD9;
  --ink-soft:     #C9C4B1;
  --muted:        #7A786E;
  --line:         #F2EDD9;
  --line-soft:    rgba(242, 237, 217, 0.18);
  --shadow:       0 4px 0 0 var(--line);
  --shadow-press: 0 1px 0 0 var(--line);
  --on-accent:    #0A0A0C;
  --on-danger:    #0A0A0C;
  --selection:    rgba(215, 255, 58, 0.35);
  color-scheme: dark;
}

/* ─────────────────────────────────────────────────────────────
   3. RESET / BASE
   ───────────────────────────────────────────────────────────── */

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Subtle paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
:root[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.04; }

::selection { background: var(--selection); color: var(--ink); }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }

/* ─────────────────────────────────────────────────────────────
   4. TYPOGRAPHY UTILITIES
   ───────────────────────────────────────────────────────────── */

.t-display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.025em;
}

.t-eyebrow {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.t-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────────
   5. LAYOUT
   ───────────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--sp-5);
  position: relative;
  z-index: 2;
}

main.container { padding-block: var(--sp-7) var(--sp-9); }

/* Headings inside content */
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 6vw, var(--fs-3xl));
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: var(--sp-5);
}
/* Headings rendered inside a card should not use hero scale. */
article h1 {
  font-size: var(--fs-xl);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-3);
}
h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xl);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: var(--sp-7);
  margin-bottom: var(--sp-4);
}
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: var(--sp-3);
}
p { margin-bottom: var(--sp-4); }
p:last-child { margin-bottom: 0; }

.poll-description { margin-bottom: var(--sp-6); }
.poll-description blockquote { font-style: italic; }

/* ─────────────────────────────────────────────────────────────
   6. HEADER / NAV
   ───────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: var(--bw-2) solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--sp-4);
  gap: var(--sp-4);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--ink);
}
.brand__mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-display);
  font-weight: 700;
  transform: rotate(-3deg);
  border: var(--bw-2) solid var(--ink);
  transition: transform var(--dur-base) var(--ease-snap);
}
.brand:hover .brand__mark { transform: rotate(2deg) scale(1.05); }
.brand__word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
}
.brand__word::after { content: "."; color: var(--accent); margin-left: 1px; }

.tagline {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 10px;
  background: var(--surface);
  border: var(--bw-2) solid var(--line);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  color: var(--ink);
  box-shadow: none;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur-base) var(--ease-out);
}
.theme-toggle:hover { transform: translate(-1px, -1px); box-shadow: none; }
.theme-toggle:active { transform: translate(0, 0); box-shadow: none; }
.theme-toggle__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--ink);
}
:root[data-theme="dark"] .theme-toggle__dot { background: var(--accent); }

.site-header__tools {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.lang-switch {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
}
.lang-switch a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 2px 4px;
}
.lang-switch a:hover { color: var(--ink); }
.lang-switch a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ─────────────────────────────────────────────────────────────
   7. BADGES (status pills)
   ───────────────────────────────────────────────────────────── */

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 10px;
  border: var(--bw-2) solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--ink);
}
.badge--accent { background: var(--accent); color: var(--on-accent); border-color: var(--ink); }
.badge--dot::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
}
.badge--open::before { background: var(--accent); animation: pulse 1.8s ease-in-out infinite; }
.badge--closed { color: var(--muted); }
.badge--closed::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--secondary);
  display: inline-block;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.55; }
}

/* ─────────────────────────────────────────────────────────────
   8. BUTTONS
   ───────────────────────────────────────────────────────────── */

:where(.btn, button, [type="submit"], [role="button"]) {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-border: var(--line);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 14px 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-base);
  letter-spacing: -0.005em;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: var(--bw-2) solid var(--btn-border);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background var(--dur-base) var(--ease-out);
  white-space: nowrap;
}
:where(.btn, button, [type="submit"], [role="button"]):hover {
  transform: translate(-2px, -2px);
  box-shadow: 0 6px 0 0 var(--line);
}
:where(.btn, button, [type="submit"], [role="button"]):active {
  transform: translate(0, 0);
  box-shadow: var(--shadow-press);
}
:where(.btn, button, [type="submit"], [role="button"]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Default submit / primary action gets the accent fill. */
[type="submit"],
.btn--primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); }

/* Anchor-based buttons need an explicit color rule: the base `.btn` styles
   sit inside :where(...) (0 specificity), so without this the global
   `a { color: inherit }` would win and the link would inherit body text. */
a.btn { color: var(--btn-fg); }

.btn--ink     { --btn-bg: var(--ink); --btn-fg: var(--bg); }
.btn--ghost,
.secondary    { --btn-bg: var(--surface); --btn-fg: var(--ink); }
.btn--danger,
button.btn--danger,
[type="submit"].btn--danger { --btn-bg: var(--secondary); --btn-fg: var(--on-danger); }
.btn--sm      { padding: 9px 14px; font-size: var(--fs-sm); }

/* ─────────────────────────────────────────────────────────────
   9. FORM FIELDS
   ───────────────────────────────────────────────────────────── */

form { display: grid; gap: var(--sp-5); }
/* Buttons inside a grid form would otherwise stretch full-width and read as
   banners; keep them at their natural width like everywhere else. Buttons
   wrapped in <p> are already block-children of <p>, so this only targets the
   direct-child case. */
form > :where(button, [type="submit"], a.btn) { justify-self: start; }
article > label + label { margin-top: var(--sp-5); }

label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="email"],
textarea,
select {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  background: var(--surface);
  border: var(--bw-2) solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  width: 100%;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="datetime-local"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  border-color: var(--ink);
  box-shadow: 4px 4px 0 0 var(--accent);
}
input[readonly] {
  background: var(--surface-alt);
  cursor: text;
}
textarea { resize: vertical; min-height: 100px; }

/* Caption / hint text inside labels and elsewhere */
small {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: none;
}

/* ─────────────────────────────────────────────────────────────
   10. FIELDSETS — used for poll-kind selection & per-question
   ───────────────────────────────────────────────────────────── */

fieldset {
  border: var(--bw-2) solid var(--line);
  background: var(--surface);
  padding: var(--sp-5);
  margin: 0;
  display: grid;
  gap: var(--sp-3);
  box-shadow: 4px 4px 0 0 var(--line);
}
legend {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
  color: var(--ink);
  padding: 0 var(--sp-2);
  background: var(--bg);
  border: var(--bw-2) solid var(--line);
}
legend small {
  font-family: var(--font-mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-left: var(--sp-2);
}
.question-item + .question-item { margin-top: var(--sp-6); }
legend.question-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  box-sizing: border-box;
}
.legend-action {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legend-action:hover,
.legend-action:focus-visible {
  color: var(--ink);
  outline: none;
}

/* Radio / checkbox lines inside fieldset:
   the surrounding <label> shifts back to body text. */
fieldset > label {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  padding: var(--sp-3) var(--sp-4);
  border: var(--bw-2) solid var(--line);
  background: var(--bg);
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
fieldset > label:hover {
  background: var(--surface-alt);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 0 var(--line);
}
fieldset > label:has(input:checked) {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: 4px 4px 0 0 var(--accent), 4px 4px 0 2px var(--line);
  transform: translate(-2px, -2px);
}

/* Stamped radio / checkbox marks */
fieldset input[type="radio"],
fieldset input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: var(--bw-2) solid var(--line);
  background: var(--surface);
  margin: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: background var(--dur-base) var(--ease-out);
}
fieldset input[type="radio"] { border-radius: 50%; }
fieldset input[type="radio"]::after,
fieldset input[type="checkbox"]::after {
  content: "";
  width: 16px;
  height: 16px;
  background: var(--accent);
  transform: scale(0) rotate(-8deg);
  transition: transform var(--dur-base) var(--ease-snap);
}
fieldset input[type="radio"]::after { border-radius: 50%; }
fieldset input[type="radio"]:checked::after,
fieldset input[type="checkbox"]:checked::after { transform: scale(1) rotate(-8deg); }
fieldset input[type="radio"]:focus-visible,
fieldset input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Inline checkbox / radio rows that live *outside* a fieldset
   (e.g. "Multiple choice" toggle inside a question-block). */
label.inline {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  cursor: pointer;
}
label.inline input[type="checkbox"],
label.inline input[type="radio"] {
  width: auto;
  height: auto;
  margin: 0;
  accent-color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────
   11. QUESTION-BLOCKS (used both in the create-poll form
       and in vote / admin views)
   ───────────────────────────────────────────────────────────── */

.question-block {
  border: var(--bw-2) solid var(--line);
  background: var(--surface);
  padding: var(--sp-5);
  box-shadow: 6px 6px 0 0 var(--line);
  display: grid;
  gap: var(--sp-4);
  margin: 0;
}
.question-block + .question-block { margin-top: var(--sp-5); }
.question-block .options-container {
  display: grid;
  gap: var(--sp-3);
}

/* ─────────────────────────────────────────────────────────────
   12. ARTICLE — generic surface block
   ───────────────────────────────────────────────────────────── */

article {
  border: var(--bw-2) solid var(--line);
  background: var(--surface);
  padding: var(--sp-5);
  box-shadow: 6px 6px 0 0 var(--line);
  margin-bottom: var(--sp-5);
}
/* Edit action stacked above a card's title — give it room so the button's
   hard shadow doesn't crowd the heading below it. */
.card-actions { margin-bottom: var(--sp-3); }

article > header {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-4);
  border-bottom: var(--bw-2) solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-4);
}

/* ─────────────────────────────────────────────────────────────
   13. RESULT ROWS — used in admin_results.html
   ───────────────────────────────────────────────────────────── */

/* Export actions above the closed-poll results listing. */
.export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.result-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-2) var(--sp-3);
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: var(--bw-2) solid var(--line);
  margin: var(--sp-3) 0;
  overflow: hidden;
}
/* A question block in the results listing: title, caption, then rows.
   Increase the gap between consecutive questions and breathe the caption. */
#results section + section,
#public-results section + section { margin-top: var(--sp-7); }
#results section > h3,
#public-results section > h3 { margin-bottom: var(--sp-2); }
#results section > small,
#public-results section > small {
  display: block;
  margin-bottom: var(--sp-3);
}
.result-row .label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--fs-base);
  color: var(--ink);
  z-index: 2;
}
.result-row > span:nth-of-type(2) {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--ink);
  z-index: 2;
}
.result-row .bar-wrap {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--bg);
  border: var(--bw-1) solid var(--line-soft);
  z-index: 2;
}
.bar {
  background: var(--accent);
  height: 100%;
  min-width: 2px;
  transition: width var(--dur-slow) var(--ease-out);
}

/* ─────────────────────────────────────────────────────────────
   14. TOKEN LIST — participant URLs
   ───────────────────────────────────────────────────────────── */

/* Header carries a right-aligned "Copy all" action; center it against the
   title rather than sharing the baseline used for text-only headers. */
#participant-urls > header { align-items: center; }

/* The "generate URLs" form and the destructive "close poll" form are sibling
   <form>s, so the grid `gap` inside each leaves them touching. Set the spacing
   rhythm between them and give the irreversible close action its own zone with
   a soft divider, rather than stacking it flush against Generate. */
#participant-urls form + form {
  margin-top: var(--sp-5);
  padding-top: var(--sp-5);
  border-top: var(--bw-2) solid var(--line-soft);
}

.token-list {
  display: grid;
  gap: var(--sp-2);
  margin: var(--sp-3) 0;
}
.token-list code,
.token-row__url {
  display: block;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg);
  border: var(--bw-2) solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--ink);
  word-break: break-all;
}
.token-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--sp-3);
  align-items: stretch;
}
.token-row button { padding: 10px 14px; font-size: var(--fs-sm); }
.header-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.token-row__url { text-decoration: none; }
.token-row__url:hover,
.token-row__url:focus-visible { text-decoration: underline; }
.token-row__voted {
  font-family: var(--font-body);
  margin-left: var(--sp-3);
  opacity: 0.7;
}
.btn--used::before { content: "✓ "; }
.btn--used { opacity: 0.7; }

/* ─────────────────────────────────────────────────────────────
   15. COPY-ROW — read-only field + copy button
   ───────────────────────────────────────────────────────────── */

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-3);
  align-items: stretch;
}
.copy-row input { margin: 0; }
.copy-row button { padding: 10px 16px; font-size: var(--fs-sm); }

/* ─────────────────────────────────────────────────────────────
   16. CALLOUT / ALERT — also used for inline error blocks
   ───────────────────────────────────────────────────────────── */

.callout {
  border: var(--bw-2) solid var(--line);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.callout--danger {
  background: var(--secondary);
  color: var(--on-danger);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 0 var(--ink);
}
.callout--info {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 0 var(--ink);
}
.callout__mark {
  width: 32px;
  height: 32px;
  border: var(--bw-2) solid currentColor;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  transform: rotate(-4deg);
}

/* ─────────────────────────────────────────────────────────────
   16b. LANDING PAGE
   ───────────────────────────────────────────────────────────── */

.landing-hero {
  padding-block: var(--sp-7) var(--sp-7);
  border-bottom: var(--bw-2) solid var(--line);
}
.landing-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.landing-hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 8vw, var(--fs-4xl));
  line-height: 0.92;
  letter-spacing: -0.04em;
  margin-bottom: var(--sp-5);
  color: var(--ink);
  /* Stacking context so the em's negative-z-index highlight sits behind
     all of the title's text (including descenders from adjacent lines). */
  position: relative;
  z-index: 0;
}
.landing-hero__title em {
  position: relative;
  font-style: italic;
  color: var(--on-accent);
  padding: 0 0.12em;
}
.landing-hero__title em::before {
  content: "";
  position: absolute;
  top: 0.12em;
  bottom: 0.04em;
  left: 0;
  right: 0;
  background: var(--accent);
  z-index: -1;
}
.landing-hero__lede {
  font-size: var(--fs-md);
  max-width: 60ch;
  color: var(--ink-soft);
  margin-bottom: var(--sp-6);
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
  margin-top: var(--sp-7);
}
.landing-features > article {
  background: var(--surface);
  border: var(--bw-2) solid var(--line);
  padding: var(--sp-5);
  box-shadow: 4px 4px 0 0 var(--line);
  display: grid;
  gap: var(--sp-3);
}
.landing-features h3 { margin: 0; }
.landing-features p { color: var(--ink-soft); }

@media (max-width: 720px) {
  .landing-features { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────
   17. FOOTER
   ───────────────────────────────────────────────────────────── */

footer.container {
  border-top: var(--bw-2) solid var(--line);
  padding: var(--sp-6) var(--sp-5);
  margin-top: var(--sp-9);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}
footer.container a { color: var(--ink); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  justify-content: space-between;
  align-items: center;
}
.site-footer__links {
  display: inline-flex;
  gap: var(--sp-3);
  align-items: center;
}

/* Legal pages (imprint, privacy) */
.legal {
  max-width: 70ch;
  margin: var(--sp-6) auto;
  line-height: 1.65;
}
.legal > h1 {
  font-family: var(--font-display, inherit);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 0.95;
  margin: 0 0 var(--sp-6);
}
.legal p,
.legal ul { margin: var(--sp-3) 0; }
.legal ul { padding-left: 1.25em; }
.legal li { margin: 0.25em 0; }
.legal a { color: var(--ink); }
.legal code {
  font-family: var(--font-mono);
  font-size: 0.95em;
  background: var(--surface-2, rgba(0,0,0,0.04));
  padding: 0.05em 0.35em;
  border-radius: 3px;
}

.legal__head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--sp-4);
  margin: var(--sp-8) 0 var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: var(--bw-2) solid var(--line);
}
.legal__head h2 {
  font-family: var(--font-display, inherit);
  font-weight: 700;
  font-size: var(--fs-xl);
  letter-spacing: -0.02em;
  margin: 0;
}
.legal__head .t-eyebrow { white-space: nowrap; }
.legal h3 {
  font-family: var(--font-display, inherit);
  font-weight: 700;
  font-size: var(--fs-lg, 1.15rem);
  margin: var(--sp-5) 0 var(--sp-2);
}

/* ─────────────────────────────────────────────────────────────
   18. RESPONSIVE & MOTION
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  article,
  .question-block,
  fieldset { padding: var(--sp-4); box-shadow: 4px 4px 0 0 var(--line); }
  .copy-row { grid-template-columns: 1fr; }
  .token-row { gap: var(--sp-2); }
  .token-row button {
    padding: 6px 8px;
    font-size: var(--fs-xs);
    min-height: 44px;
  }
  .token-row__url { font-size: var(--fs-xs); padding: var(--sp-2) var(--sp-3); }
  article > header { flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
