/* ==========================================================================
   Mahacakra -- login page
   --------------------------------------------------------------------------
   Standalone. Layout/Login.php loads ONLY this file: no AdminLTE, no
   Bootstrap, no Font Awesome, no jQuery. The page is a headline, two inputs
   and a button, and pulling three framework stylesheets in to style that only
   bought cascade fights with metronic-skin.css. Icons are inline SVG in the
   view for the same reason.

   Tokens below are copied from /public/css/metronic-skin.css rather than
   imported -- that file is an override layer for AdminLTE markup and assumes
   AdminLTE is loaded underneath it. metronic-skin.css stays the source of
   truth; if a value changes there, change it here too. The list is short on
   purpose.

   Lives in /public/css, NOT /public/asset: the .gitignore excludes
   /public/asset wholesale, so the old /asset/css/login.css this replaces was
   invisible to git and shipped by hand. Anything under /public/css is tracked
   and deploys with the repo.
   ========================================================================== */

:root {
    color-scheme: light;

    /* from metronic-skin.css */
    --primary: #009EF7;
    --primary-active: #0095E8;
    --body: #181C32;
    --muted: #7E8299;
    --label: #3F4254;
    --input-border: #E4E6EF;
    --solid: #F5F8FA;
    --page: #F5F8FA;
    --danger: #F1416C;
    --danger-light: #FFF5F8;
    --success: #50CD89;
    --success-light: #E8FFF3;
    --radius: 0.475rem;
    --radius-lg: 0.625rem;

    /* login only -- the brand panel. Both stops are dark enough to carry
       plain white body copy: 5.2:1 at the top, 9.9:1 at the bottom. The
       accent is the light blue of the logo mark and is used for glow only,
       never behind text. */
    --brand-top: #1270BE;
    --brand-bottom: #083F73;
    --brand-accent: #38B6F5;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: Poppins, Helvetica, Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--body);
    background-color: var(--page);
    -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ shell */

.login-page {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ----------------------------------------------------------- brand column */

.login-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3rem;
    padding: 3.5rem 3rem;
    color: #fff;
    background: linear-gradient(160deg, var(--brand-top) 0%, var(--brand-bottom) 100%);
}

/* Two soft lights, sized in vmax so they scale with the viewport instead of
   banding across a wide monitor. Decorative: aria-hidden in the markup. */
.login-brand::before,
.login-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.login-brand::before {
    top: -18vmax;
    right: -14vmax;
    width: 44vmax;
    height: 44vmax;
    background: radial-gradient(circle, rgba(56, 182, 245, 0.42) 0%, rgba(56, 182, 245, 0) 62%);
}

.login-brand::after {
    bottom: -22vmax;
    left: -16vmax;
    width: 40vmax;
    height: 40vmax;
    background: radial-gradient(circle, rgba(113, 197, 232, 0.28) 0%, rgba(113, 197, 232, 0) 65%);
}

.login-brand > * {
    position: relative;
    z-index: 1;
}

.login-brand__mark {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

/* The logo mark is light blue on transparent -- it disappears straight onto
   the gradient, so it gets a white tile to sit on. */
.login-brand__logo {
    display: grid;
    place-items: center;
    width: 3.25rem;
    height: 3.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: 0 0.5rem 1.25rem rgba(4, 30, 55, 0.25);
}

.login-brand__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-brand__name {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.login-brand__tag {
    margin: 0;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.82);
}

/* The <picture> is only a wrapper for the WebP source; display: contents
   dissolves its box so the <img> stays the flex item the rules below assume
   -- without it `margin: auto` would apply to a child of the wrapper and
   centre nothing. It also means .login-brand > * does not reach the image,
   hence the position/z-index repeated below. */
.login-brand > picture {
    display: contents;
}

/* The column is flex + space-between with the mark pinned top and the
   copyright bottom, so `margin: auto` parks the cover in whatever room is
   left and keeps it centred. Height is capped as well as width: on a short
   laptop viewport an unbounded square would push the copyright off screen. */
.login-brand__cover {
    position: relative;
    z-index: 1;
    display: block;
    width: min(100%, 26rem);
    max-height: 58vh;
    margin: auto;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 1.25rem 2.5rem rgba(4, 30, 55, 0.28);
}

.login-brand__foot {
    margin: 0;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ------------------------------------------------------------ form column */

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background: #fff;
}

.login-card {
    width: 100%;
    max-width: 24rem;
}

/* Stands in for the brand column once it is dropped on narrow screens. */
.login-card__brand {
    display: none;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.login-card__logo {
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
}

.login-card__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-card__brandname {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.login-card h2 {
    margin: 0 0 0.375rem;
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.login-card__sub {
    margin: 0 0 2rem;
    color: var(--muted);
    font-size: 0.9375rem;
}

/* ----------------------------------------------------------------- alerts */

/* The flash payloads are built as raw <div class="alert alert-danger"> in
   HomeController and LaunchpadController. Matching those class names here is
   what lets the page drop Bootstrap -- do not rename without changing every
   setFlashdata() call that lands on this page. */
.alert {
    margin: 0 0 1.25rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    border: 1px solid transparent;
}

.alert-danger {
    color: var(--danger);
    background: var(--danger-light);
    border-color: rgba(241, 65, 108, 0.24);
}

.alert-success {
    color: #2f9c67;
    background: var(--success-light);
    border-color: rgba(80, 205, 137, 0.3);
}

/* ------------------------------------------------------------------ field */

.login-field {
    margin-bottom: 1.125rem;
}

.login-field label {
    display: block;
    margin-bottom: 0.4375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--label);
}

.login-input {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input__icon {
    position: absolute;
    left: 0.875rem;
    width: 1.125rem;
    height: 1.125rem;
    color: var(--muted);
    pointer-events: none;
}

.login-input input {
    width: 100%;
    padding: 0.75rem 0.875rem 0.75rem 2.75rem;
    font: inherit;
    font-size: 0.9375rem;
    color: var(--body);
    background: var(--solid);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.login-input input::placeholder {
    color: var(--muted);
}

.login-input input:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 158, 247, 0.18);
}

/* Chrome paints its own background over an autofilled field. The inset shadow
   is the only way to override it, and it has to be restated on :focus because
   it occupies the same box-shadow slot as the focus ring. */
.login-input input:-webkit-autofill {
    -webkit-text-fill-color: var(--body);
    -webkit-box-shadow: 0 0 0 100px var(--solid) inset;
}

.login-input input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 100px #fff inset, 0 0 0 0.2rem rgba(0, 158, 247, 0.18);
}

/* :focus-within rather than a sibling selector on the input -- the icon is
   painted before the input in the markup, so `input:focus ~ .icon` would
   never match. */
.login-input:focus-within .login-input__icon {
    color: var(--primary);
}

.login-input--password input {
    padding-right: 3rem;
}

.login-toggle {
    position: absolute;
    right: 0.375rem;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    color: var(--muted);
    background: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.login-toggle:hover {
    color: var(--body);
}

.login-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 158, 247, 0.25);
}

.login-toggle svg {
    width: 1.125rem;
    height: 1.125rem;
}

/* [hidden] in the UA stylesheet is scoped to the HTML namespace, so it does
   not reliably hide an <svg>. Say it explicitly. */
.login-toggle svg[hidden] {
    display: none;
}

/* Caps Lock warning. Hidden by default; the view's script flips [hidden]. */
.login-hint {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.4375rem;
    font-size: 0.8125rem;
    color: #b3503f;
}

.login-hint[hidden] {
    display: none;
}

.login-hint svg {
    flex: none;
    width: 0.9375rem;
    height: 0.9375rem;
}

/* ----------------------------------------------------------------- submit */

.login-submit {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.8125rem 1rem;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.login-submit:hover {
    background: var(--primary-active);
}

.login-submit:focus-visible {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 158, 247, 0.35);
}

.login-submit[disabled] {
    cursor: default;
    opacity: 0.75;
}

.login-submit__spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
    vertical-align: -0.1875rem;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: login-spin 0.7s linear infinite;
}

.login-submit.is-busy .login-submit__spinner {
    display: inline-block;
}

@keyframes login-spin {
    to {
        transform: rotate(360deg);
    }
}

.login-help {
    margin: 1.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--muted);
    text-align: center;
}

.login-card__foot {
    display: none;
    margin: 2rem 0 0;
    font-size: 0.75rem;
    color: var(--muted);
    text-align: center;
}

/* ------------------------------------------------------------ narrow view */

/* The brand column is decoration plus a value proposition; on a phone the
   form is the whole job, so the column goes and its logo reappears above the
   heading. */
@media (max-width: 61.99em) {
    .login-page {
        grid-template-columns: 1fr;
    }

    .login-brand {
        display: none;
    }

    .login-main {
        align-items: flex-start;
        padding-top: 3rem;
        background: var(--page);
    }

    .login-card {
        max-width: 26rem;
        padding: 2rem 1.75rem 2.25rem;
        background: #fff;
        border-radius: var(--radius-lg);
        box-shadow: 0 0 2.5rem rgba(76, 87, 125, 0.08);
    }

    .login-card__brand {
        display: flex;
    }

    .login-card__foot {
        display: block;
    }
}

@media (max-width: 24em) {
    .login-card {
        padding: 1.75rem 1.25rem 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
