/* ------------------------------------------------------------------ *
 * The immersive signed-out screens
 *
 * resources/views/filament/auth/immersive.blade.php, chosen per audience in the
 * sign-in screen settings. Registered on both panels because both can use it;
 * every rule is scoped inside `.ai-shell`, so nothing here reaches a screen that
 * did not ask for it — and the classic screens, which are the way back, are
 * untouched.
 *
 * The scene is deep in both themes. It is a room with the lights down and the
 * brand's colour moving in it, and a light version of that is a pale gradient —
 * exactly the kind of flat backdrop this replaces. The form column follows the
 * theme like the rest of the panel.
 * ------------------------------------------------------------------ */

.ai-shell {
    --ai-accent: var(--primary-500, #4f46e5);
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    background-color: var(--color-white, #fff);
}

.dark .ai-shell {
    background-color: var(--gray-950, #09090b);
}

@media (min-width: 64rem) {
    .ai-shell {
        grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    }
}

/* -- The scene ------------------------------------------------------ */

.ai-scene {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 1.25rem 1.75rem;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(70% 55% at 30% 28%, color-mix(in oklab, var(--ai-accent) 42%, transparent), transparent 70%),
        linear-gradient(165deg, color-mix(in oklab, var(--ai-accent) 38%, #0b0b1d) 0%, #07070f 72%);
}

@media (min-width: 64rem) {
    .ai-scene {
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
        padding: 2.25rem 3rem 2.75rem;
    }
}

.ai-ambient {
    position: absolute;
    inset: -3rem;
    z-index: -1;
    pointer-events: none;
}

.ai-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
}

.ai-blob--one {
    top: -8rem;
    left: -6rem;
    width: 30rem;
    height: 30rem;
    background: var(--ai-accent);
    animation: ai-drift-one 22s ease-in-out infinite alternate;
}

.ai-blob--two {
    right: -8rem;
    bottom: 10%;
    width: 26rem;
    height: 26rem;
    background: color-mix(in oklab, var(--ai-accent) 45%, #22d3ee);
    opacity: 0.35;
    animation: ai-drift-two 26s ease-in-out infinite alternate;
}

.ai-blob--three {
    bottom: -12rem;
    left: 20%;
    width: 30rem;
    height: 30rem;
    background: color-mix(in oklab, var(--ai-accent) 55%, #f472b6);
    opacity: 0.3;
    animation: ai-drift-three 30s ease-in-out infinite alternate;
}

@keyframes ai-drift-one { to { transform: translate3d(7rem, 4rem, 0) scale(1.1); } }
@keyframes ai-drift-two { to { transform: translate3d(-6rem, -5rem, 0) scale(0.9); } }
@keyframes ai-drift-three { to { transform: translate3d(-5rem, -4rem, 0) scale(1.08); } }

/* A fine grid of light, strongest behind the picture. */
.ai-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgb(255 255 255 / 0.16) 1px, transparent 1.3px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(ellipse 55% 50% at 50% 45%, #000 10%, transparent 75%);
    mask-image: radial-gradient(ellipse 55% 50% at 50% 45%, #000 10%, transparent 75%);
}

.ai-scene-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/*
 * The logo is always on the dark scene, so it always wears its dark-theme
 * version — the same hand-over the split layout makes. Three classes deep to
 * beat Filament's own pair.
 */
.ai-shell .ai-logo .fi-logo {
    color: #fff;
}

.ai-shell .ai-logo .fi-logo-light {
    display: none;
}

.ai-shell .ai-logo .fi-logo-dark {
    display: flex;
}

.ai-status {
    --state: #3b82f6;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3125rem 0.75rem 0.3125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    background: rgb(255 255 255 / 0.08);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.ai-status[hidden] { display: none; }
.ai-status[data-state='ok'] { --state: #10b981; }
.ai-status[data-state='warn'] { --state: #f59e0b; }
.ai-status[data-state='bad'] { --state: #ef4444; }

.ai-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--state);
    animation: ai-pulse 2s ease-out infinite;
}

@keyframes ai-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--state) 60%, transparent); }
    70% { box-shadow: 0 0 0 0.45rem transparent; }
}

.ai-stage {
    display: grid;
    flex: 1;
    place-items: center;
    min-height: 0;
}

.ai-shell .ai-picture {
    --illo-size: clamp(8.5rem, 34vw, 11rem);
}

@media (min-width: 64rem) {
    .ai-shell .ai-picture {
        --illo-size: min(26rem, 34vw, 52vh);
    }
}

.ai-copy {
    position: relative;
    max-width: 30rem;
}

.ai-copy > * {
    animation: ai-rise 700ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ai-copy > :nth-child(2) { animation-delay: 80ms; }
.ai-copy > :nth-child(n + 3) { animation-delay: 160ms; }

@keyframes ai-rise { from { opacity: 0; transform: translateY(0.625rem); } }

.ai-eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in oklab, var(--ai-accent) 45%, #fff);
}

.ai-heading {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.ai-body {
    margin: 0.75rem 0 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: rgb(255 255 255 / 0.74);
}

.ai-note {
    margin: 1.25rem 0 0;
    font-size: 0.75rem;
    color: rgb(255 255 255 / 0.5);
}

/* On a phone the scene is a band above the form: the picture, the heading, and
   no more — the form is what the visitor came for. */
@media (max-width: 63.99rem) {
    .ai-scene {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            'top top'
            'stage copy';
        align-items: center;
        column-gap: 1rem;
    }

    .ai-scene-top { grid-area: top; }
    .ai-stage { grid-area: stage; }
    .ai-copy { grid-area: copy; }

    .ai-body,
    .ai-note {
        display: none;
    }
}

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

.ai-main {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.25rem;
    background:
        radial-gradient(60% 40% at 100% 0%, color-mix(in oklab, var(--ai-accent) 8%, transparent), transparent 70%),
        transparent;
}

@media (min-width: 40rem) {
    .ai-main {
        padding: 1.75rem;
    }
}

.ai-main-head {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    min-height: 2.25rem;
}

.ai-card {
    display: flex;
    width: 100%;
    max-width: 27rem;
    flex-direction: column;
    /* Centred by auto margins, so a form taller than the screen starts at the
       top and scrolls, rather than overflowing upwards out of reach. */
    margin: auto;
    padding: 1.75rem 1.5rem;
    border-radius: 1.25rem;
    background-color: var(--color-white, #fff);
    box-shadow:
        0 1px 2px rgb(0 0 0 / 0.04),
        0 24px 48px -24px color-mix(in oklab, var(--ai-accent) 35%, rgb(0 0 0 / 0.3)),
        0 0 0 1px rgb(9 9 11 / 0.06);
    animation: ai-rise 600ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dark .ai-card {
    background-color: var(--gray-900, #18181b);
    box-shadow:
        0 24px 48px -24px rgb(0 0 0 / 0.7),
        0 0 0 1px rgb(255 255 255 / 0.08);
}

@media (min-width: 40rem) {
    .ai-card {
        padding: 2.25rem 2.25rem 2rem;
    }
}

.ai-card.fi-width-xl { max-width: var(--container-xl, 36rem); }
.ai-card.fi-width-2xl { max-width: var(--container-2xl, 42rem); }
.ai-card.fi-width-3xl { max-width: var(--container-3xl, 48rem); }

.ai-main-foot {
    display: grid;
    gap: 0.75rem;
}

/* -- Filament's own page content, inside the card only ------------- */

.ai-shell .fi-simple-page-content {
    row-gap: 1.75rem;
}

.ai-shell .fi-simple-header {
    align-items: flex-start;
}

.ai-shell .fi-simple-header-heading {
    text-align: start;
    letter-spacing: -0.02em;
}

.ai-shell .fi-simple-header-subheading {
    margin-top: 0.5rem;
    text-align: start;
    line-height: 1.6;
}

/* The scene carries the logo, on every width. */
.ai-shell .fi-simple-page .fi-simple-header .fi-logo {
    display: none;
}

.ai-shell .fi-input-wrp :is(input, select, textarea).fi-input,
.ai-shell .fi-input-wrp select.fi-select-input,
.ai-shell .fi-input-wrp .fi-select-input-btn {
    padding-block: 0.5rem;
}

.ai-shell .ai-card .fi-btn {
    padding-block: 0.5625rem;
}

/* ------------------------------------------------------------------ *
 * The top of the card: the logo, and the two doors
 *
 * resources/views/filament/auth/switch.blade.php, drawn by both of this
 * application's layouts — so these rules are scoped by their own classes rather
 * than by `.ai-shell`, and the client panel, which loads this stylesheet and
 * auth.css together, gets them on the classic screens as well.
 * ------------------------------------------------------------------ */

.aa-head {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
}

.aa-brand {
    display: flex;
    align-items: center;
}

.aa-brand .fi-logo {
    height: 2rem;
    width: auto;
}

/*
 * The segmented control, in the theme switcher's shape: a plate with the
 * current segment raised out of it. The panel already teaches that this means
 * "one of these, and this is the one".
 */
.aa-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.1875rem;
    padding: 0.1875rem;
    border-radius: calc(var(--radius-lg, 0.5rem) + 0.1875rem);
    background-color: var(--gray-100, #f4f4f5);
}

.dark .aa-switch {
    background-color: var(--gray-800, #27272a);
}

.aa-switch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-lg, 0.5rem);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    text-decoration: none;
    color: var(--gray-600, #52525b);
    transition: background-color 100ms, color 100ms, box-shadow 100ms;
}

.aa-switch-btn:hover {
    color: var(--gray-950, #09090b);
    background-color: var(--gray-200, #e4e4e7);
}

.dark .aa-switch-btn {
    color: var(--gray-400, #a1a1aa);
}

.dark .aa-switch-btn:hover {
    color: #fff;
    background-color: var(--gray-700, #3f3f46);
}

.aa-switch-btn.aa-on,
.aa-switch-btn.aa-on:hover {
    color: var(--gray-950, #09090b);
    background-color: var(--color-white, #fff);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 8%);
}

.dark .aa-switch-btn.aa-on,
.dark .aa-switch-btn.aa-on:hover {
    color: #fff;
    background-color: var(--gray-700, #3f3f46);
    box-shadow: none;
}

.aa-switch-btn:focus-visible {
    outline: 2px solid var(--primary-500, #4f46e5);
    outline-offset: 2px;
}

/*
 * With the tabs up there, the page's own heading is the word above it again and
 * its subheading is the other tab as a sentence. The subheading is dropped in
 * PHP; the heading is only hidden from sight, because the page still needs an
 * `<h1>` for anything that reads the document rather than looks at it.
 */
.aa-tabbed .fi-simple-header {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    border-width: 0;
    clip-path: inset(50%);
}

/* -- The theme switcher -------------------------------------------- */

.ai-theme .fi-theme-switcher {
    padding: 0.1875rem;
    border-radius: calc(var(--radius-md, 0.375rem) + 0.1875rem);
    background-color: var(--gray-100);
}

.dark .ai-theme .fi-theme-switcher {
    background-color: var(--gray-800);
}

.ai-theme .fi-theme-switcher-btn.fi-active {
    background-color: var(--color-white, #fff);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 8%);
}

.dark .ai-theme .fi-theme-switcher-btn.fi-active {
    background-color: var(--gray-700);
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    .ai-blob,
    .ai-status-dot,
    .ai-copy > *,
    .ai-card {
        animation: none;
    }
}
