.election-results-strip {
    --banner-max-height: 334px;
    --metadata-height: 34px;
    --chart-height: var(--banner-max-height);
    --column-gap: 12px;
    --label-height: 74px;
    --bar-label-gap: clamp(4px, 0.8vw, 10px);

    /* Top logo band */
    --logo-band-height: 82px;
    --logo-top-offset: 12px;
    --logo-safe-gap: 10px;
    --logo-max-height: calc(var(--logo-band-height) - var(--logo-top-offset) - var(--logo-safe-gap));

    /* Bottom reserved space */
    --bottom-reserved-height: calc(var(--metadata-height) + 18px);

    /* Current rendered height */
    --current-strip-height: var(--chart-height);

    /* Available vertical space for bars */
    --bar-max-height: max(
            60px,
            calc(var(--current-strip-height) - var(--logo-band-height) - var(--label-height) - var(--bottom-reserved-height))
    );

    position: relative;
    width: 100%;
    height: var(--banner-max-height);
    isolation: isolate;
    box-sizing: border-box;
}

.election-results-inner {
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    gap: var(--column-gap);
    align-items: flex-end;
    width: 100%;
    max-width: 1314px;
    height: var(--chart-height);
    margin-right: auto;
    margin-left: auto;
    padding: var(--logo-band-height) 16px var(--bottom-reserved-height);
    box-sizing: border-box;
}

.election-results-logo {
    position: absolute;
    top: var(--logo-top-offset);
    right: clamp(8px, 1vw, 12px);
    width: 96px;
    max-width: none;
    max-height: var(--logo-max-height);
    z-index: 1;
    pointer-events: none;
}

.election-results-logo img {
    display: block;
    width: 100%;
    height: auto;
}

.election-results-majority-marker {
    position: absolute;
    right: 16px;
    bottom: calc(var(--bottom-reserved-height) + var(--label-height) + var(--bar-label-gap));
    left: 16px;
    height: var(--bar-max-height);
    z-index: 4;
    pointer-events: none;
}

.election-results-majority-line {
    position: absolute;
    right: 0;
    bottom: var(--majority-height, 86.67%);
    left: 0;
    height: 0;
    border-top: 1px dashed #111111;
}

.election-results-majority-label {
    position: absolute;
    right: 0;
    bottom: 6px;
    display: inline-flex;
    align-items: center;
    color: #333333;
    font-family: Inter, sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.election-results-majority-label::before {
    content: none;
}

.election-results-strip::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    z-index: -2;
}

.election-results-strip::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background-image: url("../images/E26_BGTEXTURE_4k.jpg");
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
    z-index: -1;
}

@media (max-width: 807px) {
    .election-results-inner {
        padding: var(--logo-band-height) 16px var(--bottom-reserved-height);
    }

    .election-results-strip::after {
        background-size: cover;
    }

}

.result-card {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: var(--bar-label-gap);
    box-sizing: border-box;
    transition: gap 280ms ease;
    --result-stagger: calc(var(--result-order, 0) * 80ms);
}

.result-bar-zone {
    position: relative;
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: var(--bar-max-height);
}

.result-label {
    position: relative;
    overflow: hidden;
    background-image:
            linear-gradient(rgba(var(--party-rgb), 0.9), rgba(var(--party-rgb), 0.9)),
            url("../images/E26_BGTEXTURE_4k.jpg");
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-size: auto, cover;
    background-blend-mode: multiply;
}

.result-bar {
    position: relative;
    width: 100%;
    height: var(--result-bar-height, var(--result-min-height, 8px));
    min-height: var(--result-min-height, 8px);
    overflow: hidden;
    background-image:
            linear-gradient(rgba(var(--party-rgb), 0.9), rgba(var(--party-rgb), 0.9)),
            url("../images/E26_BGTEXTURE_4k.jpg");
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-size: auto, cover;
    background-blend-mode: multiply;
    transform: translateX(0) translateY(0);
    opacity: 1;
    transition:
            height 460ms cubic-bezier(0.22, 1, 0.36, 1),
            min-height 460ms cubic-bezier(0.22, 1, 0.36, 1),
            transform 460ms cubic-bezier(0.22, 1, 0.36, 1),
            opacity 220ms ease;
    transition-delay: var(--result-stagger);
}

.result-bar::before,
.result-label::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.08) 0%,
            rgba(255, 255, 255, 0.08) 35%,
            rgba(255, 255, 255, 0) 35%,
            rgba(255, 255, 255, 0) 60%,
            rgba(255, 255, 255, 0.06) 60%,
            rgba(255, 255, 255, 0.06) 100%
    );
    opacity: 0.55;
    pointer-events: none;
}

.result-label {
    height: var(--label-height);
    padding: clamp(6px, 1vw, 10px) clamp(12px, 1.8vw, 16px) clamp(6px, 1vw, 10px) clamp(8px, 1.4vw, 12px);
    clip-path: polygon(0 0, 100% 0, 80% 100%, 0 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    box-sizing: border-box;
    backdrop-filter: saturate(115%) blur(1px);
}

.result-card .party,
.result-card .seats {
    position: relative;
    z-index: 1;
    color: #111111;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-card .party {
    font-family: Inter, sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
}

.result-card .seats {
    font-family: Inter, sans-serif;
    font-size: clamp(14px, 2vw, 24px);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.election-results-skeleton-card {
    --party-rgb: 190, 190, 190;
}

.election-results-strip.is-loading .result-bar,
.election-results-strip.is-loading .result-label,
.election-results-strip.is-loading .seat-change {
    background-image: linear-gradient(
            105deg,
            rgba(255, 255, 255, 0.18) 0%,
            rgba(255, 255, 255, 0.18) 34%,
            rgba(255, 255, 255, 0.42) 48%,
            rgba(255, 255, 255, 0.18) 62%,
            rgba(255, 255, 255, 0.18) 100%
    );
    background-size: 260% 100%;
    background-color: rgba(74, 74, 74, 0.16);
    background-blend-mode: normal;
    animation: election-results-skeleton-shimmer 1800ms ease-in-out infinite;
}

.election-results-strip.is-loading .result-label {
    clip-path: polygon(0 0, 100% 0, 80% 100%, 0 100%);
}

.election-results-strip.is-loading .result-card .party,
.election-results-strip.is-loading .result-card .seats {
    display: block;
    width: 58%;
    height: 10px;
    border-radius: 2px;
    background: rgba(17, 17, 17, 0.16);
}

.election-results-strip.is-loading .result-card .seats {
    width: 42%;
    height: 16px;
    margin-top: 5px;
}

.election-results-strip.is-loading .seat-change {
    min-width: var(--seat-change-size);
    padding: 0;
    border-color: rgba(17, 17, 17, 0.22);
    box-shadow: none;
}

.election-results-strip.is-loading .seat-change-note,
.election-results-strip.is-loading .election-results-last-updated {
    color: #6a6a6a;
}

@keyframes election-results-skeleton-shimmer {
    0% {
        background-position: 130% 0;
    }

    100% {
        background-position: -130% 0;
    }
}

.seat-change {
    --seat-change-size: 24px;

    position: absolute;
    bottom: calc(var(--seat-change-size) / -2);
    right: clamp(22px, 4vw, 46px);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: calc(var(--seat-change-size) + 10px);
    height: var(--seat-change-size);
    padding: 0 7px;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: 0 2px 0 rgba(17, 17, 17, 0.18);
    color: #000000;
    font-family: Inter, sans-serif;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    box-sizing: border-box;
    white-space: nowrap;
}

.seat-change-gain,
.seat-change-loss,
.seat-change-no-change {
    background: #ffffff;
}

.seat-change-arrow {
    color: #000000;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

.seat-change-number {
    color: #000000;
    font-weight: 800;
    line-height: 1;
}

.election-results-meta {
    position: absolute;
    right: 16px;
    bottom: 0;
    left: 16px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: var(--metadata-height);
    padding: 7px 0 9px;
    box-sizing: border-box;
}

.seat-change-note,
.election-results-last-updated {
    margin: 0;
    color: #4a4a4a;
    font-family: Inter, sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.seat-change-note {
    text-align: left;
}

.election-results-last-updated {
    flex-shrink: 0;
    margin-left: auto;
    text-align: right;
}

@media (max-width: 807px) {
    .seat-change {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 560px) {
    .election-results-strip {
        --bottom-reserved-height: calc(var(--metadata-height) + 24px);
    }

    .election-results-meta {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        align-content: flex-start;
        gap: 4px;
        padding-top: 12px;
    }

    .seat-change-note,
    .election-results-last-updated {
        width: 100%;
    }

    .election-results-last-updated {
        margin-left: 0;
        text-align: left;
    }
}

.result-card.labour {
    color: rgba(248, 62, 90, 0.8);
    --party-rgb: 248, 62, 90;
}

.result-card.libdem {
    color: rgba(255, 175, 0, 0.8);
    --party-rgb: 255, 175, 0;
}

.result-card.conservative {
    color: rgba(1, 111, 255, 0.8);
    --party-rgb: 1, 111, 255;
}

.result-card.reform {
    color: rgba(51, 211, 255, 0.8);
    --party-rgb: 51, 211, 255;
}

.result-card.independent {
    color: rgba(181, 156, 183, 0.8);
    --party-rgb: 181, 156, 183;
}

.result-card.snp {
    color: rgba(242, 250, 1, 0.85);
    --party-rgb: 242, 250, 1;
}

.result-card.green {
    color: rgba(11, 249, 150, 0.85);
    --party-rgb: 11, 249, 150;
}

.result-card.other {
    color: rgba(170, 171, 172, 0.8);
    --party-rgb: 170, 171, 172;
}

@media (max-width: 480px) {
    .election-results-strip {
        --banner-max-height: 214px;
        --metadata-height: 44px;
        --chart-height: var(--banner-max-height);
        --column-gap: 5px;
        --label-height: 42px;
        --logo-band-height: 36px;
        --logo-top-offset: 8px;
        --logo-safe-gap: 6px;
        --logo-max-height: calc(var(--logo-band-height) - var(--logo-top-offset) - var(--logo-safe-gap));

        --bottom-reserved-height: calc(var(--metadata-height) + 12px);
        --current-strip-height: var(--chart-height);

        --bar-max-height: max(
                32px,
                calc(var(--current-strip-height) - var(--logo-band-height) - var(--label-height) - var(--bottom-reserved-height))
        );
    }

    .election-results-inner {
        padding: var(--logo-band-height) 16px var(--bottom-reserved-height);
    }

    .election-results-logo {
        top: var(--logo-top-offset);
        right: 8px;
        max-width: 52px;
        max-height: var(--logo-max-height);
    }

    .election-results-majority-marker {
        right: 16px;
        left: 16px;
    }

    .election-results-majority-label {
        bottom: 4px;
        font-size: 10px;
    }

    .election-results-meta {
        right: 16px;
        left: 16px;
        flex-wrap: wrap;
        gap: 2px;
        align-content: flex-start;
        padding: 0 0 0;
    }

    .seat-change-note,
    .election-results-last-updated {
        font-size: 9px;
    }

    .result-label {
        padding: 3px 5px;
        clip-path: none;
        gap: 0;
    }

    .result-card .party {
        font-size: 11px;
    }

    .result-card .seats {
        font-size: 12px;
    }

    .seat-change {
        --seat-change-size: 18px;

        right: auto;
        left: 50%;
        transform: translateX(-50%);
        gap: 2px;
        min-width: 24px;
        padding: 0 5px;
        font-size: 10px;
    }

    .seat-change-arrow {
        font-size: 9px;
    }
}

@media (max-width: 360px) {
    .election-results-strip {
        --banner-max-height: 204px;
        --metadata-height: 44px;
        --chart-height: var(--banner-max-height);
        --column-gap: 3px;
        --label-height: 34px;
        --logo-band-height: 32px;
        --logo-top-offset: 6px;
        --logo-safe-gap: 4px;
        --logo-max-height: calc(var(--logo-band-height) - var(--logo-top-offset) - var(--logo-safe-gap));
        --bottom-reserved-height: calc(var(--metadata-height) + 24px);
        --current-strip-height: var(--chart-height);
        --bar-max-height: max(
                28px,
                calc(var(--current-strip-height) - var(--logo-band-height) - var(--label-height) - var(--bottom-reserved-height))
        );
    }

    .election-results-logo {
        right: 6px;
        max-width: 44px;
        max-height: var(--logo-max-height);
    }

    .result-label {
        padding: 2px;
        text-align: center;
    }

    .result-card .party {
        font-size: 9px;
    }

    .result-card .seats {
        font-size: 10px;
        letter-spacing: -0.01em;
    }

    .seat-change {
        --seat-change-size: 16px;

        bottom: calc((var(--seat-change-size) / -2) - 3px);
        min-width: 20px;
        padding: 0 4px;
        font-size: 9px;
    }

    .seat-change-arrow {
        font-size: 8px;
    }

    .election-results-meta {
        right: 16px;
        left: 16px;
    }

    .seat-change-note,
    .election-results-last-updated {
        font-size: 8px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .election-results-strip,
    .result-card,
    .result-bar {
        transition: none;
    }

    .election-results-strip.is-loading .result-bar,
    .election-results-strip.is-loading .result-label,
    .election-results-strip.is-loading .seat-change {
        animation: none;
    }
}
