/* =====================================================
   BALLOT CHEAT SHEET (/cheat-sheet)
   Builds on styles.css tokens.
   ===================================================== */

.cs-print-only { display: none; }

/* ---------- Picker ---------- */
.cs-picker {
  padding: 1.75rem 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-soft);
}
.cs-picker-title { font-size: 1.35rem; margin-bottom: 0.35rem; }
.cs-picker-help { color: var(--text-secondary); font-size: 0.95rem; max-width: 680px; }
.cs-picker-row {
  display: flex; flex-wrap: wrap; gap: 1.25rem 2rem;
  align-items: flex-end; margin-top: 0.5rem;
}
.cs-label {
  display: block;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--accent-pine);
  margin-bottom: 0.4rem;
}
.combobox-wrapper { position: relative; flex: 1 1 260px; max-width: 360px; }
.combobox-wrapper input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font: inherit; font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
}
.combobox-wrapper input:focus { outline: 2px solid var(--accent-pine); outline-offset: 1px; }
.combobox-options {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  margin: 4px 0 0; padding: 0.3rem 0;
  list-style: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  max-height: 260px; overflow-y: auto;
}
.combobox-option { padding: 0.5rem 0.9rem; cursor: pointer; font-size: 0.95rem; }
.combobox-option.active, .combobox-option:hover { background: var(--bg-primary); color: var(--accent-pine); }
.combobox-empty { padding: 0.5rem 0.9rem; color: var(--text-tertiary); font-size: 0.9rem; }

.cs-dist-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cs-dist-btn {
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex; flex-direction: column; align-items: center;
  line-height: 1.2; min-width: 84px;
  transition: border-color 0.15s, background-color 0.15s;
}
.cs-dist-btn span { font-size: 0.72rem; font-weight: 500; color: var(--text-tertiary); }
.cs-dist-btn:hover { border-color: var(--accent-pine); }
.cs-dist-btn[aria-pressed="true"] {
  background: var(--accent-pine); border-color: var(--accent-pine); color: var(--bg-secondary);
}
.cs-dist-btn[aria-pressed="true"] span { color: rgba(248, 246, 238, 0.85); }

.cs-picker-foot {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 0.75rem;
  margin-top: 1.25rem;
}
.cs-status { margin: 0; font-size: 0.95rem; color: var(--text-secondary); }
.cs-status strong { color: var(--text-primary); }
.cs-print-btn { padding: 0.55rem 1.1rem; font-size: 0.9rem; }

/* ---------- Method note ---------- */
.cs-method {
  margin: 1.75rem 0 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
}
.cs-method summary { cursor: pointer; font-weight: 600; color: var(--accent-pine); }
.cs-method ul { margin: 0.75rem 0 0.25rem; padding-left: 1.2rem; }
.cs-method li { font-size: 0.92rem; color: var(--text-secondary); margin-bottom: 0.4rem; }

/* ---------- Races ---------- */
.cs-group-title {
  font-size: 1rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent-pine);
  margin: 2.5rem 0 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-pine);
}
.cs-race { padding: 1.75rem 0 0.5rem; }
.cs-race[hidden] { display: none; }
.cs-race-head h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); margin-bottom: 0.2rem; }
.cs-race-sub { font-size: 0.92rem; color: var(--text-secondary); margin: 0 0 0.85rem; }
.cs-race-sub a { font-weight: 500; }

.cs-quiz {
  font-size: 0.9rem;
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-pine);
  padding: 0.6rem 0.9rem;
  border-radius: 4px;
  margin: 0 0 0.85rem;
}

.cs-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
}
.cs-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cs-table thead th {
  text-align: left;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem; font-weight: 600;
  padding: 0.8rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.cs-table thead th.cs-topic-col {
  width: 19%;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-tertiary);
}
.cs-table tbody th, .cs-table tbody td {
  vertical-align: top;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-soft);
  text-align: left;
}
.cs-table tbody tr:first-child th, .cs-table tbody tr:first-child td { border-top: none; }
.cs-table tbody th { background: var(--bg-secondary); font-weight: 600; }
.cs-table tbody td + td { border-left: 1px solid var(--border-soft); }
.cs-topic { display: block; font-size: 0.95rem; color: var(--text-primary); }
.cs-topic-note { display: block; margin-top: 0.35rem; font-size: 0.8rem; font-weight: 400; color: var(--text-secondary); }
.cs-pos { font-size: 0.93rem; line-height: 1.55; margin: 0 0 0.5rem; }
.cs-src { font-size: 0.76rem; line-height: 1.45; color: var(--text-tertiary); margin: 0; }
.cs-src-label { font-weight: 600; }
.cs-src a { color: var(--text-secondary); }

.cs-also { font-size: 0.85rem; color: var(--text-secondary); margin: 0.6rem 0 0; }
.cs-pending {
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 0.95rem; color: var(--text-secondary);
}
.cs-house-prompt {
  margin: 1.5rem 0 0;
  font-size: 0.92rem; color: var(--text-secondary);
  font-style: italic;
}
.cs-house-prompt[hidden] { display: none; }

.cs-more {
  margin: 2.5rem 0 1rem;
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-wheat);
  padding: 1.1rem 1.4rem;
  border-radius: 4px;
}
.cs-more h2 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.cs-more p { margin: 0; font-size: 0.95rem; color: var(--text-secondary); }

/* ---------- Mobile: stack each row ---------- */
@media (max-width: 760px) {
  .cs-table, .cs-table tbody, .cs-table tr, .cs-table th, .cs-table td { display: block; width: 100%; }
  .cs-table thead { display: none; }
  .cs-table tbody tr { border-top: 1px solid var(--border); }
  .cs-table tbody tr:first-child { border-top: none; }
  .cs-table tbody th { border-top: none; padding: 0.75rem 1rem 0.6rem; }
  .cs-table tbody td { border-top: 1px solid var(--border-soft); }
  .cs-table tbody td + td { border-left: none; }
  .cs-table tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 0.3rem;
  }
  .cs-dist-btn { min-width: 0; flex: 1 1 calc(50% - 0.5rem); }
  .combobox-wrapper { max-width: none; }
}

/* ---------- Print ---------- */
@media print {
  @page { size: letter; margin: 0.35in; }
  html, body { background: #fff !important; font-size: 7.5pt; }
  .no-print, .skip-link, .election-banner, .top-nav, footer, .cs-picker,
  .cs-method, .cs-house-prompt, .cs-src, .cs-quiz, .cs-race-sub { display: none !important; }
  .cs-print-only { display: block; }
  .container { max-width: none; padding: 0; }
  .page-header { padding: 0 0 0.2rem; border-bottom: 1px solid #999; }
  .page-title { font-size: 14pt; margin: 0; display: inline; }
  .page-subtitle { font-size: 8pt; margin: 0 0 0 0.5rem; display: inline; }
  .cs-print-meta { font-size: 7pt; color: #444; margin: 0.1rem 0 0; }
  .cs-group-title { font-size: 7pt; margin: 0.35rem 0 0; padding-bottom: 0.1rem; border-bottom-width: 1px; }
  .cs-race { padding: 0.25rem 0 0; }
  .cs-race-head h2 { font-size: 9.5pt; margin: 0 0 0.1rem; }
  .cs-table-wrap { border: 1px solid #999; border-radius: 0; box-shadow: none; }
  .cs-table thead th { font-size: 7.5pt; padding: 0.12rem 0.3rem; background: #eee !important; }
  .cs-table thead th.cs-topic-col { font-size: 6pt; width: 13%; }
  .cs-table tbody th, .cs-table tbody td { padding: 0.12rem 0.3rem; border-color: #bbb; }
  .cs-table tbody th { background: #f4f4f4 !important; }
  .cs-table tr { break-inside: avoid; }
  .cs-topic { font-size: 7.2pt; }
  .cs-topic-note { font-size: 5.8pt; margin-top: 0.1rem; }
  .cs-pos { font-size: 7.3pt; line-height: 1.3; margin: 0; }
  .cs-also { font-size: 6pt; margin: 0.05rem 0 0; }
  .cs-pending { font-size: 6.8pt; padding: 0.25rem; }
  .party-label.r, .party-label.d { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cs-race[hidden] { display: none !important; }
}
