/* ==========================================================================
   Auth screens — self-contained.
   Deliberately does NOT load app.css or Bootstrap: the sign-in screen is a
   standalone page and shouldn't inherit the admin panel's boxed-input look.

   Design: warm paper canvas, hairline (underline-only) fields with floating
   labels, ink-black primary action, teal used only for focus and accents.
   ========================================================================== */

/* Tokens live in tokens.css, which is loaded before this file. Only the
   auth-specific overrides below belong here. */

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background-color: var(--paper);
    /* Fine dot grid — texture without noise. */
    background-image: radial-gradient(var(--line) 1px, transparent 1px);
    background-size: 22px 22px;
    background-position: -1px -1px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* --- background aurora --------------------------------------------------- */

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

.aurora span {
    position: absolute;
    display: block;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
}

.aurora .a1 {
    width: 46vmax;
    height: 46vmax;
    top: -18vmax;
    left: -12vmax;
    background: radial-gradient(circle at 40% 40%, #bfe3dc, transparent 68%);
    animation: drift1 26s ease-in-out infinite alternate;
}

.aurora .a2 {
    width: 38vmax;
    height: 38vmax;
    bottom: -16vmax;
    right: -10vmax;
    background: radial-gradient(circle at 60% 60%, #dfd8ee, transparent 68%);
    animation: drift2 32s ease-in-out infinite alternate;
}

:root[data-theme="dark"] .aurora span { opacity: .26; }
:root[data-theme="dark"] .aurora .a1 { background: radial-gradient(circle at 40% 40%, #14544c, transparent 68%); }
:root[data-theme="dark"] .aurora .a2 { background: radial-gradient(circle at 60% 60%, #2c2a52, transparent 68%); }

@keyframes drift1 {
    to { transform: translate3d(7vmax, 5vmax, 0) scale(1.12); }
}

@keyframes drift2 {
    to { transform: translate3d(-6vmax, -4vmax, 0) scale(1.08); }
}

/* Motion is decoration here, so it goes away entirely when unwanted. */
@media (prefers-reduced-motion: reduce) {
    .aurora .a1, .aurora .a2 { animation: none; }
    * { transition: none !important; }
}

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

.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 32px 22px;
}

.auth-col {
    width: 100%;
    max-width: 396px;
}

/* --- wordmark ----------------------------------------------------------- */

.mark {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 34px;
}

.mark-glyph {
    width: 33px;
    height: 33px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: var(--paper-2);
    background: var(--ink);
    box-shadow: 0 2px 8px -2px rgba(21, 23, 28, .34);
}

.mark-glyph svg { width: 17px; height: 17px; }

.mark-word {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -.02em;
}

/* --- headings ----------------------------------------------------------- */

.auth-title {
    font-family: var(--font-display);
    font-size: 33px;
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -.028em;
    margin: 0 0 7px;
}

.auth-sub {
    margin: 0 0 28px;
    color: var(--ink-3);
    font-size: 14.5px;
}

.auth-sub a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.auth-sub a:hover { color: var(--accent); }

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

.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    border-radius: var(--r);
    padding: 11px 13px;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 20px;
    border: 1px solid var(--bad-line);
    background: var(--bad-soft);
    color: var(--bad);
}

.alert svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }

.alert-ok {
    border-color: var(--ok-line);
    background: var(--ok-soft);
    color: var(--ok);
}

/* --- hairline fields ---------------------------------------------------- */
/*
   No boxes. Each field is an icon, an input, a floating label and a hairline
   that grows from the left on focus.
*/

.field {
    position: relative;
    padding: 20px 0 9px 30px;
    margin-bottom: 6px;
}

.field-ico {
    position: absolute;
    left: 0;
    bottom: 12px;
    color: var(--ink-4);
    transition: color .18s ease;
    pointer-events: none;
}

.field-ico svg { width: 17px; height: 17px; display: block; }

.field input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: var(--font-ui);
    font-size: 15.5px;
    color: var(--ink);
    padding: 0 34px 6px 0;
    /* The visible rule is .field-rail; this keeps layout stable. */
    border-bottom: 1px solid transparent;
}

.field input::placeholder { color: transparent; }

.field input:-webkit-autofill {
    -webkit-text-fill-color: var(--ink);
    /* Kills Chrome's yellow autofill wash without hiding the text. */
    -webkit-box-shadow: 0 0 0 100px var(--paper) inset;
    transition: background-color 9999s ease-out 0s;
}

.field label {
    position: absolute;
    left: 30px;
    bottom: 12px;
    color: var(--ink-3);
    font-size: 15px;
    pointer-events: none;
    transform-origin: left center;
    transition: transform .19s cubic-bezier(.2, .7, .3, 1), color .19s ease;
}

/* Floats when focused or filled. Needs placeholder=" " on the input. */
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
    transform: translateY(-24px) scale(.78);
    color: var(--ink-3);
    font-weight: 600;
    letter-spacing: .02em;
}

.field input:focus + label { color: var(--accent); }

/* The hairline: a static base plus an accent that scales in from the left. */
.field-rail {
    position: absolute;
    left: 30px;
    right: 0;
    bottom: 6px;
    height: 1px;
    background: var(--line-2);
}

.field-rail::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .26s cubic-bezier(.2, .7, .3, 1);
}

.field input:focus ~ .field-rail::after { transform: scaleX(1); }
.field input:focus ~ .field-rail { height: 2px; bottom: 5px; }
.field input:focus ~ .field-ico { color: var(--accent); }

/* Invalid state, set by the JS on submit. */
.field.is-bad .field-rail { background: var(--bad); }
.field.is-bad label,
.field.is-bad .field-ico { color: var(--bad); }

/* --- password reveal ---------------------------------------------------- */

.eye {
    position: absolute;
    right: -6px;
    bottom: 3px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--ink-4);
    border-radius: 8px;
    cursor: pointer;
    transition: color .16s ease, background .16s ease;
}

.eye:hover { color: var(--ink-2); background: var(--accent-soft); }
.eye svg { width: 17px; height: 17px; }

/* --- caps lock hint ----------------------------------------------------- */

.hint-caps {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0 0 30px;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--bad);
}

.hint-caps svg { width: 14px; height: 14px; }
.hint-caps[hidden] { display: none; }

/* --- remember row ------------------------------------------------------- */

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 20px 0 26px;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
}

/* The native checkbox stays in the DOM for the form post and for a11y; it is
   visually replaced by the track below. */
.toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.track {
    position: relative;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: var(--line-2);
    transition: background .2s ease;
    flex: 0 0 auto;
}

.track .dot {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--paper-2);
    box-shadow: 0 1px 3px rgba(21, 23, 28, .28);
    transition: transform .2s cubic-bezier(.2, .7, .3, 1);
}

.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track .dot { transform: translateX(16px); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 4px var(--accent); }

.toggle-text { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }

.link-quiet {
    font-size: 13.5px;
    font-weight: 550;
    color: var(--ink-3);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .16s ease, border-color .16s ease;
}

.link-quiet:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* --- primary action ----------------------------------------------------- */

.btn-ink {
    width: 100%;
    border: 0;
    border-radius: var(--r);
    background: var(--ink);
    color: var(--paper-2);
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.005em;
    padding: 13px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    cursor: pointer;
    box-shadow: var(--shadow-2);
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}

.btn-ink svg {
    width: 17px;
    height: 17px;
    transition: transform .2s cubic-bezier(.2, .7, .3, 1);
}

.btn-ink:hover { background: #23262d; transform: translateY(-1px); }
.btn-ink:hover svg { transform: translateX(3px); }
.btn-ink:active { transform: translateY(0); }

.btn-ink[disabled] { opacity: .6; cursor: default; transform: none; }
.btn-ink[disabled] svg { transform: none; }

:root[data-theme="dark"] .btn-ink { background: var(--ink); color: #101216; }
:root[data-theme="dark"] .btn-ink:hover { background: #ffffff; }

/* --- spinner in the button --------------------------------------------- */

.btn-ink .spin {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: currentColor;
    animation: spin .65s linear infinite;
}

:root[data-theme="dark"] .btn-ink .spin { border-color: rgba(0, 0, 0, .25); border-top-color: currentColor; }

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

/* --- back link + footer ------------------------------------------------- */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 22px;
    font-size: 13.5px;
    font-weight: 550;
    color: var(--ink-3);
    text-decoration: none;
}

.back-link:hover { color: var(--accent); }
.back-link svg { width: 15px; height: 15px; }

/* Sits between the button and the footer rule on the two-step screen. */
.auth-note {
    margin: 20px 0 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--ink-4);
}

.auth-foot {
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--ink-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-foot .dot-sep { width: 4px; height: 4px; border-radius: 50%; background: var(--line-2); }

/* --- focus visibility --------------------------------------------------- */

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.field input:focus-visible { outline: none; }

/* --- small screens ------------------------------------------------------ */

@media (max-width: 479.98px) {
    .auth-shell { padding: 26px 18px; align-items: start; padding-top: 42px; }
    .auth-title { font-size: 28px; }
    .mark { margin-bottom: 26px; }
    .row-between { flex-wrap: wrap; gap: 12px; }
}

/* --- development credentials panel — TEMPORARY --------------------------- */
/*
   Rendered only when APP_ENV=local and AIBLOG_DEV_LOGIN_HINT=true. Styled to
   look deliberately provisional (dashed edge, warning tint) so it reads as a
   build-time aid and not part of the finished screen.
*/

.dev-note {
    margin-top: 26px;
    padding: 14px 15px 12px;
    border: 1px dashed var(--warn-line);
    border-radius: var(--r);
    background: var(--warn-soft);
}

.dev-note-head {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--warn);
    margin-bottom: 11px;
}

.dev-note-head svg { width: 15px; height: 15px; }

.dev-note-tag {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--warn);
    color: var(--warn-soft);
}

.dev-note-kv {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 5px 12px;
    margin: 0 0 12px;
    font-size: 13px;
}

.dev-note-kv dt { color: var(--warn); font-weight: 600; }

.dev-note-kv dd {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    color: var(--ink);
    word-break: break-all;
    /* Selectable, so it can be copied straight out. */
    user-select: all;
}

.dev-note-fill {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--warn-line);
    border-radius: 9px;
    background: transparent;
    color: var(--warn);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.dev-note-fill:hover { background: var(--warn); color: var(--warn-soft); }
.dev-note-fill svg { width: 15px; height: 15px; }

.dev-note-foot {
    margin: 10px 0 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--warn);
    opacity: .85;
}

.dev-note-foot code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    background: rgba(138, 99, 32, .12);
    border-radius: 3px;
    padding: 1px 4px;
}

/* The warn tokens flip in tokens.css; only this literal needs a pair. */
:root[data-theme="dark"] .dev-note-foot code { background: rgba(216, 183, 106, .14); }
