/* crowdsteer: sign system. See DESIGN.md. */
:root {
  --sign: #f5cc14;
  --label: #ffffff;
  --ink: #121212;
  --muted: #3a3517;
  --hair: #d9d5c3;
  --wide: "Archivo", "Helvetica Neue", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --r: 4px;
}
* { box-sizing: border-box; }
html { background: var(--sign); color: var(--ink); }
body {
  margin: 0;
  font: 400 17px/1.55 var(--wide);
  font-variation-settings: "wdth" 100;
}
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.meta { color: var(--muted); font-size: 0.875rem; margin: 0.25rem 0 0; }

/* the sign: the one loud thing, set wide and heavy */
.sign {
  padding: 40px clamp(16px, 5vw, 64px) 32px;
  border-bottom: 3px solid var(--ink);
}
.wordmark {
  margin: 0 0 20px;
  font: 800 1.25rem/1 var(--wide);
  font-variation-settings: "wdth" 125;
}
h1 {
  margin: 0;
  max-width: 16ch;
  font: 800 clamp(2.2rem, 6.4vw, 4.6rem)/1.02 var(--wide);
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.01em;
}
h1 em { font-style: italic; }
.lede { max-width: 60ch; margin: 20px 0 0; font-size: 1.125rem; }

/* the countdown: the page's one ominous object. Black band, yellow digits;
   in the last ten seconds it flips to black on yellow (state, not decoration) */
.countdown {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 32px;
  padding: 8px clamp(16px, 5vw, 64px) 20px;
  background: var(--ink); color: var(--sign);
  border-bottom: 3px solid var(--ink);
}
.digits {
  font: 800 clamp(6rem, 24vw, 18rem)/0.86 var(--wide);
  font-variation-settings: "wdth" 125;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.countdown-note {
  margin: 0 0 12px; max-width: 22ch;
  font: 700 clamp(1.1rem, 2.4vw, 1.6rem)/1.2 var(--wide);
  font-variation-settings: "wdth" 118;
}
.countdown.closing { background: var(--sign); color: var(--ink); }
.countdown .url {
  margin: 0 0 12px auto;
  font: 800 clamp(1.1rem, 2.4vw, 1.6rem)/1.2 var(--wide);
  font-variation-settings: "wdth" 125;
}
.entry-url {
  margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--hair);
  font: 800 0.95rem/1 var(--wide); font-variation-settings: "wdth" 125;
  text-align: right;
}
q { font-style: italic; }

main {
  padding: 32px clamp(16px, 5vw, 64px) 48px;
  display: grid;
  gap: 28px;
  align-items: start;
}
.col-main { display: grid; gap: 28px; min-width: 0; }
/* narrow: one column, chat directly after the ballot instead of at the end */
@media (max-width: 1099px) {
  .col-main { display: contents; }
  .entry { order: 1; } .gate { order: 2; } .ballot { order: 3; }
  .chat { order: 4; } .notes { order: 5; }
}
@media (min-width: 1100px) {
  main { grid-template-columns: minmax(0, 1fr) 360px; }
  .chat { position: sticky; top: 16px; height: calc(100vh - 32px); }
}
h2 {
  margin: 0;
  font: 800 1.375rem/1.2 var(--wide);
  font-variation-settings: "wdth" 118;
}

/* the model's answer: the product, set quietly as prose on a white label */
.entry {
  max-width: 68ch;
  background: var(--label);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  padding: 20px 24px 18px;
}
.entry-head {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: space-between; align-items: baseline;
}
blockquote {
  margin: 16px 0 12px;
  font: 400 1.3rem/1.55 var(--serif);
  font-optical-sizing: auto;
}
blockquote p { margin: 0; }
blockquote .pending { color: var(--muted); }

button {
  font: 600 0.95rem/1 var(--wide);
  min-height: 44px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--label);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  cursor: pointer;
}
button[aria-pressed="true"] { background: var(--ink); color: var(--sign); }
button:hover { text-decoration: underline; text-underline-offset: 3px; }

.gate { max-width: 68ch; }

/* ballot: wider than the entry, so the page steps out once */
.ballot {
  max-width: 1000px;
  background: var(--label);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  padding: 20px 24px 12px;
}
table { width: 100%; border-collapse: collapse; margin-top: 16px; }
thead th {
  text-align: left; font-weight: 600; font-size: 0.8rem; color: var(--muted);
  padding: 6px 8px; border-bottom: 2px solid var(--ink);
}
tbody th, td { padding: 10px 8px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
tbody tr:last-child > * { border-bottom: 0; }
.r { text-align: right; }
.dir { font-weight: 600; text-align: left; font-size: 1rem; }
td.dose { text-align: right; white-space: nowrap; }
.track {
  display: inline-block; vertical-align: middle; position: relative;
  width: 72px; height: 10px; margin-left: 10px;
  border: 1px solid var(--ink); border-radius: 2px; overflow: hidden;
}
/* doses are signed: the bar grows right of the center line for positive
   doses and left of it for negative ones */
.track::after {
  content: ""; position: absolute; left: 50%; top: -1px; bottom: -1px;
  width: 1px; background: var(--ink);
}
.fill {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 50%;
  background: var(--ink);
  transform-origin: left; transform: scaleX(0);
  transition: transform 0.6s ease-out;
}
.fill.neg { left: auto; right: 50%; transform-origin: right; }
svg.trail { display: block; width: 150px; height: 30px; overflow: visible; }
svg.trail .zero { stroke: var(--muted); stroke-dasharray: 2 3; }
svg.trail polyline { fill: none; stroke: var(--ink); stroke-width: 1.5; }
td.tally { text-align: right; color: var(--muted); font-size: 0.9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.vote { white-space: nowrap; text-align: right; }
td.vote button + button { margin-left: 6px; }

.notes { max-width: 68ch; }
.notes .ask {
  font: 800 clamp(1.8rem, 4vw, 2.6rem)/1.1 var(--wide);
  font-variation-settings: "wdth" 125;
  margin: 12px 0 28px;
}
.notes h2 { margin-top: 12px; }
.notes p { margin: 10px 0; }
#feed { padding-left: 0; list-style: none; margin: 10px 0; }
#feed li { padding: 12px 0; border-top: 1px solid var(--ink); }
#feed .text { margin: 0; font: 400 1.05rem/1.55 var(--serif); }

/* chat: a white label like the others, the log scrolls inside it */
.chat {
  display: flex; flex-direction: column; min-height: 420px;
  background: var(--label);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  padding: 16px 16px 12px;
}
.chat[hidden] { display: none; }
#chatlog {
  flex: 1; overflow-y: auto; list-style: none; margin: 10px 0; padding: 0;
  border-top: 1px solid var(--hair); max-height: 70vh;
}
#chatlog li { padding: 8px 0; border-bottom: 1px solid var(--hair); overflow-wrap: anywhere; }
#chatlog .who { font-weight: 700; font-size: 0.85rem; display: block; }
#chatlog .mine .who::after { content: " (you)"; font-weight: 400; color: var(--muted); }
#chatform { display: flex; gap: 8px; }
#chatinput {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 12px;
  font: 400 1rem var(--wide); color: var(--ink); background: var(--label);
  border: 2px solid var(--ink); border-radius: var(--r);
}

footer {
  padding: 20px clamp(16px, 5vw, 64px) 32px;
  border-top: 3px solid var(--ink);
  font-size: 0.875rem;
}
footer p { margin: 0; }

@media (max-width: 720px) {
  th:nth-child(3), td.trailcell { display: none; }
}
@media (max-width: 480px) {
  th:nth-child(4), td.tally { display: none; }
}
@media (max-width: 720px) {
  .track { display: none; }
  .ballot, .entry { padding: 16px; }
  .countdown .url { margin-left: 0; }
  blockquote { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  .fill { transition: none; }
}
