/* =============================================================================
   The Sweeney Model: race page
   ============================================================================= */

.crumb { font-size: var(--step--1); margin: 6px 0 18px; }
.race-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.race-head h1 { font-size: var(--step-4); }
.race-head .sub { color: var(--ink-soft); margin: 8px 0 0; }

/* top layout: forecast card + map */
.race-top { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 32px; margin-top: 26px; align-items: start; }
@media (max-width: 860px) { .race-top { grid-template-columns: 1fr; } }

.matchup { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cand { display: flex; gap: 14px; align-items: center; }
.cand.right { flex-direction: row-reverse; text-align: right; }
.cand .photo { width: 84px; height: 84px; flex: none; border-radius: 50%; border: var(--outline); overflow: hidden;
               display: grid; place-items: center; font-family: var(--display); font-stretch: 125%; font-weight: 900;
               font-size: var(--step-2); color: #fff; background: var(--ink-soft); }
.cand .photo.d { background: var(--sky); }
.cand .photo.r { background: var(--red); }
.cand .photo img { width: 100%; height: 100%; object-fit: cover; }
.cand .name { font-weight: 700; font-size: var(--step-1); line-height: 1.2; }
.cand .tag { color: var(--ink-soft); font-size: var(--step--1); }
.cand .chance { font-family: var(--display); font-stretch: 125%; font-weight: 900; font-size: var(--step-4); line-height: 1; }
.chance-label { font-size: var(--step--1); color: var(--ink-soft); }

.mapbox { border: 2px solid var(--line); border-radius: var(--radius-card); padding: 14px; }
.mapbox svg { width: 100%; height: auto; display: block; }
.mapbox .note { font-size: var(--step--1); color: var(--ink-soft); margin: 8px 0 0; }

/* expandable sections */
.details { margin-top: 36px; display: grid; gap: 14px; }
details.panel { border: 2px solid var(--ink); border-radius: var(--radius-card); background: var(--paper); }
details.panel[open] { box-shadow: 4px 4px 0 var(--ink); }
details.panel > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; justify-content: space-between;
                          align-items: center; gap: 12px; font-weight: 700; font-size: var(--step-1); }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: "+"; font-family: var(--display); font-weight: 900; font-size: var(--step-2); line-height: 1; }
details.panel[open] > summary::after { content: "–"; }
details.panel > summary .count { font-weight: 400; color: var(--ink-soft); font-size: var(--step-0); margin-left: auto; margin-right: 12px; }
details.panel .inner { padding: 0 20px 20px; }

/* polls table */
.tablewrap { overflow-x: auto; }
table.polls { width: 100%; border-collapse: collapse; font-size: var(--step--1); min-width: 640px; }
table.polls th { text-align: left; font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
table.polls td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.polls td.num { text-align: right; }
table.polls .internal { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 6px; border-radius: 4px;
                        background: var(--sun-pale); margin-left: 6px; }
.wbar { display: inline-block; height: 8px; background: var(--ink); border-radius: 4px; vertical-align: middle; margin-right: 6px; }

/* forecast components: diverging bars around zero */
.comp { display: grid; grid-template-columns: 13rem 1fr 4.5rem; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.comp .track { position: relative; height: 14px; }
.comp .track::before { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; border-left: 2px solid var(--ink); }
.comp .fill { position: absolute; top: 0; height: 14px; border-radius: 4px; }
.comp .val { text-align: right; font-weight: 700; }
.comp.total { border-bottom: 0; font-weight: 700; }
@media (max-width: 560px) { .comp { grid-template-columns: 8rem 1fr 3.8rem; } }

/* views table */
table.views { border-collapse: collapse; font-size: var(--step--1); }
table.views td { padding: 6px 14px 6px 0; border-bottom: 1px solid var(--line); }
table.views td.num { text-align: right; font-weight: 700; }

.notes-body p { max-width: 70ch; }
.race-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.race-chart .axis text { font: var(--step--1) var(--body); fill: var(--ink-soft); }
.race-chart .axis path, .race-chart .axis line { stroke: var(--line); }
.notfound { padding: 60px 0; }

/* probability-first summary line */
.verdict { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 0; font-weight: 700; font-size: var(--step-1); }

/* control-impact and companion tables */
table.views.imp { width: 100%; max-width: 640px; }
table.views.imp th { text-align: left; font-size: var(--step--1); padding: 6px 14px 6px 0; border-bottom: 2px solid var(--ink); }
table.views.imp th:not(:first-child), table.views.imp td.num { text-align: right; }

/* race news */
.news-list { list-style: none; padding: 0; margin: 0; }
.news-list li { padding: 9px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.news-list a { color: var(--ink); text-decoration: none; font-weight: 700; }
.news-list a:hover { text-decoration: underline; }
.news-list .muted { font-size: var(--step--1); }

/* data status line */
.data-status { margin-top: 26px; font-size: var(--step--1); color: var(--ink-soft); }

/* what's pulling the forecast: visible decomposition below the headline numbers */
.pull { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line); }
.pull h2 { font-size: var(--step-3); margin-bottom: 8px; }
.pull .blend { font-weight: 700; margin-top: 14px; max-width: 70ch; }
