/* ==========================================================================
   Onboarding — the 3-step slider guests meet at `/`

   Rides on the `.auth` mesh background and its tokens (see _auth.css, which
   must load first), so the hand-off to the login screen is seamless; only the
   layout inside it is bespoke.
   ========================================================================== */

/* `.auth` already centres its child both ways; only its padding is dropped, so
   the shell can run edge to edge as a full-screen app view on phones. */
.onboarding { padding: 0; }

.onboarding__shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    /* dvh keeps the screen inside the visible viewport on mobile; vh is the fallback. */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    /* `.auth` deliberately aligns to flex-start and leaves vertical centring to
       an auto margin on its child, so that a panel taller than the viewport
       overflows downward instead of having its top clipped. `.auth__card` sets
       that margin; this shell is not an `.auth__card`, so it has to set it
       itself — without this the panel sat pinned to the top of the screen with
       the rest of the page empty below it. */
    margin-block: auto;
    padding:
        calc(var(--sp-5) + env(safe-area-inset-top, 0px))
        var(--sp-5)
        calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
}

.onboarding__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
}

.onboarding__brand img { height: 20px; width: auto; object-fit: contain; }

.onboarding__skip {
    padding: var(--sp-2) var(--sp-1);
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    transition: color var(--dur) var(--ease);
}

.onboarding__skip:hover { color: var(--text); }

/* The viewport clips; the track slides one full width per step. The negative
   margin lets each slide use the full width without fighting the shell padding. */
.onboarding__viewport {
    flex: 1;
    display: flex;
    overflow: hidden;
    margin: 0 calc(var(--sp-5) * -1);
}

.onboarding__track {
    display: flex;
    width: 100%;
    transition: transform 0.38s var(--ease);
    will-change: transform;
}

.onboarding__slide {
    flex: 0 0 100%;
    min-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--sp-5) var(--sp-8);
    /* The viewport clips, so a slide that cannot fit — landscape phones, mostly
       — has to scroll on its own or it silently loses its last lines. */
    overflow-y: auto;
    overscroll-behavior: contain;
}

.onboarding__art {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Square, always: as a flex item it would otherwise squash into an oval the
       moment the slide runs short of room. */
    flex: 0 0 auto;
    width: 92px;
    height: 92px;
    margin-bottom: var(--sp-6);
    border-radius: 26px;
    background: var(--glass-fill-strong);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--glass-shadow);
    color: var(--primary);
    font-size: 2.2rem;
}

.onboarding__copy {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.onboarding__title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--text);
    text-wrap: balance;
}

.onboarding__text {
    max-width: 320px;
    margin: var(--sp-3) 0 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-2);
}

.onboarding__foot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-5);
    padding-top: var(--sp-5);
}

.onboarding__dots { display: flex; gap: var(--sp-2); }

.onboarding__dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    border-radius: var(--r-pill);
    background: rgba(var(--primary-rgb), 0.28);
    cursor: pointer;
    transition: width var(--dur) var(--ease), background var(--dur) var(--ease);
}

.onboarding__dot:not(.is-active):hover { background: rgba(var(--primary-rgb), 0.5); }

.onboarding__dot:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.onboarding__dot.is-active {
    width: 24px;
    background: var(--primary);
}

.onboarding__legal {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-2);
}

.onboarding__legal a {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.onboarding__legal a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Short viewports — small phones, and any screen in landscape. The art tile is
   the first thing that has to give, or the copy gets squeezed against the
   button. Width-capped so a short desktop window keeps the roomier panel below
   rather than falling back to the phone sizing.
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) and (max-height: 720px) {
    .onboarding__art {
        width: 76px;
        height: 76px;
        margin-bottom: var(--sp-4);
        border-radius: 22px;
        font-size: 1.9rem;
    }
}

@media (max-width: 991.98px) and (max-height: 560px) {
    .onboarding__shell { padding: var(--sp-3) var(--sp-5); }

    .onboarding__art {
        width: 58px;
        height: 58px;
        margin-bottom: var(--sp-3);
        border-radius: 18px;
        font-size: 1.45rem;
    }

    .onboarding__slide { padding: var(--sp-2) var(--sp-8); }
    .onboarding__title { font-size: 1.15rem; }
    .onboarding__text { margin-top: var(--sp-2); }
    .onboarding__foot { gap: var(--sp-3); padding-top: var(--sp-3); }
}

/* --------------------------------------------------------------------------
   Tablet up — it stops being a full-screen view and becomes a contained panel.
   A 480px column stretched over a 900px-tall viewport just strands the content
   in empty space.
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
    .onboarding { padding: var(--sp-6) var(--sp-4); }

    .onboarding__shell {
        min-height: 0;
        /* Height follows the content; the viewport below carries the min-height
           so the panel does not resize as the copy changes length per step. */
        max-height: calc(100dvh - 48px);
        padding: var(--sp-6);
        border-radius: 20px;
        /* Same frosted treatment as the auth fields it hands off to, so the two
           screens read as one surface — the fill and the shadow carry it, with
           no outline around the panel. */
        background: var(--glass-fill);
        -webkit-backdrop-filter: var(--glass-blur);
        backdrop-filter: var(--glass-blur);
        box-shadow: var(--glass-shadow);
    }

    /* The panel is content-height, so the track needs a floor of its own —
       without it the panel would grow and shrink with each step's copy. */
    .onboarding__viewport {
        min-height: 260px;
        margin: 0 calc(var(--sp-6) * -1);
    }

    /* The tile already carries the frosted treatment of the panel it now sits
       on; a second blurred layer over the first turns it milky. */
    .onboarding__art {
        background: var(--surface);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

/* --------------------------------------------------------------------------
   Desktop — a phone-shaped column centred on a wide screen reads as a mistake,
   so the slide turns on its side: art beside the copy, text ranged left, and
   the footer spread across one row instead of stacked.
   -------------------------------------------------------------------------- */
@media (min-width: 992px) {
    /* Sized to the copy rather than to the screen — a panel wider than the text
       it holds just moves the empty space inside the card. */
    .onboarding__shell {
        max-width: 660px;
        padding: var(--sp-6) var(--sp-8);
    }

    .onboarding__brand img { height: 25px; }

    .onboarding__viewport {
        min-height: 200px;
        margin: 0;
    }

    .onboarding__slide {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: var(--sp-8);
        text-align: left;
        padding: var(--sp-5) 0;
    }

    .onboarding__art {
        width: 112px;
        height: 112px;
        margin-bottom: 0;
        border-radius: 30px;
        font-size: 2.6rem;
    }

    .onboarding__copy { align-items: flex-start; }

    .onboarding__title { font-size: 1.5rem; }

    .onboarding__text {
        max-width: 400px;
        font-size: 0.94rem;
    }

    /* Dots left, then the sign-in line, then the CTA on the right — the reading
       order of the row, not the DOM order the stacked layout needs. */
    .onboarding__foot {
        flex-direction: row;
        align-items: center;
        gap: var(--sp-5);
        padding-top: var(--sp-5);
    }

    .onboarding__dots { margin-right: auto; }

    .onboarding__legal { order: 2; }

    .onboarding__foot .btn-app {
        order: 3;
        width: auto;
        min-width: 200px;
    }
}

@media (min-width: 992px) and (max-height: 760px) {
    .onboarding__shell { padding: var(--sp-5) var(--sp-8); }

    .onboarding__viewport { min-height: 176px; }

    .onboarding__art {
        width: 92px;
        height: 92px;
        border-radius: 26px;
        font-size: 2.2rem;
    }

    .onboarding__slide { gap: var(--sp-6); padding: var(--sp-3) 0; }
    .onboarding__title { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
    .onboarding__track { transition: none; }
}
