/* Fraunces carries the brand voice: an old-style face with just enough
   wonk to feel human, for the questions and the wordmark only. Latin
   subset self-hosted; Hindi, Japanese, Chinese, Russian text falls back
   to the system serif by design. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/assets/fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD;
}

:root {
  --paper: #faf6ee;
  --card: #fffdf8;
  --ink: #1b1611;
  --ink-mid: #5c584e;
  --ink-dim: #8d8778;
  --line: #e3dccb;
  --accent: #0e7a5f;
  --accent-ink: #ffffff;
  --accent-soft: #e7f2ed;
  --seal: #c2452d;
  --amber: #b26f00;
  --contrarian: #6d3fd1;
  --contrarian-soft: #efe9fb;
  --danger: #b3261e;
  --display: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14120e;
    --card: #1d1a15;
    --ink: #f0ece1;
    --ink-mid: #a8a294;
    --ink-dim: #6f6a5e;
    --line: #2e2a22;
    --accent: #3fcf9d;
    --accent-ink: #08130f;
    --accent-soft: #15251e;
    --seal: #e2694f;
    --amber: #e0a83f;
    --contrarian: #a98ff0;
    --contrarian-soft: #241d38;
    --danger: #e57373;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

a { color: var(--accent); text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------- header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 10px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -0.015em;
}

.wordmark b { font-weight: 700; }

.mark { width: 26px; height: 26px; display: block; }

.top-meta {
  font-size: 13px;
  color: var(--ink-mid);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 13px;
  font-weight: 600;
}

/* ------------------------------------------------------------ sections */
/* Print, not panels: content sits on the paper, sections open with a rule
   the way a ballot or a broadsheet section does. The first section gets
   the heavy ink rule; the rest get hairlines. No boxes, no shadows. */

.card {
  background: transparent;
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 20px 0 10px;
  margin-top: 26px;
  position: relative;
}

#app > .card:first-child {
  border-top: 2.5px solid var(--ink);
}

.kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
}

.kicker .sep { color: var(--ink-dim); margin: 0 6px; font-weight: 400; }
.kicker .date { color: var(--ink-dim); letter-spacing: 0.04em; }

.question {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(25px, 6vw, 34px);
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 8px 0 20px;
  text-wrap: balance;
}

.subline { color: var(--ink-mid); font-size: 14px; margin: 0 0 16px; }

/* ------------------------------------------------------------- options */

.options { display: grid; gap: 10px; }

/* Ballot lines: heavy ink outlines, a square box you mark. */
.opt {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 17px;
  font-weight: 550;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 3px;
  padding: 14px 15px;
  cursor: pointer;
  transition: background 0.12s, transform 0.06s;
  touch-action: manipulation;
}

.opt:hover { background: var(--card); }
.opt:active { transform: scale(0.985); }

.opt .tag {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 2px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 750;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
}

.opt.picked {
  background: var(--accent-soft);
  border-color: var(--ink);
}

.opt.picked .tag { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.opt:disabled { cursor: default; opacity: 0.9; }

/* --------------------------------------------------------------- timer */

.timer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.ring { width: 52px; height: 52px; flex: none; }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--line); }
.ring .arc {
  stroke: var(--accent);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
}
.ring.late .arc { stroke: var(--amber); }

.ring text {
  font: 700 17px var(--mono);
  fill: var(--ink);
  text-anchor: middle;
  dominant-baseline: central;
}

.timer-label { font-size: 13px; color: var(--ink-mid); line-height: 1.35; }

/* --------------------------------------------------------------- misc */

/* Buttons are ink stamps: the accent stays reserved for data and links. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 13px 20px;
  cursor: pointer;
  border: 2px solid var(--ink);
  text-decoration: none;
  touch-action: manipulation;
}

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--card); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.countdown {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.bignum {
  font-family: var(--mono);
  font-size: clamp(30px, 8vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}

.note { font-size: 13px; color: var(--ink-dim); margin-top: 14px; }

/* Pills speak in the eyebrow voice: type, not iconography. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-mid);
}

.pill.green { color: var(--accent); border-color: var(--accent); }
.pill.contrarian { color: var(--contrarian); border-color: var(--contrarian); }
.pill.amber { color: var(--amber); border-color: var(--amber); }

.badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }

/* The receipt pills land one by one right after the vote seals. */
.badges .pill { animation: pillrise 0.3s ease both; }
.badges .pill:nth-child(2) { animation-delay: 0.1s; }
.badges .pill:nth-child(3) { animation-delay: 0.2s; }
.badges .pill:nth-child(4) { animation-delay: 0.3s; }
@keyframes pillrise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* Final hour: the countdown turns accent. Set from the tick, no polling
   cost beyond the second-timer that already runs. */
.countdown.soon { color: var(--accent); }

/* A single lift of the primary button a few seconds in, once per day. */
.btn-nudge { animation: nudge 0.7s ease 1; }
@keyframes nudge {
  0%, 100% { transform: none; }
  30% { transform: translateY(-4px); }
  55% { transform: translateY(1px); }
}

.email-inline { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* The address field needs real width; on narrow screens the button drops
   to its own full-width line instead of crushing the input. */
.email-inline .btn-row { flex-wrap: wrap; }
.email-inline input { flex: 1 1 170px; }
.email-inline .btn { flex: 1 1 auto; }

details.more { margin-top: 14px; }
details.more summary {
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink-mid);
  list-style: none;
}
details.more summary::before { content: "▸ "; color: var(--ink-dim); }
details.more[open] summary::before { content: "▾ "; }
details.more summary::-webkit-details-marker { display: none; }

/* Defend/Argue as one equal-width pair. */
.btn-row.split2 .btn { flex: 1 1 0; text-align: center; justify-content: center; }

/* The composer: countdown counter warms as characters run out, the send
   button pops the moment a line qualifies, the preview row is the exact
   voice slot from the reveal page. */
.composer-meta {
  display: flex;
  justify-content: flex-end;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-dim);
  margin-top: 4px;
}
.composer-meta .low { color: var(--amber); font-weight: 700; }
.composer .voice { margin-top: 10px; }
.btn.pop { animation: btnpop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
@keyframes btnpop {
  50% { transform: scale(1.05); }
}

/* ---------------------------------------------------------------- seal */
/* The stamp: the sealed state made physical. One per view, always tilted,
   always vermillion. */

.seal-stamp {
  position: absolute;
  top: 18px;
  right: 0;
  width: 92px;
  height: 92px;
  border: 2px solid var(--seal);
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  transform: rotate(8deg);
  color: var(--seal);
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.7;
  opacity: 0.85;
  pointer-events: none;
}

.card:has(.seal-stamp) .kicker,
.card:has(.seal-stamp) .question {
  padding-right: 96px;
}

@media (max-width: 420px) {
  .seal-stamp { width: 76px; height: 76px; font-size: 8px; top: 16px; right: 0; }
  .card:has(.seal-stamp) .kicker,
  .card:has(.seal-stamp) .question { padding-right: 84px; }
}

.seal-stamp { mix-blend-mode: multiply; border-width: 1.5px; }

.seal-stamp::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--seal);
  border-radius: 50%;
  opacity: 0.75;
}

@media (prefers-color-scheme: dark) {
  .seal-stamp { mix-blend-mode: screen; }
}

/* ------------------------------------------------------------ world bar */
/* The trademark: ten cells, same silhouette as the share artifact. */

.worldbar {
  display: flex;
  gap: 5px;
  margin: 16px 0 8px;
}

.worldbar i {
  flex: 1;
  aspect-ratio: 1 / 1;
  border-radius: 22%;
  transform: scale(0.3);
  opacity: 0;
  animation: cellpop 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
  animation-delay: calc(var(--i) * 55ms);
}

/* Sealed cells breathe in a slow wave: the ballot box is alive, waiting.
   Staggered by cell index; one full sweep takes ~4s. */
/* Sealed cells breathe in a slow wave: the ballot box is alive, waiting.
   Staggered by cell index; one full sweep takes ~4s. */
.worldbar i.sealed {
  background: var(--card);
  border: 2px solid var(--ink);
  transform: none;
  animation: breathe 4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.28s);
}

@keyframes breathe {
  0%, 100% { opacity: 0.45; }
  12% { opacity: 1; }
  30% { opacity: 0.45; }
}

/* A "?" rides the wave: each cell asks the question as the sweep passes
   through it, then goes dark again. Same clock, same stagger. Upright on
   purpose: the cells are <i> tags and would lend it their italics. */
.worldbar i.sealed { position: relative; }
.worldbar i.sealed::after {
  content: "?";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-style: normal;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-mid);
  opacity: 0;
  animation: qride 4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.28s);
}
@keyframes qride {
  0%, 100% { opacity: 0; transform: translateY(2px); }
  12% { opacity: 0.8; transform: none; }
  30% { opacity: 0; transform: translateY(-2px); }
}

/* The call screen: drag the split you expect. The bar paints live, the
   ends carry the names and numbers, and the interaction is a drag so it
   can never be mistaken for the vote screen it replaced. */
.call-ends {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 16px 0 8px;
  font-size: 15px;
  color: var(--ink-mid);
}
.call-ends b { font-family: var(--mono); font-size: 19px; color: var(--ink); }
.call-ends span { max-width: 46%; }
.call-ends span:last-child { text-align: right; }
input[type="range"].call-range {
  width: 100%;
  margin-top: 12px;
  accent-color: var(--accent);
  height: 28px;
}

@keyframes cellpop {
  to { transform: scale(1); opacity: 1; }
}

.ring .ticks {
  stroke: var(--line);
  stroke-width: 2;
  stroke-dasharray: 1.5 8.45; /* 12 dial marks on r=19 */
}

/* ------------------------------------------------------------- results */

.res-row { margin: 14px 0; }

.res-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 15px;
  margin-bottom: 5px;
}

.res-head .you {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.res-pct { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }

.bar {
  height: 13px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  background: var(--ink-dim);
  transition: width 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* One encoding per option, everywhere: meters wear the option color. */
.bar > i.c0 { background: var(--accent); }
.bar > i.c1 { background: #8f63e0; }
.bar > i.c2 { background: #ddb43c; }
.bar > i.c3 { background: #3f8ae0; }
.res-row.mine .res-head { color: var(--ink); font-weight: 650; }

/* Attribution inside the screenshot region: links get stripped when
   results are reposted, pixels don't. */
.stamp {
  margin: 12px 0 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink-mid);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}

/* Report figures, not tiles: a rule over a number. */
.stat {
  border: none;
  border-top: 2px solid var(--ink);
  border-radius: 0;
  padding: 8px 0 0;
  background: transparent;
}

.stat .v { font-family: var(--mono); font-size: 21px; font-weight: 700; }
.stat .k { font-size: 12px; color: var(--ink-mid); margin-top: 2px; }

.split-section { margin-top: 26px; }
.split-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mid);
  margin: 0 0 4px;
}
.split-sub { font-size: 13px; color: var(--ink-dim); margin: 0 0 12px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-mid); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

.split-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 14px; }
.split-row .lbl {
  flex: none;
  width: 128px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.split-row .lbl small { color: var(--ink-dim); }
.split-row .stack {
  flex: 1;
  display: flex;
  height: 14px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--line);
}
.split-row .stack i {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  overflow: hidden;
  font: 650 10px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: #fdfaf3;
}
.split-row .stack i.c2 { color: #2a2005; }
@media (prefers-color-scheme: dark) {
  .split-row .stack i.c0 { color: #08130f; }
}

/* Option colors match the share emoji palette: 🟩 🟪 🟨 🟦 */
.c0 { background: var(--accent); }
.c1 { background: #8f63e0; }
.c2 { background: #ddb43c; }
.c3 { background: #3f8ae0; }

/* Margin note, not an alert box. */
.callout {
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0 0;
  margin-top: 20px;
  font-size: 14.5px;
  color: var(--ink-mid);
  background: transparent;
}

.callout b { color: var(--ink); }

.expander {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------- profile */

.profile-grid { display: grid; gap: 12px; margin-top: 14px; }

.profile-grid label { font-size: 13px; font-weight: 650; color: var(--ink-mid); display: block; margin-bottom: 5px; }

.profile-grid select {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 11px 12px;
  border-radius: 3px;
  border: 1.5px solid var(--ink-dim);
  background: transparent;
  color: var(--ink);
}

/* -------------------------------------------------------------- footer */

.foot {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-mid);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.foot a { color: var(--ink-mid); }
.foot a:hover { color: var(--accent); }

/* --------------------------------------------------------------- prose */

.prose h1 { font-family: var(--display); font-weight: 600; font-size: 30px; line-height: 1.2; margin: 26px 0 8px; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: 21px; margin: 26px 0 6px; }
.prose p, .prose li { color: var(--ink); font-size: 16px; }
.prose p { margin: 10px 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  border-radius: 3px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 50;
}
.toast.show { opacity: 1; }

.fade-in { animation: fadeUp 0.35s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

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

.archive-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.archive-item .q { font-family: var(--display); font-weight: 600; font-size: 18px; margin: 2px 0 6px; }
.archive-item .meta { font-size: 13px; color: var(--ink-mid); }
.hidden { display: none !important; }

/* RTL (Arabic): flip the physical-direction rules above. Flex and grid
   layouts mirror on their own from dir="rtl". */
[dir="rtl"] .top-meta { text-align: left; }
[dir="rtl"] .opt { text-align: right; }
[dir="rtl"] .seal-stamp { right: auto; left: 0; }
[dir="rtl"] .card:has(.seal-stamp) .kicker,
[dir="rtl"] .card:has(.seal-stamp) .question { padding-right: 0; padding-left: 96px; }
@media (max-width: 420px) {
  [dir="rtl"] .seal-stamp { left: 0; }
  [dir="rtl"] .card:has(.seal-stamp) .kicker,
  [dir="rtl"] .card:has(.seal-stamp) .question { padding-left: 84px; }
}

#suggestCard textarea, #suggestCard input, #defendCard textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 11px 12px;
  border-radius: 3px;
  border: 1.5px solid var(--ink-dim);
  background: transparent;
  color: var(--ink);
  margin-top: 10px;
  resize: vertical;
}

#suggestCard textarea::placeholder, #suggestCard input::placeholder { color: var(--ink-dim); }

.voice { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.voice-q { display: block; font-family: var(--serif); font-style: italic; font-size: 16px; }
.voice-meta { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink-mid); }
.voice-meta i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
