/*
 * VEIC 2027 — shared responsive login layout (v2.344.25).
 *
 * Presentation only. Every selector is scoped to a login root: .veic-login-responsive (added to the
 * administrator and delegate sign-in screens) or #veic-lt (the existing administrator lamp, whose own
 * script rewrites its class list). Nothing here styles html, body, the site header/footer, the
 * authenticated dashboards or the registration forms, and there are no global !important overrides.
 * (The only body reference is body.admin-bar, which sets the --veic-lr-reserve custom property below.)
 *
 * Principles
 *  - Width: fluid. A login root fills its parent and is capped by the saved Login Page Max Width
 *    (--veic-al-width / --veic-dp-max-width, set inline from veic_login_max_width — unchanged).
 *  - Height (v2.344.26): every login root has min-height = 100dvh (100vh fallback) minus
 *    --veic-lr-reserve, so it fills the available viewport at normal zoom. It is never a fixed height:
 *    height stays auto, forms grow naturally and the page scrolls instead of clipping controls.
 *    --veic-lr-reserve (default 0px) is the vertical space the surrounding page already uses (WordPress
 *    admin bar is handled below; a site header/footer can be subtracted by setting the token on the
 *    login root or any ancestor, e.g. --veic-lr-reserve: 120px).
 *  - Switches between "artwork beside the card" and "artwork above the card" follow the width of the
 *    login container itself (@container), not the browser window, so an embedded layout behaves too.
 *  - Artwork is scaled, never stretched: SVGs keep their viewBox aspect ratio.
 *
 * Every layout switch appears twice: as an @container rule and as a viewport @media fallback
 * under @supports not (container-type: inline-size). Keep the two copies identical when editing.
 */

/* ── 0. Zero-specificity defaults (themes override these tokens) ────────────── */
:where(.veic-login-responsive) {
    --veic-lr-pad: clamp(14px, 3.6vw, 50px);
    --veic-lr-gap: clamp(10px, 3.2vw, 46px);
    --veic-lr-panel: 440px;
    --veic-lr-justify: center;
    --veic-lr-art-vh: 64;
}
/* --veic-lr-reserve = vertical space the surrounding page already uses (default 0px, via the var() fallback in
   each min-height below, so it can be set on the login root or any ancestor). Logged-in WordPress visitors get
   the admin bar above the page, so the token is set once on body.admin-bar (custom property only) and inherited. */
:where(body.admin-bar) { --veic-lr-reserve: 32px; }
@media (max-width: 782px) {
    :where(body.admin-bar) { --veic-lr-reserve: 46px; }
}
:where(.veic-admin-animated-login.veic-login-responsive) { --veic-lr-cap: var(--veic-al-width, 1500px); }
:where(.veic-dp-animated-login.veic-login-responsive) { --veic-lr-cap: var(--veic-dp-max-width, 1500px); --veic-lr-panel: 446px; }

/* ── 1. Generic guards inside a login root ──────────────────────────────────── */
:is(.veic-login-responsive, #veic-lt) { box-sizing: border-box; min-width: 0; margin-inline: auto; }
:is(.veic-login-responsive, #veic-lt) *,
:is(.veic-login-responsive, #veic-lt) *::before,
:is(.veic-login-responsive, #veic-lt) *::after { box-sizing: border-box; }
:is(.veic-login-responsive, #veic-lt) :is(input, select, textarea, button) { max-width: 100%; min-width: 0; }
:is(.veic-login-responsive, #veic-lt) :is(h1, h2, h3, p, label, a, strong) { overflow-wrap: anywhere; }

/* ── 2. Animated themes — administrator and delegate ────────────────────────── */

:is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive {
    container-type: inline-size;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    justify-content: var(--veic-lr-justify);
    gap: var(--veic-lr-gap);
    width: 100%;
    min-width: 0;
    max-width: min(100%, var(--veic-lr-cap));
    min-height: calc(100vh - var(--veic-lr-reserve, 0px));   /* v2.344.26 — fill the viewport (fallback) */
    min-height: calc(100dvh - var(--veic-lr-reserve, 0px));  /* preferred: dynamic viewport height */
    height: auto;                                            /* grows with content; never a fixed height */
    padding: var(--veic-lr-pad);
}

/* Default composition = artwork above the card (also what a browser without container queries gets). */
:is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-art {
    flex: 0 0 min(100%, 480px);
    width: min(100%, 480px);
    min-width: 0;
    height: clamp(120px, 30vw, 200px);
    height: clamp(120px, 30cqi, 200px);
    aspect-ratio: auto;
    max-height: none;
    margin: 0;
}
:is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-panel {
    flex: 0 1 var(--veic-lr-panel);
    width: min(100%, var(--veic-lr-panel));
    min-width: 0;
    margin: 0;
}

@container (max-width: 799px) {
    :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive .veic-al-console { inset: 5% auto; aspect-ratio: 1.32; left: 50%; translate: -50% 0; overflow: hidden; }
    @media (max-height: 520px) {
        :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-art { height: clamp(72px, 24vh, 130px); }
    }
}
@supports not (container-type: inline-size) {
    @media (max-width: 859px) {
        :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive .veic-al-console { inset: 5% auto; aspect-ratio: 1.32; left: 50%; translate: -50% 0; overflow: hidden; }
        @media (max-height: 520px) {
            :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-art { height: clamp(72px, 24vh, 130px); }
        }
    }
}

@container (min-width: 800px) {
    :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-art {
        flex: 1 1 0;
        width: auto;
        height: auto;
        aspect-ratio: 5 / 4;
        max-height: clamp(300px, calc(var(--veic-lr-art-vh) * 1vh), 720px);
    }
    @supports (height: 1svh) {
        :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-art { max-height: clamp(300px, calc(var(--veic-lr-art-vh) * 1svh), 720px); }
    }
    :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-panel {
        flex: 0 0 clamp(300px, 40%, var(--veic-lr-panel));
        width: auto;
    }
}
@supports not (container-type: inline-size) {
    @media (min-width: 860px) {
        :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-art {
            flex: 1 1 0;
            width: auto;
            height: auto;
            aspect-ratio: 5 / 4;
            max-height: clamp(300px, calc(var(--veic-lr-art-vh) * 1vh), 720px);
        }
        @supports (height: 1svh) {
            :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-art { max-height: clamp(300px, calc(var(--veic-lr-art-vh) * 1svh), 720px); }
        }
        :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive > .veic-al-panel {
            flex: 0 0 clamp(300px, 40%, var(--veic-lr-panel));
            width: auto;
        }
    }
}

/* Short windows (landscape phones, 200% zoom): the root is only ever a min-height of the viewport and
   height stays auto, so content grows the page and the page scrolls; nothing is clipped. (v2.344.26: the
   former "min-height: 0" short-window override is gone so the theme keeps filling the viewport.) */

/* ── 3. Administrator — Classic Card ────────────────────────────────────────── */
.veic-auth-wrap.veic-login-responsive {
    /* v2.344.26 — beats the screen's inline .veic-auth-wrap min-height clamp by specificity (2 classes vs 1). */
    min-height: calc(100vh - var(--veic-lr-reserve, 0px));
    min-height: calc(100dvh - var(--veic-lr-reserve, 0px));
    height: auto;
    padding: clamp(14px, 4vw, 30px) clamp(10px, 3vw, 16px);
    overflow-wrap: anywhere;
}
.veic-auth-wrap.veic-login-responsive .veic-auth-box { min-width: 0; }
.veic-auth-wrap.veic-login-responsive .veic-auth-header { padding: clamp(20px, 5vw, 32px) clamp(16px, 5vw, 32px) clamp(18px, 4vw, 26px); }
.veic-auth-wrap.veic-login-responsive .veic-auth-body { padding: clamp(18px, 5vw, 28px) clamp(16px, 5vw, 32px) clamp(22px, 5vw, 32px); }

/* ── 4. Delegate — Classic Card (portal stylesheet stays untouched) ─────────── */
.veic-dp.veic-dp-auth.veic-login-responsive:not(.veic-dp-animated-login, .veic-dp-lamp-stage) {
    width: 100%;
    max-width: min(100%, var(--veic-dp-max-width, 1500px));
    /* v2.344.26 — fill the viewport: hero on top, sign-in card centred in the space left, footer at the bottom. */
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--veic-lr-reserve, 0px));
    min-height: calc(100dvh - var(--veic-lr-reserve, 0px));
    height: auto;
}
.veic-dp-auth.veic-login-responsive:not(.veic-dp-animated-login, .veic-dp-lamp-stage) > .veic-dp-auth-main {
    flex: 1 1 auto;
    justify-content: center;
}
.veic-dp-auth.veic-login-responsive:not(.veic-dp-animated-login, .veic-dp-lamp-stage) .veic-dp-hero-inner { min-width: 0; }
.veic-dp-auth.veic-login-responsive:not(.veic-dp-animated-login, .veic-dp-lamp-stage) .veic-dp-hero-auth .veic-dp-hero-title { font-size: clamp(1.35rem, 5vw, 1.9rem); }
.veic-dp-auth.veic-login-responsive:not(.veic-dp-animated-login, .veic-dp-lamp-stage) .veic-dp-auth-main { padding-inline: clamp(10px, 3vw, 20px); }
.veic-dp-auth.veic-login-responsive:not(.veic-dp-animated-login, .veic-dp-lamp-stage) .veic-dp-auth-card {
    min-width: 0;
    padding: clamp(18px, 5vw, 34px) clamp(16px, 5vw, 34px) clamp(20px, 4vw, 28px);
}

/* ── 5. Administrator — existing VEIC lamp (#veic-lt): shared touches only ──── */
/* Its layout lives in the screen's own inline stylesheet; this keeps long text inside the card. */
#veic-lt #veic-lt-card :is(h2, p, span, label) { overflow-wrap: anywhere; }
/* v2.344.26 — fill the viewport. The screen's inline <style> sets #veic-lt min-height (clamp 440–800px) and a
   max-height:560px reset at specificity 1-0-0; the element selector here (1-0-1) wins without !important. */
div#veic-lt {
    min-height: calc(100vh - var(--veic-lr-reserve, 0px));
    min-height: calc(100dvh - var(--veic-lr-reserve, 0px));
    height: auto;
}

/* ── 6. Delegate — GDF lamp stage: shared touches only ─────────────────────── */
.veic-dp-lamp-stage.veic-login-responsive {
    max-width: min(100%, 1300px);
    /* v2.344.26 — fill the viewport. The stage keeps its 22px top/bottom margin (veic-delegate-login-lamp.css),
       so 44px is subtracted; the layout inside grows to fill the stage. */
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 44px - var(--veic-lr-reserve, 0px));
    min-height: calc(100dvh - 44px - var(--veic-lr-reserve, 0px));
    height: auto;
}
/* The layout's own 480–760px viewport floor (and its short-window reset) is superseded by the stage's min-height
   (3 classes beat the 2-class rules in veic-delegate-login-lamp.css). */
.veic-dp-lamp-stage.veic-login-responsive > .veic-dp-lamp-layout { flex: 1 1 auto; min-height: 0; }
/* Stacked (narrow) composition: lamp stays at the top, the sign-in card is centred in the space below it.
   Side-by-side (>= 880px) keeps its own single-row grid, which already centres the card. */
@container (max-width: 879px) {
    .veic-dp-lamp-stage.veic-login-responsive > .veic-dp-lamp-layout { grid-template-rows: auto 1fr; }
    .veic-dp-lamp-stage.veic-login-responsive > .veic-dp-lamp-layout > .veic-dp-lamp-panel { align-self: center; }
}

/* ── 7. Gallery preview documents (sandboxed iframe) ────────────────────────── */
/* v2.344.26 — the preview iframe is the viewport; its own padding and demo-controls row (~76px) are reserved so the
   mock fills the frame without adding a scrollbar. */
.veic-preview-document { --veic-lr-reserve: 76px; }
@media (max-width: 430px) { .veic-preview-document { --veic-lr-reserve: 120px; } } /* demo controls wrap to two rows */
.veic-preview-document :is(.veic-admin-animated-login, .veic-dp-animated-login).veic-login-responsive { margin: 0 auto; }
