/*
 * Shared poll widget styles — used by BOTH partials/poll (in-page) and
 * partials/poll-float (the site-wide floating card).
 *
 * This is a real stylesheet rather than an inline @once block because the two
 * partials render independently: an article page shows only the float, so any
 * CSS living inside the in-page partial's @once never loads there and the card
 * came out unstyled (options side by side, stray scrollbar). Both partials link
 * this file, and the browser dedupes a double <link>.
 *
 * Themes override anything here via .poll-widget.
 */
/* Neutral base — themes restyle via .poll-widget. */
.poll-widget {
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: 12px;
    padding: 18px 20px;
    margin-block: 12px;
    background: #fff;
}
.poll-widget__head { margin-bottom: 12px; }
.poll-widget__badge {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--pw-accent); font-size: 12px; font-weight: 700;
    margin-bottom: 6px;
}
.poll-widget__badge-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--pw-accent); display: inline-block;
}
.poll-widget__question { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.5; }
.poll-widget__note { border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; }
.poll-widget__note--ok { background: #ecfdf5; color: #047857; }
.poll-widget__note--err { background: #fef2f2; color: #b91c1c; }
.poll-widget__row { margin-bottom: 10px; }
.poll-widget__row-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; }
.poll-widget__pct { font-weight: 700; color: var(--pw-accent); }
.poll-widget__bar { height: 8px; border-radius: 100px; background: rgba(0, 0, 0, .07); overflow: hidden; }
.poll-widget__fill { display: block; height: 100%; border-radius: inherit; background: var(--pw-accent); transition: width .6s ease; }
.poll-widget__total { font-size: 12.5px; opacity: .7; margin-top: 8px; }
.poll-widget__still-open { font-size: 13px; font-weight: 700; margin-top: 12px; }
.poll-widget__form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.poll-widget__opt {
    display: flex; align-items: center; gap: 10px;
    border: 1px solid rgba(0, 0, 0, .1); border-radius: 10px;
    padding: 10px 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.poll-widget__opt:hover { border-color: var(--pw-accent); }
.poll-widget__opt input { accent-color: var(--pw-accent); width: 16px; height: 16px; }
.poll-widget__hint { font-size: 12px; opacity: .7; }
.poll-widget__submit {
    align-self: flex-start; border: 0; cursor: pointer;
    background: var(--pw-accent); color: #fff; font-weight: 700;
    padding: 9px 22px; border-radius: 10px; transition: filter .15s;
}
.poll-widget__submit:hover { filter: brightness(1.08); }
.poll-widget__submit[disabled] { opacity: .6; cursor: default; }

/* Everything on one row, full width: results (bars + donut) beside the
   vote form. Each column can shrink, and the whole thing stacks once
   there is no longer room — no fixed max-width anywhere, so the
   widget fills whatever container the theme gives it. */
.poll-widget__panel {
    display: flex; align-items: flex-start; gap: 26px;
    flex-wrap: wrap;
}
.poll-widget__results-wrap { flex: 1 1 340px; min-width: 0; }
.poll-widget__results-inner { display: flex; align-items: center; gap: 20px; }
.poll-widget__results-inner > .poll-widget__results { flex: 1 1 200px; min-width: 0; }
.poll-widget__panel > .poll-widget__form { flex: 1 1 260px; min-width: 0; margin-top: 0; }
.poll-widget__chart { flex: 0 0 auto; }
.poll-widget__form-head { font-size: 13px; font-weight: 700; opacity: .75; margin-bottom: 2px; }
/* The reader's current answer, when the poll allows changing it. */
.poll-widget__opt--chosen { border-color: var(--pw-accent); background: rgba(0, 0, 0, .02); }
.poll-widget__chart svg { display: block; width: 190px; height: 190px; }
.poll-widget__chart-total { font-weight: 800; font-size: 22px; fill: currentColor; }
.poll-widget__chart-caption { font-size: 10px; fill: currentColor; opacity: .6; }
.poll-widget__seg { transition: stroke-dasharray .6s ease; }
@media (max-width: 860px) {
    .poll-widget__panel { gap: 18px; }
}
@media (max-width: 560px) {
    .poll-widget__panel,
    .poll-widget__results-inner { flex-direction: column; align-items: stretch; gap: 16px; }
    .poll-widget__chart { align-self: center; }
    .poll-widget__chart svg { width: 168px; height: 168px; }
}

/* ═══════════════════════════════════════════════════════════════
   MERGED ROWS variant (.poll-widget__form--merged)

   One list instead of two: each option row carries its own
   percentage and hairline track, so the results are the options
   rather than a second copy of them. Used by the floating card,
   where height is scarce; the wide in-page widget keeps the boxed
   rows + separate bars.

   The radio/checkbox stays in the DOM and focusable — only visually
   hidden — so the form still posts with zero JS and keyboard users
   keep real radio semantics.
   ═══════════════════════════════════════════════════════════════ */
.poll-widget__form--merged { gap: 0; margin-top: 12px; }

.poll-widget__form--merged .poll-widget__opt {
  display: block;
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  border-radius: 0;
  padding: 9px 2px 8px;
  transition: none;
}
.poll-widget__form--merged .poll-widget__opt:last-of-type { border-bottom: 0; }
.poll-widget__form--merged .poll-widget__opt:hover { border-color: rgba(0, 0, 0, .07); }
.poll-widget__form--merged .poll-widget__opt:hover .poll-widget__opt-label { color: var(--pw-accent); }

/* Visually hidden, still focusable and still a real radio. */
.poll-widget__form--merged .poll-widget__opt input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap;
}
.poll-widget__form--merged .poll-widget__opt:focus-within {
  outline: 2px solid var(--pw-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.poll-widget__opt-line {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px;
}
.poll-widget__opt-label { min-width: 0; }
.poll-widget__form--merged .poll-widget__pct { font-size: 12.5px; }

.poll-widget__track {
  display: block; height: 3px; margin-top: 6px;
  border-radius: 100px; background: rgba(0, 0, 0, .08);
  overflow: hidden;
}
.poll-widget__track-fill {
  display: block; height: 100%; width: 0;
  border-radius: inherit; background: var(--pw-accent);
  transition: width .7s cubic-bezier(.22, 1, .36, 1);
}

.poll-widget__form--merged .poll-widget__opt--chosen .poll-widget__opt-label {
  font-weight: 700; color: var(--pw-accent);
}
.poll-widget__form--merged .poll-widget__opt--chosen .poll-widget__opt-label::after {
  content: "✓"; margin-inline-start: 6px; font-weight: 800;
}

/* With JS the row itself votes, so the button is redundant. It stays in the
   markup (and visible) until poll-widget.js confirms it can take over. */
.poll-widget--live-vote .poll-widget__form--merged .poll-widget__submit { display: none; }
