/* =============================================
   senedd-seat-calc.css — Senedd Seat Calculator
   Scoped under body.senedd-seat-calc, prefix: snsc-
   Requires: editorial-base.css + polls-editorial.css
   ============================================= */

body.senedd-seat-calc {
    background: var(--ed-color-surface);
    font-family: var(--ed-font-sans);
    color: var(--ed-color-body);
    -webkit-font-smoothing: antialiased;
}

.snsc-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 48px 24px 64px;
}

/* ---- Hub Navigation ---- */
.snsc-hub-nav {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #1a1a1a;
}
.snsc-hub-nav a {
    padding: 10px 20px;
    font-family: var(--ed-font-sans);
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}
.snsc-hub-nav a:hover { color: #1a1a1a; text-decoration: none; }
.snsc-hub-nav a.active {
    color: #1a1a1a;
    border-bottom-color: #1a1a1a;
}

/* ---- Masthead ---- */
.snsc-masthead { margin-bottom: 32px; max-width: 700px; }
.snsc-kicker {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ed-color-text);
    margin: 0 0 8px 0;
}
.snsc-masthead-rule {
    border: none;
    border-top: 3px solid var(--ed-color-text);
    margin: 0 0 16px 0;
}
.snsc-headline {
    font-family: var(--ed-font-serif);
    font-size: 36px;
    font-weight: 700;
    color: var(--ed-color-text);
    line-height: 1.1;
    margin: 0 0 6px 0;
}
.snsc-subtitle {
    font-family: var(--ed-font-sans);
    font-size: 14px;
    color: var(--ed-color-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ---- Info Box ---- */
.snsc-info-box {
    background: #f7f7f7;
    border-left: 3px solid #1a1a1a;
    padding: 16px 20px;
    margin: 16px 0 0 0;
}
.snsc-info-box p {
    margin: 6px 0;
    font-family: var(--ed-font-sans);
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}
.snsc-info-box p:first-child { margin-top: 0; }
.snsc-info-box p:last-child { margin-bottom: 0; }

/* ---- Latest Poll Card ---- */
.snsc-latest-poll-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 0;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    font-family: var(--ed-font-sans);
    font-size: 13px;
}
.snsc-latest-poll-label {
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
}
.snsc-latest-poll-detail {
    color: #666;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.snsc-latest-poll-link {
    color: #333;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}
.snsc-latest-poll-link:hover { color: #1a1a1a; }

/* ---- Story Layer ---- */
.snsc-story {
    margin: 32px 0 0;
    max-width: 680px;
}
.snsc-story-kicker {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #999;
    margin: 0 0 8px;
}
.snsc-story-headline {
    font-family: var(--ed-font-serif);
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    margin: 0 0 20px;
}
.snsc-story-bullets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 32px;
}
.snsc-story-bullet-label {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1a1a1a;
    margin: 0 0 4px;
}
.snsc-story-bullet p {
    font-family: var(--ed-font-serif);
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    margin: 0;
}

/* ---- Constituency Card Enhancements ---- */
.snsc-const-card-band {
    font-family: var(--ed-font-sans);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
    margin-left: 8px;
}
.snsc-const-marginal {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-family: var(--ed-font-sans);
    font-size: 12px;
    color: #333;
}
.snsc-const-marginal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.snsc-const-marginal-vs {
    color: #999;
    font-size: 11px;
}
.snsc-const-marginal-margin {
    margin-left: auto;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.snsc-const-baseline {
    font-family: var(--ed-font-sans);
    font-size: 11px;
    color: #999;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}
.snsc-const-baseline span {
    color: #666;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ---- Marginal Seats List ---- */
.snsc-marginal-list {
    margin-top: 24px;
}
.snsc-marginal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-family: var(--ed-font-sans);
    font-size: 13px;
}
.snsc-marginal-row:first-child {
    border-top: 2px solid #1a1a1a;
    padding-top: 10px;
}
.snsc-marginal-row:last-child {
    border-bottom: 2px solid #1a1a1a;
}
.snsc-marginal-name {
    flex: 1;
    font-weight: 600;
    color: #1a1a1a;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.snsc-marginal-parties {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.snsc-marginal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.snsc-marginal-party-name {
    font-size: 12px;
    color: #666;
}
.snsc-marginal-vs {
    font-size: 11px;
    color: #999;
}
.snsc-marginal-margin {
    flex-shrink: 0;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 48px;
    text-align: right;
}
.snsc-marginal-margin.tight { color: #c62828; }
.snsc-marginal-margin.medium { color: #e65100; }
.snsc-marginal-margin.wide { color: #666; }

/* ---- Section dividers ---- */
.snsc-rule {
    border: none;
    border-top: 1px solid var(--ed-color-border);
    margin: 40px 0;
}
.snsc-section-label {
    font-family: var(--ed-font-sans);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ed-color-meta);
    margin: 0 0 16px 0;
}
.snsc-section-head {
    font-family: var(--ed-font-serif);
    font-size: 22px;
    font-weight: 700;
    color: var(--ed-color-text);
    margin: 0 0 4px 0;
    line-height: 1.15;
}
.snsc-section-intro {
    font-family: var(--ed-font-serif);
    font-size: 17px;
    color: #333;
    line-height: 1.7;
    margin: 0 0 16px 0;
    max-width: 680px;
}

/* ---- Chart heading ---- */
.snsc-chart-heading {
    font-family: var(--ed-font-serif);
    font-size: 22px;
    font-weight: 700;
    color: var(--ed-color-text);
    margin: 0 0 4px 0;
    line-height: 1.2;
}
.snsc-chart-subtext {
    font-family: var(--ed-font-sans);
    font-size: 13px;
    color: var(--ed-color-secondary);
    margin: 0 0 16px 0;
}

/* ---- Section heading (for subsections) ---- */
.snsc-section-heading {
    font-family: var(--ed-font-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--ed-color-text);
    margin: 0 0 4px 0;
}
.snsc-section-desc {
    font-family: var(--ed-font-sans);
    font-size: 13px;
    color: var(--ed-color-secondary);
    margin: 0 0 16px 0;
}

/* ---- Action Buttons ---- */
.snsc-action-btns {
    margin-top: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}
.snsc-action-btn {
    font-family: var(--ed-font-sans);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    line-height: 1.4;
}
.snsc-action-btn:hover { border-color: #999; }
.snsc-action-btn-sub {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #999;
    margin-top: 2px;
}
.snsc-action-btn--clear {
    font-weight: 500;
    color: #666;
    border-color: #e0e0e0;
    background: transparent;
}
.snsc-action-btn--clear:hover { color: #1a1a1a; border-color: #999; }
.snsc-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Slider Input Panel ---- */
/* Senedd: 2-column grid (party name + single slider/input)
   unlike Holyrood's 3-column (party + constituency + regional) */
.snsc-slider-panel {
    margin-top: 24px;
    border: 1px solid #e0e0e0;
    background: #fff;
}
.snsc-slider-header {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0;
    border-bottom: 2px solid #1a1a1a;
    padding: 10px 16px;
}
.snsc-slider-header-party,
.snsc-slider-header-col {
    font-family: var(--ed-font-sans);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
}

.snsc-slider-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0;
    align-items: center;
    padding: 6px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
}
.snsc-slider-row:hover { background: #fafafa; }
.snsc-slider-row:last-of-type { border-bottom: 1px solid #e0e0e0; }

.snsc-slider-party {
    display: flex;
    align-items: center;
    gap: 8px;
}
.snsc-party-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.snsc-party-name {
    font-family: var(--ed-font-sans);
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
}

.snsc-slider-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
}

/* Range slider */
.snsc-range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: #e8e8e8;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.snsc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--party-color, #999);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.1s;
    margin-top: -6px;
}
.snsc-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.snsc-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--party-color, #999);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    cursor: pointer;
}
.snsc-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; }
.snsc-range::-moz-range-track { height: 4px; background: #e8e8e8; border-radius: 2px; }

/* Number input */
.snsc-num-wrap {
    display: flex;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
}
.snsc-num {
    width: 52px;
    font-family: var(--ed-font-sans);
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #1a1a1a;
    padding: 4px 4px 4px 8px;
    text-align: right;
    outline: none;
    transition: border-color 0.15s;
}
.snsc-num:focus { border-color: #999; }
.snsc-num::-webkit-outer-spin-button,
.snsc-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.snsc-num[type="number"] { -moz-appearance: textfield; }
.snsc-pct {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-weight: 600;
    color: #999;
}

/* Totals row */
.snsc-slider-totals {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0;
    padding: 8px 16px;
    border-top: 2px solid #1a1a1a;
}
.snsc-total-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1px;
    padding: 0 8px;
}
.snsc-total-value {
    font-family: var(--ed-font-sans);
    font-weight: 700;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: #1a1a1a;
}
.snsc-total-cell .snsc-pct { margin-left: 2px; }
.snsc-normalise-note {
    font-family: var(--ed-font-sans);
    font-size: 11px;
    color: #999;
    text-align: right;
    padding: 4px 16px 0;
}

/* ---- Poll Cards (quick-fill tiles) ---- */
.snsc-poll-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 16px;
}
.snsc-poll-card {
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
}
.snsc-poll-card:hover { border-color: #999; background: #fafafa; }
.snsc-poll-card.active { border-color: #1a1a1a; border-width: 2px; padding: 11px 13px; }
.snsc-poll-card-pollster {
    font-family: var(--ed-font-sans);
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 2px;
}
.snsc-poll-card-date {
    font-family: var(--ed-font-sans);
    font-size: 11px;
    color: #999;
}
.snsc-poll-card-shares {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.snsc-poll-card-pill {
    font-family: var(--ed-font-sans);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding: 2px 6px;
    border-radius: 2px;
    color: #fff;
}

/* ---- Seat Summary Bar ---- */
.snsc-seat-bar-wrap {
    position: relative;
    margin: 0 auto 24px;
    max-width: 680px;
}
.snsc-seat-bar {
    display: flex;
    height: 28px;
    border-radius: 3px;
    overflow: hidden;
    background: #f0f0f0;
}
.snsc-seat-bar-segment {
    transition: width 0.4s ease;
    position: relative;
    min-width: 0;
}
/* Majority marker at 49/96 = 51.04% */
.snsc-seat-bar-majority {
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: 51.04%;
    width: 0;
    border-left: 2px dashed #999;
    z-index: 2;
    pointer-events: none;
}
.snsc-seat-bar-majority-label {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--ed-font-sans);
    font-size: 10px;
    font-weight: 600;
    color: #999;
    white-space: nowrap;
}
.snsc-seat-bar-labels {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.snsc-seat-bar-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--ed-font-sans);
    font-size: 12px;
    color: #333;
    font-variant-numeric: tabular-nums;
}
.snsc-seat-bar-label-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.snsc-seat-bar-label-count { font-weight: 700; }
.snsc-seat-bar-label-change {
    font-size: 11px;
    font-weight: 600;
}
.snsc-seat-bar-label-change.positive { color: #2e7d32; }
.snsc-seat-bar-label-change.negative { color: #c62828; }

/* ---- Seat Card Grid ---- */
.snsc-seat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 24px;
}
.snsc-seat-card {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-top: 3px solid var(--party-color, #999);
    background: #fff;
}
.snsc-seat-card-name {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}
.snsc-seat-card-total {
    font-family: var(--ed-font-sans);
    font-size: 28px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #1a1a1a;
    line-height: 1;
    margin-bottom: 6px;
}
.snsc-seat-card-change {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
}
.snsc-seat-card-change.positive { color: #2e7d32; }
.snsc-seat-card-change.negative { color: #c62828; }
.snsc-seat-card-change.neutral { color: #999; }

/* ---- Snapshot bar (editorial) ---- */
.snsc-snapshot-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid var(--ed-color-border);
    background: var(--ed-color-surface);
}
.snsc-snapshot-title {
    font-family: var(--ed-font-sans);
    font-weight: 700;
    color: var(--ed-color-text);
    font-size: 14px;
    margin-right: 8px;
}
#seneddSeatTrendSnapshotItems {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ---- Majority box (editorial) ---- */
.snsc-majority-box {
    display: none;
    margin: 12px 0;
    padding: 12px 16px;
    border-left: 4px solid #d97706;
    font-family: var(--ed-font-sans);
    font-weight: 600;
    font-size: 14px;
}

/* ---- Coalition section ---- */
.snsc-coalition-heading {
    margin: 0 0 10px 0;
    font-family: var(--ed-font-sans);
    font-size: 14px;
    font-weight: 700;
    color: var(--ed-color-body);
}
.snsc-coalition-result {
    font-family: var(--ed-font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--ed-color-secondary);
}
.snsc-coalition-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.snsc-coalition-btn {
    font-family: var(--ed-font-sans);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border: 1px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
}
.snsc-coalition-btn:hover { border-color: #999; }
.snsc-coalition-btn.selected {
    color: #fff;
    border-color: transparent;
}

/* ---- D'Hondt Constituency Breakdown ---- */
.snsc-const-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
    gap: 8px;
    margin-top: 16px;
}
.snsc-const-card {
    border: 1px solid #e0e0e0;
    background: #fff;
}
.snsc-const-card-header {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.1s;
}
.snsc-const-card-header:hover { background: #fafafa; }
.snsc-const-card-name {
    font-family: var(--ed-font-sans);
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
}
.snsc-const-card-seats {
    display: flex;
    gap: 3px;
}
.snsc-const-card-chip {
    width: 14px;
    height: 14px;
    border-radius: 2px;
}
.snsc-const-card-toggle {
    font-size: 12px;
    color: #999;
    transition: transform 0.2s;
}
.snsc-const-card.open .snsc-const-card-toggle { transform: rotate(180deg); }
.snsc-const-detail {
    display: none;
    padding: 0 14px 14px;
    overflow-x: auto;
}
.snsc-const-card.open .snsc-const-detail { display: block; }

/* D'Hondt table within constituency card */
.snsc-dhondt-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.snsc-dhondt-table th {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
    border-bottom: 2px solid #1a1a1a;
    padding: 4px 6px;
    text-align: right;
}
.snsc-dhondt-table th:first-child { text-align: left; }
.snsc-dhondt-table td {
    padding: 4px 6px;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
    color: #333;
}
.snsc-dhondt-table td:first-child { text-align: left; font-weight: 600; }
.snsc-dhondt-table tr:last-child td { border-bottom: 2px solid #1a1a1a; }
.snsc-dhondt-table td.winner {
    background: #f0fdf4;
    font-weight: 700;
}

/* ---- Map tooltip (desktop hover only) ---- */
.snsc-map-tooltip {
    position: fixed;
    display: none;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    pointer-events: none;
    z-index: 1000;
    max-width: 260px;
}

/* ---- Map detail panel (combined seats + vote share) ---- */
.snsc-map-detail {
    display: none;
    margin: 12px auto 0;
    max-width: 460px;
    padding: 14px 18px;
    border: 1px solid var(--ed-color-border);
    background: var(--ed-color-surface);
}
.snsc-map-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.snsc-map-detail-title {
    font-family: var(--ed-font-sans);
    font-weight: 700;
    color: var(--ed-color-text);
    font-size: 14px;
}
.snsc-map-detail-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ed-color-meta);
    font-size: 18px;
    padding: 0 4px;
}

/* ---- Chart container ---- */
.snsc-chart-container {
    border: 1px solid #e0e0e0;
    padding: 24px;
    background: #fff;
}
.snsc-chart-container .sst-chart-svg {
    display: block;
    width: 100%;
    max-height: 400px;
}

/* ---- FAQ Methodology Accordion ---- */
.snsc-faq details { border-bottom: 1px solid #e0e0e0; }
.snsc-faq details:first-of-type { border-top: 1px solid #e0e0e0; }
.snsc-faq summary {
    font-family: var(--ed-font-sans);
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    padding: 14px 32px 14px 0;
    cursor: pointer;
    list-style: none;
    position: relative;
    line-height: 1.4;
}
.snsc-faq summary::-webkit-details-marker { display: none; }
.snsc-faq summary::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 14px;
    font-size: 18px;
    font-weight: 300;
    color: #999;
    line-height: 1;
}
.snsc-faq details[open] summary::after { content: '\2212'; }
.snsc-faq .snsc-faq-answer {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px;
    line-height: 1.7;
    color: #333;
    padding: 0 0 16px 0;
    max-width: 680px;
}
.snsc-faq .snsc-faq-answer p { margin: 0 0 10px 0; }
.snsc-faq .snsc-faq-answer p:last-child { margin-bottom: 0; }
.snsc-faq .snsc-faq-answer ul { padding-left: 20px; margin: 4px 0 8px 0; }
.snsc-faq .snsc-faq-answer li { margin-bottom: 4px; }

/* ---- Share Section ---- */
.snsc-share-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.snsc-share-label {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-weight: 700;
    color: #1a1a1a;
    margin-right: 4px;
}
.snsc-share-feedback {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    color: #2e7d32;
    font-weight: 500;
}

/* ---- Methodology (legacy prose) ---- */
.snsc-methodology {
    font-family: var(--ed-font-sans);
    font-size: 14px;
    color: var(--ed-color-body);
    line-height: 1.7;
}
.snsc-methodology h3 {
    font-family: var(--ed-font-serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--ed-color-text);
    margin: 0 0 12px 0;
}
.snsc-methodology h4 {
    font-family: var(--ed-font-serif);
    font-size: 16px;
    font-weight: 700;
    color: var(--ed-color-text);
    margin: 20px 0 8px 0;
}
.snsc-methodology p { margin: 0 0 10px 0; }
.snsc-methodology ul { padding-left: 20px; margin: 8px 0; }
.snsc-methodology li { margin-bottom: 6px; }

/* ---- Footer text ---- */
.snsc-footer-text {
    font-family: var(--ed-font-sans);
    font-size: 11px;
    color: var(--ed-color-muted);
    line-height: 1.6;
}

/* ---- Links ---- */
.snsc-wrap a {
    color: var(--ed-color-text);
    text-decoration: underline;
    text-decoration-color: #CCCCCC;
    text-underline-offset: 2px;
    transition: text-decoration-color 0.15s;
}
.snsc-wrap a:hover { text-decoration-color: var(--ed-color-text); }

/* ---- Poll Info (quick-fill source label) ---- */
.snsc-poll-info {
    font-family: var(--ed-font-sans);
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    min-height: 20px;
}

/* ---- Narrative subtitle ---- */
.snsc-narrative-sub {
    font-family: var(--ed-font-sans);
    font-size: 14px;
    color: var(--ed-color-secondary);
    margin: 0 0 16px 0;
}

/* ---- Chart note ---- */
.snsc-chart-note {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    color: #999;
    text-align: center;
    margin: 10px 0 6px 0;
}

/* ---- Attribution ---- */
.snsc-attribution {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    color: #999;
    line-height: 1.6;
}

/* ---- Share buttons ---- */
.snsc-share-btn {
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
}
.snsc-share-btn:hover { border-color: #999; }
.snsc-share-btn--dark {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}
.snsc-share-btn--dark:hover { background: #333; }

/* ---- Legacy classes (JS-generated HTML, will migrate in WS1C) ---- */

/* Poll selection grid */
.poll-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

/* Constituency grid & cards */
.constituency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}
.const-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 12px;
}
.const-card h4 {
    margin: 0 0 8px 0;
    font-family: var(--ed-font-sans);
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
}
.const-seats { display: flex; flex-wrap: wrap; gap: 6px; }

/* Seat chips (JS-generated party badges) */
.seat-chip {
    display: inline-block;
    padding: 4px 8px;
    font-family: var(--ed-font-sans);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: #f0f0f0;
    color: #333;
}
.seat-chip.labour { background: #fecaca; color: #7f1d1d; }
.seat-chip.conservative { background: #bfdbfe; color: #1e3a8a; }
.seat-chip.pc { background: #bbf7d0; color: #14532d; }
.seat-chip.greens { background: #bbf7d0; color: #065f46; }
.seat-chip.libdem { background: #fde68a; color: #92400e; }
.seat-chip.reform { background: rgba(18, 182, 207, 0.2); color: #0e7490; }
.seat-chip.others { background: #e5e7eb; color: #374151; }

/* Custom input form */
#poll-input-grid .percent-input-wrap { position: relative; margin-top: 8px; }
#poll-input-grid .percent-input {
    width: 100%;
    font-family: var(--ed-font-sans);
    font-weight: 700;
    font-size: 2.2rem;
    line-height: 1.1;
    border: none;
    background: transparent;
    color: inherit;
    padding-right: 28px;
    outline: none;
    -moz-appearance: textfield;
}
#poll-input-grid .percent-input::-webkit-outer-spin-button,
#poll-input-grid .percent-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#poll-input-grid .percent-suffix {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    font-size: 1.6rem;
    color: rgba(0,0,0,0.35);
    pointer-events: none;
}

/* Mini poll row (JS-generated) */
.poll-mini-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.poll-mini {
    background: #f0f0f0;
    color: #333;
    padding: 2px 6px;
    font-family: var(--ed-font-sans);
    font-size: 11px;
}

/* Custom poll card accent */
.custom-poll-card {
    border: 2px solid #1a1a1a;
    background: #fff;
    text-align: center;
}
.custom-poll-card .poll-mini { display: none; }

/* Custom total badge */
.custom-total-badge {
    background: #f0f0f0;
    color: #333;
    padding: 6px 10px;
    font-family: var(--ed-font-sans);
    font-weight: 600;
    font-size: 13px;
}
.custom-total-badge.ok { background: #e6f4ea; color: #065f46; }

/* ============================================= */
/* D3 SEAT TREND CHART                           */
/* ============================================= */

.sst-chart-svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Axes */
.sst-axis path,
.sst-axis line {
    stroke: none;
}
.sst-axis text {
    fill: #666;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 11px;
}

/* Gridlines */
.sst-grid-line {
    stroke: #f3f4f6;
    stroke-width: 0.5;
}

/* Majority line */
.sst-majority-line {
    stroke: #999;
    stroke-dasharray: 4,3;
    stroke-width: 1;
}
.sst-majority-label {
    fill: #999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 11px;
}

/* Crosshair */
.sst-crosshair {
    stroke: #ddd;
    stroke-width: 1;
}

/* End labels */
.sst-end-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 11px;
    font-weight: 600;
}

/* Tooltip */
.sst-tooltip {
    position: absolute;
    pointer-events: none;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 8px 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    z-index: 20;
    white-space: nowrap;
}
.sst-tooltip-date {
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
    font-size: 11px;
}
.sst-tooltip-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 0;
}
.sst-tooltip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sst-tooltip-party {
    flex: 1;
    color: #666;
    font-size: 11px;
}
.sst-tooltip-val {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

/* ============================================= */
/* RESPONSIVE                                    */
/* ============================================= */

@media (max-width: 768px) {
    .snsc-wrap { padding: 32px 16px 48px; overflow-x: hidden; }
    .snsc-headline { font-size: 28px; }
    .snsc-section-head { font-size: 20px; }
    .snsc-section-intro { font-size: 16px; }
    .snsc-rule { margin: 32px 0; }
    .snsc-action-btns { gap: 6px; }
    .snsc-action-btn { font-size: 12px; padding: 8px 12px; }

    /* Story layer */
    .snsc-story-headline { font-size: 20px; }
    .snsc-story-bullets { grid-template-columns: 1fr; gap: 16px; }
    .snsc-story-bullet p { font-size: 14px; }

    /* Latest poll card */
    .snsc-latest-poll-card { flex-wrap: wrap; gap: 6px; font-size: 12px; }

    /* Marginal list */
    .snsc-marginal-party-name { display: none; }

    /* Slider panel */
    .snsc-slider-header { grid-template-columns: 100px 1fr; padding: 8px 12px; }
    .snsc-slider-row { grid-template-columns: 100px 1fr; padding: 6px 12px; }
    .snsc-slider-totals { grid-template-columns: 100px 1fr; padding: 8px 12px; }
    .snsc-party-name { font-size: 12px; }
    .snsc-slider-cell { gap: 4px; padding: 0 4px; }
    .snsc-num { width: 44px; font-size: 13px; padding: 3px 2px 3px 4px; }

    .snsc-seat-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
    .snsc-seat-card-total { font-size: 24px; }
    .snsc-const-grid { grid-template-columns: 1fr; }
    .snsc-poll-cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

    .snsc-hub-nav a { padding: 8px 14px; font-size: 13px; }
    .poll-selection-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .constituency-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 480px) {
    .snsc-headline { font-size: 24px; }
    .snsc-rule { margin: 24px 0; }

    /* Mobile: slider-only with read-only value label */
    .snsc-slider-header { grid-template-columns: 48px 1fr; padding: 8px 8px; }
    .snsc-slider-header-col { font-size: 10px; }
    .snsc-slider-row { grid-template-columns: 48px 1fr; padding: 4px 8px; }
    .snsc-slider-totals { grid-template-columns: 48px 1fr; padding: 8px 8px; }
    .snsc-slider-cell { flex-wrap: nowrap; gap: 0; padding: 0 2px; overflow: hidden; }
    .snsc-range { display: block; flex: 1; min-width: 0; height: 4px; }
    .snsc-range::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -8px; }
    .snsc-range::-moz-range-thumb { width: 18px; height: 18px; }
    .snsc-num-wrap { flex-shrink: 0; width: 28px; text-align: right; }
    .snsc-num {
        width: 28px; font-size: 10px; padding: 0;
        border: none; background: transparent; color: #666;
        text-align: right; pointer-events: none;
        -moz-appearance: textfield;
    }
    .snsc-num::-webkit-inner-spin-button,
    .snsc-num::-webkit-outer-spin-button { display: none; }
    .snsc-pct { font-size: 9px; color: #999; }
    .snsc-party-dot { width: 8px; height: 8px; }
    .snsc-party-name { font-size: 10px; white-space: nowrap; }
    /* Abbreviate long party names on mobile */
    .snsc-party-name[data-abbr] { font-size: 0; }
    .snsc-party-name[data-abbr]::after { content: attr(data-abbr); font-size: 10px; }

    .snsc-poll-cards { grid-template-columns: 1fr 1fr; gap: 6px; }
    .snsc-poll-card { padding: 8px 10px; }
    .snsc-poll-card-pollster { font-size: 12px; }

    .snsc-hub-nav a { padding: 8px 10px; font-size: 12px; }
    .snsc-seat-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    #seatsTrackChart { height: 240px; }
    .poll-selection-grid { grid-template-columns: 1fr; }
    .constituency-grid { grid-template-columns: 1fr; }
}
