/* ===== DARK THEME BASE ===== */
@font-face {
    font-family: 'RadioCanada';
    src: url('/fonts/RadioCanada-VariableFont_wdth%2Cwght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
:root {
    --bg-gradient-start: #0a0e27;
    --bg-gradient-mid: #16213e;
    --bg-gradient-end: #0f3460;
    --text-primary: #e8eaf6;
    --text-secondary: #90caf9;
    --text-muted: #bbdefb;
    --accent-red: #f44336;
    --accent-blue: #2196f3;
    --border-subtle: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(30, 40, 80, 0.9);
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'RadioCanada', "Atkinson Hyperlegible Next", Atkinson Hyperlegible Mono, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-mid) 50%, var(--bg-gradient-end) 100%) fixed;
    color: var(--text-primary);
    min-height: 100vh;
}

/* ===== HEADER & NAVIGATION ===== */
header {
    padding: 20px;
    border-radius: 15px;
}

header nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

header a, 
footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

header a:hover,
footer a:hover {
    color: var(--text-primary);
}

.site-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

.switch-language {
    margin-left: auto;
}

.switch-language a {
    color: var(--text-secondary);
    margin: 0 4px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.switch-language a:hover,
.switch-language a[aria-current="page"] {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ===== TITLE SECTION ===== */
.title {
    text-align: center;
    padding: 60px 20px 40px;
    max-width: 900px;
    margin: 0 auto;
}

.title h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 900;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.title p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

/* ===== FILTERS FORM ===== */
form[name="filters"] {
    display: flex;
    flex-wrap: wrap;
    column-gap: 20px;
    row-gap: 16px;
    justify-content: center;
    align-items: flex-end;
    padding: 24px;
    margin: 0 auto 40px;
    max-width: 1400px;
    
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
}

.no-js form[name="filters"] {
    display: none;
}

form[name="filters"] .filter {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

form[name="filters"] label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

form[name="filters"] label + select {
    margin-inline-start: 0;
}

#filter-constituency {
    background: rgba(13, 71, 161, 0.3);
}
#filter-party {
    background: rgba(13, 71, 161, 0.3);
}

form[name="filters"] select {
    background: rgba(13, 71, 161, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 1rem;
    min-width: 180px;
    cursor: pointer;
    transition: all 0.2s;
}

form[name="filters"] select:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(13, 71, 161, 0.5);
}

form[name="filters"] select option {
    background: #1a237e;
    color: var(--text-primary);
}

form[name="filters"] label:has(input[type="checkbox"]) {
    display: flex;
    flex-direction: column;
    align-items: center; /* was baseline */
    column-gap: 0.25rem;
    gap: 8px;
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #ffcdd2;
}

form[name="filters"] label:has(input[type="checkbox"]) > * {
    padding: 0 20px;
}

form[name="filters"] label:has(input[type="checkbox"])::before {
    content: attr(for);
    display: none;
}

form[name="filters"] label:has(input[type="checkbox"]) {
    padding-top: 12px;
}

form[name="filters"] label:has(input[type="checkbox"]) input {
    order: 2;
    margin-bottom: 12px;
}

/* Create a wrapper effect for checkbox label */
form[name="filters"] label:has(input[type="checkbox"]) {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
}

form[name="filters"] label:has(input[type="checkbox"])::after {
    content: none;
}

form[name="filters"] label:has(input[type="checkbox"]):hover {
    background: rgba(244, 67, 54, 0.25);
}

form[name="filters"] input[type="checkbox"] {
    align-self: center;
    margin: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}
#filter-voted-bill-14 {
    height: 10px;
}
@supports selector(::picker(select)) {
    form[name="filters"] select, 
    form[name="filters"] ::picker(select) {
        background-color: rgba(13, 71, 161, 0.3);
    }

    form[name="filters"] ::picker(select) {
        border-radius: 4px;
        margin-block: 4px;
    }

    form[name="filters"] selectedcontent {
        display: flex;
        align-items: baseline;
        gap: 0.25rem;
    }

    form[name="filters"] option {
        gap: 0.25rem;
    }
}

/* ===== MEMBER CARDS GRID ===== */
.member-cards-grid {
    display: grid;
    list-style: none;
    padding-inline-start: 0;
    column-gap: 24px;
    row-gap: 24px;
    justify-content: center;
    grid-template-columns: repeat(auto-fill, minmax(345px, 1fr));
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== MEMBER CARD ===== */
.member-card {
    grid-template-columns: 120px 1fr;
    /* top: header, middle: expandable content, bottom: CTA */
    grid-template-rows: auto 1fr auto;
    column-gap: 8px;
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(20, 30, 60, 0.9) 100%);
    font-family: var(--font-mono);
    position: relative;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    max-inline-size: 500px;
    justify-self: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    align-content: start;
}

.member-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--party-color, #666);
    transition: height 0.3s;
    z-index: 1;
    border-radius: 16px 16px 0 0;
}

.member-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.member-card:hover::before {
    height: 8px;
}

.member-card:not([hidden]) {
    display: grid;
}

/* Party Colors - Adjusted for dark theme */
.member-card:where([data-party="Bloc Québécois"]) { --party-color: #0088ce; }
.member-card:where([data-party="Conservative"], [data-party="UC"]) { --party-color: #1976d2; }
.member-card:where([data-party="Green"]) { --party-color: #388e3c; }
.member-card:where([data-party="Liberal"]) { --party-color: #d32f2f; }
.member-card:where([data-party="NDP"], [data-party="New Democrat"]) { --party-color: #ff6f00; }
.member-card:where([data-party="Alberta Party"], [data-party="AP"]) { --party-color: #5B9BD5; }

/* ===== CARD CONTENT ===== */
.member-card-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    row-gap: 8px;
    padding: 20px 16px 16px 16px;
    grid-row: 1;
    grid-column: 2;
    background: rgba(0, 0, 0, 0.2);
}

.member-card-title {
    margin-block: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

.member-card-cta {
    margin-top: auto;
    text-underline-offset: 0.3em;
    font-weight: 700;
    color: #64b5f6;
    transition: color 0.2s;
    text-decoration: underline;
}

.member-card-cta::after {
    inset: 0;
    position: absolute;
    content: "";
    border-radius: 16px;
}

.member-card-cta:hover {
    color: #90caf9;
}

.member-card-content :not(.member-card-cta) {
    position: relative;
    z-index: 2;
}

.member-card-details {
    display: grid;
    justify-items: start;
    row-gap: 16px;
    margin-block: 0;
}

.member-card-details :where(dt, dd) {
    margin-inline-start: 0;
}

.member-card-details > dd {
    background: var(--party-color);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.member-additional-details {
    display: grid;
    row-gap: 4px;
}

.member-additional-details dd {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ===== PORTRAIT ===== */
.member-portrait {
    display: block;
    inline-size: 120px;
    block-size: 150px;
    object-fit: cover;
    object-position: center top;
    background: rgba(0, 0, 0, 0.3);
    grid-row: 1;
    grid-column: 1;
    border-radius: 8px 0 0 0px;
}

.member-warning-list-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

li[data-checked="true"] {
  color: #b00020;
  font-weight: 600;
}

/* ===== WARNING LIST ===== */
.member-warning-list {
    list-style: none;
    margin: 0;
    padding: 16px;
    display: block;
    grid-column: 1 / -1;
    grid-row: 2;
    inline-size: 100%;
    /* background: rgba(0, 0, 0, 0.2); */
    align-self: start;
}

.member-warning-list::before {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.member-warning-list li {
    display: block;
    white-space: normal;
    word-break: break-word;
    margin: 0 0 0.5rem 0;
    padding-inline-start: 0;
    font-size: 0.9rem;
    color: #e0e0e0;
    padding-right: 20px;
}

.member-warning-list li:empty {
    display: none;
}

/* ===== LEARN MORE BUTTON ===== */
.member-card-cta-wrapper {
    grid-column: 1 / -1;
    grid-row: 3;
    display: block;
    background: rgba(33, 150, 243, 0.2);
    border-top: 1px solid var(--border-subtle);
    transition: background 0.2s;
    border-radius: 0 0 14px 14px;
    padding: 0;
    margin: 0;
}

.member-card-cta-wrapper:hover {
    background: rgba(33, 150, 243, 0.3);
}

.member-card-cta-wrapper .member-card-cta {
    display: block;
    text-align: center;
    padding: 16px;
    color: #64b5f6;
    text-decoration: none;
    font-weight: 700;
    margin: 0;
}

/* Ensure take-action CTA fills the card bottom and matches wrapper radius */
.member-card-cta.take-action {
    width: 100%;
    box-sizing: border-box;
    font-size: x-large;
    border-radius: 0 0 14px 14px;
    display: block;
    margin: 0;
}

.member-card-cta-wrapper:hover .member-card-cta {
    color: #90caf9;
}

.member-card-cta.take-action {
    background: linear-gradient(180deg, #b00020 0%, #f44336 100%);
    color: #ffffff !important;
    border-radius: 0 0 14px 14px;
}

/* ===== TOTALS TABLE ===== */
.totals {
    max-inline-size: 30rem;
    margin-inline: auto;
    margin-block-end: 1rem;
}

:where(
    [data-party="Bloc Québécois"],
    [data-party="Coalition avenir Québec"]
) { --party-color: #0088ce; }
:where([data-party~="Conservative"], [data-party="Parti québécois"], [data-party="UC"], [data-party="PC"]) { --party-color: #1976d2; }
:where([data-party~="Green"]) { --party-color: #388e3c; }
:where([data-party="Saskatchewan Party"]) { --party-color: #005941; }
:where([data-party~="Liberal"], [data-party~="libéral"], [data-party="IND LIB"], [data-party="Liberal Party"]) { --party-color: #d32f2f; }
:where([data-party="NDP"], [data-party^="New Democratic Party"], [data-party="Québec solidaire"], [data-party="New Democrat"], [data-party="BC NDP"]) { --party-color: #ff6f00; }
:where([data-party~="Independent"], [data-party~="Indépendant"], [data-party~="Independent/Non-Affiliated"], [data-party="IND"]) { --party-color: #757575; }
:where([data-party="Alberta Party"], [data-party="AP"]) { --party-color: #5B9BD5; }

.totals-table-wrapper {
    min-inline-size: 100%;
    overflow: auto;
    position: relative;
    overscroll-behavior: none;
}

.totals-table {
    table-layout: fixed;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.totals-table th:first-of-type {
    text-align: start;
    padding-inline-end: 8px;
    min-inline-size: 12ch;
    inline-size: 100%;
    position: sticky;
    inset-inline-start: 2px;
}

.totals-table th:first-of-type:is(tbody [scope="row"]) {
    border-inline-start: 4px solid var(--party-color);
    padding-inline-start: 8px;
}

.totals-table th:first-of-type:is(:is(thead, tfoot) th) {
    padding-inline-start: 12px;
}

.totals-table th:nth-of-type(2) { inline-size: 6ch; }
.totals-table th:nth-of-type(3) { inline-size: 8ch; }
.totals-table th:nth-of-type(4) { inline-size: 9ch; }

.totals-table th:not(:first-of-type), 
.totals-table td {
    text-align: end;
    padding-inline: 8px;
}

.totals-table thead th {
    border-block-end: 2px solid rgba(255, 255, 255, 0.3);
    inline-size: fit-content;
}

.totals-table tfoot :is(th, td) {
    border-block-start: 2px solid rgba(255, 255, 255, 0.3);
}

.totals-table tbody tr:nth-of-type(odd) :is(td, th) {
    background-color: rgba(0, 0, 0, 0.2);
}

.totals-table tbody tr:nth-of-type(even) :is(td, th) {
    background-color: rgba(255, 255, 255, 0.05);
}

.totals-table :is(thead, tfoot) :is(th, td) {
    background-color: rgba(255, 255, 255, 0.05);
}

/* ===== UTILITIES ===== */
.visually-hidden:not(:focus-within, :active) {
    clip-path: inset(50%);
    white-space: nowrap;
    user-select: none;
    border: 0;
    width: 1px;
    height: 1px;
    margin: -1px;
    position: absolute;
    overflow: hidden;
}

/* ===== MODERN NAVIGATION BAR ===== */
header {
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    padding: 0;
}

header nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 20px;
}

.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 12px 24px;
    background: #2196f3;
    color: white;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    font-weight: 600;
}

.skip-to-content:focus {
    left: 0;
    top: 0;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    letter-spacing: -0.5px;
}

.site-title:hover {
    color: #90caf9 !important;
    transform: translateY(-1px);
}

.site-title::before {
    content: "🏛️";
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links > a {
    color: #90caf9;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-links > a:hover {
    background: rgba(144, 202, 249, 0.1);
    color: #ffffff;
    transform: translateY(-1px);
}

.nav-links > a[aria-current="page"] {
    background: rgba(33, 150, 243, 0.2);
    color: #ffffff;
}

.nav-links > a[aria-current="page"]::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 2px;
    background: #2196f3;
}

.language-switcher {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.language-switcher a {
    padding: 8px 16px;
    border-radius: 8px;
    color: #90caf9 !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.language-switcher a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
}

.language-switcher a[aria-current="page"] {
    background: rgba(33, 150, 243, 0.3);
    color: #ffffff !important;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #90caf9;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(144, 202, 249, 0.1);
    color: #ffffff;
}

@media (max-width: 768px) {
    header nav {
        padding: 0 16px;
        height: 60px;
    }

    .site-title {
        font-size: 1.2rem;
    }

    .site-title::before {
        font-size: 1.4rem;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .nav-links {
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(10, 14, 39, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 20px;
        gap: 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        display: none;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links > a {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
    }

    .language-switcher {
        width: 100%;
        justify-content: center;
    }

    .language-switcher a {
        flex: 1;
        text-align: center;
    }
}

@media (max-width: 480px) {
    header nav {
        height: 56px;
    }

    .nav-links {
        top: 56px;
    }
    #filter-constituency {
        max-width: 300px;
    }
}

/* ===== MODERN NAVIGATION BAR ===== */
header {
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    padding: 0;
    transition: transform 0.3s ease-in-out;
}

header.scroll-down {
    transform: translateY(-100%);
}

header.scroll-up {
    transform: translateY(0);
}