/* Polls (Pages/Polls, Core/Polls): the poll above a thread's posts, its vote form, its
   results, and the poll fields on the new-thread page and the poll's own page.

   Mobile first: one column that wraps, nothing fixed in width, every choice a target at
   least 44 px tall. Every color, radius and shadow is a custom property from site.css, so
   a community's theme (and the dark theme) changes them. The bars are only a picture of
   the numbers beside them: the percentage and the count are always written out. */

.poll { padding: 16px; display: grid; gap: 14px; overflow: visible; }
.poll-head { display: grid; gap: 4px; }
.poll-kicker {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.poll-kicker svg { flex: none; color: var(--accent); }
.poll-question { margin: 0; font-family: var(--font-heading); font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.poll-meta { display: flex; flex-wrap: wrap; gap: 0 6px; margin: 0; color: var(--muted); font-size: 14px; }
.poll-note { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.poll .forum-error { margin: 0; }

/* ---- The vote form ---- */
.poll-form { display: grid; gap: 14px; }
.poll-choices { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.poll-hint { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.poll-choice {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px;
  min-height: 44px; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--control-line); border-radius: var(--radius-small);
  background: var(--surface); box-shadow: var(--elev-1);
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.poll-choice:hover { border-color: var(--accent-line); background: var(--surface-alt); }
.poll-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.poll-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.poll-choice input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.poll-choice-text { overflow-wrap: anywhere; }
.poll-choice-count { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.poll-choice .poll-bar { grid-column: 2 / -1; }
.poll-form .buttons { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- The results ---- */
.poll-results { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.poll-result { display: grid; gap: 6px; }
.poll-result-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.poll-result-text { overflow-wrap: anywhere; }
.poll-result-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.poll-result-count .muted { margin-left: 4px; }
.poll-leading .poll-result-text { font-weight: 700; }
.poll-mine-tag { margin-left: 6px; vertical-align: 1px; }

/* The bar: a track and a fill as long as the share (--share, written by the page). */
.poll-bar { display: block; height: 10px; border-radius: var(--radius-round); background: var(--surface-alt); box-shadow: inset 0 0 0 1px var(--line-soft); overflow: hidden; }
.poll-bar > span { display: block; width: var(--share, 0%); height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.4s var(--ease); }
.poll-choice .poll-bar { height: 6px; }

.poll-foot { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* ---- The poll fields ---- */
.poll-compose { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface-alt); }
.poll-compose-summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px;
  cursor: pointer; font-weight: 600; list-style-position: inside;
}
.poll-compose-summary svg { flex: none; color: var(--accent); }
.poll-compose-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-small); }
.poll-compose[open] .poll-compose-summary { border-bottom: 1px solid var(--line); }
.poll-compose-body { display: grid; gap: 14px; padding: 14px; }
.poll-compose-body .m-field { margin: 0; }
.poll-edit .m-form { display: grid; gap: 16px; }
.poll-number { max-width: 8em; }
.poll-option-fields { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.poll-option-field .forum-field { width: 100%; }
.poll-end-days { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.poll-end-days .check { min-height: 44px; }
.poll-fixed { margin: 6px 0; padding-left: 20px; }
.poll-remove { margin: 16px 0 0; }

/* A group of choices in the poll fields is a fieldset for its legend, without the browser's frame. */
.poll-compose fieldset, .poll-edit fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.poll-compose legend.m-label, .poll-edit legend.m-label { padding: 0; margin-bottom: 6px; }
.poll-hint-more { display: block; margin-top: 2px; color: var(--muted); font-weight: 400; }
