* {
    box-sizing: border-box;
}

html {
    background: #101114;
    color: #f4f4f4;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    margin: 0;
}

a {
    color: #d9e7ff;
}

.topbar {
    height: 64px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #292b31;
}

.brand {
    color: white;
    text-decoration: none;
    font-weight: 700;
}

.topbar nav a {
    text-decoration: none;
    color: #bfc4ce;
}

main {
    width: min(1200px, 92vw);
    margin: 56px auto 80px;
}

.hero {
    margin-bottom: 54px;
}

.hero h1,
h1 {
    font-size: clamp(2rem, 5vw, 3.6rem);
    margin-bottom: 12px;
}

.hero p {
    color: #aeb2bb;
    font-size: 1.1rem;
}

.chart {
    width: 100%;
}

.axis-labels {
    margin-left: 220px;
    margin-right: 100px;
    display: flex;
    justify-content: space-between;
    color: #717783;
    font-size: 0.8rem;
}

.axis-line {
    margin-left: 220px;
    margin-right: 100px;
    height: 1px;
    background: #30333a;
    margin-bottom: 10px;
}

.party-row {
    height: 62px;
    display: grid;
    grid-template-columns: 200px 1fr 80px;
    gap: 20px;
    align-items: center;
}

.party-name {
    text-align: right;
    font-weight: 600;
}

.bar-area {
    height: 30px;
    position: relative;
    background:
        linear-gradient(
            to right,
            transparent 49.8%,
            #555 49.8%,
            #555 50.2%,
            transparent 50.2%
        );
}

.zero-line {
    position: absolute;
    left: 50%;
    top: -5px;
    bottom: -5px;
    width: 1px;
    background: #60646d;
}

.bar {
    position: absolute;
    top: 4px;
    height: 22px;
    border-radius: 4px;
    min-width: 2px;
}

.score {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.method-short {
    margin-top: 42px;
    color: #8d929b;
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 40px 0;
}

.stats-grid div {
    padding: 22px;
    background: #191b20;
    border: 1px solid #292c33;
    border-radius: 8px;
}

.stats-grid strong {
    display: block;
    font-size: 1.8rem;
}

.stats-grid span {
    color: #90959f;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
}

th,
td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #2d3036;
}

th {
    color: #999faa;
    font-weight: 500;
}

.text-page {
    max-width: 850px;
}

.text-page h2 {
    margin-top: 38px;
}

.text-page p {
    line-height: 1.65;
    color: #c7cad0;
}

.large-score {
    font-size: 3rem;
    font-weight: bold;
}

footer {
    width: min(1200px, 92vw);
    margin: 0 auto 40px;
    color: #626771;
    font-size: 0.8rem;
}

@media (max-width: 700px) {

    .topbar {
        padding: 0 18px;
    }

    main {
        width: 94vw;
    }

    .party-row {
        grid-template-columns: 110px 1fr 60px;
        gap: 10px;
    }

    .party-name {
        font-size: 0.8rem;
    }

    .axis-labels,
    .axis-line {
        margin-left: 120px;
        margin-right: 70px;
    }

    table {
        font-size: 0.8rem;
    }
}

/* ---------------------------------------------------------
   Vertikalt huvuddiagram
--------------------------------------------------------- */

.vertical-chart {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 12px;
    height: 560px;
    margin-top: 40px;
}

.y-axis {
    position: relative;
    color: #7f8590;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.y-axis span {
    position: absolute;
    right: 0;
    transform: translateY(-50%);
}

.y100   { top: 0%; }
.y50    { top: 25%; }
.y0     { top: 50%; }
.ym50   { top: 75%; }
.ym100  { top: 100%; }

.plot-area {
    position: relative;
    min-width: 0;
}

.grid-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: #2b2e35;
    z-index: 0;
}

.grid-100  { top: 0%; }
.grid-50   { top: 25%; }
.grid-0    {
    top: 50%;
    background: #666b75;
}
.grid-m50  { top: 75%; }
.grid-m100 { top: 100%; }

.party-columns {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(8, minmax(70px, 1fr));
    gap: 18px;
    align-items: stretch;
}

.party-column {
    position: relative;
    display: grid;
    grid-template-rows: 1fr 72px;
    min-width: 0;
}

.bar-zone {
    position: relative;
}

.vbar {
    position: absolute;
    left: 18%;
    width: 64%;
    border-radius: 5px 5px 0 0;
    min-height: 2px;
}

.vbar.negative {
    border-radius: 0 0 5px 5px;
}

.bar-score {
    position: absolute;
    left: 50%;
    top: 46%;
    transform: translate(-50%, -100%);
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
}

.bar-score.na {
    top: 50%;
    color: #777d87;
    transform: translate(-50%, -50%);
}

.party-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
}

.party-logo img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    display: block;
}

.political-axis {
    margin-left: 72px;
    margin-top: 18px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    color: #888e98;
    font-size: 0.8rem;
}

.axis-gradient {
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        #b52b32 0%,
        #b16b69 28%,
        #888888 50%,
        #6987b1 72%,
        #2a67bd 100%
    );
}

@media (max-width: 900px) {
    .vertical-chart {
        height: 460px;
        overflow-x: auto;
    }

    .plot-area {
        min-width: 760px;
    }

    .political-axis {
        min-width: 760px;
    }
}

.party-fallback {
    display: none;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    color: white;
    border: 2px solid rgba(255,255,255,.18);
}


/* ---------------------------------------------------------
   Vit diagramyta
--------------------------------------------------------- */

.vertical-chart {
    background: #ffffff;
    color: #111111;
    border-radius: 10px;
    padding: 24px 24px 18px 16px;
}

.y-axis {
    color: #555555;
}

.grid-line {
    background: #d9d9d9;
}

.grid-0 {
    background: #777777;
}

.zero-line {
    background: #777777;
}

.bar-score {
    color: #111111;
}

.bar-score.na {
    color: #777777;
}

.party-logo {
    background: #ffffff;
}

.political-axis {
    background: #ffffff;
    color: #555555;
    margin-top: 0;
    margin-left: 0;
    padding: 8px 24px 18px 88px;
    border-radius: 0 0 10px 10px;
}

