/* ============================================
   by-election-page.css - by-election template page
   Prefix: bx-. Consumes css/pc-tokens.css only (no raw hexes) and sits on
   top of css/pc-components.css. Reference page: holborn-and-st-pancras.html.
   Legacy style.css still loads for the site header/footer; anything here
   that has to outgun a legacy rule is scoped under body.bx-body.
   ============================================ */

body.bx-body {
    background: var(--pc-bg);
    color: var(--pc-text-body);
    font-family: var(--pc-sans);
}
body.bx-body main.pc-wrap { padding: 48px 24px 64px; }
@media (max-width: 768px) {
    body.bx-body main.pc-wrap { padding: 32px 16px 48px; }
}

/* ---- Hero ---- */
.bx-hero { margin-bottom: 32px; }
.bx-hero .pc-kicker {
    border-top: 3px solid var(--pc-text);
    padding-top: 10px;
    color: var(--pc-text-meta);
    letter-spacing: 0.05em;
    font-size: 13px;
    font-weight: 600;
}
.bx-h1 {
    font-family: var(--pc-serif);
    font-size: 36px;
    line-height: 1.15;
    font-weight: 700;
    color: var(--pc-text);
    margin: 0 0 10px;
}
.bx-meta {
    font-family: var(--pc-sans);
    font-size: 13px;
    color: var(--pc-text-meta);
    margin: 0 0 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}
.bx-meta strong { color: var(--pc-text); font-weight: 600; }
.bx-lead {
    font-family: var(--pc-serif);
    font-size: 20px;
    line-height: 1.5;
    color: var(--pc-text);
    max-width: 720px;
    margin: 0 0 20px;
}

/* Status banner + stage stepper */
.bx-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0;
    margin: 0 0 12px;
}
.bx-status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pc-negative); flex-shrink: 0; }
.bx-status-stage { font-size: 14px; font-weight: 700; color: var(--pc-text); }
.bx-status-detail { font-size: 13px; color: var(--pc-text-secondary); }
.bx-stepper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
}
.bx-stepper .pc-pill {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pc-text-muted);
    border-color: var(--pc-border-light);
    cursor: default;
}
.bx-stepper .pc-pill.is-done { color: var(--pc-text-secondary); border-color: var(--pc-border); }
.bx-stepper .pc-pill.is-current { color: var(--pc-on-ink); background: var(--pc-text); border-color: var(--pc-text); }

/* Share row (inline SVG icons) */
.bx-share { display: flex; align-items: center; gap: 8px; margin: 0 0 24px; }
.bx-share-label { font-size: 11px; color: var(--pc-text-meta); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; margin-right: 2px; }
.bx-share a, .bx-share button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--pc-border); border-radius: 50%;
    color: var(--pc-text-body); background: var(--pc-surface);
    cursor: pointer; text-decoration: none;
}
.bx-share a:hover, .bx-share button:hover { background: var(--pc-hover-bg); color: var(--pc-text); }

/* Key facts line */
.bx-facts-line {
    font-family: var(--pc-sans);
    font-size: 14px;
    line-height: 1.6;
    color: var(--pc-text-secondary);
    margin: 0 0 8px;
    padding: 10px 0 0;
    border-top: 1px solid var(--pc-border);
    font-variant-numeric: tabular-nums;
}
.bx-fact-k { color: var(--pc-text-meta); text-transform: uppercase; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; margin-right: 4px; }
.bx-fact-sep { margin: 0 10px; color: var(--pc-text-meta); }
.bx-facts-line--section { border-top: 0; padding-top: 0; margin: 0 0 16px; }

/* Locals: bars beside the ward map */
.bx-locals-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.bx-locals-map { margin: 0; }
.bx-map-tabs { margin: 0 0 8px; }
.bx-map { min-height: 200px; }
.bx-map > * { max-width: 100%; }
@media (max-width: 768px) {
    .bx-locals-grid { grid-template-columns: 1fr; gap: 20px; }
}
.bx-caption {
    font-family: var(--pc-sans);
    font-size: 12px;
    line-height: 1.5;
    color: var(--pc-text-meta);
    margin: 10px 0 0;
    max-width: 720px;
}
.bx-caption a { color: var(--pc-text-secondary); }

/* ---- At a glance ---- */
.bx-glance {
    border-top: 1px solid var(--pc-border);
    padding: 16px 0 8px;
    margin: 0 0 8px;
}
.bx-glance ul { margin: 0; padding: 0; list-style: none; }
.bx-glance li {
    font-family: var(--pc-serif);
    font-size: 16px;
    line-height: 1.5;
    color: var(--pc-text);
    padding-left: 20px;
    margin: 0 0 9px;
    position: relative;
}
.bx-glance li:last-child { margin-bottom: 0; }
.bx-glance li::before { content: ''; position: absolute; left: 2px; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--pc-negative); }

/* ---- Sections ---- */
.bx-section {
    border-top: 1px solid var(--pc-border);
    padding-top: 32px;
    margin-top: 32px;
    margin-bottom: 0;
}
.bx-section[hidden] { display: none; }
.bx-section > h2, .bx-h2 {
    font-family: var(--pc-serif);
    font-size: 22px;
    font-weight: 700;
    color: var(--pc-text);
    line-height: 1.2;
    margin: 0 0 16px;
}
.bx-h3 {
    font-family: var(--pc-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--pc-text);
    margin: 28px 0 10px;
}
.bx-prose {
    font-family: var(--pc-serif);
    font-size: 17px;
    line-height: 1.7;
    color: var(--pc-text-body);
    max-width: 680px;
    margin: 0 0 14px;
}
.bx-prose:last-child { margin-bottom: 0; }
.bx-prose-pre { white-space: pre-wrap; }
.bx-prose a { color: var(--pc-text); }
.bx-bars { margin: 12px 0 0; max-width: 720px; }
.bx-bars .pc-bar-name { width: 120px; }
@media (max-width: 480px) { .bx-bars .pc-bar-name { width: 92px; font-size: 11px; } }
.bx-bars-key { font-family: var(--pc-sans); font-size: 11px; color: var(--pc-text-meta); margin: 6px 0 0; }
.bx-note {
    font-family: var(--pc-sans);
    font-size: 12px;
    line-height: 1.55;
    color: var(--pc-text-meta);
    margin: 12px 0 0;
    max-width: 720px;
}
.bx-note a { color: var(--pc-text-secondary); }
.bx-table-wrap { margin-top: 12px; }
.bx-table td:first-child { font-weight: 500; color: var(--pc-text); white-space: nowrap; }
.bx-table .pc-swatch { width: 9px; height: 9px; vertical-align: middle; margin-right: 2px; }
.bx-table.bx-table-2col td:last-child { white-space: nowrap; }
.bx-table td.bx-nowrap { white-space: nowrap; }
.pc-change.is-pos { color: var(--pc-positive); }
.pc-change.is-neg { color: var(--pc-negative); }
.pc-change.is-nc { color: var(--pc-text-meta); }

/* Result grid (post-declaration) */
.bx-result-banner {
    font-family: var(--pc-sans);
    font-size: 18px;
    font-weight: 700;
    color: var(--pc-on-ink);
    padding: 16px 20px;
    margin: 0 0 20px;
}

/* Council composition line + static pills */
.bx-council {
    font-family: var(--pc-sans);
    font-size: 13px;
    color: var(--pc-text-body);
    margin: 16px 0 0;
    line-height: 1.8;
}
.bx-council-lead { color: var(--pc-text-secondary); }
.bx-council .pc-swatch { width: 9px; height: 9px; vertical-align: middle; }
.bx-council strong { color: var(--pc-text); font-variant-numeric: tabular-nums; }
.bx-sep { color: var(--pc-nc); }
.bx-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.bx-pill-static { cursor: default; }
.bx-pill-static .pc-pill-label { display: inline-flex; align-items: center; gap: 6px; }
.bx-pill-static .pc-swatch { width: 9px; height: 9px; }

/* News timeline */
.bx-news { list-style: none; margin: 0; padding: 0; }
.bx-news-item {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--pc-border-light);
    align-items: baseline;
}
.bx-news-item:first-child { border-top: 1px solid var(--pc-border); }
.bx-news-time { font-family: var(--pc-sans); font-size: 12px; font-weight: 600; color: var(--pc-text-meta); text-transform: uppercase; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; }
.bx-news-text { font-family: var(--pc-sans); font-size: 15px; line-height: 1.5; color: var(--pc-text); }
.bx-news-src { color: var(--pc-text-meta); font-size: 13px; }
@media (max-width: 560px) { .bx-news-item { grid-template-columns: 1fr; gap: 2px; } }

/* Trajectory chart */
.bx-chart-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.bx-chart-summary { font-family: var(--pc-sans); font-size: 13px; color: var(--pc-text-secondary); }
.bx-range .pc-btn { font-size: 12px; padding: 6px 12px; }
.bx-chart { height: 300px; border: 1px solid var(--pc-border); background: var(--pc-surface); padding: 12px 8px 4px; }
@media (max-width: 600px) { .bx-chart { height: 240px; } }
/* Dark-mode overrides for the chart module's injected light styles */
body.dark-mode .gbp-chart-container .axis text { fill: var(--pc-text-meta); }
body.dark-mode .gbp-chart-container .grid-line { stroke: var(--pc-border-grid); }
body.dark-mode .gbp-chart-container .crosshair { stroke: var(--pc-border); }
body.dark-mode .gbp-tooltip { background: var(--pc-surface); border-color: var(--pc-border); color: var(--pc-text-body); }
body.dark-mode .gbp-tooltip-date, body.dark-mode .gbp-tooltip-party { color: var(--pc-text-body); }

/* Explorer host */
.bx-explorer { margin-top: 12px; min-height: 80px; }

/* Link rows */
.bx-links { display: flex; flex-wrap: wrap; gap: 12px 24px; font-family: var(--pc-sans); font-size: 14px; }
.bx-links a { color: var(--pc-text); }

/* FAQ */
.bx-faq .pc-faq-answer { font-family: var(--pc-serif); font-size: 16px; max-width: 680px; }

/* Method note */
.bx-method {
    font-family: var(--pc-sans);
    font-size: 13px;
    line-height: 1.6;
    color: var(--pc-text-secondary);
    max-width: 720px;
    border-top: 1px solid var(--pc-border);
    padding-top: 20px;
    margin-top: 40px;
}
.bx-method strong { color: var(--pc-text); }

@media (max-width: 768px) {
    .bx-h1 { font-size: 28px; }
    .bx-lead { font-size: 18px; }
}

/* Standing list (candidates) */
.bx-standing { margin: 0 0 18px; }
.bx-standing-list { list-style: none; margin: 6px 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 10px; }
.bx-standing-item {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--pc-sans); font-size: 13px; color: var(--pc-text);
    border: 1px solid var(--pc-border); padding: 5px 10px 5px 8px;
}
.bx-standing-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--party-color, var(--pc-text-meta)); flex-shrink: 0; }
.bx-standing-party { font-weight: 600; }
.bx-standing-status { font-size: 11px; color: var(--pc-text-meta); text-transform: uppercase; letter-spacing: 0.04em; }
.bx-standing-item.is-confirmed .bx-standing-status { color: var(--pc-positive); }
