*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body.login {
    background: #1B1840;
    color: #F2ECE2;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

/* Bakgrunnen: bredt bilde på PC, smalt på mobil */
.scene {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    background: #1B1840 url("../tema/standard/bakgrunn-mobil.jpg") center bottom / cover no-repeat;
}

@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
    .scene { background-image: url("../tema/standard/bakgrunn-pc.jpg"); background-position: center center; }
}

/* Skjemaet står midt på plenen */
.login-form {
    position: absolute;
    left: 50%;
    top: 41%;
    transform: translateX(-50%);
    width: min(360px, 92vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
    .login-form { top: 53%; width: min(920px, 94vw); gap: 14px; }
}

.fields {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
    .fields { flex-direction: row; gap: 16px; }
}

/* Feltene er bildene, med et ekte tekstfelt oppå den svarte flaten */
.field {
    position: relative;
    flex: 1 1 0;
    aspect-ratio: 1200 / 310;
}

.field img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
}

.field input {
    position: absolute;
    left: 18.75%;
    top: 30.6%;
    height: 40.3%;
    width: 71%;
    padding: 0 6px;
    border: none;
    outline: none;
    background: transparent;
    color: #F2ECE2;
    font: 700 clamp(17px, 2.2vw, 22px) / 1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    caret-color: #F7A62B;
}

.field--pass input { width: 61%; }

.field input::placeholder { color: #CFC6B8; opacity: 1; }

/* Gløden rundt feltet når man skriver i det */
.field:focus-within img { filter: drop-shadow(0 0 10px rgba(255, 170, 40, 0.75)); }

.toggle-pass {
    position: absolute;
    left: 81%;
    top: 26%;
    width: 11%;
    height: 48%;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
}

.toggle-pass:focus-visible { outline: 2px solid #FFE27A; outline-offset: 2px; }

.toggle-pass[aria-pressed="true"]::after {
    content: "";
    position: absolute;
    left: 15%; right: 15%;
    top: 50%;
    height: 3px;
    background: #E8E2D8;
    transform: rotate(-35deg);
}

.error {
    margin: 0;
    padding: 8px 14px;
    border-radius: 6px;
    background: rgba(120, 20, 20, 0.85);
    border: 2px solid #FF8A65;
    color: #FFF3EF;
    font-weight: 600;
    font-size: 15px;
    text-align: center;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px 22px;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 6px;
    font-weight: 600;
    font-size: 15px;
    color: #FFE7A8;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.remember input { width: 20px; height: 20px; margin: 0; accent-color: #F28C1E; }

.btn-login {
    min-height: 48px;
    padding: 0 34px;
    border: 3px solid #3A2414;
    border-radius: 4px;
    background: linear-gradient(#FFC24A, #F28C1E);
    box-shadow: 0 0 18px rgba(255, 170, 40, 0.7), inset 0 -4px 0 rgba(0, 0, 0, 0.25);
    color: #2A160A;
    font: 800 16px / 1 ui-monospace, "Cascadia Mono", Consolas, monospace;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
}

.btn-login:hover { filter: brightness(1.08); }
.btn-login:active { transform: translateY(2px); box-shadow: 0 0 12px rgba(255, 170, 40, 0.6), inset 0 -2px 0 rgba(0, 0, 0, 0.25); }
.btn-login:focus-visible { outline: 3px solid #FFE27A; outline-offset: 3px; }

/* ================= Temaer ================= */

/* Jul */
.tema-jul .scene { background-color: #0B1633; background-image: url("../tema/jul/bakgrunn-mobil.jpg"); }
.tema-jul .login-form { top: 58%; }
@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
    .tema-jul .scene { background-image: url("../tema/jul/bakgrunn-pc.jpg"); }
    .tema-jul .login-form { top: 54%; }
}
.tema-jul .btn-login { background: linear-gradient(#E5484D, #B3202A); color: #fff; box-shadow: 0 0 14px rgba(229, 72, 77, .5); }
.tema-jul .remember input { accent-color: #D63A2F; }
.tema-jul .remember { background: rgba(15, 22, 51, .6); padding: 6px 12px; border-radius: 8px; color: #fff; text-shadow: none; }

/* Juleskiltene: lyst tekstfelt til høyre, hengelåsen viser/skjuler passordet */
.tema-jul .field input {
    left: 53%;
    top: 41%;
    height: 26%;
    width: 34%;
    color: #3B2412;
    caret-color: #B3202A;
    font-size: clamp(16px, 2vw, 21px);
}
.tema-jul .field--pass input { left: 53.5%; width: 33.5%; }
.tema-jul .field input::placeholder { color: transparent; }
.tema-jul .toggle-pass { left: 48.3%; top: 38%; width: 5%; height: 32%; }
.tema-jul .toggle-pass[aria-pressed="true"]::after { background: #B3202A; }
.tema-jul .field:focus-within img { filter: drop-shadow(0 0 12px rgba(255, 210, 120, 0.8)); }

/* Tema uten eget PC-bilde: mobilbildet står i midten, med en uskarp kopi bak */
@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
    .uten-pc-bakgrunn .scene { background-image: none; overflow: hidden; isolation: isolate; }
    .uten-pc-bakgrunn .scene::before,
    .uten-pc-bakgrunn .scene::after {
        content: "";
        position: absolute;
        background-repeat: no-repeat;
        background-position: center center;
    }
    .uten-pc-bakgrunn .scene::before { inset: -40px; z-index: -2; background-size: cover; filter: blur(28px) brightness(.5); }
    .uten-pc-bakgrunn .scene::after { inset: 0; z-index: -1; background-size: contain; }
    .tema-jul.uten-pc-bakgrunn .scene::before,
    .tema-jul.uten-pc-bakgrunn .scene::after { background-image: url("../tema/jul/bakgrunn-mobil.jpg"); }
    .uten-pc-bakgrunn .login-form { top: 58%; width: min(400px, 44vh, 92vw); gap: 10px; }
    .uten-pc-bakgrunn .fields { flex-direction: column; gap: 6px; }
}

/* Snø som daler (slås av for de som har bedt om mindre bevegelse) */
.tema-jul .fx {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .95) 0 2.5px, transparent 3.5px),
        radial-gradient(circle at 70% 60%, rgba(255, 255, 255, .8) 0 1.8px, transparent 2.8px),
        radial-gradient(circle at 10% 80%, rgba(255, 255, 255, .6) 0 1.2px, transparent 2.2px),
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, .5) 0 1px, transparent 2px);
    background-size: 251px 263px, 173px 191px, 119px 127px, 67px 83px;
    animation: snow 30s linear infinite;
    opacity: .8;
}
@keyframes snow {
    from { background-position: 0 0, 40px 0, 15px 0, 5px 0; }
    to { background-position: 120px 1052px, 0 955px, 70px 635px, 30px 498px; }
}
@media (prefers-reduced-motion: reduce) { .tema-jul .fx { animation: none; opacity: .4; } }

/* ---------- Syden ---------- */
.tema-syden .scene { background-color: #2B1A3A; background-image: url("../tema/syden/bakgrunn-pc.jpg"); background-position: 16% center; }
@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
    .tema-syden .scene { background-position: center center; }
    .tema-syden .login-form { top: 47%; left: 62%; width: min(640px, 48vw); }
    .tema-syden .fields { flex-direction: column; gap: 8px; }
}
.tema-syden .login-form { top: 44%; }
.tema-syden .field { aspect-ratio: 1500 / 255; }
.tema-syden .field input {
    left: 52.5%;
    top: 34%;
    height: 42%;
    width: 42%;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(25, 10, 30, .45);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    color: #FFF8EC;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
    caret-color: #FFC15A;
    font-size: clamp(14px, 1.7vw, 20px);
}
.tema-syden .field--pass input { left: 45%; width: 39%; }
.tema-syden .field input::placeholder { color: transparent; }
.tema-syden .toggle-pass { left: 85.5%; top: 30%; width: 9%; height: 46%; }
.tema-syden .toggle-pass[aria-pressed="true"]::after { background: #FF5E7E; }
.tema-syden .field:focus-within img { filter: drop-shadow(0 0 12px rgba(255, 190, 90, .9)); }
.tema-syden .btn-login { background: linear-gradient(#FFC15A, #FF7A45); color: #2A0F05; box-shadow: 0 0 16px rgba(255, 140, 70, .55); }
.tema-syden .remember { background: rgba(40, 15, 45, .55); padding: 6px 12px; border-radius: 8px; color: #fff; }
.tema-syden .remember input { accent-color: #FF7A45; }

/* Varme lysprikker som svever sakte oppover, som solgnister */
.tema-syden .fx {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 30% 40%, rgba(255, 214, 140, .55) 0 3px, transparent 7px),
        radial-gradient(circle at 70% 70%, rgba(255, 170, 110, .45) 0 2px, transparent 6px),
        radial-gradient(circle at 15% 85%, rgba(255, 240, 200, .5) 0 1.5px, transparent 4px);
    background-size: 331px 347px, 223px 241px, 157px 173px;
    animation: sparkle 40s linear infinite;
    mix-blend-mode: screen;
}
@keyframes sparkle {
    from { background-position: 0 0, 60px 0, 20px 0; }
    to { background-position: 80px -1388px, 0 -964px, 60px -692px; }
}
@media (prefers-reduced-motion: reduce) { .tema-syden .fx { animation: none; opacity: .5; } }
