/* 2026 Forecast Post-Mortem — the .ei-pm-* namespace (DRAFT, local only).
 * Sits on the forecast hero/deck (.ei-fc__hero / .ei-fc__deck in style.css).
 * Party colour only where it means a party; the timeline's three chambers use
 * a validated non-party categorical trio so blue never reads as "Democratic" there. */

.ei-pm {
  --pm-d: #1b4b8f;
  --pm-r: #e0241f;
  --pm-s1: #2a78d6; /* House */
  --pm-s2: #c98a00; /* Senate */
  --pm-s3: #1f9e8a; /* Governors */
  --pm-grid: #e6eaf0;
  --pm-axis: #b9c3d1;
  --pm-us: var(--ei-navy);
  --pm-open: #ecdcaa;   /* not yet called: pale gold, never a party tint */
  --pm-none: #eef1f6;   /* no race */
  --pm-mid: #e3e6eb;    /* miss scale midpoint */
  --pm-toss: #e6c34c;   /* Toss-up, as on the forecast maps (eifc-core.js) */
  --pm-line: #ffffff;
  max-width: 1180px; margin: 0 auto; padding: clamp(.5rem, 2vw, 1.25rem) 0 2rem;
  color: var(--ei-text);
}
[data-theme="dark"] .ei-pm {
  --pm-d: #4d8fe0;
  --pm-r: #f0544e;
  --pm-s1: #3987e5;
  --pm-s2: #c98500;
  --pm-s3: #199e70;
  --pm-grid: #232c3a;
  --pm-axis: #3a4659;
  --pm-open: #5a4f2c;
  --pm-none: #141a23;
  --pm-mid: #2c3340;
  --pm-toss: #c9a536;
  --pm-line: #0d1117;
}
.ei-pm__loading { color: var(--ei-muted); padding: 2rem 0; }

/* Sections */
.ei-pm__sec { margin: 0 0 1.25rem; padding: clamp(1.1rem, 2.6vw, 1.9rem); background: var(--ei-bg); border: 1px solid var(--ei-border); border-radius: var(--ei-radius-lg); box-shadow: var(--ei-shadow); }
.ei-pm__kicker { margin: 0 0 .35rem; font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--ei-red); }
.ei-pm__h { margin: 0; font-size: clamp(1.3rem, 2.4vw, 1.75rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: var(--ei-heading); text-wrap: balance; }
.ei-pm__p { margin: .7rem 0 0; max-width: 72ch; font-size: 1rem; line-height: 1.62; }
.ei-pm__p b { color: var(--ei-heading); }
.ei-pm__note { margin: .85rem 0 0; font-size: .84rem; line-height: 1.5; color: var(--ei-muted); max-width: 80ch; }
.ei-pm__grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1.5rem; margin-top: 1.1rem; }
.ei-pm__todo { margin: 1rem 0 0; padding: .8rem 1rem; border: 1px dashed var(--ei-gold-border); background: var(--ei-gold-bg); border-radius: var(--ei-radius); font-size: .88rem; line-height: 1.5; color: var(--ei-text); }
.ei-pm__todo b { color: var(--ei-gold-ink); }
.ei-pm__todo ul { margin: .35rem 0 0; padding-left: 1.1rem; }

/* Lead: the verdict */
.ei-pm__lead { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2.5rem); align-items: start; }
@media (max-width: 820px) { .ei-pm__lead { grid-template-columns: 1fr; } }
.ei-pm__tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.ei-pm__tile { padding: .85rem 1rem; border: 1px solid var(--ei-border); border-radius: var(--ei-radius); background: var(--ei-surface); }
[data-theme="dark"] .ei-pm__tile { background: var(--ei-surface); }
.ei-pm__tile-v { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; color: var(--ei-heading); font-variant-numeric: tabular-nums; line-height: 1.1; }
.ei-pm__tile-l { display: block; margin-top: .2rem; font-size: .8rem; line-height: 1.35; color: var(--ei-muted); }

/* Chamber cards */
.ei-pm__chambers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: .9rem; margin-top: 1.1rem; }
.ei-pm__ch { padding: 1rem 1.1rem; border: 1px solid var(--ei-border); border-radius: var(--ei-radius); }
.ei-pm__ch-h { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin: 0; font-size: 1rem; font-weight: 800; color: var(--ei-heading); }
.ei-pm__ch-tag { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: .18rem .5rem; border-radius: 999px; background: color-mix(in srgb, var(--pm-d) 14%, transparent); color: var(--ei-heading); }
.ei-pm__bar { position: relative; display: flex; gap: 2px; height: 14px; margin: .8rem 0 .45rem; border-radius: 4px; overflow: hidden; background: var(--ei-surface); }
.ei-pm__bar span { display: block; height: 100%; }
.ei-pm__bar .d { background: var(--pm-d); }
.ei-pm__bar .r { background: var(--pm-r); }
.ei-pm__bar .o { background: repeating-linear-gradient(135deg, var(--pm-axis) 0 3px, transparent 3px 7px); }
.ei-pm__bar i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ei-heading); }
.ei-pm__ch-legend { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .8rem; color: var(--ei-muted); font-variant-numeric: tabular-nums; }
.ei-pm__ch-legend b { color: var(--ei-heading); }
.ei-pm__ch-fc { margin: .6rem 0 0; font-size: .84rem; line-height: 1.45; color: var(--ei-text); }

/* Tables */
.ei-pm__tw { margin-top: 1rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ei-pm__t { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.ei-pm__t th { text-align: left; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ei-muted); padding: .45rem .6rem; border-bottom: 1px solid var(--ei-border); white-space: nowrap; }
.ei-pm__t td { padding: .5rem .6rem; border-bottom: 1px solid var(--ei-border); vertical-align: top; }
.ei-pm__t tr:last-child td { border-bottom: 0; }
.ei-pm__t .num { text-align: right; }
.ei-pm__t .code { font-weight: 800; color: var(--ei-heading); white-space: nowrap; }
.ei-pm__t .sub { display: block; font-size: .78rem; color: var(--ei-muted); }
.ei-pm__t tr.is-us td { background: color-mix(in srgb, var(--pm-us) 7%, transparent); font-weight: 700; }
.ei-pm__pill { display: inline-block; padding: .1rem .45rem; border-radius: 999px; font-size: .74rem; font-weight: 800; white-space: nowrap; }
.ei-pm__pill.d { background: color-mix(in srgb, var(--pm-d) 15%, transparent); color: var(--ei-heading); box-shadow: inset 3px 0 0 var(--pm-d); }
.ei-pm__pill.r { background: color-mix(in srgb, var(--pm-r) 15%, transparent); color: var(--ei-heading); box-shadow: inset 3px 0 0 var(--pm-r); }

/* Charts */
.ei-pm__chart { position: relative; margin-top: 1rem; }
.ei-pm__chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ei-pm__chart text { font-family: inherit; fill: var(--ei-muted); font-size: 12px; }
.ei-pm__chart .lbl { fill: var(--ei-text); font-weight: 700; }
.ei-pm__chart .val { fill: var(--ei-heading); font-weight: 700; font-variant-numeric: tabular-nums; }
.ei-pm__chart .grid { stroke: var(--pm-grid); stroke-width: 1; }
.ei-pm__chart .axis { stroke: var(--pm-axis); stroke-width: 1; }
.ei-pm__chart .zero { stroke: var(--ei-heading); stroke-width: 1.5; }
.ei-pm__chart .val-in { fill: #fff; }
.ei-pm__chart .hit { fill: transparent; cursor: default; }
.ei-pm__chart .bar-d { fill: var(--pm-d); }
.ei-pm__chart .bar-r { fill: var(--pm-r); }
.ei-pm__chart .bar-us { fill: var(--pm-us); }
.ei-pm__chart .bar-them { fill: var(--pm-axis); }
.ei-pm__chart .is-now .lbl { fill: var(--ei-heading); }
.ei-pm__chart .diag { stroke: var(--pm-axis); stroke-dasharray: 4 4; }
.ei-pm__chart .dot { fill: var(--pm-us); stroke: var(--ei-bg); stroke-width: 2; }
.ei-pm__chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.ei-pm__chart .s1 { stroke: var(--pm-s1); } .ei-pm__chart .f1 { fill: var(--pm-s1); }
.ei-pm__chart .s2 { stroke: var(--pm-s2); } .ei-pm__chart .f2 { fill: var(--pm-s2); }
.ei-pm__chart .s3 { stroke: var(--pm-s3); } .ei-pm__chart .f3 { fill: var(--pm-s3); }
.ei-pm__chart .cross { stroke: var(--ei-muted); stroke-width: 1; }
.ei-pm__panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1.25rem; margin-top: 1rem; }
.ei-pm__panel-h { margin: 0 0 .25rem; font-size: .82rem; font-weight: 800; color: var(--ei-heading); }
.ei-pm__legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .6rem; font-size: .8rem; color: var(--ei-muted); }
.ei-pm__legend span { display: inline-flex; align-items: center; gap: .35rem; }
.ei-pm__legend i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.ei-pm__legend i.sq { width: 11px; height: 11px; border-radius: 3px; }

/* Tooltip */
.ei-pm__tip { position: fixed; z-index: 50; pointer-events: none; max-width: 260px; padding: .55rem .7rem; border-radius: 8px; background: var(--ei-heading); color: var(--ei-bg); font-size: .8rem; line-height: 1.45; box-shadow: var(--ei-shadow-lg); opacity: 0; transition: opacity .12s; }
.ei-pm__tip.is-on { opacity: 1; }
.ei-pm__tip b { display: block; font-size: .84rem; }

/* Problems list */
.ei-pm__issues { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: .9rem; margin-top: 1.1rem; }
.ei-pm__issue { padding: 1rem 1.1rem; border: 1px solid var(--ei-border); border-left: 3px solid var(--ei-red); border-radius: var(--ei-radius); }
.ei-pm__issue h3 { margin: 0; font-size: .98rem; font-weight: 800; color: var(--ei-heading); }
.ei-pm__issue p { margin: .4rem 0 0; font-size: .88rem; line-height: 1.55; }
.ei-pm__issue .fix { color: var(--ei-muted); }

/* Verdict chips for the Nov 2 review check — label + tint, never colour alone. */
.ei-pm__verdict { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 800; white-space: nowrap; border: 1px solid var(--ei-border); color: var(--ei-heading); }
.ei-pm__verdict.is-held::before { content: "✓ "; }
.ei-pm__verdict.is-held { background: color-mix(in srgb, var(--ei-green) 14%, transparent); border-color: color-mix(in srgb, var(--ei-green) 40%, transparent); }
.ei-pm__verdict.is-missed::before { content: "✕ "; }
.ei-pm__verdict.is-missed { background: color-mix(in srgb, var(--ei-gold-accent) 18%, transparent); border-color: var(--ei-gold-border); }
.ei-pm__verdict.is-moot, .ei-pm__verdict.is-open { background: var(--ei-surface); color: var(--ei-muted); }
.ei-pm__t--claims td:first-child { width: 42%; }
.ei-pm__t--claims td { line-height: 1.5; }

/* Forecaster comparison */
.ei-pm__h3 { margin: 1.6rem 0 .2rem; font-size: 1.08rem; font-weight: 800; color: var(--ei-heading); }
.ei-pm__who { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; color: var(--ei-heading); white-space: nowrap; }
.ei-pm__logo { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; }
.ei-pm__t--score td.is-best { font-weight: 800; color: var(--ei-heading); }
.ei-pm__t--score .sub { margin-left: 1.65rem; }
.ei-pm__colhead { display: inline-flex; flex-direction: column; align-items: center; gap: .2rem; font-size: .64rem; letter-spacing: .02em; }
.ei-pm__colhead .ei-pm__logo { width: 18px; height: 18px; }
.ei-pm__t--matrix { font-size: .82rem; }
.ei-pm__t--matrix th, .ei-pm__t--matrix td { padding: .4rem .35rem; text-align: center; }
.ei-pm__t--matrix th:first-child, .ei-pm__t--matrix td:first-child, .ei-pm__t--matrix td:nth-child(2) { text-align: left; }
.ei-pm__cell { background: color-mix(in srgb, var(--c) var(--t), transparent); color: var(--ei-heading); font-weight: 600; border-left: 2px solid var(--ei-bg); }
.ei-pm__cell.is-wrong { box-shadow: inset 0 0 0 2px var(--ei-heading); font-weight: 800; }
.ei-pm__cell.is-na { background: none; color: var(--ei-muted); }
.ei-pm__cell.is-uscol { outline: 1px solid color-mix(in srgb, var(--pm-us) 45%, transparent); outline-offset: -1px; }
.ei-pm__t--score tr.is-us td { font-weight: 500; }
.ei-pm__t--score tr.is-us td.is-best, .ei-pm__t--score td.is-best { font-weight: 800; }

/* Brier | Accuracy toggle */
.ei-pm__h3row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .6rem 1rem; margin-top: 1.6rem; }
.ei-pm__h3row .ei-pm__h3 { margin: 0; }
.ei-pm__seg { display: inline-flex; gap: .2rem; padding: .25rem; border: 1px solid var(--ei-border); border-radius: 999px; background: var(--ei-surface); }
.ei-pm__seg button { appearance: none; border: 0; background: none; padding: .38rem .85rem; border-radius: 999px; font: inherit; font-size: .82rem; font-weight: 700; color: var(--ei-muted); cursor: pointer; }
.ei-pm__seg button[aria-pressed="true"] { background: var(--ei-bg); color: var(--ei-heading); box-shadow: var(--ei-shadow); }
.ei-pm__seg button:focus-visible { outline: 2px solid var(--ei-navy); outline-offset: 2px; }

.ei-pm__h3 .ei-pm__logo { vertical-align: -3px; margin-right: .35rem; }

/* Map */
.ei-pm__mapbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1rem; }
.ei-pm__zoom { display: inline-flex; gap: .25rem; margin-left: auto; }
.ei-pm__zoom button { appearance: none; border: 1px solid var(--ei-border); background: var(--ei-bg); color: var(--ei-heading); border-radius: 8px; min-width: 2.1rem; height: 2.1rem; padding: 0 .6rem; font: inherit; font-weight: 700; cursor: pointer; }
.ei-pm__map { margin-top: .8rem; border-radius: var(--ei-radius); overflow: hidden; background: var(--ei-bg); touch-action: pan-y; }
/* Capped like the /forecasts maps (66–74vh) so the whole map fits on screen with its controls. */
.ei-pm__map svg { display: block; width: 100%; height: auto; max-height: calc(62vh + 50px); margin: 0 auto; cursor: grab; }
.ei-pm__shape { stroke: var(--pm-line); stroke-width: .5; vector-effect: non-scaling-stroke; }
.ei-pm__shape:hover { stroke: var(--ei-heading); stroke-width: 1.5; }
.ei-pm__statelines { fill: none; stroke: var(--pm-line); stroke-linejoin: round; pointer-events: none; }
.ei-pm__missed { stroke: var(--pm-line); stroke-width: .5; vector-effect: non-scaling-stroke; }
/* legend key for the hatch: -45deg draws "/" like the SVG's rotate(45) (see the is-flipkey note in style.css) */
.ei-pm__sw-miss { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--ei-flip-hatch, #fff) 60%, transparent) 0 1.8px, transparent 1.8px 4.2px), var(--pm-d); }
.ei-pm__ramp { display: inline-flex; align-items: center; gap: .4rem; }
.ei-pm__ramp i { display: inline-block; width: 140px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, var(--pm-r), var(--pm-mid), var(--pm-d)); }

/* Parts + table of contents */
.ei-pm__toc { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1.25rem; }
.ei-pm__toc a { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border: 1px solid var(--ei-border); border-radius: 999px; background: var(--ei-surface); color: var(--ei-heading); font-size: .86rem; font-weight: 700; text-decoration: none; }
.ei-pm__toc a:hover { border-color: var(--pm-us); }
.ei-pm__toc a span { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--pm-us); color: var(--ei-bg); font-size: .72rem; }
.ei-pm__part { scroll-margin-top: 5rem; }
.ei-pm__part:empty { display: none; }

/* The shape of the miss */
.ei-pm__chart .pt { fill: var(--pm-axis); opacity: .75; }
.ei-pm__chart .pt:hover { fill: var(--pm-us); opacity: 1; }
.ei-pm__chart .band { stroke: var(--pm-us); stroke-width: 3.5; stroke-linecap: round; }

/* What to improve */
.ei-pm__fixes { margin: 1rem 0 0; padding: 0; list-style: none; counter-reset: fix; display: grid; gap: .75rem; }
.ei-pm__fix { counter-increment: fix; padding: .9rem 1rem .95rem 3rem; position: relative; border: 1px solid var(--ei-border); border-radius: 12px; }
.ei-pm__fix::before { content: counter(fix); position: absolute; left: 1rem; top: .95rem; width: 1.4rem; height: 1.4rem; display: grid; place-items: center; border-radius: 50%; background: var(--pm-us); color: var(--ei-bg); font-size: .75rem; font-weight: 800; }
.ei-pm__fix-h { margin: 0; font-weight: 800; color: var(--ei-heading); line-height: 1.35; }
.ei-pm__fix-tag { display: inline-block; margin-right: .5rem; padding: .1rem .5rem; border-radius: 999px; background: var(--ei-gold-ink, #8a6a00); color: var(--ei-bg); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; vertical-align: 2px; }
.ei-pm__fix .ei-pm__p { margin-top: .45rem; }
@media (max-width: 560px) { .ei-pm__fix { padding-left: 1rem; padding-top: 2.6rem; } .ei-pm__fix::before { top: .85rem; } }
.ei-pm__chart .halo { paint-order: stroke; stroke: var(--ei-surface); stroke-width: 4px; stroke-linejoin: round; }

/* Crosstab test score table */
.ei-pm__t td.is-best { font-weight: 800; color: var(--ei-heading); }
.ei-pm__t th.is-uscol, .ei-pm__t td.is-uscol { background: color-mix(in srgb, var(--pm-us) 7%, transparent); }

/* fix verdict tags */
.ei-pm__fix-tag.is-keep { background: #1f7a4d; }
.ei-pm__fix-tag.is-no { background: var(--ei-muted, #6b7280); }
.ei-pm__fix-num { margin: .5rem 0 0; font-size: .8rem; color: var(--ei-muted, #6b7280); }

/* five map views: let the group wrap on narrow screens, one label per line */
.ei-pm__mapbar .ei-pm__seg { flex-wrap: wrap; max-width: 100%; }
.ei-pm__mapbar .ei-pm__seg button { white-space: nowrap; }
@media (max-width: 560px) { .ei-pm__mapbar .ei-pm__seg { border-radius: 14px; } }
