@font-face {
  font-family: "Outfit";
  src: url("/fonts/outfit.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Avida-inspired palette: red, greys, white */
  --red: #a5292f;
  --red-dark: #861f25;
  --red-soft: #fbf1f1;
  --red-line: #e7c3c5;
  --bg: #ffffff;
  --soft: #f6f5f3;
  --text: #2a2a2a;
  --muted: #6f6f6f;
  --line: #e4e2de;
  --line-strong: #bdbab5;
  --ok: #2f7a4f;
  --ok-soft: #eef7f1;
  --danger: #b3261e;
  --danger-soft: #fdf0ef;
  --radius: 14px;
  --bar-h: 84px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.55 "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
a { color: var(--red); }
em.hl { font-style: normal; color: var(--red); }

/* ── Header: name + live counter, then the thin progress bar ───────────── */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.topbar-inner {
  max-width: 640px; margin: 0 auto; padding: 12px 16px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; line-height: 1.2; min-width: 0; }
.brand svg, .brand img { width: 28px; height: 28px; flex-shrink: 0; object-fit: contain; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-name { font-size: 14px; font-weight: 600; color: var(--muted); }
.counter { display: flex; align-items: center; gap: 8px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 10px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(165, 41, 47, .5); }
  70% { box-shadow: 0 0 0 7px rgba(165, 41, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(165, 41, 47, 0); }
}
.counter-num { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--red); line-height: 1; }
.counter-label { font-size: 13px; color: var(--muted); line-height: 1; }
.counter-num.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.3); } }

.progress { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.progress-track { height: 4px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--red); border-radius: 99px; transition: width .4s ease; }
.progress.off .progress-track { visibility: hidden; }

/* ── Page + fade transition ───────────────────────────────────────────── */
#screen { transition: opacity .2s ease; }
#screen.out { opacity: 0; }
.page { max-width: 640px; margin: 0 auto; padding: 44px 20px calc(var(--bar-h) + 40px); animation: fadeIn .32s ease both; }
.page.no-bar { padding-bottom: 48px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 480px) { .page { padding-top: 32px; } }

h1, h2 { font-weight: 600; letter-spacing: -.01em; margin: 0 0 14px; }
h1 { font-size: 34px; line-height: 1.15; }
h2 { font-size: 28px; line-height: 1.2; }
@media (max-width: 480px) { h1 { font-size: 28px; } h2 { font-size: 24px; } }
h1:focus, h2:focus { outline: none; }
.lead { color: var(--muted); margin: 0 0 24px; font-size: 17px; }
.lead em.hl { color: var(--red); }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--red); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; }

/* ── Landing ──────────────────────────────────────────────────────────── */
.landing { text-align: center; padding-top: 56px; }
.landing .emblem { width: 96px; height: 96px; margin: 0 auto 28px; display: block; }
.landing img.emblem { width: auto; max-width: 220px; height: 72px; object-fit: contain; }
.landing h1 { font-size: 32px; max-width: 460px; margin: 0 auto 18px; }
.landing .disclaimer {
  max-width: 420px; margin: 0 auto 32px; font-size: 14px; color: var(--muted);
  background: var(--soft); border-radius: 12px; padding: 12px 16px;
}
.landing .count-line { font-size: 15px; color: var(--muted); margin-top: 18px; }
.landing .count-line b { color: var(--red); }

/* ── Petition intro ───────────────────────────────────────────────────── */
ul.asks { padding: 0; margin: 0 0 24px; list-style: none; }
ul.asks li { position: relative; padding: 12px 0 12px 32px; border-bottom: 1px solid var(--line); }
ul.asks li:last-child { border-bottom: 0; }
ul.asks li::before {
  content: ""; position: absolute; left: 4px; top: 19px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--red);
}
.section-title { font-size: 19px; font-weight: 600; margin: 8px 0 4px; }
.note { background: var(--soft); border-radius: 12px; padding: 14px 16px; font-size: 15px; margin: 0 0 20px; color: var(--text); }
.note b { color: var(--red); font-weight: 600; }
details.letter-toggle { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 8px; }
details.letter-toggle summary { cursor: pointer; padding: 16px 18px; font-weight: 600; color: var(--red); list-style: none; display: flex; justify-content: space-between; }
details.letter-toggle summary::after { content: "+"; font-size: 22px; line-height: 1; }
details.letter-toggle[open] summary::after { content: "–"; }
details.letter-toggle .paper { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }

/* ── Options (outlined rows) ──────────────────────────────────────────── */
.options { display: grid; gap: 12px; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  min-height: 64px; padding: 16px 20px; background: var(--bg); cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); font-size: 17px; font-weight: 500;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.option:hover { border-color: var(--line-strong); }
.option small { display: block; color: var(--muted); font-size: 14px; font-weight: 400; margin-top: 2px; }
.option[aria-pressed="true"] { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: var(--red-soft); }
.option .tick { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex-shrink: 0; display: grid; place-items: center; color: #fff; font-size: 13px; }
.option[aria-pressed="true"] .tick { background: var(--red); border-color: var(--red); }
.options.towers { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 480px) { .options.towers { grid-template-columns: repeat(3, 1fr); } }
.options.towers .option { flex-direction: column; justify-content: center; gap: 0; min-height: 88px; padding: 10px; text-align: center; }
.options.towers .option span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.options.towers .option strong { font-size: 30px; font-weight: 600; line-height: 1.1; }

/* ── Text inputs ──────────────────────────────────────────────────────── */
.field label { display: block; font-weight: 500; margin-bottom: 8px; color: var(--muted); font-size: 15px; }
.field input {
  width: 100%; min-height: 64px; padding: 14px 20px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--bg); font-size: 22px; font-weight: 500; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.field input.invalid { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.field input.initials { font-size: 30px; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.field input::placeholder { color: #c4c1bc; }
.hint { font-size: 14px; color: var(--muted); margin-top: 10px; }
.error { font-size: 14px; color: var(--danger); margin-top: 8px; font-weight: 500; min-height: 1.3em; }
.echo { margin-top: 6px; font-size: 15px; color: var(--muted); }
.echo strong { color: var(--text); font-weight: 600; }
.affirm { border-left: 3px solid var(--red); padding: 2px 0 2px 14px; margin: 0 0 24px; color: var(--muted); }

/* ── Bottom action bar ────────────────────────────────────────────────── */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--bg);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottombar-inner { max-width: 640px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 12px; min-height: var(--bar-h); }
.bottombar .spacer { flex: 1; }
.btn-back {
  width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.btn-back:hover { border-color: var(--line-strong); }
.btn-back svg { width: 18px; height: 18px; }
.btn-next {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 28px;
  border-radius: 999px; border: 0; background: var(--red); color: #fff; font-size: 17px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, opacity .15s ease, transform .08s ease;
}
.btn-next:hover { background: var(--red-dark); }
.btn-next:active { transform: scale(.98); }
.btn-next:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn-next svg { width: 16px; height: 16px; }
@media (max-width: 380px) { .btn-next { padding: 0 20px; } }

/* Generic buttons (organizer page, dialogs) */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 12px 20px;
  border-radius: 999px; border: 1px solid transparent; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-ghost { background: var(--bg); color: var(--text); border-color: var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-hero { display: inline-flex; width: auto; min-width: 240px; min-height: 56px; font-size: 18px; }
.actions { display: grid; gap: 10px; margin-top: 22px; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 15px; padding: 8px 0; }

/* ── Review ───────────────────────────────────────────────────────────── */
.preview-label { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.review-list { margin: 22px 0 0; border: 1px solid var(--line); border-radius: var(--radius); }
.review-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.review-row:last-child { border-bottom: 0; }
.review-row dt { flex: 0 0 120px; font-size: 15px; color: var(--muted); }
.review-row dd { flex: 1; margin: 0; font-weight: 600; word-break: break-word; }
.review-row button { background: none; border: 0; color: var(--red); font-weight: 600; font-size: 15px; cursor: pointer; padding: 6px; }
.redact { display: inline-block; background: var(--text); color: transparent; border-radius: 3px; user-select: none; letter-spacing: .1em; }

/* ── Consent ──────────────────────────────────────────────────────────── */
.disclosure { padding: 0; margin: 0 0 22px; list-style: none; counter-reset: d; }
.disclosure li { counter-increment: d; position: relative; padding: 12px 0 12px 38px; font-size: 15px; border-bottom: 1px solid var(--line); }
.disclosure li::before {
  content: counter(d); position: absolute; left: 0; top: 13px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 700; display: grid; place-items: center;
}
.check {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: 15px;
  transition: border-color .15s ease, background .15s ease;
}
.check:has(input:checked) { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: var(--red-soft); }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--red); cursor: pointer; }
.banner-error { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 14px 16px; font-weight: 500; font-size: 15px; margin-top: 16px; }
.turnstile-wrap { margin-top: 12px; }
.ts-err-title { margin: 0 0 4px; font-weight: 600; }
.ts-err-body { margin: 0 0 12px; font-weight: 400; color: var(--text); }
.btn-retry { background: var(--danger); color: #fff; border: 0; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; }

/* ── Done + live document ─────────────────────────────────────────────── */
.success { text-align: center; margin-bottom: 32px; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 30px; margin: 0 auto 18px; }
.success p { color: var(--muted); margin: 0; }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.doc-head h2 { margin: 0; font-size: 22px; }
.live-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: .08em; }

.paper {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 44px;
  font-family: Georgia, "Times New Roman", serif; font-size: 15.5px; line-height: 1.6; color: #222;
}
@media (max-width: 600px) { .paper { padding: 24px 18px; font-size: 15px; } }
.paper p { margin: 0 0 14px; }
.paper .recipient { margin: 18px 0; }
.paper .recipient p { margin: 0; }
.paper .subject { font-weight: 700; margin: 18px 0; }
.paper ul { margin: 0 0 14px; padding-left: 22px; }
.paper li { margin-bottom: 8px; }
.paper h3 { font-size: 16px; margin: 26px 0 10px; }
.paper .footnote { font-size: 13px; font-style: italic; color: var(--muted); margin-top: 18px; }
.paper .received { font-size: 13px; margin-top: 18px; word-break: break-word; }

.sig-table-wrap { overflow-x: auto; }
.sig-table { width: 100%; border-collapse: collapse; font-family: "Outfit", -apple-system, sans-serif; font-size: 14px; }
.sig-table th, .sig-table td { border: 1px solid var(--line); padding: 9px 10px; text-align: left; white-space: nowrap; }
.sig-table th { background: var(--soft); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.sig-table td.num { color: var(--muted); font-variant-numeric: tabular-nums; }
.sig-table .masked { color: var(--muted); letter-spacing: .12em; }
.sig-table .sig { font-family: "Snell Roundhand", "Segoe Script", "Brush Script MT", cursive; font-size: 20px; line-height: 1; }
.sig-table tr.mine td { background: var(--red-soft); font-weight: 600; }
.sig-table tr.fresh td { animation: fresh 2.5s ease; }
@keyframes fresh { from { background: #fff4d6; } }
.you-tag { display: inline-block; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 2px; letter-spacing: .06em; }
.sig-empty { color: var(--muted); font-style: italic; }
.privacy-foot { font-size: 14px; color: var(--muted); margin-top: 16px; text-align: center; }

@media (max-width: 600px) {
  .sig-table thead { display: none; }
  .sig-table, .sig-table tbody { display: block; }
  .sig-table tr { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; }
  .sig-table td { display: block; border: 0; padding: 0; white-space: normal; background: none !important; }
  .sig-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; line-height: 1.4; }
  .sig-table td.num { flex-basis: 100%; }
  .sig-table td.num::before { display: inline; margin-right: 4px; }
  .sig-table tr.mine { background: var(--red-soft); border-color: var(--red); }
  .sig-table tr.fresh { animation: fresh 2.5s ease; }
  .sig-table td[colspan] { flex-basis: 100%; }
}

/* ── Organizer page bits ──────────────────────────────────────────────── */
main.admin { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; }

/* ── Dialog ───────────────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30, 30, 30, .45); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; padding: 26px 24px; max-width: 420px; width: 100%; }
.modal h2 { font-size: 22px; }
.modal p { color: var(--muted); margin: 0; }

.loading { text-align: center; padding: 80px 0; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .topbar, .progress, .bottombar, .no-print { display: none !important; }
  .paper { border: 0; padding: 0; }
}
