/* seat-calculator.css - /seat-calculator/ (prefix sc-). Builds on us.css (us-l- fills,
   seat bar, map) and pc-components.css; tokens only, no raw hexes.
   The slider dock is sticky under the header so the bars and maps stay in view while it moves. */

.sc-masthead { margin-bottom: 8px; }

/* ---- Slider dock ---- */
.sc-dock {
    --sc-side: var(--pc-text-meta);
    position: sticky; top: var(--us-nav-h, 60px); z-index: 30;
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 24px;
    background: var(--pc-surface); padding: 14px 0 12px; margin: 0 0 8px;
    border-bottom: 1px solid var(--pc-border); font-family: var(--pc-sans);
}
.sc-dock.is-d { --sc-side: var(--us-dem); }
.sc-dock.is-r { --sc-side: var(--us-rep); }
.sc-dial { display: flex; flex-direction: column; min-width: 112px; }
.sc-val { font-size: 40px; font-weight: 800; line-height: 1; color: var(--pc-text); font-variant-numeric: tabular-nums; }
.sc-dock.is-d .sc-val { color: var(--us-dem-text); }
.sc-dock.is-r .sc-val { color: var(--us-rep-text); }
.sc-val-lab { font-size: 12px; font-weight: 600; color: var(--pc-text-meta); margin-top: 4px; }
.sc-range { min-width: 0; }
.sc-slider {
    appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 10px; margin: 10px 0 0;
    background: linear-gradient(to right, var(--us-rep) 0%, var(--us-lean-r) 42%, var(--pc-border-light) 50%, var(--us-lean-d) 58%, var(--us-dem) 100%);
    border: 0; border-radius: 5px; outline: none; cursor: pointer;
}
.sc-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 30px; height: 30px; border-radius: 50%;
    background: var(--sc-side); border: 3px solid var(--pc-surface); box-shadow: 0 0 0 1px var(--pc-text-meta); cursor: grab;
}
.sc-slider::-moz-range-thumb {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--sc-side); border: 3px solid var(--pc-surface); box-shadow: 0 0 0 1px var(--pc-text-meta); cursor: grab;
}
.sc-slider::-moz-range-track { background: transparent; border: 0; }
.sc-slider:focus-visible { outline: 2px solid var(--pc-text); outline-offset: 6px; }
.sc-ticks { display: flex; justify-content: space-between; margin-top: 8px; padding: 0 15px; font-size: 11px; font-weight: 600; color: var(--pc-text-meta); font-variant-numeric: tabular-nums; }
.sc-ticks span { width: 0; display: flex; justify-content: center; white-space: nowrap; }
.sc-presets { display: flex; flex-direction: column; gap: 6px; }
.sc-presets .pc-btn { min-height: 38px; white-space: nowrap; }
.sc-avg.is-active { background: var(--pc-text); color: var(--pc-surface); border-color: var(--pc-text); }

/* ---- Office blocks ---- */
.sc-block { padding-top: 28px; }
.sc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.sc-office { font-family: var(--pc-serif); font-size: 22px; font-weight: 700; color: var(--pc-text); margin: 0; }
.sc-nums { display: flex; align-items: baseline; gap: 18px; font-family: var(--pc-sans); font-variant-numeric: tabular-nums; }
.sc-num { font-size: 30px; font-weight: 800; line-height: 1; }
.sc-num small { font-size: 12px; font-weight: 600; margin-right: 6px; }
.sc-d { color: var(--us-dem-text); }
.sc-r { color: var(--us-rep-text); }
.sc-verdict { font-family: var(--pc-serif); font-size: 16px; font-weight: 700; color: var(--pc-text); }
.sc-bar-wrap { position: relative; padding: 20px 0 14px; }
.sc-bar.pc-seatbar { height: 40px; border-radius: 0; }
.sc-bar .pc-seat-seg { transition: width 0.18s ease-out; font-size: 0; }
.sc-bar .pc-seat-seg.us-l-none { background: var(--pc-border-light); }
@media (prefers-reduced-motion: reduce) { .sc-bar .pc-seat-seg { transition: none; } }
.sc-maj {
    position: absolute; top: 14px; bottom: 8px; width: 2px; margin-left: -1px;
    background: var(--pc-text); z-index: 2; pointer-events: none;
}
.sc-maj span {
    position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
    font-family: var(--pc-sans); font-size: 12px; font-weight: 700; color: var(--pc-text);
    background: var(--pc-surface); padding: 0 6px; line-height: 1.3; white-space: nowrap;
}
/* the 80% range: a whisker under the bar, measured from the Democratic end */
.sc-band {
    position: absolute; bottom: 2px; height: 8px; border: 2px solid var(--pc-text); border-top: 0;
    transition: left 0.18s ease-out, width 0.18s ease-out; pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .sc-band { transition: none; } }
.sc-line { margin: 0; font-family: var(--pc-sans); font-size: 12px; color: var(--pc-text-secondary); font-variant-numeric: tabular-nums; }

/* ---- House map ---- */
.sc-stage { position: relative; margin-top: 12px; overflow: hidden; }
.sc-hmap { display: block; width: 100%; height: auto; min-height: 200px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.sc-stage.is-zoomed .sc-hmap { touch-action: none; cursor: grab; }
.sc-hmap .sc-d-shape { fill: var(--us-fill); stroke: var(--pc-surface); stroke-width: 0.4; vector-effect: non-scaling-stroke; }
.sc-hmap .sc-d-shape:hover, .sc-hmap .sc-d-shape.is-sel { stroke: var(--pc-text); stroke-width: 1.8; }
.sc-hmap .sc-states { fill: none; stroke: var(--pc-text-meta); stroke-width: 0.8; vector-effect: non-scaling-stroke; pointer-events: none; }
.sc-hmap .us-l-tossup { fill: var(--pc-border); }
.sc-loading { position: absolute; inset: 40% 0 auto; text-align: center; font-family: var(--pc-sans); font-size: 13px; color: var(--pc-text-meta); margin: 0; }
.sc-loading[hidden] { display: none; }
.sc-zoom { position: absolute; top: 4px; right: 0; display: flex; gap: 4px; }
.sc-zoom .pc-btn { min-width: 40px; min-height: 40px; padding: 0 10px; font-size: 18px; background: var(--pc-surface); }
.sc-zoom .pc-btn[data-zoom="fit"] { font-size: 13px; }
.sc-readout { min-height: 20px; margin: 4px 0 0; font-family: var(--pc-sans); font-size: 13px; font-weight: 600; color: var(--pc-text); font-variant-numeric: tabular-nums; }

/* ---- Senate map ---- */
.sc-smap-wrap { max-width: 640px; margin: 10px auto 0; }
.sc-smap path.sc-st { fill: var(--us-fill); stroke: var(--pc-surface); stroke-width: 0.8; cursor: pointer; }
.sc-smap path.sc-st:hover, .sc-smap path.sc-st.is-sel { stroke: var(--pc-text); stroke-width: 1.6; }
.sc-smap path.sc-st-off { fill: var(--pc-border-light); cursor: default; }
.sc-smap path.sc-st-off:hover { stroke: var(--pc-surface); stroke-width: 0.8; }
.sc-smap path.us-l-tossup { fill: var(--pc-border); }

/* ---- Closest seats ---- */
.sc-close-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; margin-top: 10px; }
.sc-list { list-style: none; margin: 0; padding: 0; font-family: var(--pc-sans); font-size: 14px; font-variant-numeric: tabular-nums; }
.sc-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--pc-border-light); }
.sc-list li:first-child { border-top: 2px solid var(--pc-text); }
.sc-list .sc-sw { flex: 0 0 auto; width: 12px; height: 12px; background: var(--us-fill); }
.sc-list .sc-nm { flex: 1 1 auto; color: var(--pc-text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-list .sc-gain { font-size: 11px; font-weight: 700; color: var(--pc-text-meta); text-transform: uppercase; letter-spacing: 0.04em; }
.sc-list .sc-mg { font-weight: 700; min-width: 52px; text-align: right; }

@media (max-width: 768px) {
    .sc-dock { grid-template-columns: auto minmax(0, 1fr); padding: 10px 0 10px; gap: 6px 14px; }
    .sc-dial { min-width: 0; }
    .sc-val { font-size: 32px; }
    .sc-val-lab { display: none; }
    .sc-range { grid-column: 1 / -1; grid-row: 2; }
    .sc-presets { flex-direction: row; justify-content: flex-end; grid-column: 2; grid-row: 1; }
    .sc-presets .pc-btn { min-height: 40px; padding: 0 10px; font-size: 13px; }
    .sc-ticks span:nth-child(2n) { visibility: hidden; }
    .sc-num { font-size: 26px; }
    .sc-head { align-items: baseline; }
    .sc-close-grid { grid-template-columns: 1fr; }
    .sc-close-grid .sc-list + .sc-list { margin-top: 18px; }
}
