:root {
    color-scheme: only light;
    --favicon-url: url('https://cdn-universe.fortytwo.io/checkid/ssikt/ssikt-icon-1.png');
    --logo-url-colorful: url('https://cdn-universe.fortytwo.io/checkid/ssikt/logo-07.png');
    --logo-url-white: url('https://cdn-universe.fortytwo.io/checkid/ssikt/logo-07.png');
    --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/ssikt/ssikt-background.jpeg')
        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"
   FIX: also target p one level deeper (.container > div > div > p),
   which covers "Vi beklager..." / "Av sikkerhetsårsaker..." on the
   select-account error page */
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,
body.background-gray .app > .container > div > div > p,
body.background-purple .app > .container > div > div > p,
body:not(.background-gray):not(.background-purple) .app > .container > div > 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 white and readable */
body.background-gray .bottom-card,
body.background-purple .bottom-card,
body:not(.background-gray):not(.background-purple) .bottom-card {
    background-color: #FFFFFF;
    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: #FFFFFF;
    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: safety net – if a bottom-card ever contains the nested div > div > p
   structure, keep that text dark (this rule is more specific than the white
   text rule above) */
body.background-gray .bottom-card .container div > p,
body.background-purple .bottom-card .container div > p,
body:not(.background-gray):not(.background-purple) .bottom-card .container div > p {
    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;
}

/* 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: #FFFFFF;
        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: #FFFFFF;
        height: auto;
        min-height: auto;
        max-height: none;
        overflow: visible;
        padding-bottom: 32px;
    }
}