/* =============================================================
   Signed-out workspace shell: Account/Login and Public/Choose.

   Shares the app's typeface (--font-family-base in app/base/tokens.css)
   and theme colours (--app-* in app/themes/themes.css), so the light and
   dark themes follow the same preference as the signed-in app. The only
   colours of its own are the logo mark's pastels, used for decoration.
   ============================================================= */

:root {
    --wa-page: var(--app-bg, #f5f7fa);
    --wa-surface: var(--app-card, #ffffff);
    --wa-surface-alt: var(--app-surface-muted, #f8fafc);
    --wa-surface-subtle: var(--app-surface-subtle, #f1f5f9);
    --wa-frost: rgba(255, 255, 255, .82);
    --wa-ink: var(--app-text-strong, #0f172a);
    --wa-muted: #64748b;
    --wa-muted-strong: var(--app-text-secondary, #334155);
    --wa-hairline: #e2e8f0;
    --wa-brand: var(--app-primary, #2563eb);
    --wa-brand-hover: #1d4ed8;
    --wa-brand-text: var(--app-primary-text, #2563eb);
    --wa-brand-subtle: var(--app-primary-subtle, #eff6ff);
    --wa-accent: #7c3aed;
    --wa-accent-subtle: var(--app-accent-subtle, #f5f3ff);
    --wa-success: #16a34a;
    --wa-input: #fbfcfe;
    --wa-shadow: 0 18px 55px rgba(15, 23, 42, .055), 0 3px 14px rgba(15, 23, 42, .035);
    --wa-shadow-hover: 0 30px 70px rgba(30, 64, 175, .13), 0 6px 18px rgba(30, 64, 175, .06);

    /* The logo mark's own pastels (favicon.svg). */
    --wa-mark-blue: #8bc2f9;
    --wa-mark-violet: #e2d6fc;
    --wa-mark-green: #bdf9d5;
    --wa-mark-pink: #f7d1e8;

    --wa-gradient-text: linear-gradient(100deg, #2563eb 0%, #4f6ef0 48%, #8b5cf6 100%);
    --wa-gradient-fill: linear-gradient(120deg, #1d4ed8 0%, #2563eb 50%, #4f63f0 100%);
}

[data-bs-theme="dark"] {
    --wa-frost: rgba(15, 23, 42, .84);
    --wa-ink: var(--app-text-strong, #ffffff);
    --wa-muted: var(--app-muted, #94a3b8);
    --wa-muted-strong: var(--app-text-secondary, #cbd5e1);
    --wa-hairline: var(--app-border, #334155);
    --wa-brand-text: var(--app-primary-text, #60a5fa);
    --wa-brand-hover: #3b82f6;
    --wa-accent: #a78bfa;
    --wa-success: #4ade80;
    --wa-input: #172135;
    --wa-shadow: 0 20px 60px rgba(0, 0, 0, .22);
    --wa-shadow-hover: 0 28px 70px rgba(0, 0, 0, .34);
    --wa-gradient-text: linear-gradient(100deg, #60a5fa 0%, #818cf8 50%, #c4b5fd 100%);
}

/* _AuthLayout centres a single card; these pages are full-width. */
body.workspace-auth {
    display: block !important;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    background: var(--wa-page);
    color: var(--wa-ink);
    font-family: var(--font-family-base, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif);
    -webkit-font-smoothing: antialiased;
}

/* Its inline place-items:center also centres block boxes in current
   Chromium, which shrank the page to its content's width. */
body.workspace-auth > main {
    display: block !important;
    justify-items: stretch !important;
}

.workspace-auth button,
.workspace-auth input {
    font: inherit;
}

.workspace-auth a:focus-visible,
.workspace-auth button:focus-visible,
.workspace-auth input:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .45);
    outline-offset: 3px;
}

.wa-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    /* Both axes: the 860px glow must not make a short page scroll. */
    overflow: clip;
}

.wa-glow {
    position: absolute;
    z-index: 0;
    inset: 0 0 auto;
    height: 860px;
    overflow: hidden;
    pointer-events: none;
}

    .wa-glow::before,
    .wa-glow::after {
        content: "";
        position: absolute;
        width: 960px;
        height: 690px;
        top: -270px;
        filter: blur(8px);
    }

    .wa-glow::before {
        left: -320px;
        background: radial-gradient(ellipse, rgba(37, 99, 235, .13), transparent 70%);
    }

    .wa-glow::after {
        right: -320px;
        background: radial-gradient(ellipse, rgba(139, 92, 246, .11), transparent 70%);
    }

[data-bs-theme="dark"] .wa-glow::before {
    background: radial-gradient(ellipse, rgba(59, 130, 246, .18), transparent 70%);
}

[data-bs-theme="dark"] .wa-glow::after {
    background: radial-gradient(ellipse, rgba(139, 92, 246, .16), transparent 70%);
}

.wa-shell {
    position: relative;
    z-index: 1;
    width: min(1248px, calc(100% - 72px));
    margin-inline: auto;
}

/* ---------- Header ---------- */

.wa-header {
    position: relative;
    z-index: 5;
    border-bottom: 1px solid var(--wa-hairline);
    background: var(--wa-frost);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.wa-header-inner {
    height: var(--wa-header-h, 84px);
    display: flex;
    align-items: center;
    gap: 32px;
}

.wa-logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

    .wa-logo img {
        display: block;
        width: auto;
        height: 36px;
    }

/* Same light/dark pair as the sidebar (app/components/theme.css). */
.wa-logo .app-logo--dark,
[data-bs-theme="dark"] .wa-logo .app-logo--light {
    display: none;
}

[data-bs-theme="dark"] .wa-logo .app-logo--dark {
    display: block;
}

.wa-tagline {
    padding-left: 20px;
    border-left: 1px solid var(--wa-hairline);
    color: var(--wa-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    line-height: 1.5;
    text-transform: uppercase;
}

.wa-header-spacer {
    flex: 1;
}

.wa-current {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 15px;
    color: var(--wa-muted-strong);
    background: var(--wa-surface);
    border: 1px solid var(--wa-hairline);
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

    .wa-current svg {
        width: 16px;
        height: 16px;
        color: var(--wa-brand-text);
    }

.wa-theme-toggle {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    color: var(--wa-muted-strong);
    background: var(--wa-surface);
    border: 1px solid var(--wa-hairline);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .2s, transform .2s;
}

    .wa-theme-toggle:hover {
        transform: translateY(-2px);
        background: var(--wa-surface-alt);
    }

    .wa-theme-toggle svg {
        width: 19px;
        height: 19px;
    }

    .wa-theme-toggle .sun,
    [data-bs-theme="dark"] .wa-theme-toggle .moon {
        display: none;
    }

[data-bs-theme="dark"] .wa-theme-toggle .sun {
    display: block;
}

/* Landing header: sticky, with section links and sign-in buttons. */
.wa-header.is-sticky {
    position: sticky;
    top: 0;
    z-index: 50;
}

.wa-nav {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-left: auto;
}

    .wa-nav a {
        color: var(--wa-muted-strong);
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
        white-space: nowrap;
        transition: color .2s;
    }

        .wa-nav a:hover {
            color: var(--wa-brand-text);
        }

.wa-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 8px;
}

.wa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 44px;
    padding: 0 18px;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .2s, background-color .2s, box-shadow .2s, border-color .2s;
}

    .wa-btn svg {
        width: 16px;
        height: 16px;
        flex: none;
    }

.wa-btn-primary {
    color: #fff;
    background: var(--wa-brand);
    border: 1px solid transparent;
    box-shadow: 0 8px 21px rgba(37, 99, 235, .2);
}

    .wa-btn-primary:hover {
        color: #fff;
    }

.wa-btn-soft {
    color: var(--wa-ink);
    background: var(--wa-surface);
    border: 1px solid var(--wa-hairline);
    box-shadow: 0 3px 12px rgba(15, 23, 42, .04);
}

    .wa-btn-soft:hover {
        color: var(--wa-ink);
    }

.wa-nav .wa-nav-mobile {
    display: none;
}

.wa-menu-toggle {
    display: none;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    color: var(--wa-muted-strong);
    background: var(--wa-surface);
    border: 1px solid var(--wa-hairline);
    border-radius: 50%;
    cursor: pointer;
}

    .wa-menu-toggle svg {
        width: 19px;
        height: 19px;
    }

@media (max-width: 1180px) {
    .wa-nav { gap: 18px; }
    .wa-header.is-sticky .wa-tagline { display: none; }
}

/* Below this the section links fold into a menu under the header. */
@media (max-width: 1100px) {
    .wa-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: 8px 24px 14px;
        background: var(--wa-surface);
        border-bottom: 1px solid var(--wa-hairline);
        box-shadow: var(--wa-shadow);
    }

        .wa-nav.is-open {
            display: flex;
        }

        .wa-nav a {
            padding: 13px 2px;
            font-size: 15px;
        }

            .wa-nav a + a {
                border-top: 1px solid var(--wa-hairline);
            }

    .wa-header-actions { margin-left: auto; }
    .wa-menu-toggle { display: grid; }
}

@media (max-width: 640px) {
    .wa-header-actions .wa-header-cta { display: none; }
    .wa-nav .wa-nav-mobile { display: block; color: var(--wa-brand-text); }
    .wa-menu-toggle { width: 38px; height: 38px; }
}

/* ---------- Shared pieces ---------- */

.wa-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--wa-brand-text);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.wa-eyebrow-line {
    width: 26px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, #2563eb, #a78bfa);
}

.wa-gradient-text {
    background: var(--wa-gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.wa-float-chip {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    background: var(--wa-frost);
    border: 1px solid var(--wa-hairline);
    border-radius: 13px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .09);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    animation: wa-bob 5s ease-in-out infinite;
}

    .wa-float-chip svg {
        width: 19px;
        height: 19px;
    }

    .wa-float-chip.hr { color: var(--wa-brand-text); }
    .wa-float-chip.qa { color: var(--wa-accent); animation-delay: -1.6s; }
    .wa-float-chip.lms { color: #db2777; animation-delay: -2.6s; }

[data-bs-theme="dark"] .wa-float-chip.lms {
    color: #f9a8d4;
}

.wa-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 26px 0 24px;
    color: var(--wa-muted);
    font-size: 12px;
}

    .wa-footer a {
        color: var(--wa-muted);
        text-decoration: none;
    }

        .wa-footer a:hover {
            color: var(--wa-brand-text);
        }

.wa-footer-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
}

    .wa-footer-brand img {
        width: 16px;
        height: 16px;
    }

@keyframes wa-bob {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -8px; }
}

@media (max-width: 1000px) {
    .wa-shell { width: calc(100% - 44px); }
    .wa-tagline { display: none; }
}

/* Laptop-height screens: a slimmer header and footer leave the page
   content room to fit without scrolling. */
@media (max-height: 860px) {
    :root { --wa-header-h: 68px; }
    .wa-logo img { height: 32px; }
    .wa-theme-toggle { width: 38px; height: 38px; }
    .wa-current { padding: 8px 13px; }
    .wa-footer { padding: 14px 0; }
}

@media (min-width: 1700px) {
    .wa-shell { width: min(1400px, calc(100% - 120px)); }
}

@media (max-width: 640px) {
    :root { --wa-header-h: 64px; }
    .wa-shell { width: calc(100% - 32px); }
    .wa-header-inner { gap: 12px; }
    .wa-logo img { height: 28px; }
    .wa-current { display: none; }
    .wa-footer { flex-direction: column; gap: 8px; text-align: center; }
}

/* ---------- Page transitions ----------
   Landing, Choose and Login opt in through _WorkspaceMotionHead.cshtml,
   which also tags each transition wa-forward (landing -> choose -> sign-in)
   or wa-back (the other way).

   - The page slides a short way in the direction of travel. The old page
     accelerates out while the new one decelerates in, overlapping, so the
     background never blinks between them.
   - The header is its own layer: it stays put and crossfades between its
     landing and pill forms.
   - The chooser's HR card and the sign-in card share a name, so "Open HR
     workspace" grows the card into the sign-in card (and back). When only
     one of them is on screen (landing <-> sign-in) the card simply travels
     with the page.
   Only transform and opacity animate, so it all stays on the compositor. */

/* The --wa-vt-* tokens and the wa-vt-* slide keyframes are shared with the
   workspace: app/components/page-transitions.css, which the motion head links. */

@media (prefers-reduced-motion: no-preference) {
    .wa-header {
        view-transition-name: wa-header;
    }

    .choose-card.is-primary,
    .login-stage {
        view-transition-name: wa-stage;
    }

    /* The page, forwards by default... */
    ::view-transition-old(root),
    ::view-transition-old(wa-stage):only-child {
        animation: wa-vt-out-fwd var(--wa-vt-out) var(--wa-vt-ease-out) both;
    }

    ::view-transition-new(root),
    ::view-transition-new(wa-stage):only-child {
        animation: wa-vt-in-fwd var(--wa-vt-in) var(--wa-vt-ease-in) both;
    }

    /* ...and mirrored going back. */
    html:active-view-transition-type(wa-back)::view-transition-old(root),
    html:active-view-transition-type(wa-back)::view-transition-old(wa-stage):only-child {
        animation-name: wa-vt-out-back;
    }

    html:active-view-transition-type(wa-back)::view-transition-new(root),
    html:active-view-transition-type(wa-back)::view-transition-new(wa-stage):only-child {
        animation-name: wa-vt-in-back;
    }

    /* The header holds still; its two forms crossfade. */
    ::view-transition-group(wa-header) {
        animation-duration: var(--wa-vt-in);
        animation-timing-function: var(--wa-vt-ease-in);
    }

    ::view-transition-old(wa-header),
    ::view-transition-new(wa-header) {
        animation-duration: 360ms;
        animation-timing-function: ease;
    }

    /* The card morph: the box glides to its new size and place while the
       two faces crossfade together (no dip), each fitted to the box rather
       than stretched across it. */
    ::view-transition-group(wa-stage) {
        animation-duration: var(--wa-vt-morph);
        animation-timing-function: var(--wa-vt-ease-move);
        border-radius: 22px;
        overflow: clip;
    }

    ::view-transition-old(wa-stage),
    ::view-transition-new(wa-stage) {
        height: 100%;
        object-fit: cover;
        object-position: center top;
    }

    ::view-transition-old(wa-stage):not(:only-child),
    ::view-transition-new(wa-stage):not(:only-child) {
        animation-duration: 420ms;
        animation-timing-function: ease;
    }
}

/* ---------- Entrances on a direct load ----------
   When a page is opened directly (no transition carried it in), its main
   blocks settle in with a short stagger. html.wa-motion is set only when
   motion is allowed, and html.wa-arrived when a transition brought the page,
   so this never plays on top of a transition. */
html.wa-motion:not(.wa-arrived) :is(.choose-hero > div:first-child > *, .choose-section-head, .choose-card, .choose-benefits, .login-stage) {
    animation: wa-enter .8s var(--wa-vt-ease-in) backwards;
}

html.wa-motion:not(.wa-arrived) .choose-hero > div:first-child > :nth-child(2) { animation-delay: .06s; }
html.wa-motion:not(.wa-arrived) .choose-hero > div:first-child > :nth-child(3) { animation-delay: .12s; }
html.wa-motion:not(.wa-arrived) .choose-art { animation: wa-enter-fade 1s var(--wa-vt-ease-in) .1s backwards; }
html.wa-motion:not(.wa-arrived) .choose-section-head { animation-delay: .16s; }
html.wa-motion:not(.wa-arrived) .choose-card:nth-child(1) { animation-delay: .22s; }
html.wa-motion:not(.wa-arrived) .choose-card:nth-child(2) { animation-delay: .29s; }
html.wa-motion:not(.wa-arrived) .choose-card:nth-child(3) { animation-delay: .36s; }
html.wa-motion:not(.wa-arrived) .choose-benefits { animation-delay: .44s; }

/* The sign-in card's contents settle in just after the card itself, whether
   the card rose on a direct load or grew out of the chooser's HR card. */
html.wa-motion :is(.login-story, .login-auth) > * {
    animation: wa-enter-soft .7s var(--wa-vt-ease-in) backwards;
}

html.wa-motion .login-story > :nth-child(1),
html.wa-motion .login-auth > :nth-child(1) { animation-delay: .2s; }
html.wa-motion .login-story > :nth-child(2),
html.wa-motion .login-auth > :nth-child(2) { animation-delay: .25s; }
html.wa-motion .login-story > :nth-child(3),
html.wa-motion .login-auth > :nth-child(3) { animation-delay: .3s; }
html.wa-motion .login-story > :nth-child(4),
html.wa-motion .login-auth > :nth-child(4) { animation-delay: .35s; }
html.wa-motion .login-story > :nth-child(n+5),
html.wa-motion .login-auth > :nth-child(n+5) { animation-delay: .4s; }

@keyframes wa-enter {
    from { opacity: 0; transform: translateY(16px); }
}

@keyframes wa-enter-soft {
    from { opacity: 0; transform: translateY(8px); }
}

@keyframes wa-enter-fade {
    from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .workspace-auth *,
    .workspace-auth *::before,
    .workspace-auth *::after {
        animation: none !important;
        transition: none !important;
    }
}
