@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Montserrat:wght@700;800;900&display=swap');

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; border: 0; box-sizing: border-box; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
body {
    font-family: 'Open Sans', sans-serif;
    color: #111;
    background: #fff;
    line-height: 1.5;
}
h1, h2, h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    line-height: 1.2;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Logo ===== */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.logo__img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.logo:hover .logo__img {
    transform: scale(1.05);
}

.logo__text {
    font-size: 14px;
    font-weight: 900;
    font-family: 'Montserrat', sans-serif;
    line-height: 1.15;
    color: #111;
}

.logo--small .logo__img {
    width: 32px;
    height: 32px;
}

.logo--small .logo__text {
    font-size: 11px;
}

/* ===== Topbar ===== */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 20px;
}

.topbar__inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar__right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar__link {
    font-size: 13px;
    font-weight: 700;
    color: #333;
}

.topbar__link:hover {
    color: #007fa3;
}

.topbar__link--active {
    color: #007fa3 !important;
    font-weight: 800;
}

.topbar__link--accent {
    color: #f30;
}

/* ===== Red Button ===== */
.red-btn {
    display: inline-block;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    padding: 13px 40px;
    background: #f30;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.red-btn:hover {
    background: #ff8060;
}

/* ===== Hero ===== */
.hero {
    position: relative;
    min-height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 40px;
    overflow: hidden;
}

.hero__bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #2c3e6b, #3a4a7b, #303a52);
    z-index: 0;
}

.hero__bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><filter id="n"><feTurbulence baseFrequency="0.7" numOctaves="3" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/></filter><rect width="300" height="300" filter="url(%23n)" opacity="0.07"/></svg>');
    background-size: 150px;
    opacity: 0.5;
}

.hero__card {
    position: relative;
    z-index: 1;
    background: #fff;
    max-width: 680px;
    width: 100%;
    padding: 40px;
}

.hero__card .logo {
    margin-bottom: 32px;
}

.hero__title {
    font-size: 36px;
    margin-bottom: 20px;
}

.hero__desc {
    font-size: 16px;
    line-height: 160%;
    color: #444;
    margin-bottom: 32px;
}

.hero__meta {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.hero__meta-value {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 28px;
    color: #007fa3;
}

.hero__meta-label {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== Sections ===== */
.section {
    padding: 64px 0;
}

.section--teal {
    background: #e7f6fa;
}

.section--dark {
    background: #1a1e2e;
}

.section__title {
    font-size: 32px;
    margin-bottom: 8px;
}

.section__title--light {
    color: #fff;
}

.section__subtitle {
    font-size: 14px;
    color: #888;
    margin-bottom: 32px;
}

.subsection__title {
    font-size: 22px;
    margin: 40px 0 20px;
}

/* ===== Party Colors ===== */
:root {
    --c-nr: #3366cc;      /* Неделимая Россия — синий */
    --c-kprr: #cc2222;    /* КПРР — красный */
    --c-nl: #47c2c0;      /* Новейшие Люди — бирюзовый */
    --c-nldpr: #1a3a8a;   /* нЛДПР — тёмно-синий */
    --c-nsr: #eaad1a;     /* Несправедливая Россия — жёлтый */
    --c-ppzh: #e89888;    /* Партия Пожилых — телесно-розовый */
    --c-rep: #2ea44f;     /* РЭП «Шмалёвые» — зелёный */
    --c-apple: #94a3b8;   /* Apple — снята с выборов */
    --c-ind: #64748b;     /* Самовыдвиженцы */
}

/* ===== National Results ===== */
.national-results {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 40px;
}

.party-row {
    display: grid;
    grid-template-columns: 200px 1fr 70px 60px;
    align-items: center;
    gap: 16px;
}

.party-name {
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.party-dot {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.party-bar-wrap {
    background: #f0f0f0;
    height: 32px;
    position: relative;
    overflow: hidden;
}

.party-bar {
    height: 100%;
    transition: width 0.8s ease;
}

.party-pct {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 18px;
    text-align: right;
}

.party-seats {
    font-size: 12px;
    color: #888;
    text-align: right;
}

/* Excluded party */
.excluded-parties {
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px dashed #ddd;
}

.party-row--excluded {
    opacity: 0.55;
}

.excluded-name {
    text-decoration: line-through;
    color: #999;
}

.excluded-badge {
    font-size: 10px;
    font-weight: 700;
    color: #cc2222;
    background: #ffeaea;
    padding: 2px 8px;
    border-radius: 2px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ===== National Chart (stacked bar) ===== */
.national-chart {
    display: flex;
    height: 48px;
    overflow: hidden;
    margin-bottom: 12px;
}

.national-chart__segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 13px;
    transition: width 0.8s ease;
    white-space: nowrap;
    overflow: hidden;
}

/* ===== Map Header & Mode Toggle ===== */
.map-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.map-mode-toggle {
    display: inline-flex;
    background: #fff;
    padding: 3px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.mode-btn {
    padding: 7px 18px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    color: #0f172a;
}

.mode-btn.active {
    background: #0f172a;
    color: #fff;
}

/* ===== Region Map ===== */
.region-map {
    display: grid;
    gap: 4px;
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.region-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: clamp(6px, 0.95vw, 11px);
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
    user-select: none;
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
}

.region-cell:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    z-index: 20;
}

/* Mosaic in districts mode */
.region-cell--mosaic {
    display: grid !important;
    gap: 1px;
    padding: 1px;
    background: rgba(15, 23, 42, 0.25) !important;
    cursor: default;
    overflow: visible !important;
}

.region-cell--mosaic:hover {
    transform: none !important;
    box-shadow: none !important;
}

.d-mosaic-tile {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    border-radius: 1.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: clamp(6px, 0.65vw, 9.5px);
    cursor: pointer;
    position: relative;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    user-select: none;
    box-sizing: border-box;
}

.d-mosaic-tile:hover {
    outline: 2px solid #fff;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transform: scale(1.25);
    border-radius: 2px;
}

.d-mosaic-tile--transparent {
    background: #ffffff !important;
    color: #64748b !important;
    border: 1px dashed #94a3b8;
}

.d-mosaic-tile[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    transform-origin: bottom center;
    background: #222;
    color: #fff;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 10px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    white-space: nowrap;
    z-index: 300;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.d-mosaic-tile[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100%);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    transform-origin: bottom center;
    border: 4px solid transparent;
    border-top-color: #222;
    z-index: 300;
    pointer-events: none;
}

.region-cell.empty {
    background: transparent !important;
    cursor: default;
    pointer-events: none;
}

.region-cell--transparent {
    background: #ffffff !important;
    border: 2px dashed #94a3b8 !important;
    color: #475569 !important;
    opacity: 0.95 !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.region-cell--transparent:hover {
    background: #ffffff !important;
    border-color: #007fa3 !important;
    color: #007fa3 !important;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.transparent-notice {
    background: #fff8e6;
    border-left: 4px solid #eaad1a;
    color: #7a5e0b;
    padding: 14px 18px;
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.region-cell[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #222;
    color: #fff;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

.region-cell[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100%);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #222;
    z-index: 100;
}

/* ===== Region Detail ===== */
.back-btn {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 700;
    color: #007fa3;
    cursor: pointer;
    margin-bottom: 20px;
    padding: 0;
}

.back-btn:hover {
    text-decoration: underline;
}

.region-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.districts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.district-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
}

@keyframes districtPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 127, 163, 0.7); }
    50% { box-shadow: 0 0 0 8px rgba(0, 127, 163, 0.25); }
    100% { box-shadow: 0 0 0 0 rgba(0, 127, 163, 0); }
}

.district-card--highlighted {
    animation: districtPulse 1.4s ease;
    border-color: #007fa3 !important;
}

.district-card__head {
    margin-bottom: 12px;
}

.district-card__title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 16px;
    color: #0f172a;
    margin-bottom: 3px;
}

.district-card__voters {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* Sleek Winner Callout */
.district-winner-callout {
    background: #f8fafc;
    border-left: 4px solid #3366cc;
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: 0 3px 3px 0;
    border-top: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.district-winner-callout__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 4px;
}

.winner-party-tag {
    color: #fff;
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
}

.district-winner-callout__name {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 2px;
}

.district-winner-callout__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #475569;
}

/* Editorial Tabs */
.district-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}

.d-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 7px 12px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.15s ease;
}

.d-tab:hover {
    color: #0f172a;
}

.d-tab.active {
    color: #007fa3;
    border-bottom-color: #007fa3;
    background: transparent;
}

/* Candidate Row */
.cand-item {
    padding: 8px 10px;
    border-radius: 3px;
    margin-bottom: 6px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    transition: background 0.15s;
}

.cand-item--winner {
    background: #ffffff;
    border: 1.5px solid #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cand-item__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.cand-item__name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    flex-wrap: wrap;
}

.cand-party-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.cand-fullname {
    font-weight: 700;
}

.cand-party-pill {
    font-size: 9.5px;
    font-weight: 800;
    border: 1px solid;
    padding: 0 4px;
    border-radius: 2px;
    font-family: 'Montserrat', sans-serif;
}

.cand-winner-pill {
    font-size: 9px;
    font-weight: 900;
    background: #0f172a;
    color: #fff;
    padding: 1px 5px;
    border-radius: 2px;
    letter-spacing: 0.05em;
    font-family: 'Montserrat', sans-serif;
}

.cand-item__numbers {
    text-align: right;
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-family: 'Montserrat', sans-serif;
}

.cand-votes {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
}

.cand-pct {
    font-size: 13.5px;
    font-weight: 800;
    color: #0f172a;
}

.cand-bar-track {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.cand-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.district-card .party-row {
    grid-template-columns: 130px 1fr 50px;
    gap: 10px;
    margin-bottom: 6px;
}

.district-card .party-name {
    font-size: 12px;
}

.district-card .party-bar-wrap {
    height: 18px;
}

.district-card .party-pct {
    font-size: 13px;
}
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* National Summary Table */
.national-table-wrap {
    overflow-x: auto;
    margin-top: 36px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.national-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.national-table th {
    background: #f8fafc;
    padding: 12px 16px;
    font-weight: 800;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.national-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.national-table tr:hover td {
    background: #f8fafc;
}

.badge-pass {
    background: #dcfce7;
    color: #15803d;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 11px;
    display: inline-block;
}

.badge-fail {
    background: #f1f5f9;
    color: #64748b;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
    display: inline-block;
}

.table-total-row td {
    background: #f8fafc;
    font-weight: 800;
    border-top: 2px solid #cbd5e1;
    font-size: 13px;
}

/* ===== About + Donate ===== */
.about-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
    align-items: start;
}

.about-text {
    font-size: 15px;
    line-height: 170%;
    color: rgba(255,255,255,0.7);
    margin-top: 16px;
}

.donate-card {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 28px;
}

.donate-card__title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 18px;
    color: #fff;
    margin-bottom: 12px;
}

.donate-card__text {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    line-height: 160%;
    margin-bottom: 20px;
}

/* ===== Footer ===== */
.footer {
    padding: 20px 0;
    background: #e7f6fa;
    border-top: 1px solid #cde8ef;
}

.footer__inner {
    text-align: center;
    font-size: 13px;
    color: #4aa5bf;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero__title { font-size: 26px; }
    .hero__card { padding: 24px; }
    .hero__meta { gap: 20px; }
    .hero__meta-value { font-size: 22px; }

    .party-row {
        grid-template-columns: 120px 1fr 55px 45px;
        gap: 8px;
    }
    .party-name { font-size: 12px; }
    .party-pct { font-size: 14px; }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .region-cell { font-size: clamp(5px, 1.1vw, 7px); border-radius: 2px; }
    .region-map { gap: 2px; }

    .districts {
        grid-template-columns: 1fr;
    }

    .section__title { font-size: 24px; }

    .topbar__link { font-size: 11px; }
}

@media (max-width: 480px) {
    .hero { min-height: auto; padding: 70px 12px 24px; }
    .hero__card { padding: 20px; }
    .hero__title { font-size: 22px; }
    .hero__meta-value { font-size: 18px; }

    .party-row {
        grid-template-columns: 90px 1fr 45px;
    }
    .party-seats { display: none; }

    .region-cell { font-size: clamp(4px, 1.2vw, 5.5px); border-radius: 2px; }
    .region-map { gap: 1.5px; }
}
