/* =================================================================
 * Lexington Times — Reader poll
 * Inherits the --lext-* tokens from lext-spruce.css (incl. dark mode).
 * ================================================================= */

.lext-poll {
  font-family: var(--lext-sans);
  max-width: 760px;
  margin: 0 auto var(--wp--preset--spacing--superbspacing-small, 1.5rem);
  border: 1px solid var(--lext-rule-strong, #c7c7c3);
  border-radius: 12px;
  background: var(--lext-bg-raised, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

/* On the homepage the main column is full-width; keep the card tidy. */
.lext-home-main .lext-poll { margin-top: 0; }
.lext-article > .lext-poll:first-child { margin-bottom: var(--wp--preset--spacing--superbspacing-small, 1.5rem); }

.lext-poll__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--lext-rule, #e4e4e1);
  background: var(--lext-accent-soft, #e8eefb);
  cursor: pointer;
  user-select: none;
}

.lext-poll__toggle {
  margin-left: auto;
  flex: 0 0 auto;
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--lext-ink-soft, #333);
}
.lext-poll__toggle:hover { background: rgba(0, 0, 0, 0.06); color: var(--lext-accent, #0033a0); }
:root[data-theme="dark"] .lext-poll__toggle:hover { background: rgba(255, 255, 255, 0.08); }
.lext-poll__toggle:focus-visible { outline: 2px solid var(--lext-accent, #0033a0); outline-offset: 2px; }

.lext-poll__chev {
  display: block;
  width: 8px;
  height: 8px;
  margin-top: -3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);          /* points down when expanded */
  transition: transform 0.18s ease;
}
.lext-poll.is-collapsed .lext-poll__chev {
  transform: rotate(-135deg);        /* points up when collapsed */
  margin-top: 3px;
}
.lext-poll.is-collapsed .lext-poll__head { border-bottom: 0; }
.lext-poll.is-collapsed .lext-poll__body,
.lext-poll.is-collapsed .lext-poll__foot,
.lext-poll.is-collapsed .lext-poll__err { display: none; }

.lext-poll__badge {
  font-family: var(--lext-mono, monospace);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: var(--lext-live, #d6263b);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}

.lext-poll__title {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--lext-ink, #111);
  margin: 0;
}

.lext-poll__body { padding: 0.4rem 1.1rem 1rem; }

.lext-poll__q { border-top: 1px solid var(--lext-rule, #e4e4e1); padding-top: 0.9rem; }
.lext-poll__q:first-child { border-top: 0; }

.lext-poll__question {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--lext-ink, #111);
  margin: 0.5rem 0 0.7rem;
}

/* ---------- ballot ---------- */
.lext-poll__options { display: flex; flex-direction: column; gap: 0.45rem; }

/* Yes/No renders as a 2-up row */
.lext-poll__q[data-type="yesno"] .lext-poll__options {
  flex-direction: row;
  gap: 0.6rem;
}
.lext-poll__q[data-type="yesno"] .lext-poll__opt { flex: 1; text-align: center; }

.lext-poll__opt {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--lext-ink, #111);
  background: var(--lext-bg, #fff);
  border: 1.5px solid var(--lext-rule-strong, #c7c7c3);
  border-radius: 9px;
  padding: 0.62rem 0.9rem;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, transform 0.06s ease;
}
.lext-poll__opt:hover {
  border-color: var(--lext-accent, #0033a0);
  background: var(--lext-accent-soft, #e8eefb);
  color: var(--lext-accent-dim, #00257a);
}
.lext-poll__opt:active { transform: translateY(1px); }
.lext-poll__opt:focus-visible { outline: 2px solid var(--lext-accent, #0033a0); outline-offset: 2px; }

/* ---------- results ---------- */
.lext-poll__results { display: flex; flex-direction: column; gap: 0.5rem; }

.lext-poll__bar {
  position: relative;
  display: block;
  border: 1px solid var(--lext-rule, #e4e4e1);
  border-radius: 8px;
  overflow: hidden;
  background: var(--lext-bg, #fff);
}
.lext-poll__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--lext-accent-soft, #e8eefb);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.lext-poll__bar--mine .lext-poll__fill { background: var(--lext-accent, #0033a0); opacity: 0.22; }
.lext-poll__bar--mine { border-color: var(--lext-accent, #0033a0); }

.lext-poll__row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
}
.lext-poll__label { font-weight: 600; color: var(--lext-ink, #111); }
.lext-poll__label .lext-poll__mine {
  font-family: var(--lext-mono, monospace);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--lext-accent, #0033a0);
  margin-left: 0.4rem;
  text-transform: uppercase;
}
.lext-poll__pct {
  font-family: var(--lext-mono, monospace);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--lext-ink-soft, #333);
  white-space: nowrap;
}

.lext-poll__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.6rem;
  font-size: 0.74rem;
  color: var(--lext-muted, #6b6b6b);
}
.lext-poll__count { font-family: var(--lext-mono, monospace); }
.lext-poll__change {
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  color: var(--lext-muted, #6b6b6b);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}
.lext-poll__change:hover { color: var(--lext-accent, #0033a0); }

.lext-poll__foot {
  margin: 0.3rem 1.1rem 0.85rem;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--lext-muted, #6b6b6b);
}

.lext-poll.is-busy { opacity: 0.6; pointer-events: none; }
.lext-poll__err {
  margin: 0 1.1rem 0.9rem;
  font-size: 0.8rem;
  color: var(--lext-live, #d6263b);
}

@media (max-width: 540px) {
  .lext-poll__q[data-type="yesno"] .lext-poll__options { flex-direction: column; }
}
