/* ============================================================
   Foresight Schools, Ikom — Administration sign-in
   A contained two-panel unit on a light page: maroon editorial panel with the crest, welcome
   copy, feature list and a campus photograph bleeding into its lower edge; white sign-in card
   on the right. Colours come from the shared theme_tokens.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg { display: block; max-width: 100%; }
input, button, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:root {
    --font-display: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;   /* No webfont: instant paint, zero bytes over the wire. */
    --font-text:    system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --line:      #E3E6EA;
    --line-soft: #EDEFF2;
    --ink-70:    #55606B;
    --ink-55:    #7A828C;
    --maroon-deep: color-mix(in srgb, var(--color-primary) 72%, #000);
    --teal-deep:   color-mix(in srgb, var(--color-secondary) 78%, #000);
    --ease: cubic-bezier(.22, .61, .36, 1);
    --t: 250ms var(--ease);
    --shadow-unit: 0 1px 2px rgba(20,16,14,.04), 0 12px 34px rgba(20,16,14,.07), 0 40px 80px rgba(20,16,14,.06);
    --shadow-card: 0 1px 2px rgba(20,16,14,.03), 0 6px 20px rgba(20,16,14,.06);
}

body.auth {
    font-family: var(--font-text);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: #fff;
    -webkit-font-smoothing: antialiased;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: clamp(12px, 2.4vw, 30px);
}
::selection { background: var(--color-primary); color: #fff; }
:focus-visible { outline: 2px solid var(--color-secondary); outline-offset: 2px; border-radius: 6px; }

/* ── The unit ── */
.auth__shell {
    width: 100%; max-width: 1080px;
    display: grid;
    border: 1px solid var(--color-login-border, #D4AF37);
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    /* A soft gold halo under the usual shadow, so the frame reads as intentional rather
       than as a stray outline */
    box-shadow: var(--shadow-unit),
                0 0 0 6px color-mix(in srgb, var(--color-login-border, #D4AF37) 12%, transparent);
    animation: unitIn 620ms var(--ease) both;
}
/* The floor is deliberately below what the copy needs, so the panel is sized
   by its content rather than propped to a number. Left at 660 it would swallow
   most of a reduction and the page would barely move. */
@media (min-width: 940px) { .auth__shell { grid-template-columns: 1.02fr .98fr; min-height: 520px; } }
@keyframes unitIn { from { opacity: 0; transform: translateY(18px) scale(.99); } to { opacity: 1; transform: none; } }

/* ── Left: maroon editorial panel ── */
.auth__aside {
    position: relative;
    display: none;
    flex-direction: column;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(165deg,
        var(--color-primary) 0%,
        color-mix(in srgb, var(--color-primary) 88%, #000) 52%,
        var(--maroon-deep) 100%);
}
@media (min-width: 940px) { .auth__aside { display: flex; } }

/* Very slow drifting light — presence without anything loud happening.

   The three layers of this panel are numbered here, in one place, and each one
   says its number out loud rather than relying on where it sits in the markup:
   orbs 0, photograph 1, copy 2. Source order used to decide it, which is how
   the copy came to be painted under the veil. */
/* Left behind the photograph deliberately. Raising them above it would tint
   the picture, and they exist to give a flat maroon field some movement — which
   is the case where no photograph has been uploaded and the veil is eased off. */
.auth__orbs { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.auth__orbs span { position: absolute; border-radius: 50%; filter: blur(80px); }
.auth__orbs span:nth-child(1) { width: 340px; height: 340px; left: -110px; top: 4%;  background: var(--color-accent); opacity: .16; animation: drift 26s ease-in-out infinite alternate; }
.auth__orbs span:nth-child(2) { width: 300px; height: 300px; right: -90px; top: 34%; background: var(--color-secondary); opacity: .16; animation: drift 32s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translate3d(0,0,0); } to { transform: translate3d(34px, -40px, 0); } }

.auth__aside-inner {
    position: relative; z-index: 2;
    display: flex; flex-direction: column;
    /* The bottom padding replaces the photograph band that used to sit below
       this block. The band left the flow when the picture went full-bleed, and
       without this the panel would lose its height — so the space is kept, and
       it is now space with photograph showing through rather than a separate
       strip of one. */
    padding: clamp(26px, 2.8vw, 34px) clamp(30px, 3.4vw, 44px) clamp(116px, 12.2vw, 148px);
    /* Sets the height of the whole unit: the photograph is behind it now, not
       below it, so nothing else in this column contributes. The rhythm was
       tightened by about 15em and then let out by 5em — a net 10em off where it
       started — and anything loosened again is added to both columns. */
    flex: 1 0 auto;
}

/* Crest lockup, centred */
.auth__lockup { display: grid; justify-items: center; text-align: center; margin-bottom: clamp(15px, 1.8vw, 21px); }
/* The drawn fallback used to be a dark maroon on the maroon panel, which is
   very nearly invisible — currentColor was inherited from a rule written for a
   white ground. Gold reads on both, and is the crest's own trim colour. */
/* The mark carries the identity of the panel, so it is sized to be read at a
   glance rather than to be tidy. The drawn fallback still inherits gold; an
   uploaded crest brings its own colours. */
.crest { display: block; width: 92px; height: 92px; color: var(--color-accent); }
.crest svg { width: 100%; height: 100%; }
/* An uploaded crest carries its own colours, so it is only ever sized. */
.crest__img { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Tracking is eased off as the size goes up: .16em was set for 19px text and
   at 27px it pulls the word apart rather than holding it together. */
.auth__wordmark { font-family: var(--font-display); font-weight: 700; font-size: 27px; letter-spacing: .11em; text-transform: uppercase; margin-top: 10px; line-height: 1.15; }
.auth__wordsub  { font-size: 13.5px; font-weight: 500; letter-spacing: .3em; text-transform: uppercase; color: #fff; margin-top: 4px; line-height: 1.3; }

.auth__welcome { font-family: var(--font-display); font-size: clamp(1.4rem, 1.2rem + .6vw, 1.7rem); font-weight: 700; letter-spacing: -.015em; line-height: 1.2; }
.auth__welcome-sub { margin-top: 7px; font-size: 14px; line-height: 1.5; color: #F3E9E9; max-width: 34ch; }

/* Feature list */
.auth__features { display: grid; gap: 13px; margin-top: clamp(15px, 1.7vw, 20px); padding-bottom: 16px; }
.auth__feature { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.auth__feature-ico {
    display: grid; place-items: center; width: 32px; height: 32px; flex: none;
    border: 1px solid rgba(255, 255, 255, .55);
    background: rgba(0, 0, 0, .18);
    border-radius: 9px;
    color: #fff;
}
.auth__feature-title { font-family: var(--font-display); font-size: 15.5px; font-weight: 600; }
.auth__feature-text  { font-size: 13px; line-height: 1.45; color: #EFE2E2; margin-top: 2px; max-width: 34ch; }

/* The campus photograph, behind the whole panel.

   It used to be a band along the bottom under a scrim, which meant the copy sat
   on flat maroon and the picture was a strip. Now it fills the panel and the
   maroon becomes a veil over it, so the photograph is the panel rather than a
   footnote to it.

   The veil is what keeps the copy readable, and it is graded rather than flat:
   heaviest behind the crest and the heading, easing through the feature list,
   lightest at the foot where nothing is written. Even at its lightest, white
   text over the worst case — a blown-out white area of the photograph — stays
   above 4.5:1, so the grading is a matter of how much picture shows and not of
   whether the words can be read.

   One element carries both. `--shot` is the photograph, handed in from the
   markup; the veil is the background layer painted over it. Doing it this way
   means there is no pseudo-element and no second stacking context — which is
   what went wrong before, when a veil on its own layer ended up above the copy
   instead of below it. Layers in `background` always paint first-listed-on-top
   within the one element, so this ordering cannot be got wrong.

   `--shot` is deliberately given no fallback beyond `none`: with nothing
   uploaded the veil is all there is, which is the flat maroon panel the screen
   started life as.

   Tune with the four stops below; they are the only numbers that matter. */
.auth__shot {
    position: absolute; inset: 0;
    z-index: 1;
    background-image:
        linear-gradient(180deg,
            rgba(74, 0, 0, .82) 0%,
            rgba(74, 0, 0, .78) 30%,
            rgba(60, 0, 0, .70) 66%,
            rgba(60, 0, 0, .50) 100%),
        var(--shot, none);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
}
/* No photograph uploaded: a faint weave so the field is not dead flat. It goes
   between the veil and nothing, so it needs the veil eased right off. */
.auth__shot--plate {
    background-image:
        linear-gradient(180deg, rgba(74, 0, 0, .34) 0%, rgba(60, 0, 0, .30) 100%),
        repeating-linear-gradient(-45deg, rgba(255,255,255,.05) 0 1px, transparent 1px 16px),
        repeating-linear-gradient(45deg,  rgba(255,255,255,.035) 0 1px, transparent 1px 24px);
}

/* ── Right: sign-in card ── */
.auth__panel {
    --card-bg: #FBFBFC;
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: clamp(26px, 4vw, 48px) clamp(20px, 3.4vw, 44px);
    background: var(--card-bg);
}
.auth__card { position: relative; z-index: 2; width: 100%; max-width: 348px; }

/* Lock watermark, bottom-right */
.auth__watermark {
    position: absolute; right: 20px; bottom: 18px; z-index: 1;
    width: 74px; height: 74px; color: var(--color-slate); opacity: .13;
    pointer-events: none;
}

.auth__mobile-brand { display: grid; justify-items: center; margin-bottom: 26px; }
@media (min-width: 940px) { .auth__mobile-brand { display: none; } }
.auth__mobile-brand .crest { width: 74px; height: 74px; }
/* On the white card the drawn fallback needs the dark maroon back. */
.auth__mobile-brand .crest { color: color-mix(in srgb, var(--color-primary) 78%, #000); }
.auth__mobile-brand .auth__wordmark { color: var(--color-text); font-size: 22px; letter-spacing: .12em; }
.auth__mobile-brand .auth__wordsub { color: var(--ink-55); font-size: 12px; opacity: 1; }
.auth__mobile-brand .auth__wordsub  { color: var(--ink-55); }

.auth__title { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.auth__sub { margin-top: 6px; font-size: 15px; color: var(--ink-55); }

.auth__note {
    display: flex; align-items: flex-start; gap: 8px;
    margin-top: 18px; padding: 11px 13px;
    border-radius: 9px; font-size: 14.5px; line-height: 1.5;
    animation: noteIn 380ms var(--ease) both;
}
@keyframes noteIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.auth__note--error { background: #FEF3F2; border: 1px solid #FECDCA; color: #B42318; }
.auth__note--warn  { background: #FFFAEB; border: 1px solid #FEDF89; color: #93370D; }
.auth__note--ok    { background: #ECFDF3; border: 1px solid #ABEFC6; color: #067647; }
.auth__note .ico { flex: none; margin-top: 1px; }

/* ── Fields ── */
.auth__form { display: grid; gap: 16px; margin-top: 26px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 14px; font-weight: 500; color: var(--ink-70); }
.field__wrap { position: relative; display: flex; align-items: center; }
.field__input {
    width: 100%; padding: 12px 14px;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius-input, 8px);
    font-size: 15px;
    transition: border-color var(--t), box-shadow var(--t);
}
.field__input--pw { padding-right: 44px; }
.field__input::placeholder { color: #AEB4BC; }
.field__input:focus {
    outline: none; border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-secondary) 12%, transparent);
}
.field__toggle {
    position: absolute; right: 5px;
    display: grid; place-items: center; width: 34px; height: 34px;
    border-radius: 7px; color: var(--ink-55);
    transition: background var(--t), color var(--t);
}
.field__toggle:hover { background: #F2F4F6; color: var(--color-primary); }

/* Remember me + Forgot password on one row */
.auth__row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--ink-70); cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
    display: grid; place-items: center; width: 17px; height: 17px; flex: none;
    border: 1.5px solid var(--line); border-radius: 4px; background: #fff; color: transparent;
    transition: background var(--t), border-color var(--t), color var(--t);
}
.check input:checked + .check__box { background: var(--color-secondary); border-color: var(--color-secondary); color: #fff; }
.check input:focus-visible + .check__box { outline: 2px solid var(--color-secondary); outline-offset: 2px; }
.auth__forgot { font-size: 14.5px; font-weight: 500; color: var(--color-secondary); text-decoration: underline; text-underline-offset: 2px; transition: color var(--t); }
.auth__forgot:hover { color: var(--color-primary); }

/* ── Submit ── */
.auth__submit {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; padding: 13px 22px;
    background: var(--color-secondary); color: #fff;
    border-radius: var(--radius-button, 8px);
    font-size: 15.5px; font-weight: 600;
    transition: background var(--t), transform var(--t), box-shadow var(--t);
}
.auth__submit:hover { background: var(--teal-deep); transform: translateY(-1px); box-shadow: 0 8px 20px color-mix(in srgb, var(--color-secondary) 26%, transparent); }
.auth__submit:active { transform: none; }
.auth__submit .ico { transition: transform var(--t); }
.auth__submit:hover .ico { transform: translateX(3px); }
.auth__submit[disabled] { opacity: .74; cursor: progress; transform: none; }
.auth__submit.is-busy .ico { animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth__back { display: inline-flex; align-items: center; gap: 6px; justify-self: center; font-size: 14px; color: var(--ink-55); transition: color var(--t); }
.auth__back:hover { color: var(--color-primary); }

/* ── OAuth ── */
.auth__divider { position: relative; margin: 22px 0 16px; text-align: center; }
.auth__divider::before { content: ''; position: absolute; inset: 50% 0 auto; height: 1px; background: var(--line-soft); }
/* The label sits over the rule, so its background must track the panel surface */
.auth__divider span { position: relative; padding: 0 12px; background: var(--card-bg, #fff); font-size: 13.5px; color: var(--ink-55); }
.auth__oauth { display: grid; gap: 9px; }
.oauth {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 12px 16px;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius-button, 8px);
    font-size: 15px; font-weight: 500;
    transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.oauth:hover { border-color: #CFD5DB; box-shadow: 0 3px 12px rgba(20,16,14,.06); transform: translateY(-1px); }
/* Rendered but inert until a client ID is configured — honest rather than a dead button */
.oauth.is-disabled { opacity: .55; cursor: not-allowed; }
.oauth.is-disabled:hover { transform: none; box-shadow: none; border-color: var(--line); }

/* ── 2FA ── */
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp__box {
    width: 100%; aspect-ratio: 3/4; padding: 0; text-align: center;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius-input, 8px);
    font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
    transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.otp__box:focus { outline: none; border-color: var(--color-secondary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-secondary) 12%, transparent); transform: translateY(-2px); }
.otp__box.is-filled { border-color: var(--color-secondary); }

/* ── Card footer ── */
.auth__foot { margin-top: 22px; font-size: 13px; line-height: 1.5; color: var(--ink-55); text-align: center; }
.auth__foot a { color: var(--color-secondary); }

.ico { flex: none; stroke-width: 1.75; }
i[data-lucide] { display: inline-block; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 939px) {
    body.auth { background: var(--color-bg); padding: 0; place-items: stretch; }
    /* Full-bleed on phones: a frame around the whole viewport reads as a rendering fault,
       so the border becomes a single gold rule along the top edge instead. */
    .auth__shell {
        max-width: none; min-height: 100svh;
        border: 0; border-top: 1.5px solid var(--color-login-border, #D4AF37);
        border-radius: 0; box-shadow: none;
    }
    .auth__panel { --card-bg: #fff; justify-content: flex-start; padding-top: clamp(34px, 8vw, 64px); }
    .auth__watermark { display: none; }
}

@media (max-width: 420px) {
    .auth__panel { padding-inline: 20px; }
    .otp { gap: 6px; }
    .otp__box { font-size: 1.1rem; }
}

@media (pointer: coarse) {
    .field__input, .otp__box { font-size: 17px; }   /* stops iOS zooming on focus */
    .field__toggle { min-width: 44px; min-height: 44px; }
}

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