:root {
    --poll-green: #6cc24a;
    --poll-green-dark: #046a38;
    --poll-green-darker: #03512b;
    --poll-white: #ffffff;
}

* {
    box-sizing: border-box;
}

/* Full-screen takeover, like a Story: the poll fills the entire viewport
   it's given edge-to-edge. The parent page is responsible for making the
   iframe itself position:fixed/100vw/100vh when triggered — see
   examples/embed-snippet.html — this just fills whatever box it's in. */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
    background: #111;
    overflow: hidden;
    font-size: 62.5%;
}

.poll {
    width: 100%;
    height: 100%;
}

/* The campaign photo IS the whole screen — question art, buttons and
   results all sit on top of it, matching the print/TV poster look. */
.poll__photo {
    position: relative;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #111; /* shows briefly while the photo loads */
}

.poll__close {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top));
    left: calc(14px + env(safe-area-inset-left));
    z-index: 3;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: var(--poll-white);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

/* Vignette: clear in the center where the photo subject sits, darkening
   toward every edge so the logo (top), headline/buttons (middle) and
   cultuur logo (bottom) all stay legible now that content is spread the
   full height via space-between, not just anchored at the bottom. */
.poll__scrim {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.8) 100%);
    pointer-events: none;
}

.poll__lvbo-logo {
    position: absolute;
    top: 0;
    right: calc(40px + env(safe-area-inset-right));
    width: 30%;
    max-width: 70px;
    height: auto;
    z-index: 2;
}

@media screen and (max-width: 500px) {
    .poll__lvbo-logo {
        max-width: 50px;
        right: calc(20px + env(safe-area-inset-right));
    }
}

.poll__content {
    /* position: absolute; */
    /* inset: auto 0 0 0; */
    justify-content: space-between;
    z-index: 2;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    gap: 20px;
    padding: 20px calc(40px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) calc(40px + env(safe-area-inset-left));
}

@media screen and (max-width: 500px) {
    .poll__content {
        padding: 140px calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom))
            calc(20px + env(safe-area-inset-left));
        gap: 20px;
        justify-content: flex-start;
    }
}

/* Short, wide boxes — a fixed-height inline embed (e.g. 16:10 on desktop),
   not just a landscape phone. The 80px gap + 40px padding that work fine
   when height tracks the full device screen will overflow a box that's
   only a few hundred px tall, clipping the cultuur logo at the bottom. */
@media screen and (max-height: 550px) {
    .poll__content {
        gap: 16px;
        padding: 60px calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom))
            calc(16px + env(safe-area-inset-left));
    }

    .poll__question-section {
        gap: 16px;
    }

    .poll__headline-image {
        max-width: 32%;
        min-width: 160px;
    }

    .poll__cultuur-logo {
        width: 14%;
        min-width: 110px;
    }
}

.poll__question-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

@media screen and (max-width: 500px) {
    .poll__question-section {
        gap: 20px;
    }
}

.poll__headline {
    width: 100%;
    text-align: center;
    /* backwards, not both: holds the *starting* keyframe before the
       animation plays (avoids a flash of the wrong style), but doesn't
       keep the transform actively applied once it's done. The "to" state
       here is visually identical to the un-animated default anyway, and
       Chromium has documented hit-testing bugs where a lingering active
       transform on an ancestor can throw off touch/click coordinates on
       its descendants — plausible contributor to a reported Samsung
       Internet bug where the A/B buttons (descendants of an animated
       ancestor) weren't clickable. */
    animation: poll-fade-up 0.3s ease-out backwards;
}

.poll__headline-image {
    max-width: 55%;
    height: auto;
    min-width: 300px;
    filter: drop-shadow(0 2px 28px rgba(0, 0, 0, 0.55));
}

@media screen and (max-width: 500px) {
    .poll__headline-image {
        min-width: 70%;
        max-width: 70%;
    }
}

/* Landscape phones/tablets are short on vertical space — shrink the
   headline so it doesn't crowd out the logo/buttons above and below it. */
@media screen and (orientation: landscape) {
    .poll__headline-image {
        max-width: 35%;
        min-width: 200px;
    }
}

.poll__headline-text {
    margin: 0;
    color: var(--poll-white);
    font-weight: 800;
    font-style: italic;
    font-size: 1.5rem;
    line-height: 1.15;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* CSS animations restart automatically whenever an element goes from
   display:none to visible (unlike transitions, which can't animate
   across that boundary) — so just toggling `hidden` in app.js is enough
   to replay these every time a question/results view appears. */
@keyframes poll-fade-up {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes poll-slide-open {
    from {
        opacity: 0;
        transform: scaleY(0.9) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scaleY(1) translateY(0);
    }
}

#question-view,
#results-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: poll-fade-up 0.35s ease-out backwards;
    /* Explicit, not incidental: an active CSS transform always creates a
       stacking context, which is what used to keep this painted above the
       cultuur-logo video (a later flex sibling with none of its own) —
       purely as a side effect of the animation's old fill-mode:both. Once
       that was switched to backwards (so the transform doesn't linger
       after the entrance animation ends), the video started painting on
       top and literally blocking clicks on the A/B buttons — confirmed by
       Playwright's own click-interception detection. z-index on a flex
       item doesn't need position:relative, and doesn't depend on any
       animation being active. */
    position: relative;
    z-index: 1;
}

.poll__options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    min-width: 400px;
}

@media screen and (max-width: 500px) {
    .poll__options {
        width: 100%;
        min-width: 100%;
    }
}

.poll__option {
    flex: 1;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 15px;
    background: var(--poll-white);
    color: var(--poll-green-dark);
    font-weight: 800;
    font-size: 1.6rem;
    text-transform: uppercase;
    line-height: 1.6;
    cursor: pointer;
    white-space: nowrap;

    transition: background 0.3s ease;
    font-family: "Tahoma", sans-serif;
}

@media screen and (max-width: 500px) {
    .poll__option {
        font-size: 1.1rem;
        /* padding: 0.5rem 1rem; */
    }
}

.poll__option:hover,
.poll__option:focus-visible {
    background: var(--poll-green-darker);
    color: var(--poll-white);
}

.poll__results-panel {
    width: 100%;
    background: var(--poll-white);
    max-width: 600px;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
    font-family: "Tahoma", sans-serif;
    transform-origin: top center;
    animation: poll-slide-open 0.35s ease-out 0.1s backwards;
}

@media screen and (max-width: 500px) {
    .poll__results-panel {
        padding: 16px;
    }
}

.poll__bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}


@media screen and (max-width: 500px) {
    .poll__bar-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

.poll__bar-row + .poll__bar-row {
    margin-top: 20px;
}

@media screen and (max-width: 500px) {
    .poll__bar-row + .poll__bar-row {
        margin-top: 10px;
    }
}

.poll__bar-container {
    flex: 1;
    display: flex;
    gap: 8px;
    align-items: center;
}

@media screen and (max-width: 500px) {
    .poll__bar-container {
        width: 100%;
    }
}


.poll__bar-label {
    flex: 0 0 130px;
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--poll-green-dark);
}

@media screen and (max-width: 500px) {
    .poll__bar-label {
        font-size: 1.1rem;
        flex: none;
    }
}

.poll__bar {
    flex: 1;
    height: 16px;
    background: #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.poll__bar-fill {
    height: 100%;
    background: var(--poll-green);
    width: 0%;
    transition: width 0.4s ease;
}

.poll__bar-pct {
    flex: 0 0 60px;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: right;
    color: var(--poll-green-dark);
}

@media screen and (max-width: 500px) {
    .poll__bar-pct {
        font-size: 1.1rem;
    }
}

.poll__actions {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    min-width: 400px;
    animation: poll-fade-up 0.35s ease-out 0.18s backwards;
}

@media screen and (max-width: 500px) {
    .poll__actions {
        width: 100%;
        min-width: 100%;
    }
}

.poll__cta,
.poll__next {
    flex: 1;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 15px;
    background: var(--poll-white);
    color: var(--poll-green-dark);
    font-weight: 800;
    font-size: 1.6rem;
    text-transform: uppercase;
    line-height: 1.6;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: flex;
    justify-content: center;
    transition: background 0.3s ease;
    font-family: "Tahoma", sans-serif;
}

.poll__cta {
    background: var(--poll-green);
    border-color: var(--poll-green);
    color: var(--poll-white);
}

.poll__next:hover {
    background: var(--poll-green-darker);
    color: var(--poll-white);
}

.poll__cta:hover {
    background: var(--poll-green-darker);
    color: var(--poll-white);
}

@media screen and (max-width: 500px) {
    .poll__cta,
    .poll__next {
        flex: 1 1 100%;
        /* padding: 0.5rem 1rem; */
        font-size: 1.1rem;
        text-align: center;
    }
}

/* [hidden]'s default display:none only wins cascade ties against equal-
   specificity author rules (class/ID selectors that set display) when it
   comes later — easy to break by accident (happened twice already: once
   on these buttons, once on #question-view/#results-view). !important
   settles it for every hidden element on the page, for good. */
[hidden] {
    display: none !important;
}

.poll__cultuur-logo {
    width: 55%;
    min-width: 200px;
    height: auto;
    opacity: 1;
    /* allow-discrete lets `display` itself join the transition instead of
       snapping instantly: on hide, the display:none switch is deferred
       until the opacity fade finishes; on show, it applies immediately so
       the fade-in has something to animate. @starting-style below gives
       the browser an opacity to animate FROM on that show — without it,
       display:none -> visible has no previous rendered state to
       interpolate from and would just jump straight to opacity:1. */
    transition: opacity 0.3s ease, display 0.3s ease allow-discrete;
}

@starting-style {
    .poll__cultuur-logo {
        opacity: 0;
    }
}

@media screen and (max-width: 200px) {
    .poll__cultuur-logo {
        min-width: 100%;
    }
}

@media screen and (max-width: 500px) {
    .poll__cultuur-logo {
        width: calc(
            100% + (env(safe-area-inset-left) + env(safe-area-inset-right))
        ); /* Adjust width based on padding/margin if needed */
        margin-top: -40px; /* Adjust based on the extra width added */
    }

    /* Not enough vertical room for it alongside the results panel + both
       action buttons on a small screen — only show it on the question
       side. #results-view is the cultuur logo's earlier sibling in the
       DOM, so ":not([hidden]) ~" matches it while results are showing. */
    #results-view:not([hidden]) ~ .poll__cultuur-logo {
        display: none;
        opacity: 0;
    }
}

@media screen and (orientation: landscape) {
    .poll__cultuur-logo {
        width: 40%;
        margin-top: -10%; /* Adjust based on the extra width added */
    }
}

.poll__error {
    color: var(--poll-white);
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
