:root {
    color-scheme: only light;
    --favicon-url: url('https://cdn-universe.fortytwo.io/checkid/leroy/favicon.png');
    --logo-url-colorful: url('https://cdn-universe.fortytwo.io/checkid/leroy/logo.svg');
    --logo-url-white: url('https://cdn-universe.fortytwo.io/checkid/leroy/logo.svg');
    --logo-height: 140px;
    --logo-width: 428px;
}

body.background-gray,
body.background-purple,
body:not(.background-gray):not(.background-purple) {
    color-scheme: only light;
    background:
        url('https://cdn-universe.fortytwo.io/checkid/leroy/blatime_fiskebater_skjar_foto_montag.webp')
        center bottom / cover no-repeat fixed;
    background-color: #DDEEF6;
}

body.background-gray .app,
body.background-purple .app,
body:not(.background-gray):not(.background-purple) .app {
    background: transparent;
}

body.background-gray .app > .container,
body.background-purple .app > .container,
body:not(.background-gray):not(.background-purple) .app > .container {
    align-items: center;
}

/* Logo scaling */
body.background-gray .logo-colorful,
body.background-gray .logo-white,
body.background-purple .logo-colorful,
body.background-purple .logo-white,
body:not(.background-gray):not(.background-purple) .logo-colorful,
body:not(.background-gray):not(.background-purple) .logo-white {
    align-self: center;
    margin-inline: auto;
    width: min(var(--logo-width), calc(100vw - 48px));
    max-width: calc(100vw - 48px);
    height: var(--logo-height);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: none;
    forced-color-adjust: none;
}

/* Top headings and intro text on dark background */
body.background-gray h1,
body.background-purple h1,
body:not(.background-gray):not(.background-purple) h1,
body.background-gray .text-color-accent,
body.background-purple .text-color-accent,
body:not(.background-gray):not(.background-purple) .text-color-accent,
body.background-gray .text-color-alternative,
body.background-purple .text-color-alternative,
body:not(.background-gray):not(.background-purple) .text-color-alternative {
    color: #FFFFFF;
    -webkit-text-fill-color: #FFFFFF;
    forced-color-adjust: none;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}

/* Center text like "Velg konto" and "La oss sette opp kontoen din" */
body.background-gray .app > .container > div > p,
body.background-purple .app > .container > div > p,
body:not(.background-gray):not(.background-purple) .app > .container > div > p {
    width: 100%;
    text-align: center;
    color: #FFFFFF;
    -webkit-text-fill-color: #FFFFFF;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}

body.background-gray h1.heading-1,
body.background-purple h1.heading-1,
body:not(.background-gray):not(.background-purple) h1.heading-1 {
    width: 100%;
    max-width: 760px;
    text-align: center;
    white-space: normal;
    font-size: clamp(30px, 3vw, 40px);
    line-height: 1.15;
    color: #FFFFFF;
    -webkit-text-fill-color: #FFFFFF;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
    opacity: 1;
}

/* Cards must stay readable */
body.background-gray .bottom-card,
body.background-purple .bottom-card,
body:not(.background-gray):not(.background-purple) .bottom-card {
    background-color: rgba(255, 255, 255, 0.75);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    color: #111111;
    text-align: center;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
}

body.background-gray .bottom-card > .container,
body.background-purple .bottom-card > .container,
body:not(.background-gray):not(.background-purple) .bottom-card > .container {
    background-color: transparent;
    color: #111111;
    text-align: center;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
}

body.background-gray .bottom-card p,
body.background-gray .bottom-card a,
body.background-gray .bottom-card span,
body.background-gray .bottom-card .text-color-muted,
body.background-gray .bottom-card .text-color-accent,
body.background-gray .bottom-card .text-color-alternative,
body.background-purple .bottom-card p,
body.background-purple .bottom-card a,
body.background-purple .bottom-card span,
body.background-purple .bottom-card .text-color-muted,
body.background-purple .bottom-card .text-color-accent,
body.background-purple .bottom-card .text-color-alternative,
body:not(.background-gray):not(.background-purple) .bottom-card p,
body:not(.background-gray):not(.background-purple) .bottom-card a,
body:not(.background-gray):not(.background-purple) .bottom-card span,
body:not(.background-gray):not(.background-purple) .bottom-card .text-color-muted,
body:not(.background-gray):not(.background-purple) .bottom-card .text-color-accent,
body:not(.background-gray):not(.background-purple) .bottom-card .text-color-alternative {
    color: #111111;
    -webkit-text-fill-color: #111111;
    text-shadow: none;
}

/* Fix completed page text: Well Done and Helpful links */
body.completed-background-gradient .app > .container > p,
body.completed-background-gradient .app > .container > div > p {
    color: #FFFFFF;
    -webkit-text-fill-color: #FFFFFF;
    text-align: center;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}

/* Make "Nyttige lenker for å komme i gang" bigger */
body.completed-background-gradient main.app > .container > h1 + p {
    font-size: 20px;
    line-height: 1.4;
    color: #FFFFFF;
    -webkit-text-fill-color: #FFFFFF;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}

/* Fix Step 2 primary button text */
body.background-gray .button-primary,
body.background-purple .button-primary,
body:not(.background-gray):not(.background-purple) .button-primary,
body.background-gray .button-primary span,
body.background-purple .button-primary span,
body:not(.background-gray):not(.background-purple) .button-primary span {
    color: #FFFFFF;
    -webkit-text-fill-color: #FFFFFF;
    text-shadow: none;
    opacity: 1;
}

/* Center username and Temporary Access Pass values in Step 2 info box */
main.app div.padding-medium.background-color-secondary div.display-flex.align-items-center.gap-small {
    justify-content: center;
    width: 100%;
}

main.app div.padding-medium.background-color-secondary {
    text-align: center;
}

/* Put steps 1-4 in a slightly transparent white box */
main.app div.display-flex.flex-direction-column.gap-medium:has(> div.display-flex.flex-direction-row.gap-medium .list-bullet) {
    background-color: rgba(247, 247, 248, 0.75);
    border-radius: 12px;
    padding: 16px 20px;
}

/* Buttons */
body.background-gray .button-secondary.index-cta-button,
body.background-purple .button-secondary.index-cta-button,
body:not(.background-gray):not(.background-purple) .button-secondary.index-cta-button {
    background-color: #FFFFFF;
    color: #003B7A;
}

body.background-gray .button-secondary.index-cta-button svg,
body.background-purple .button-secondary.index-cta-button svg,
body:not(.background-gray):not(.background-purple) .button-secondary.index-cta-button svg {
    color: #003B7A;
    stroke: currentColor;
}

/* Put Logg ut on its own line below Tilbake */
main.app > .container > div.display-inline-flex:has(form[action="/logout"]) {
    display: flex;
    flex-direction: column;
    align-items: center;
}

main.app > .container > div.display-inline-flex:has(form[action="/logout"]) > button,
main.app > .container > div.display-inline-flex:has(form[action="/logout"]) > form[action="/logout"] {
    width: 160px;
}

main.app > .container > div.display-inline-flex:has(form[action="/logout"]) > form[action="/logout"] button[type="submit"] {
    width: 100%;
}

/* Footer on dark background */
body.background-purple .index-footer,
body.background-purple .index-footer p,
body.background-purple p.index-footer,
body.background-purple .text-color-alternative.index-footer,
body.background-gray .index-footer,
body.background-gray .index-footer p,
body.background-gray p.index-footer,
body.background-gray .text-color-alternative.index-footer,
body:not(.background-gray):not(.background-purple) .index-footer,
body:not(.background-gray):not(.background-purple) .index-footer p,
body:not(.background-gray):not(.background-purple) p.index-footer,
body:not(.background-gray):not(.background-purple) .text-color-alternative.index-footer {
    color: #FFFFFF;
    -webkit-text-fill-color: #FFFFFF;
    text-align: center;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}

/* Mobile fixes */
@media (max-width: 480px) {
    body.background-gray,
    body.background-purple,
    body:not(.background-gray):not(.background-purple) {
        background-attachment: scroll;
    }

    body.background-gray .logo-colorful,
    body.background-gray .logo-white,
    body.background-purple .logo-colorful,
    body.background-purple .logo-white,
    body:not(.background-gray):not(.background-purple) .logo-colorful,
    body:not(.background-gray):not(.background-purple) .logo-white {
        width: calc(100vw - 48px);
        max-width: calc(100vw - 48px);
        height: 90px;
    }

    body.background-gray .bottom-card,
    body.background-purple .bottom-card,
    body:not(.background-gray):not(.background-purple) .bottom-card {
        width: 100%;
        max-width: 100%;
        background-color: rgba(255, 255, 255, 0.75);
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
        height: auto;
        min-height: auto;
        max-height: none;
        overflow: visible;
    }

    body.background-gray .bottom-card > .container,
    body.background-purple .bottom-card > .container,
    body:not(.background-gray):not(.background-purple) .bottom-card > .container {
        width: 100%;
        max-width: 100%;
        background-color: transparent;
        height: auto;
        min-height: auto;
        max-height: none;
        overflow: visible;
        padding-bottom: 32px;
    }

    /* Compact and even mobile spacing for steps 1-4 */
    main.app div.display-flex.flex-direction-column.gap-medium:has(> div.display-flex.flex-direction-row.gap-medium .list-bullet) {
        width: 100%;
        box-sizing: border-box;
        padding: 14px 18px;
        gap: 6px;
        row-gap: 6px;
        text-align: left;
    }

    main.app div.display-flex.flex-direction-column.gap-medium:has(> div.display-flex.flex-direction-row.gap-medium .list-bullet)
    > div.display-flex.flex-direction-row.gap-medium {
        display: grid;
        grid-template-columns: 28px minmax(0, 1fr);
        column-gap: 10px;
        row-gap: 0;
        align-items: start;
        justify-content: start;
        width: 100%;
        min-height: 38px;
        text-align: left;
    }

    main.app div.display-flex.flex-direction-column.gap-medium:has(> div.display-flex.flex-direction-row.gap-medium .list-bullet)
    > div.display-flex.flex-direction-row.gap-medium
    .list-bullet {
        grid-column: 1;
        width: 28px;
        min-width: 28px;
        height: 28px;
        min-height: 28px;
        margin-top: 0;
        align-self: start;
        justify-self: start;
    }

    main.app div.display-flex.flex-direction-column.gap-medium:has(> div.display-flex.flex-direction-row.gap-medium .list-bullet)
    > div.display-flex.flex-direction-row.gap-medium
    > span.text-size-small {
        grid-column: 2;
        display: block;
        width: 100%;
        min-width: 0;
        text-align: left;
        line-height: 1.2;
    }

    main.app div.display-flex.flex-direction-column.gap-medium:has(> div.display-flex.flex-direction-row.gap-medium .list-bullet)
    > div.display-flex.flex-direction-row.gap-medium
    > span.text-size-small span {
        text-align: left;
        line-height: inherit;
    }
}

/* Not-ready / logout safety page text */
main.app .container div:has(img[src="/v2/assets/hilde_waiting.png"]) p.text-size-large {
    color: #ffffff;
}