/* Poll — Living Print tokens (from UX/personal-brand/assets/site.css), trimmed to what a poll needs. */
@font-face { font-family: "Source Sans 3"; src: url("fonts/source-sans-3.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Equity"; src: url("fonts/equity_b_regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Equity"; src: url("fonts/equity_b_italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Equity"; src: url("fonts/equity_b_bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --ink: #262015; --authority: #2F6173; --paper-neutral: #A69F8E; --light-accent: #85B9D9; --warm: #735439;
  --bg: #F6F4EF; --bg-raised: #FBFAF6; --text: #262015; --text-secondary: #735439; --text-muted: #7a6e5b;
  --link: #2F6173; --hover: #85B9D9;
  --rule: rgba(38, 32, 21, 0.16); --rule-strong: rgba(38, 32, 21, 0.32);
  --tile-bg: #ece8df;
  --bar: rgba(47, 97, 115, 0.16);
  --font-display: "Cardo", Georgia, "Times New Roman", serif;
  --font-body: "Equity", Georgia, "Times New Roman", serif;
  --font-sans: "Source Sans 3", system-ui, -apple-system, sans-serif;
  --page-max: 1280px; --gutter: clamp(16px, 5vw, 88px);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #14120F; --bg-raised: #1c1a15; --text: #E8E1D4; --text-secondary: #BFB7A8; --text-muted: #918a7c;
  --link: #85B9D9; --hover: #a9d0e8;
  --rule: rgba(232, 225, 212, 0.16); --rule-strong: rgba(232, 225, 212, 0.32);
  --tile-bg: #211e18;
  --bar: rgba(133, 185, 217, 0.18);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: clamp(18px, 1.05vw + 14px, 20px); line-height: 1.72;
  font-feature-settings: "kern", "liga", "onum", "pnum";
  -webkit-font-smoothing: antialiased;
  transition: background-color 600ms var(--ease), color 600ms var(--ease), opacity 500ms ease;
}
html.preload body { opacity: 0; }
a { color: var(--link); text-decoration: none; }
::selection { background: var(--light-accent); color: var(--ink); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; line-height: 1.08; letter-spacing: -0.012em; text-wrap: balance; }
h1 { font-size: clamp(34px, 6vw, 64px); }
.h3 { font-size: clamp(22px, 2vw, 30px); line-height: 1.18; }
p { margin: 0 0 1.1em; text-wrap: pretty; }

.wrap { width: 100%; max-width: var(--page-max); margin: 0 auto; padding-inline: var(--gutter); }
.eyebrow { font: 600 13px/1.4 var(--font-sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--link); margin: 0 0 14px; }
.meta { font: 500 13.5px/1.5 var(--font-sans); letter-spacing: 0.04em; color: var(--text-muted); }

/* Masthead / colophon: hairlines, not boxes */
.masthead { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.wordmark { font: italic 400 22px/1 var(--font-display); color: var(--text); }
.theme-toggle { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--rule); background: none; color: var(--text); opacity: .55; cursor: pointer; display: grid; place-items: center; transition: opacity 300ms var(--ease); }
.theme-toggle:hover, .theme-toggle:focus-visible { opacity: 1; }
.colophon { margin-top: auto; padding-top: 18px; padding-bottom: 22px; border-top: 1px solid var(--rule); font: 500 12.5px/1.5 var(--font-sans); color: var(--text-muted); }
main { padding-top: clamp(32px, 7vw, 88px); padding-bottom: clamp(40px, 8vw, 96px); }

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

/* ---------- Choices (vote buttons and live result rows share one shape) ---------- */
.poll .question { max-width: 22ch; margin-bottom: clamp(24px, 4vw, 44px); }
.choices, .results { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; max-width: 760px; border-top: 1px solid var(--rule); }
.choice {
  position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  width: 100%; min-height: 60px; padding: 16px 4px; margin: 0;
  border: 0; border-bottom: 1px solid var(--rule); background: none; color: var(--text);
  font: 400 clamp(20px, 2.4vw, 26px)/1.3 var(--font-body); text-align: left; overflow: hidden;
}
button.choice { cursor: pointer; transition: color 300ms var(--ease); }
button.choice:hover:not(:disabled) { color: var(--link); }
button.choice:disabled { cursor: default; }
.choice-label { position: relative; z-index: 1; padding-left: 30px; }
/* Selection mark: a hairline ring that fills with ink when chosen */
button.choice .choice-label::before {
  content: ""; position: absolute; left: 2px; top: .38em; width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--rule-strong); transition: background-color 300ms var(--ease), border-color 300ms var(--ease);
}
button.choice[aria-pressed="true"] { color: var(--link); }
button.choice[aria-pressed="true"] .choice-label::before { background: var(--link); border-color: var(--link); box-shadow: inset 0 0 0 3px var(--bg); }
.results .choice-label { padding-left: 0; }

/* The bar sits behind the label and grows from the left once released */
.bar { position: absolute; inset: 0 auto 0 0; width: var(--pct, 0%); background: var(--bar); transform-origin: left; transform: scaleX(0); transition: width 900ms var(--ease), transform 900ms var(--ease); }
.pct { position: relative; z-index: 1; font: 600 15px/1 var(--font-sans); font-variant-numeric: lining-nums tabular-nums; color: var(--text-secondary); opacity: 0; transition: opacity 600ms var(--ease); }
.is-revealed .bar { transform: scaleX(1); }
.is-revealed .pct { opacity: 1; }

.status { margin-top: 18px; min-height: 1.5em; }
.tally { margin-top: clamp(28px, 5vw, 48px); display: flex; align-items: baseline; gap: 12px; }
.tally-n { font: 400 clamp(56px, 10vw, 120px)/1 var(--font-display); font-variant-numeric: lining-nums; }
.tally-l { font: 600 13px/1 var(--font-sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-secondary); }

/* ---------- Projector screen ---------- */
.live { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(32px, 6vw, 96px); align-items: start; }
.live .question { font-size: clamp(40px, 5.2vw, 80px); }
.live .choice { font-size: clamp(22px, 2.2vw, 34px); min-height: 72px; }
.live .tally-n { font-size: clamp(80px, 12vw, 180px); }
.live-qr { position: sticky; top: 32px; text-align: center; }
.qr { width: clamp(180px, 28vw, 360px); aspect-ratio: 1; color: var(--text); margin-top: 8px; }
.qr svg { display: block; width: 100%; height: 100%; }
.qr-url { margin-top: 12px; font: 600 16px/1.4 var(--font-sans); letter-spacing: 0.02em; color: var(--text-secondary); }
@media (max-width: 640px) { .live { grid-template-columns: 1fr; } .live-qr { position: static; order: -1; } .qr { margin: 0 auto; } }

/* ---------- Admin ---------- */
.admin h1 { font-size: clamp(30px, 4vw, 46px); margin-bottom: 12px; }
.admin h2 { margin: 48px 0 16px; }
.stack { display: grid; gap: 18px; max-width: 560px; }
label { display: grid; gap: 6px; font: 600 12px/1.4 var(--font-sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
input, textarea { font: 400 18px/1.5 var(--font-body); color: var(--text); background: var(--bg-raised); border: 1px solid var(--rule-strong); border-radius: 2px; padding: 10px 12px; letter-spacing: 0; text-transform: none; }
input:focus, textarea:focus { outline: none; border-color: var(--link); }
.btn { font: 600 15px/1 var(--font-sans); color: var(--text); background: none; border: 1px solid var(--rule-strong); border-radius: 2px; padding: 12px 18px; min-height: 44px; cursor: pointer; transition: color 300ms var(--ease), border-color 300ms var(--ease); }
.btn:hover { color: var(--link); border-color: var(--link); }
.btn-quiet { border-color: transparent; color: var(--text-muted); padding-left: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.actions form { margin: 0; }
.text-link { font: 600 15px/1.4 var(--font-sans); }
.notice { font: 500 15px/1.5 var(--font-sans); color: var(--text-secondary); border-left: 1px solid var(--rule-strong); padding-left: 12px; }
.admin-counts { border-collapse: collapse; margin: 20px 0 6px; min-width: min(420px, 100%); }
.admin-counts td { padding: 8px 4px; border-bottom: 1px solid var(--rule); }
.admin-counts .num { text-align: right; font: 600 16px/1 var(--font-sans); font-variant-numeric: lining-nums tabular-nums; }
.logout { margin-top: 48px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}

/* Admin presenter screen: the one filled button marks the release, the moment the whole screen is for */
.btn-primary { background: var(--link); border-color: var(--link); color: var(--bg); }
.btn-primary:hover { background: none; color: var(--link); }
.live-qr .eyebrow { margin-bottom: 12px; }
.private { margin-top: 20px; max-width: 560px; border-top: 1px solid var(--rule); padding-top: 12px; }
.private summary { font: 600 13px/1.4 var(--font-sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); cursor: pointer; }
.private[open] summary { margin-bottom: 12px; }
.admin .actions { margin-top: 28px; }
.admin .logout { margin-top: 28px; }

/* ---------- Multiple questions (voter + presenter) ---------- */
.questions { display: grid; gap: clamp(48px, 8vw, 88px); }
.q .question { font-size: clamp(30px, 4.4vw, 52px); max-width: 24ch; margin-bottom: clamp(18px, 3vw, 28px); }
.live .q .question { font-size: clamp(32px, 3.6vw, 56px); }
.q-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; }
.q-foot .status { margin: 0; min-height: 0; }
.is-closed .choice { color: var(--text-secondary); }
.waiting .question { max-width: 18ch; margin-bottom: 12px; }

/* ---------- Editor (Google Forms shape, Living Print surface) ---------- */
.toolbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.toolbar-inner { max-width: 820px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-top: 10px; padding-bottom: 10px; }
.select-all { flex-direction: row; display: flex; align-items: center; gap: 8px; letter-spacing: 0.08em; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar-actions[hidden] { display: none; }
.save-state { margin-left: auto; }
.btn-sm { padding: 8px 12px; min-height: 36px; font-size: 14px; }
.editor { max-width: 820px; }
.editor-head { margin-bottom: 28px; }
.editor-head h1 { margin-bottom: 10px; }
.editor-head .meta { max-width: 62ch; }
.editor-head strong { color: var(--text); font-weight: 600; }
.cards { display: grid; gap: 20px; }
.empty { color: var(--text-muted); font-style: italic; }

.card { background: var(--bg-raised); border: 1px solid var(--rule); border-radius: 3px; padding: 18px clamp(16px, 3vw, 28px) 14px; transition: border-color 300ms var(--ease); }
.card:focus-within { border-color: var(--link); }
.card-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pick input, .select-all input { width: 18px; height: 18px; accent-color: var(--link); margin: 0; }
.q-num { font: 400 20px/1 var(--font-display); color: var(--text-muted); }
.chip { font: 600 11.5px/1 var(--font-sans); letter-spacing: 0.12em; text-transform: uppercase; padding: 5px 8px; border: 1px solid var(--rule-strong); border-radius: 2px; color: var(--text-muted); }
.status-open .chip { border-color: var(--link); color: var(--link); }
.status-closed .chip { color: var(--text-secondary); }
.q-total { margin-left: auto; }
.card-move { display: flex; gap: 2px; }
.icon { width: 32px; height: 32px; border: 0; background: none; color: var(--text-muted); font: 500 17px/1 var(--font-sans); cursor: pointer; border-radius: 2px; }
.icon:hover:not(:disabled) { color: var(--link); background: var(--tile-bg); }
.icon:disabled { opacity: .3; cursor: default; }

.q-title { width: 100%; margin: 14px 0 10px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--rule-strong); border-radius: 0; background: none; font: 400 clamp(22px, 2.6vw, 28px)/1.25 var(--font-display); }
.q-title:focus { border-bottom: 2px solid var(--link); padding-bottom: 7px; }
.opts { list-style: none; margin: 0; padding: 0; }
.opt { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.ring { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--rule-strong); }
.opt-input { flex: 1; min-width: 0; border: 0; border-bottom: 1px solid transparent; border-radius: 0; background: none; padding: 8px 0; font-size: 18px; }
.opt-input:hover { border-bottom-color: var(--rule); }
.opt-input:focus { border-bottom-color: var(--link); }
.opt-count { font: 600 13px/1 var(--font-sans); font-variant-numeric: lining-nums tabular-nums; color: var(--text-muted); white-space: nowrap; }
.opt-tools { display: flex; opacity: .35; transition: opacity 200ms var(--ease); }
.opt:hover .opt-tools, .opt:focus-within .opt-tools { opacity: 1; }
@media (hover: none) { .opt-tools { opacity: 1; } }
.add-opt { display: flex; align-items: center; gap: 10px; padding: 10px 0; border: 0; background: none; color: var(--text-muted); font: 400 18px/1.4 var(--font-body); cursor: pointer; }
.add-opt:hover { color: var(--link); }
.add-opt .ring { border-style: dashed; }

.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 2px; }
.seg-btn { border: 0; background: none; color: var(--text-secondary); font: 600 14px/1 var(--font-sans); padding: 9px 14px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--rule-strong); }
.seg-btn[aria-pressed="true"] { background: var(--link); color: var(--bg); }
.switch { display: inline-flex; flex-direction: row; align-items: center; gap: 10px; font: 600 14px/1 var(--font-sans); letter-spacing: 0; text-transform: none; color: var(--text-secondary); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { width: 36px; height: 20px; border-radius: 10px; background: var(--rule-strong); position: relative; transition: background-color 250ms var(--ease); }
.track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg-raised); transition: transform 250ms var(--ease); }
.switch input:checked + .track { background: var(--link); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--link); outline-offset: 2px; }
.foot-tools { margin-left: auto; display: flex; gap: 4px; }
.btn-quiet.btn-sm { padding: 8px 8px; }
button.btn-quiet { background: none; border: 1px solid transparent; font: 600 14px/1 var(--font-sans); color: var(--text-muted); cursor: pointer; border-radius: 2px; }
.btn-quiet:hover { color: var(--link); }
.danger:hover { color: #a3402f; }
html[data-theme="dark"] .danger:hover { color: #e08a78; }
.add-question { margin-top: 24px; }

/* ---------- Voter sign-in ---------- */
.signin h1 { margin-bottom: 14px; }
.lede { font-size: clamp(19px, 1.6vw, 23px); line-height: 1.5; color: var(--text-secondary); max-width: 40ch; }
.signin .stack { margin-top: 24px; max-width: 420px; }
.signin input { font-size: 22px; }
.whoami { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 clamp(28px, 5vw, 48px); }
.whoami strong { color: var(--text); font-weight: 600; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Responses page ---------- */
.responses h1 { margin: 6px 0 10px; }
.responses .eyebrow a { color: inherit; }
.section-h { margin: 48px 0 10px; }
.table-scroll { overflow-x: auto; margin-top: 18px; }
.resp-table { border-collapse: collapse; width: 100%; font: 400 15px/1.45 var(--font-sans); }
.resp-table th { text-align: left; font: 600 12px/1.4 var(--font-sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule-strong); }
.resp-table td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.upload { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 14px 0 8px; font: 500 15px/1.4 var(--font-sans); }

/* ---------- Editor: question type ---------- */
.q-type { font: 600 13.5px/1 var(--font-sans); color: var(--text); background: var(--bg); border: 1px solid var(--rule-strong); border-radius: 2px; padding: 7px 10px; cursor: pointer; }
.type-note { margin: 4px 0 12px; max-width: 62ch; }
.mod-words { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.mod-words li { display: inline-flex; align-items: center; gap: 8px; padding: 2px 2px 2px 12px; border: 1px solid var(--rule-strong); border-radius: 2px; font: 400 17px/1.3 var(--font-body); }
.mod-words .mw-n { font: 600 12.5px/1 var(--font-sans); color: var(--text-muted); font-variant-numeric: lining-nums tabular-nums; }
.mod-words .icon { width: 28px; height: 28px; }
.mod-words .is-hidden { border-style: dashed; color: var(--text-muted); }
.mod-words .is-hidden .mw-text { text-decoration: line-through; }
.num-summary { font: 500 16px/1.5 var(--font-sans); color: var(--text-secondary); }
.num-summary strong { color: var(--text); font-weight: 600; }

/* ---------- Voter: typed answers ---------- */
.entry { display: flex; gap: 10px; max-width: 520px; }
.entry[hidden] { display: none; }
.entry input { flex: 1; min-width: 0; font-size: 20px; }
.entry .btn { flex: none; }
.entry-hint { margin: 8px 0 0; min-height: 1.5em; }
.mine-words { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mine-words:empty { display: none; }
.chip-word { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border: 1px solid var(--link); color: var(--link); border-radius: 2px; font: 400 18px/1.3 var(--font-body); }
.chip-word .icon { width: 30px; height: 30px; color: inherit; }
.res { margin-top: 20px; }
.res:empty { display: none; }

/* ---------- Word cloud: type, not graphics ---------- */
.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0.1em 0.55em; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.w { font-family: var(--font-display); line-height: 1.15; font-size: calc(18px + var(--t) * var(--cloud-range, 46px)); color: var(--text-secondary); animation: w-in 700ms var(--ease) both; }
.w-mid { color: var(--text); }
.w-top { color: var(--link); }
.w-it { font-style: italic; }
.live .cloud { --cloud-range: 84px; min-height: 240px; align-content: center; }
@keyframes w-in { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
.cloud-empty { margin: 0; }

/* ---------- Log number line ---------- */
.numline { display: block; width: 100%; max-width: 760px; height: auto; overflow: visible; }
.nl-axis { stroke: var(--rule-strong); stroke-width: 1; }
.nl-tick { stroke: var(--text-muted); stroke-width: 1; }
.nl-minor { stroke: var(--rule-strong); stroke-width: 1; }
.nl-label { fill: var(--text-muted); font: 600 12px var(--font-sans); font-variant-numeric: lining-nums tabular-nums; }
.nl-dot { fill: var(--link); fill-opacity: .75; }
.nl-median { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; }
.nl-median-label { fill: var(--text); font: 600 12.5px var(--font-sans); font-variant-numeric: lining-nums; }
.live .nl-label { font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .w { animation: none; } }

/* d3-cloud frame: the layout is sized to this box, then drawn as SVG text */
.wc { width: 100%; aspect-ratio: 4 / 3; max-height: 70vh; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.live .wc { aspect-ratio: 16 / 10; }
.wc svg { display: block; width: 100%; height: 100%; }
.wc-w { font-family: var(--font-display); animation: w-in 700ms var(--ease) both; }
.wc-top { fill: var(--link); }
.wc-mid { fill: var(--text); }
.wc-low { fill: var(--text-secondary); }
@media (prefers-reduced-motion: reduce) { .wc-w { animation: none; } }
