/*
 * Login/homepage hero background -- scoped entirely under body.guest.hero, which is
 * only ever applied to the logged-out login screen (see AuthController::showLogin()
 * and layout.php's $heroBackground flag). forgot-password/reset-password stay on the
 * plain body.guest styling in app.css, untouched. Nothing here reaches body.app.
 *
 * Loaded only on the login page (conditional <link> in layout.php), so it never adds
 * weight to any other page, including every screen inside the logged-in app.
 */

/* Frosted-panel colors, themed the same way every other color in app.css is: a light
   default in :root, overridden for dark via both the OS-preference media query and an
   explicit data-theme="dark" attribute. The background photography and dark overlay
   stay constant across themes (see the design note above .login-hero-overlay) -- only
   the login card itself and its contents adapt. */
:root {
    --color-hero-panel: rgba(255, 255, 255, 0.85);
    --color-hero-panel-border: rgba(15, 15, 20, 0.14);
    --color-hero-panel-text: #16181c;
    --color-hero-input-bg: rgba(255, 255, 255, 0.7);
    --color-hero-link: #0b4fd6;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-hero-panel: rgba(17, 19, 23, 0.68);
        --color-hero-panel-border: rgba(255, 255, 255, 0.16);
        --color-hero-panel-text: #f2f2f2;
        --color-hero-input-bg: rgba(255, 255, 255, 0.08);
        --color-hero-link: #9db8ff;
    }
}

:root[data-theme="dark"] {
    --color-hero-panel: rgba(17, 19, 23, 0.68);
    --color-hero-panel-border: rgba(255, 255, 255, 0.16);
    --color-hero-panel-text: #f2f2f2;
    --color-hero-input-bg: rgba(255, 255, 255, 0.08);
    --color-hero-link: #9db8ff;
}

/* The header sits directly on the dark overlay (not the frosted card), so its text
   stays light regardless of the light/dark/system choice -- flipping it dark in
   "light" mode would fail contrast against the still-dark photo overlay underneath. */
body.guest.hero .site-header {
    /* Must outrank main's stacking context (z-index: 2 > main's 1), not just tie with
       it -- main establishes its own stacking context (it's position:relative with a
       z-index), and its fixed-position background children are trapped inside that
       context. A tie at the same z-index falls back to DOM order, and main comes after
       the header, so a mere z-index: 1 here would let main's whole stacking context --
       background photo included -- paint over the header despite the header "winning"
       against the photo layers individually. */
    position: relative;
    z-index: 2;
    /* A dedicated dark bar, not just the shared overlay gradient at its topmost point --
       some of the 6 rotating photos are much brighter than others right at the very top
       (e.g. a daytime sky), and the header's brand text/theme controls need reliably
       readable contrast no matter which one is currently showing. */
    background: rgba(4, 6, 10, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

body.guest.hero .site-title {
    color: #f5f5f5;
}

body.guest.hero .theme-toggle button {
    color: #e6e6e6;
    border-color: rgba(255, 255, 255, 0.4);
}

body.guest.hero .theme-toggle button[aria-pressed="true"] {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.6);
}

body.guest.hero .skip-link:focus {
    z-index: 3;
}

/* Fixed full-viewport photo layer. This element's OWN background-image is the no-JS
   and reduced-motion fallback -- a single static photo -- and is never modified by
   login.js. The two child slides are purely additive: with JS and motion allowed,
   login.js crossfades between them; either layer, or neither, leaves this base image
   visible underneath. */
.login-hero-bg {
    position: fixed;
    inset: 0;
    z-index: -3;
    background-image: url("/assets/login/background1.jpg");
    background-size: cover;
    background-position: center;
    background-color: #101114;
}

.login-hero-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 2.4s ease;
}

.login-hero-slide.is-active {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .login-hero-slide {
        transition: none;
    }
}

/* Dark gradient over the photography: darkest at the very top (header legibility) and
   bottom (card legibility), lighter through the middle so the photo itself still
   reads. Deliberately constant across themes -- it's toning real photography, not
   part of the app's light/dark palette. */
.login-hero-overlay {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(
        180deg,
        rgba(4, 6, 10, 0.68) 0%,
        rgba(4, 6, 10, 0.4) 42%,
        rgba(4, 6, 10, 0.76) 100%
    );
}

body.guest.hero {
    background: #101114;
}

body.guest.hero main {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    justify-content: center;
    width: 100%;
    max-width: none;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 2.5rem 1.5rem;
    gap: 0;
}

body.guest.hero main > .alert {
    width: 100%;
    max-width: 26rem;
}

.login-branding {
    margin-bottom: 1.75rem;
}

.login-logo-badge {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 0.6rem 1.1rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.login-logo {
    display: block;
    width: 200px;
    max-width: 60vw;
    height: auto;
}

.login-card {
    width: 100%;
    max-width: 26rem;
    background: var(--color-hero-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--color-hero-panel-border);
    border-radius: 12px;
    padding: 2rem 2rem 1.75rem;
    color: var(--color-hero-panel-text);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.login-card h1 {
    margin-top: 0;
    color: var(--color-hero-panel-text);
}

.login-card label {
    color: var(--color-hero-panel-text);
}

.login-card .page-subtitle {
    color: var(--color-hero-panel-text);
    opacity: 0.75;
}

.login-card input[type="email"],
.login-card input[type="password"] {
    background: var(--color-hero-input-bg);
    border-color: var(--color-hero-panel-border);
    color: var(--color-hero-panel-text);
}

.login-card a {
    color: var(--color-hero-link);
}

/* Fallback for browsers without backdrop-filter support: a slightly more opaque panel
   still reads cleanly against the darkened photo, just without the frosted-glass blur. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root {
        --color-hero-panel: rgba(255, 255, 255, 0.94);
    }

    @media (prefers-color-scheme: dark) {
        :root:not([data-theme="light"]) {
            --color-hero-panel: rgba(15, 17, 20, 0.92);
        }
    }

    :root[data-theme="dark"] {
        --color-hero-panel: rgba(15, 17, 20, 0.92);
    }
}
