/*
 * Login page only (templates/index.tpl). Never loaded by the backoffice layout.
 * Colours of sky and mountains are CSS custom properties that js/login.js
 * rewrites from the sun position over Soelden; the values below are the
 * daytime palette used without JavaScript.
 */
:root {
    --sky-top: #3f7fc4;
    --sky-mid: #8dbfe2;
    --sky-bottom: #d4e9f4;
    --m1: #a5bdd2;
    --m2: #7d93aa;
    --m3: #4a5c6b;
    --m4: #2a3640;
    --haze: #dcecf5;
    --snow: #ffffff;
    --cable: #2a3640;
    --lights: 0;

    --ink: #2b2830;
    --ink-soft: #4d4652;
    --brass: #9a7543;
    --brass-text: #6b4e27;
    --anthracite: #2e2b31;
    --field-border: #8c8490;
}

[hidden] {
    display: none !important;
}

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

body.login-page {
    font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--sky-bottom);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ---- Backdrop -------------------------------------------------------- */

.login-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.login-sky {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 42%, var(--sky-bottom) 70%);
}

.login-celestial,
.login-snowfall {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.login-layer {
    position: absolute;
    display: block;
    top: 0;
    left: -60px;
    width: calc(100% + 120px);
    height: calc(100% + 48px);
    will-change: transform;
}

.login-snowcap {
    fill: var(--snow);
    opacity: 0.85;
}

.login-layer--far .login-snowcap {
    opacity: 0.6;
}

.login-cable {
    fill: none;
    stroke: var(--cable);
    stroke-width: 1;
    opacity: 0.4;
}

.login-station,
.login-gondola rect {
    fill: var(--cable);
}

.login-gondola path {
    stroke: var(--cable);
    stroke-width: 1;
}

.login-lights {
    fill: #ffd28a;
    opacity: var(--lights);
}

/* ---- Card ------------------------------------------------------------ */

.login-main {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 32px clamp(24px, 8vw, 140px);
}

.login-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 400px;
    padding: 34px 36px 22px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 30px 70px -28px rgba(8, 12, 24, 0.55), 0 2px 8px rgba(8, 12, 24, 0.08);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .login-card {
        background: rgba(255, 255, 255, 0.8);
        -webkit-backdrop-filter: blur(18px) saturate(1.25);
        backdrop-filter: blur(18px) saturate(1.25);
    }
}

.login-logo {
    display: block;
    width: 188px;
    height: auto;
    margin: 0 auto 20px;
}

.login-greeting {
    margin: 0;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--brass-text);
}

.login-title {
    margin: 2px 0 22px;
    text-align: center;
    font-size: 26px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--ink);
}

/* GlobalMessage renders <ul id="globalMessageContainer"><li class="error">...</li></ul> */
.login-alert ul {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
}

.login-alert li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 13px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.45;
    background: #eef6ee;
    border: 1px solid #b4d3b6;
    color: #1f5124;
}

.login-alert li + li {
    margin-top: 8px;
}

.login-alert li.error {
    background: #fbeceb;
    border-color: #e5b4ae;
    color: #7a1f17;
}

.login-alert li.error::before {
    content: "";
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='9' fill='none' stroke='%237a1f17' stroke-width='1.6'/%3E%3Cpath d='M10 5.5v5.5' stroke='%237a1f17' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='14.2' r='1.1' fill='%237a1f17'/%3E%3C/svg%3E") no-repeat center / contain;
}

.login-field {
    margin-bottom: 16px;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap input {
    padding-right: 96px;
}

.login-field label {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
}

.login-field input {
    box-sizing: border-box;
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0 14px;
    font: inherit;
    font-size: 16px; /* >= 16px keeps iOS from zooming on focus */
    color: var(--ink);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--field-border);
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-field input:focus {
    outline: none;
    border-color: var(--brass-text);
    box-shadow: 0 0 0 3px rgba(154, 117, 67, 0.38);
}

.login-reveal {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    min-height: 32px;
    padding: 4px 8px;
    font: inherit;
    font-size: 13px;
    color: var(--brass-text);
    background: none;
    border: 0;
    border-radius: 6px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.login-reveal:focus-visible {
    outline: 2px solid var(--brass-text);
    outline-offset: 2px;
}

.login-hint {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--brass-text);
}

.login-second-factor {
    margin-bottom: 16px;
}

.login-submit {
    display: block;
    width: 100%;
    height: 48px;
    margin-top: 8px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #ffffff;
    background: var(--anthracite);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.login-submit:hover {
    background: #7c5c30;
}

.login-submit:active {
    transform: translateY(1px);
}

.login-submit:focus-visible {
    outline: 3px solid var(--brass-text);
    outline-offset: 3px;
}

.login-submit[aria-busy="true"] {
    cursor: progress;
    background: #4a4650;
}

.login-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 22px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(43, 40, 48, 0.14);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
}

/* ---- Small screens: card at the bottom, peaks and sky stay visible above ---- */

@media (max-width: 720px) {
    /* Size each layer to its full aspect ratio and shift it so the summit
       (x = 528 of 1600) sits in the middle instead of being cropped away. */
    .login-layer {
        width: calc((100vh + 48px) * 1.7778);
        left: calc(50vw - (100vh + 48px) * 0.5867);
    }

    .login-main {
        align-items: flex-end;
        justify-content: center;
        padding: 24px 16px max(16px, env(safe-area-inset-bottom));
    }

    .login-card {
        padding: 26px 22px 18px;
        border-radius: 16px;
    }

    .login-logo {
        width: 156px;
        margin-bottom: 14px;
    }

    .login-title {
        margin-bottom: 18px;
        font-size: 23px;
    }
}

@media (max-height: 560px) and (min-width: 721px) {
    .login-main {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-layer {
        will-change: auto;
    }

    .login-field input,
    .login-submit {
        transition: none;
    }
}

@media (forced-colors: active) {
    .login-scene {
        display: none;
    }

    .login-card {
        border: 1px solid CanvasText;
    }
}
