/* =============================================
   PollCheck homepage (UK). Built on pc-tokens + pc-components, in the
   US homepage's layout: Georgia headings under a 2px rule, no boxes,
   aligned rows for vote share, one stacked bar for seats.
   Sizes match the US pages (which also sit under style.css's html { zoom: 0.8 }).
   Restraint: party colour is the only colour, used only to identify a party;
   changes are grey with a sign, not green/red.
   ============================================= */

.hm-wrap { max-width: 1264px; padding-top: 40px; color: var(--pc-text-body); }
body.homepage { background: var(--pc-surface); }

/* ---- Masthead ---- */
.hm-mast { margin: 0 0 20px; }
/* Wordmark, as on the old homepage: Georgia caps over a 2px rule */
.hm-brand { font-family: var(--pc-serif); font-size: 28px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--pc-text); border-bottom: 2px solid var(--pc-text); padding-bottom: 12px; margin: 0 0 16px; }
.hm-kicker { display: flex; flex-wrap: wrap; gap: 0 6px; margin: 0 0 6px; }
.hm-kicker .hp-updated { display: inline; }
.hm-title { font-family: var(--pc-serif); font-size: 40px; font-weight: 700; line-height: 1.1; color: var(--pc-text); margin: 0; }

/* ---- Section scaffold ---- */
.hm-sec { margin-top: 40px; border-top: 2px solid var(--pc-text); padding-top: 12px; }
.hm-sec--first { margin-top: 16px; }
.hm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.hm-h2 { font-family: var(--pc-serif); font-size: 22px; font-weight: 700; color: var(--pc-text); margin: 0; line-height: 1.2; }
.hm-meta { font-family: var(--pc-sans); font-size: 13px; font-weight: 700; color: var(--pc-text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc-wrap a.hm-meta { color: var(--pc-text); }
.hm-sub { font-family: var(--pc-sans); font-size: 13px; color: var(--pc-text-secondary); margin: 8px 0 0; line-height: 1.45; }
.hm-chg { font-weight: 600; color: var(--pc-text-meta); }
.hm-chg.is-pos, .hm-chg.is-neg { color: var(--pc-text-secondary); }

/* ---- Latest poll ---- */
.hm-lp { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0 12px; margin-top: 14px; }
.hm-lp-c { display: flex; flex-direction: column; border-top: 3px solid var(--party-color); padding-top: 8px; min-width: 0; }
.hm-lp-who { font-family: var(--pc-sans); font-size: 13px; font-weight: 600; color: var(--pc-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-lp-n { font-family: var(--pc-serif); font-size: 44px; font-weight: 700; line-height: 1.05; color: var(--pc-text); font-variant-numeric: tabular-nums; }
.hm-lp-c .hm-chg { font-family: var(--pc-sans); font-size: 13px; }

/* ---- Aligned rows (vote share) ---- */
.hm-rows { margin-top: 18px; }
.hm-row { display: grid; grid-template-columns: 150px 1fr 56px 44px; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--pc-border-light); font-family: var(--pc-sans); font-size: 14px; color: var(--pc-text-body); font-variant-numeric: tabular-nums; }
.hm-row-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-row-name i { display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px; background: var(--party-color); }
.hm-row-track { height: 4px; background: var(--pc-border-grid); position: relative; }
.hm-row-track span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--party-color); }
.hm-row-val { text-align: right; font-weight: 700; color: var(--pc-text); }
.hm-row-chg { text-align: right; font-size: 13px; }

/* ---- Approval ---- */
.hm-ap { display: grid; grid-template-columns: 1.6fr 1fr; gap: 32px; margin-top: 16px; }
.hm-ap-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.hm-ap-stats > div:nth-child(2) { text-align: center; }
.hm-ap-stats > div:nth-child(3) { text-align: right; }
.hm-ap-l { display: block; font-family: var(--pc-sans); font-size: 13px; font-weight: 600; color: var(--pc-text-secondary); }
.hm-ap-l.is-pos { color: var(--pc-positive); }
.hm-ap-l.is-neg { color: var(--pc-negative); }
.hm-ap-n { display: block; font-family: var(--pc-serif); font-size: 34px; font-weight: 700; line-height: 1.05; color: var(--pc-text); font-variant-numeric: tabular-nums; }
.hm-ap-bar { position: relative; display: flex; height: 14px; margin-top: 12px; gap: 2px; }
.hm-ap-bar .a { background: var(--pc-positive); }
.hm-ap-bar .n { background: var(--pc-border); }
.hm-ap-bar .d { background: var(--pc-negative); }
.hm-ap-bar i { position: absolute; top: -5px; bottom: -5px; left: 50%; width: 2px; background: var(--pc-text); }
.hm-ap-ax { display: flex; justify-content: space-between; font-family: var(--pc-sans); font-size: 11px; color: var(--pc-text-meta); margin-top: 6px; }
.hm-ap-side { border-left: 1px solid var(--pc-border); padding-left: 24px; }
.hm-ap-kick { font-family: var(--pc-sans); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pc-text-secondary); margin-bottom: 6px; }
.hm-ap-o { display: flex; justify-content: space-between; font-family: var(--pc-sans); font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--pc-border-light); font-variant-numeric: tabular-nums; }
.hm-ap-o b { color: var(--pc-text); }
.pc-wrap a.hm-ap-link { display: inline-block; margin-top: 10px; font-family: var(--pc-sans); font-size: 13px; font-weight: 600; }
.hm-ap-chart-h { font-family: var(--pc-serif); font-size: 15px; font-weight: 700; color: var(--pc-text); margin: 28px 0 4px; }
.hm-ap-chart-h span { font-family: var(--pc-sans); font-size: 12px; font-weight: 400; color: var(--pc-text-secondary); margin-left: 8px; }
.gbp-chart-container.hm-chart { height: 340px; }

/* ---- Seats ---- */
.hm-seat-nums { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; }
.hm-seat-n { display: flex; flex-direction: column; min-width: 0; }
.hm-seat-n:last-child { align-items: flex-end; text-align: right; }
.hm-seat-big { font-family: var(--pc-serif); font-size: 72px; font-weight: 700; line-height: 1; color: var(--pc-text); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.hm-seat-who { font-family: var(--pc-sans); font-size: 14px; font-weight: 700; color: var(--pc-text); margin-top: 4px; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hm-seat-who::before { content: ""; width: 10px; height: 10px; background: var(--party-color); display: inline-block; }
.hm-seat-track { margin-top: 22px; }

/* Seat bar: the shared restrained bar (css/pc-components.css); the
   homepage only sets its label colours. */
.hm-wrap .pc-seatbar .pc-seat-seg { line-height: 1; color: var(--pc-on-party-dark); flex: 0 0 auto; }
.hm-wrap .pc-seatbar .pc-seat-seg.is-light { color: var(--pc-on-party-light); }
.hm-wrap .pc-seat-majority::after { font-size: 10px; }
.hm-wrap .hm-seg-ni { background: var(--pc-border); }
.hm-wrap .pc-seat-legend { margin-top: 16px; gap: 8px 20px; }
.hm-wrap .pc-seat-legend-item { font-size: 13px; }
.hm-wrap .pc-seat-legend-item .hm-chg { font-size: 13px; }

/* Vote-share sliders (kept from the old hero panel). Neutral track and thumb
   for every party; the party colour is only on the swatch beside the name. */
.hm-calc { margin-top: 24px; border-top: 1px solid var(--pc-border); padding-top: 12px; }
.hm-calc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hm-calc-title { font-family: var(--pc-serif); font-size: 17px; font-weight: 700; color: var(--pc-text); }
.hm-sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 40px; margin-top: 10px; }
.hm-slider { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 12px; padding: 6px 0; font-family: var(--pc-sans); font-size: 14px; }
.hm-slider-name { font-weight: 500; color: var(--pc-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-slider-name i { display: inline-block; width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px; background: var(--party-color); }
.hm-slider-val { text-align: right; font-weight: 600; color: var(--pc-text); font-variant-numeric: tabular-nums; }
.hm-slider input[type=range] {
    -webkit-appearance: none; appearance: none; width: 100%; height: 2px; margin: 0; border-radius: 0; cursor: pointer;
    background: linear-gradient(to right, var(--pc-text-secondary) var(--pct, 0%), var(--pc-border) var(--pct, 0%));
}
.hm-slider input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: var(--pc-surface); border: 2px solid var(--pc-text);
}
.hm-slider input[type=range]::-moz-range-thumb {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--pc-surface); border: 2px solid var(--pc-text);
}
.hm-slider input[type=range]::-moz-range-track { height: 2px; background: transparent; }
.hm-slider input[type=range]:focus-visible { outline: 2px solid var(--pc-text); outline-offset: 4px; }
.hm-btns { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.pc-wrap a.hm-btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; text-decoration: none; height: auto; }
.pc-wrap a.hm-btn.pc-btn-primary { color: var(--pc-on-ink); }
.pc-wrap a.hm-btn:not(.pc-btn-primary) { color: var(--pc-text); font-weight: 600; }

/* ---- Party trends chart ---- */
.gbp-chart-container.hm-chart--trend { height: 340px; }

/* ---- Recent polls ---- */
.hm-polls { margin-top: 8px; }
.hm-polls td, .hm-polls th { white-space: nowrap; }
.hm-polls tbody td { padding-top: 6px; padding-bottom: 6px; }
.hm-polls .hm-when { color: var(--pc-text-secondary); }
.pc-table.hm-polls thead th:nth-child(2), .pc-table.hm-polls tbody td:nth-child(2) { text-align: left; }
.hm-polls td.is-lead { font-weight: 700; color: var(--pc-text); }

/* ---- Find your seat (IDs/classes used by js/homepage-seat-finder.js) ---- */
.hp-seatfind { padding: 12px 0 0; }
.hp-seatfind-box { position: relative; }
.hp-seatfind-input { width: 100%; padding: 12px 14px; font-family: var(--pc-sans); font-size: 16px; color: var(--pc-text); border: 1px solid var(--pc-border); border-radius: 0; background: var(--pc-surface); box-sizing: border-box; }
.hp-seatfind-input:focus { outline: none; border-color: var(--pc-text); }
.hp-seatfind-results { position: absolute; top: calc(100% + 2px); left: 0; right: 0; max-height: 360px; overflow-y: auto; background: var(--pc-surface); border: 1px solid var(--pc-border); z-index: 20; }
.hp-seatfind-result { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-family: var(--pc-sans); font-size: 14px; color: var(--pc-text-body); cursor: pointer; text-decoration: none; border-bottom: 1px solid var(--pc-border-light); }
.hp-seatfind-result:last-child { border-bottom: none; }
.hp-seatfind-result.active, .hp-seatfind-result:hover { background: var(--pc-hover-bg); }
.hp-seatfind-name { font-weight: 600; color: var(--pc-text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-seatfind-meta { font-size: 12px; color: var(--pc-text-meta); white-space: nowrap; }
.hp-seatfind-result.is-postcode { border-bottom: 1px solid var(--pc-border); background: var(--pc-hover-bg); }
.hp-seatfind-result.is-postcode:hover, .hp-seatfind-result.is-postcode:focus { background: var(--pc-border-light); outline: none; }
.hp-seatfind-empty { padding: 12px 14px; color: var(--pc-text-meta); font-family: var(--pc-sans); font-size: 13px; font-style: italic; }

/* ---- Link lists: by-elections, US midterms, tools ---- */
.hm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; margin-top: 4px; }
.hm-list--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hm-list--1 { grid-template-columns: minmax(0, 1fr); }
.pc-wrap a.hm-item, .pc-wrap a.hm-item:hover { text-decoration: none; }
.hm-item { padding: 12px 0; color: inherit; border-bottom: 1px solid var(--pc-border-light); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hm-item:hover .hm-item-title { text-decoration: underline; text-underline-offset: 2px; }
.hm-item-kick { font-family: var(--pc-sans); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--pc-text-meta); }
.hm-item-title { font-family: var(--pc-serif); font-size: 17px; font-weight: 700; color: var(--pc-text); line-height: 1.15; }
.hm-item-desc { font-family: var(--pc-sans); font-size: 13px; color: var(--pc-text-secondary); line-height: 1.4; }

/* ---- Dark mode: Restore Britain's navy has no dark variant in the tokens,
   so its marks get a thin outline to stay visible on the slate ground ---- */
body.dark-mode .hm-row.is-dim-dark .hm-row-track span,
body.dark-mode .hm-row.is-dim-dark .hm-row-name i,
body.dark-mode .hm-slider.is-dim-dark .hm-slider-name i,
body.dark-mode .pc-swatch.is-dim-dark,
body.dark-mode .pc-seat-seg.is-dim-dark { box-shadow: inset 0 0 0 1px var(--pc-text-meta); }
body.dark-mode .hm-lp-c.is-dim-dark { box-shadow: 0 -5px 0 -4px var(--pc-text-meta); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hm-wrap { padding-top: 28px; }
    .hm-title { font-size: 30px; }
    .hm-brand { font-size: 22px; }
    .hm-seat-big { font-size: 60px; }
    .hm-ap { grid-template-columns: 1fr; }
    .hm-ap-side { border-left: 0; padding-left: 0; }
    .hm-sliders { grid-template-columns: 1fr; }
    .hm-list, .hm-list--3 { grid-template-columns: minmax(0, 1fr); }
    .gbp-chart-container.hm-chart, .gbp-chart-container.hm-chart--trend { height: 300px; }
}
@media (max-width: 600px) {
    .hm-lp { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 10px; }
    .hm-lp-n { font-size: 34px; }
    .hm-row { grid-template-columns: 118px 1fr 48px 40px; gap: 8px; }
    .hm-ap-n { font-size: 28px; }
    .hm-seat-big { font-size: 52px; }
    .hm-slider { grid-template-columns: 118px 1fr 40px; gap: 8px; }
    .hp-seatfind-meta { display: none; }
    .pc-table.hm-polls thead th, .pc-table.hm-polls tbody td { padding-left: 4px; padding-right: 4px; }
    .pc-table.hm-polls thead th:first-child, .pc-table.hm-polls tbody td:first-child { padding-left: 0; }
    .pc-table.hm-polls thead th:last-child, .pc-table.hm-polls tbody td:last-child { padding-right: 0; }
}
