/* css/elections.css — US Elections dashboard (#elections). Theme-aware via css/themes.css tokens.
   Party colours are set in js/elections.js per scheme (diverging blue ↔ red, gray midpoint). */
#elections .el-lede { max-width: 900px; color: var(--text-muted); line-height: 1.65; }
#elections .el-lede strong { color: var(--text); }
#elections h3 { margin: 0 0 .6rem; font-size: .95rem; text-transform: none; letter-spacing: 0; }
#elections .el-sub { margin: -.2rem 0 .5rem; font-size: .78rem; color: var(--text-muted); }
#elections .el-hint { margin: .55rem 0 0; font-size: .72rem; color: var(--text-muted); line-height: 1.5; }
#elections .el-empty { color: var(--text-muted); font-size: .82rem; text-align: center; padding: 2rem 1rem; }
#elections .el-status { color: var(--text-muted); font-size: .85rem; padding: 2rem 0; text-align: center; }

/* filter row — one row above everything it scopes */
#elections .el-filters { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin: 1.3rem 0 1rem; padding: .7rem .8rem;
  border: 1px solid var(--border); border-radius: 12px; background: rgba(var(--fg-rgb), .025); }
#elections .el-years, #elections .el-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
#elections .el-years button, #elections .el-seg button { font: inherit; font-size: .78rem; cursor: pointer; color: var(--text-muted); background: transparent; border: 0;
  border-right: 1px solid var(--border); padding: .35rem .7rem; line-height: 1.15; min-height: 34px; }
#elections .el-years button:last-child, #elections .el-seg button:last-child { border-right: 0; }
#elections .el-years button small { display: block; font-size: .62rem; opacity: .8; }
#elections .el-years button[aria-pressed="true"], #elections .el-seg button[aria-pressed="true"] { color: var(--text); background: rgba(var(--accent-rgb), .16); box-shadow: inset 0 -2px 0 var(--green); }
#elections .el-seg button:disabled { opacity: .4; cursor: not-allowed; }
#elections button:focus-visible, #elections select:focus-visible, #elections tr:focus-visible, #elections .el-states path:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
#elections .el-select { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; color: var(--text-muted); }
#elections .el-select select { font: inherit; font-size: .8rem; color: var(--text); background: var(--bg-elevated, var(--bg-card)); border: 1px solid var(--border); border-radius: 8px; padding: .3rem .5rem; min-height: 32px; }

/* breadcrumbs + KPIs */
#elections .el-crumbs { display: flex; align-items: center; gap: .45rem; font-size: .8rem; color: var(--text-muted); margin-bottom: .6rem; flex-wrap: wrap; }
#elections .el-crumbs button { font: inherit; color: var(--green-light); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#elections .el-crumbs span { color: var(--text); font-weight: 600; }
#elections .el-crumbs i { font-style: normal; opacity: .6; }
#elections .el-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
#elections .el-kpi { border: 1px solid var(--border); border-radius: 10px; padding: .65rem .8rem; background: rgba(var(--fg-rgb), .03); min-width: 0; }
#elections .el-kpi-wide { grid-column: 1 / -1; }
#elections .el-kpi-v { display: block; font-size: 1.3rem; font-weight: 700; color: var(--text); line-height: 1.2; }
#elections .el-kpi-v small { font-size: .7rem; color: var(--text-muted); font-weight: 600; }
#elections .el-kpi-l { display: block; font-size: .7rem; color: var(--text-muted); margin-top: .2rem; overflow-wrap: anywhere; }

/* layout */
#elections .el-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 1rem; align-items: start; margin-bottom: 1rem; }
#elections .el-grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
#elections .el-side { display: grid; gap: 1rem; min-width: 0; }
#elections .el-card { border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem; background: rgba(var(--fg-rgb), .03); min-width: 0; }
@media (max-width: 980px) { #elections .el-grid, #elections .el-grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* map */
#elections .el-map { width: 100%; height: auto; display: block; }
#elections .el-counties path { stroke: var(--bg-card); stroke-width: .35; cursor: pointer; transition: opacity .2s; }
#elections .el-counties path:hover { stroke: var(--text); stroke-width: 1.2; }
#elections .el-counties path.el-sel { stroke: var(--text); stroke-width: 2; }
#elections .el-states path { stroke: none; cursor: pointer; transition: opacity .2s; }
#elections .el-states path.el-sel { fill-opacity: 0; }
#elections .el-hatch path { fill: url(#el-hatch); pointer-events: none; }
#elections .el-hatch-line { fill: var(--bg-card); opacity: .55; }
#elections .el-borders { fill: none; stroke: var(--bg-card); stroke-width: 1.3; pointer-events: none; }
#elections .el-nation { fill: none; stroke: rgba(var(--fg-rgb), .25); stroke-width: .8; pointer-events: none; }
#elections .el-dim { opacity: .22; }

/* legend */
#elections .el-legend { margin-top: .6rem; max-width: 520px; }
#elections .el-leg-bar { height: 10px; border-radius: 3px; }
#elections .el-leg-ticks { display: flex; justify-content: space-between; font-size: .66rem; color: var(--text-muted); margin-top: .25rem; font-variant-numeric: tabular-nums; }
#elections .el-leg-keys { display: flex; gap: 1rem; font-size: .68rem; color: var(--text-muted); margin-top: .45rem; }
#elections .el-leg-keys i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: .35rem; border: 1px solid var(--border); }
#elections .el-key-hatch { background: repeating-linear-gradient(45deg, rgba(var(--fg-rgb), .45) 0 2px, transparent 2px 5px); }
#elections .el-notes p { margin: .5rem 0 0; font-size: .74rem; color: var(--text-muted); line-height: 1.5; }
#elections .el-notes a, #elections .el-method a, #elections .el-hero a { color: var(--green-light); }

/* tooltip */
#elections .el-tip { position: fixed; z-index: 9000; pointer-events: none; max-width: 280px; padding: .5rem .65rem; border-radius: 8px; font-size: .75rem; line-height: 1.45;
  color: var(--text); background: var(--bg-elevated, var(--bg-card)); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
#elections .el-tip-h { font-weight: 700; }
#elections .el-tip-row.muted { color: var(--text-muted); }

/* tables */
#elections .el-table-wrap { max-height: 430px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
#elections table { width: 100%; border-collapse: collapse; font-size: .76rem; font-variant-numeric: tabular-nums; }
#elections .el-table thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-card); cursor: pointer; user-select: none; white-space: nowrap; }
#elections th, #elections td { padding: .38rem .55rem; text-align: right; border-bottom: 1px solid rgba(var(--fg-rgb), .07); }
#elections th[scope="row"], #elections thead th:first-child { text-align: left; }
#elections th[scope="row"] { font-weight: 600; color: var(--text); }
#elections th[scope="row"] small { display: block; font-weight: 400; font-size: .64rem; color: var(--text-muted); }
#elections thead th { font-weight: 600; color: var(--text-muted); font-size: .7rem; }
#elections .el-table tbody tr { cursor: pointer; }
#elections .el-table tbody tr:hover, #elections .el-row-sel { background: rgba(var(--accent-rgb), .1); }
#elections td { color: var(--text); }
#elections .el-chip { display: inline-block; padding: .05rem .4rem; border-radius: 5px; font-weight: 600; color: var(--text); box-shadow: inset 3px 0 0 var(--c); background: rgba(var(--fg-rgb), .05); }
#elections .el-dwrap { overflow-x: auto; }
#elections .el-dtable { font-size: .72rem; }
#elections .el-dtable th, #elections .el-dtable td { padding: .34rem .4rem; }
#elections .el-dtable td.el-mbar { white-space: nowrap; }
#elections .el-mbar span { display: inline-block; position: relative; width: 40px; height: 6px; margin-right: .35rem; vertical-align: 1px; border-radius: 3px; background: rgba(var(--fg-rgb), .08); }
#elections .el-mbar span i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
#elections .el-mbar small { color: var(--text-muted); }
#elections .el-demo { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .45rem; margin-top: .8rem; font-size: .68rem; color: var(--text-muted); }
#elections .el-demo b { display: block; font-size: .9rem; color: var(--text); }
#elections .el-demo em { grid-column: 1 / -1; font-style: normal; font-size: .64rem; }

/* charts */
#elections svg text.el-axis { fill: var(--text-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
#elections svg .el-grid { stroke: rgba(var(--fg-rgb), .08); stroke-width: 1; }
#elections svg .el-zero { stroke: rgba(var(--fg-rgb), .3); }
#elections svg .el-tline { fill: none; stroke: rgba(var(--fg-rgb), .45); stroke-width: 2; }
#elections svg .el-tlabel { fill: var(--text); font-size: 11px; font-weight: 700; }
#elections svg .el-hit { fill: transparent; cursor: default; }
#elections svg .el-dots circle { opacity: .55; }
#elections svg .el-dots circle.el-dot-sel { opacity: 1; stroke: var(--text); stroke-width: 2; r: 6; }
#elections svg .el-fit { stroke: var(--text); stroke-width: 1.5; opacity: .75; }
#elections .el-factor-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .4rem; }
#elections .el-factor-head h3 { margin: 0; }

/* Texas spotlight */
#elections .el-spotlight { margin-bottom: 1rem; }
#elections .el-spot-top { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 1rem; align-items: center; }
@media (max-width: 860px) { #elections .el-spot-top { grid-template-columns: minmax(0, 1fr); } }
#elections .el-hero-k { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
#elections .el-hero-v { font-size: 2.6rem; font-weight: 800; line-height: 1.1; margin: .15rem 0 .3rem; }
#elections .el-hero-sub { font-size: .78rem; color: var(--text); margin: .25rem 0; line-height: 1.45; }
#elections .el-hero-sub small { color: var(--text-muted); }
#elections .el-hero-foot { font-size: .68rem; color: var(--text-muted); margin-top: .5rem; }
#elections .el-multiples { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .6rem; margin: 1rem 0; }
@media (max-width: 860px) { #elections .el-multiples { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
#elections .el-multiples figure { margin: 0; }
#elections .el-multiples svg { width: 100%; height: auto; display: block; }
#elections .el-multiples svg path { stroke: var(--bg-card); stroke-width: .25; }
#elections .el-multiples figcaption { font-size: .7rem; color: var(--text-muted); text-align: center; margin-top: .3rem; line-height: 1.35; }
#elections .el-multiples figcaption b { color: var(--text); }
#elections .el-multiples figcaption span { font-weight: 700; display: block; }
#elections .el-multiples figcaption small { display: block; font-size: .62rem; }
#elections .el-shifts h4 { font-size: .82rem; margin: 0 0 .5rem; color: var(--text); }
#elections .el-shifts h4 small, #elections .el-shifts li small { color: var(--text-muted); font-weight: 400; }
#elections .el-shifts h5 { font-size: .74rem; margin: 0 0 .3rem; }
#elections .el-shift-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { #elections .el-shift-cols { grid-template-columns: 1fr; } }
#elections .el-shifts ol { margin: 0; padding-left: 1.2rem; font-size: .76rem; }
#elections .el-shifts li { margin: .2rem 0; }
#elections .el-shifts li button { font: inherit; color: var(--green-light); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#elections .el-shifts li span { margin: 0 .4rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* method */
#elections .el-method summary { cursor: pointer; font-weight: 600; font-size: .88rem; }
#elections .el-method ul { margin: .7rem 0; padding-left: 1.1rem; font-size: .76rem; color: var(--text-muted); line-height: 1.6; }
#elections .el-method b { color: var(--text); }
#elections .el-links { display: flex; gap: .5rem; flex-wrap: wrap; }

@media (forced-colors: active) { #elections .el-chip { border: 1px solid CanvasText; } }

@media (max-width: 600px) {
  #elections .el-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #elections .el-kpi-v { font-size: 1.05rem; }
  #elections .el-years { max-width: 100%; overflow-x: auto; }
  #elections .el-years button { padding: .35rem .5rem; }
  #elections .el-hero-v { font-size: 2rem; }
}
