/* =========================================================
   Sign-in pages (sign in, development sign-in, access pending):
   MILO on the left (what it is, a glimpse of it), the page in a
   card on the right. Stacks on a phone: a short banner on top.
   ========================================================= */

.milo-auth {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    min-height: 100vh;
}


/* ---------- The brand panel ---------- */

.milo-auth-brand {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 1.5rem;
    min-height: 100vh;
    padding: 2rem 2.5rem 2.5rem;
    color: #fff;
}

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

.milo-auth-name {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.22em;
}

.milo-auth-name img {
    width: 44px;
    height: 44px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.milo-auth-pill {
    padding: 0.45rem 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

/* A glimpse of MILO: floating cards round the instrument */
.milo-auth-showcase {
    position: relative;
    align-self: center;
    width: min(100%, 560px);
    height: 330px;
}

.milo-glass {
    position: absolute;
    padding: 1.1rem 1.3rem;
    color: #fff;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(6px);
}

.milo-glass-back {
    top: 18px;
    left: 0;
    width: 270px;
    height: 230px;
    transform: rotate(-6deg);
    opacity: 0.8;
}

.milo-glass-label {
    display: flex;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.82rem;
}

.milo-glass-figure {
    margin-top: 6.2rem;
    font-family: "Poppins", sans-serif;
    font-size: 1.7rem;
    font-weight: 600;
}

.milo-glass-note {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.78rem;
}

.milo-glass-front {
    top: 58px;
    left: 40px;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 340px;
    background: linear-gradient(160deg, rgba(12, 74, 46, 0.96), rgba(7, 59, 42, 0.96));
    transform: rotate(-3deg);
}

.milo-glass-front strong {
    display: block;
    font-family: "Poppins", sans-serif;
    font-size: 1rem;
}

.milo-glass-front span:not(.milo-glass-icon) {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.milo-glass-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 46px;
    height: 46px;
    color: var(--milo-ink);
    background: #fff;
    border-radius: 12px;
    font-size: 1.3rem;
}

.milo-glass-bar {
    display: block;
    height: 6px;
    margin-top: 0.7rem;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.milo-glass-bar b {
    display: block;
    width: 78%;
    height: 100%;
    background: var(--milo-sage-200);
    border-radius: 999px;
}

.milo-paper {
    position: absolute;
    top: 74px;
    right: 0;
    width: 290px;
    padding: 1.2rem 1.3rem;
    color: var(--milo-ink);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.32);
    transform: rotate(3deg);
}

.milo-paper-kicker {
    color: var(--milo-gray-700);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.milo-paper-title {
    margin: 0.2rem 0 0.9rem;
    font-family: "Poppins", sans-serif;
    font-size: 1.45rem;
    font-weight: 600;
}

.milo-paper-icon {
    position: absolute;
    top: 1.1rem;
    right: 1.2rem;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: var(--milo-sage-200);
    background: var(--milo-green-850);
    border-radius: 11px;
    font-size: 1.15rem;
}

.milo-paper-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--milo-surface-soft);
    border-radius: 10px;
    font-size: 0.88rem;
}

.milo-paper-row i { color: var(--milo-green-600); }

.milo-paper-row b { margin-left: auto; }

/* The instrument, over the white card's top corner */
.milo-auth-dial {
    position: absolute;
    top: 22px;
    right: -34px;
    width: 128px;
    filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.45));
}

.milo-auth-kicker {
    margin-bottom: 0.9rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.milo-auth-headline {
    margin: 0 0 1rem;
    color: #fff;
    font-family: "Poppins", sans-serif;
    font-size: clamp(2.6rem, 5.2vw, 4.6rem);
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.milo-auth-headline span { color: var(--milo-sage-200); }

.milo-auth-pitch p {
    max-width: 34rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1rem;
}


/* ---------- The carousel: the slides stacked in one cell, crossfading ---------- */

.milo-auth-carousel {
    /* Each card's turn: the active dot fills in this time, then the next */
    --milo-auth-slide-time: 3s;

    display: grid;
    grid-template-rows: 1fr auto;
    gap: 1.5rem;
}

.milo-auth-slide {
    display: grid;
    grid-area: 1 / 1;
    grid-template-rows: 1fr auto;
    gap: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease, visibility 0s 0.6s;
}

.milo-auth-slide.is-active {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.milo-auth-dots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.milo-auth-dot {
    position: relative;
    overflow: hidden;
    width: 0.6rem;
    height: 0.6rem;
    padding: 0;
    background: rgba(255, 255, 255, 0.3);
    border: 0;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.milo-auth-dot.is-active { width: 2.5rem; }

/* The timer: fills, then the next slide */
.milo-auth-dot.is-active::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--milo-sage-200);
    transform-origin: left;
    animation: milo-auth-fill var(--milo-auth-slide-time) linear forwards;
}

.milo-auth-carousel:hover .milo-auth-dot::after,
.milo-auth-carousel:focus-within .milo-auth-dot::after,
.milo-auth-carousel.is-paused .milo-auth-dot::after {
    animation-play-state: paused;
}

@keyframes milo-auth-fill {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.milo-auth-pause {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    margin-left: 0.35rem;
    padding: 0;
    color: rgba(255, 255, 255, 0.75);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    font-size: 0.85rem;
}

.milo-auth-pause:hover { color: #fff; }

.milo-auth-dot:focus-visible,
.milo-auth-pause:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* Reduced motion: the slide changes only when a dot is pressed */
@media (prefers-reduced-motion: reduce) {
    .milo-auth-slide,
    .milo-auth-dot { transition: none; }
    .milo-auth-slide { transform: none; }
    .milo-auth-dot.is-active::after { animation: none; }
    .milo-auth-pause { display: none; }
}


/* ---------- Swipe cards: the pictures in a sideways row (wider screens) ----------
   Each slide's picture is a card (60% of the row, rounded) that snaps
   to the middle; the middle card is in focus, its neighbours smaller
   and dimmer as they move out (a view timeline along the row). The
   headline and the dots below follow the middle card, and the timer
   still moves it on (auth-carousel's script). Phones keep the short
   banner without pictures; a browser without view timelines keeps the
   pictures in their slides, crossfading as before. */

.milo-auth-track {
    display: none;
}

@supports (animation-timeline: view()) and (animation-range: 0px 1px) {

    @media (min-width: 900px) {

        .milo-auth-carousel {
            grid-template-rows: auto 1fr auto;
        }

        .milo-auth-track {
            position: relative;
            grid-row: 1;

            display: flex;
            gap: 14px;

            padding: 0.5rem 0;

            overflow-x: auto;
            overscroll-behavior-x: contain;
            scroll-snap-type: x mandatory;
            scrollbar-width: none;
        }

        .milo-auth-track::-webkit-scrollbar {
            display: none;
        }

        /* Room either side, so the first and last cards reach the middle */
        .milo-auth-track::before,
        .milo-auth-track::after {
            content: "";
            flex: none;
            width: calc(20% - 14px);
        }

        .milo-auth-slide {
            grid-area: 2 / 1;
        }

        .milo-auth-slide .milo-auth-showcase {
            display: none;
        }

        .milo-auth-dots {
            grid-row: 3;
        }

        .milo-auth-slide-card {
            position: relative;

            flex: none;
            width: 60%;
            aspect-ratio: 560 / 330;

            overflow: hidden;

            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 28px;

            scroll-snap-align: center;

            animation: milo-auth-focus linear both;
            animation-duration: 1ms;
            animation-timeline: view(inline);
        }

        /* The picture as made (560 × 330), drawn to the card's size */
        .milo-auth-slide-card > .milo-auth-showcase {
            position: absolute;
            top: 0;
            left: 0;

            width: 560px;
            height: 330px;

            transform: scale(var(--milo-card-scale, 0.6));
            transform-origin: 0 0;
        }

    }

}

@keyframes milo-auth-focus {
    0%,
    100% {
        opacity: 0.45;
        transform: scale(0.86);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}


/* ---------- The page: a card under the "MILO" word ---------- */

.milo-auth-main {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background: var(--milo-surface-soft);
}


/* ---------- Drifting light behind the card ----------
   Two soft lights, MILO green and amber, drift slowly behind the card.
   Pressing Sign in or Microsoft snaps them to a fast drift; two seconds
   after letting go they settle back (--milo-drift-fast: 1 at once, back
   to 0 after a 2s delay). Still for reduced motion. */

@property --milo-drift-fast {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
}

body:has(.milo-auth-main) {
    transition: --milo-drift-fast 0s 2s;
}

body:has(:is(.milo-auth-submit, .milo-auth-microsoft):active) {
    --milo-drift-fast: 1;
    transition: none;
}

.milo-auth-main::before {
    content: "";
    position: absolute;
    inset: -20%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 30% 40%, rgba(23, 133, 74, 0.6), transparent 42%),
        radial-gradient(circle at 70% 62%, rgba(233, 167, 72, 0.55), transparent 42%);
    filter: blur(60px);
    animation: milo-drift calc(9s - 7s * var(--milo-drift-fast)) ease-in-out infinite alternate;
}

@keyframes milo-drift {
    to {
        translate: 10% -8%;
        rotate: 25deg;
        scale: 1.2;
    }
}

@media (prefers-reduced-motion: reduce) {
    .milo-auth-main::before { animation: none; }
}

.milo-auth-card {
    width: 100%;
    max-width: 500px;
    padding: 2.5rem 2.75rem;
    background: var(--milo-surface);
    border: 1px solid var(--milo-border);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(19, 52, 38, 0.08);
}

.milo-auth-word {
    display: block;
    width: 170px;
    height: auto;
    margin: 0 auto 1.6rem;
}

.milo-auth-card h1 {
    margin: 0 0 0.5rem;
    color: var(--milo-ink);
    font-family: "Poppins", sans-serif;
    font-size: 1.85rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-align: center;
}

.milo-auth-lead {
    margin: 0 auto 1.8rem;
    max-width: 24rem;
    color: var(--milo-gray-700);
    text-align: center;
}

.milo-auth-form .form-label {
    margin: 0 0 0.35rem;
    color: var(--milo-ink);
    font-weight: 600;
}

.milo-auth-form .form-control { margin-bottom: 1.1rem; }

.milo-auth-form .form-control:focus {
    border-color: var(--milo-green-600);
    box-shadow: 0 0 0 3px rgba(23, 133, 74, 0.18);
}

/* The password, with a show/hide eye inside the field */
.milo-password { position: relative; }

.milo-password .form-control { padding-right: 3rem; }

/* Edge adds its own reveal eye to a password field: on Edge that one
   is used and MILO's button stays hidden (login.blade.php sets milo-edge) */
.milo-edge .milo-password-toggle { display: none; }

.milo-edge .milo-password .form-control { padding-right: 0.75rem; }

.milo-password-toggle {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    display: grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    color: var(--milo-gray-700);
    background: none;
    border: 0;
    border-radius: 8px;
}

.milo-password-toggle:hover { color: var(--milo-ink); background: var(--milo-surface-soft); }

.milo-password-toggle:focus-visible { outline: 2px solid var(--milo-green-600); }

/* Sign in: MILO's deep green, raised */
.milo-auth-submit {
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.85rem 1rem;
    color: #fff;
    background: var(--milo-green-850);
    border: 1px solid var(--milo-green-850);
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(5, 45, 33, 0.25),
        0 4px 10px rgba(5, 45, 33, 0.18);
}

.milo-auth-submit:hover,
.milo-auth-submit:focus {
    color: #fff;
    background: var(--milo-green-700);
    border-color: var(--milo-green-700);
}

.milo-auth-submit:active { box-shadow: var(--milo-btn-pressed); }

.milo-auth-or {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.4rem 0;
    color: var(--milo-gray-700);
    font-size: 0.85rem;
}

.milo-auth-or::before,
.milo-auth-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--milo-border);
}

/* "Sign in with Microsoft": a raised white button with its four squares */
.milo-auth-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.8rem 1rem;
    color: var(--milo-ink);
    font-size: 1rem;
    font-weight: 600;
}

.milo-ms-logo {
    display: grid;
    grid-template-columns: 9px 9px;
    gap: 2px;
}

.milo-ms-logo i {
    display: block;
    width: 9px;
    height: 9px;
}

.milo-auth-fine {
    margin: 1.4rem 0 0;
    color: var(--milo-gray-700);
    font-size: 0.82rem;
}

.milo-auth-fine a { color: var(--milo-ink); font-weight: 600; }

/* Development accounts: one raised row each */
.milo-auth-account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 0.75rem;
    padding: 0.9rem 1rem;
    background: var(--milo-surface);
    border: 1px solid var(--milo-border);
    border-radius: 12px;
    box-shadow: var(--milo-shadow);
}

.milo-auth-account strong { display: block; }

.milo-auth-account small {
    display: block;
    color: var(--milo-gray-700);
    font-size: 0.8rem;
}

.milo-auth-signed {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.8rem 1rem;
    background: var(--milo-sage-soft);
    border: 1px solid var(--milo-sage-200);
    border-radius: 12px;
}

/* Access pending: who signed in */
.milo-auth-identity {
    margin: 0 0 1.25rem;
    padding: 0.25rem 1rem;
    background: var(--milo-surface-soft);
    border-radius: 12px;
}

.milo-auth-identity > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--milo-border);
    font-size: 0.88rem;
}

.milo-auth-identity > div:last-child { border-bottom: 0; }

.milo-auth-identity dt { color: var(--milo-gray-700); font-weight: 500; }

.milo-auth-identity dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }


/* ---------- Narrower screens ---------- */

@media (max-width: 1199.98px) {
    .milo-auth-showcase { transform: scale(0.85); transform-origin: left center; }
}

/* Phone and small tablet: the brand a short banner, the card below */
@media (max-width: 899.98px) {
    .milo-auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .milo-auth-brand { min-height: 0; padding: 1.25rem 1.25rem 1.75rem; gap: 1.25rem; }
    .milo-auth-showcase,
    .milo-auth-pitch p { display: none; }
    .milo-auth-headline { font-size: 2.3rem; }
    .milo-auth-kicker { font-size: 0.7rem; }
    .milo-auth-pill { font-size: 0.65rem; padding: 0.35rem 0.8rem; }
    .milo-auth-card { padding: 2rem 1.4rem; }
}


/* =========================================================
   Halftone tail (the brand panel's background): dots biggest
   near the instrument, shrinking along a tail. Soft dots
   screen-blended with a brightness map, then thresholded by
   contrast(); on the dark panel they're light and see-through.
   ========================================================= */

.milo-halftone {
    --ht-x: 62%;
    --ht-y: 36%;
    --ht-angle: 235deg;
    --ht-spread: 24deg;
    --ht-reach: 90%;
    --ht-head: 22%;
    --ht-size: 15px;
    --ht-bg: #073b2a;

    position: relative;
    isolation: isolate;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 60% at 70% 30%, rgba(23, 133, 74, 0.25), transparent 70%),
        var(--ht-bg);
}

.milo-halftone::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(closest-side, #000, #fff 170%) 0 0 / var(--ht-size) var(--ht-size),
        radial-gradient(circle at var(--ht-x) var(--ht-y), #000 0%, #999 var(--ht-head)),
        radial-gradient(circle at var(--ht-x) var(--ht-y), #000 0%, #999 var(--ht-reach)),
        conic-gradient(
            from calc(var(--ht-angle) - var(--ht-spread)) at var(--ht-x) var(--ht-y),
            #999 0deg,
            #000 var(--ht-spread),
            #999 calc(var(--ht-spread) * 2)
        );
    background-blend-mode: screen, darken, screen, normal;
    filter: contrast(30) invert(1);
    mix-blend-mode: screen;
    opacity: 0.18;
}


/* ---------- Signed out: a status bubble in the window's corner ---------- */

/* Like the small box a browser shows at the bottom-left when a link is
   pointed at: square on the window's edges, rounded on the inside corner,
   quiet grey. Only the signed-out note uses it. It fades away after 4 s:
   the sign-in box beside it already says what to do next */
.milo-auth-statusbar {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 1080;

    max-width: min(760px, calc(100vw - 16px));
    padding: 0.32rem 0.75rem;

    color: #1f2a24;
    background: #f1f3f1;
    border: 1px solid #c9cfca;
    border-bottom: 0;
    border-left: 0;
    border-top-right-radius: 6px;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.12);

    font-size: 0.78rem;
    line-height: 1.35;

    animation:
        milo-auth-statusbar-in 0.25s ease-out both,
        milo-auth-statusbar-out 0.6s ease-in 4s forwards;
}

.milo-auth-statusbar .milo-system-label {
    margin-right: 0.35rem;
}

@keyframes milo-auth-statusbar-in {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
}

@keyframes milo-auth-statusbar-out {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* No slide in; the fade stays (it doesn't move anything) */
@media (prefers-reduced-motion: reduce) {
    .milo-auth-statusbar {
        animation: milo-auth-statusbar-out 0.6s ease-in 4s forwards;
    }
}
