/*
 * Anorak Labs, for the OS gateway's own pages: the shell bar, the landing grid,
 * sign-in, passcode, admin and the error pages. Never linked into os/content/.
 *
 * Copied value for value from anorak-playable frontend/client/src:
 *   theme/brand.ts (colours, radii), theme/gradients.ts (--g-*, --spectrum),
 *   theme/type.ts (faces), components/css/baseCss.ts (.btn, .kind, .empty, .mono),
 *   components/{Btn,Card,Pill,StatusPill,Tag,Kicker,Heading,BigTitle,TextBox,
 *   SearchField,Segment,TopBar,HelpMenu,Toast,Empty,LabsMark}.tsx.
 * Fonts: the Google Fonts sheet from platform/pageBackground.ts (each page links it).
 * Dark only.
 */

:root {
    /* brand.ts */
    --charcoal: #1f1f1f;
    --ink: #151515;
    --panel: #262626;
    --raise: #2a2a2a;
    --raise-2: #353535;
    --white: #ffffff;
    --body-dark: #d9d9d9;
    --grey: #b2b2b2;
    --muted: #8f8f8f;
    --yellow: #fff200;
    --pink: #fd919e;
    --cyan: #39c4e0;
    --lime: #a0f258;
    --orange: #fdad29;
    --danger: #c93a3a;
    --danger-text: #df8989;
    --warm: #f4f3f1;
    --black: #000000;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.24);
    --field: rgba(255, 255, 255, 0.05);

    /* brand.ts radius */
    --radius-card: 16px;
    --radius-hero: 22px;
    --radius-small: 10px;
    --radius-pill: 999px;

    /* type.ts */
    --font-display: 'Zalando Sans Expanded', 'Zalando Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Zalando Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

    /* baseCss.ts */
    --shadow-float: 0 40px 80px -30px rgba(0, 0, 0, 0.75);
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --nav-h: 62px;

    /* gradients.ts via cssGradient.ts */
    --g-aim: linear-gradient(150deg, #ffe86b 0%, #fdc341 45%, #fd9d42 100%);
    --g-story: linear-gradient(150deg, #ffd9d2 0%, #fda9b3 45%, #f6849c 100%);
    --g-story-aim: linear-gradient(150deg, #f2ff8f 0%, #c5f56a 45%, #86e070 100%);
    --g-adventure: linear-gradient(150deg, #c2f5ff 0%, #72d7ee 45%, #35b2e0 100%);
    --g-chat: linear-gradient(150deg, #fffcc4 0%, #fff35c 45%, #f3d93a 100%);
    --g-style: linear-gradient(150deg, #c9f1f2 0%, #c4c6dc 45%, #f2a9bd 100%);
    --g-custom: linear-gradient(120deg, #fff36b 0%, #fdad29 25%, #fd919e 50%, #39c4e0 75%, #a0f258 100%);
    --spectrum: linear-gradient(120deg, #fff36b 34%, #fdad29 50%, #fd919e 66%, #39c4e0 82%, #a0f258 98%);
}

/* pageBackground.ts: the charcoal page, its fonts, smoothed type. */
.labs-dark {
    color-scheme: dark;
}
body.labs {
    margin: 0;
    background: var(--charcoal);
    color: var(--white);
    font: 400 15px/1.45 var(--font-body);
    -webkit-font-smoothing: antialiased;
}
.labs *,
.labs *::before,
.labs *::after {
    box-sizing: border-box;
}
.labs :focus-visible {
    outline: 2.5px solid var(--white);
    outline-offset: 3px;
}

/* Kicker.tsx / baseCss .mono: a small label in tracked caps. */
.mono,
.kicker {
    font: 600 10.5px/13px var(--font-body);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Heading.tsx: `.section-title` (level 2) and level 3. */
.section-title {
    margin: 0;
    font: 800 22px/26px var(--font-display);
    letter-spacing: -0.03em;
    color: var(--white);
}
.heading-3 {
    margin: 0;
    font: 800 15px/19px var(--font-display);
    letter-spacing: -0.03em;
    color: var(--white);
}
/* BigTitle.tsx `.page-title`: 28–38 as the column allows. */
.page-title {
    margin: 0;
    font: 800 clamp(28px, 3.2vw, 38px) / 1.02 var(--font-display);
    letter-spacing: -0.04em;
    color: var(--white);
}
@media (max-width: 559px) {
    .section-title {
        font-size: 17px;
        line-height: 21px;
    }
    .page-title {
        font-size: 28px;
    }
}

/* Btn.tsx: Labs' pill buttons. Kinds and sizes compound with .btn. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--white);
    font: 600 15px/18px var(--font-body);
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s;
}
.btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.btn svg {
    flex: none;
}
.btn.btn-white {
    background: var(--white);
    color: var(--charcoal);
}
.btn.btn-white:not(:disabled):hover {
    background: #ececec;
}
.btn.btn-glass {
    background: rgba(21, 21, 21, 0.45);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.3);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.btn.btn-ghost {
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.24);
}
.btn:is(.btn-glass, .btn-ghost):not(:disabled):hover {
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.7);
}
.btn.btn-danger {
    background: var(--danger);
}
.btn.btn-lime {
    background: var(--lime);
    color: var(--charcoal);
    box-shadow: 0 0 22px rgba(160, 242, 88, 0.42);
}
.btn.btn-lime:not(:disabled):hover {
    box-shadow: 0 0 22px rgba(160, 242, 88, 0.6);
}
.btn.btn-lg {
    height: 54px;
    padding: 0 30px;
    font-size: 16px;
}
.btn.btn-sm {
    height: 40px;
    padding: 0 16px;
    font-size: 14px;
}
.btn.btn-xs {
    height: 34px;
    padding: 0 13px;
    font-size: 13px;
}
@media (max-width: 559px) {
    .btn {
        height: 44px;
        padding: 0 18px;
        font-size: 14.5px;
    }
    .btn.btn-lg {
        height: 48px;
        padding: 0 24px;
        font-size: 15px;
    }
    .btn.btn-sm {
        height: 36px;
        padding: 0 14px;
        font-size: 13.5px;
    }
    .btn.btn-xs {
        height: 32px;
        padding: 0 13px;
        font-size: 12.5px;
    }
}
.btn.btn-block {
    width: 100%;
}
/* `.btn-meta`: small capitals after the words. */
.btn-meta {
    margin-left: 2px;
    font: 400 11px/11px var(--font-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.6;
}
/* Btn kind `link` / baseCss `.text-link`. */
.text-link {
    font-weight: 600;
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.text-link:hover {
    opacity: 0.8;
}
/* baseCss `.icon-btn`. */
.icon-btn {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    color: var(--white);
    cursor: pointer;
    transition: background-color 0.2s;
}
.icon-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* Card.tsx: radius 16 on panel. */
.card {
    background: var(--panel);
    border-radius: var(--radius-card);
    padding: 22px;
}

/* Pill.tsx `.status`: a quiet pill in tracked caps, its dot saying the state. */
.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 11px 0 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font: 400 10.5px/12px var(--font-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--white);
    white-space: nowrap;
}
.status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--grey);
}
.status.ok i,
.status.busy i {
    background: var(--lime);
}
.status.busy i {
    animation: labs-pulse 1.4s ease-in-out infinite;
}
.status.bad i {
    background: var(--danger);
}
/* StatusPill.tsx: the smaller one laid over covers. */
.status.status-sm {
    height: 24px;
    background: rgba(21, 21, 21, 0.72);
}

/* Tag.tsx `.chip-format`: a mark in its colour, then a name. */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(21, 21, 21, 0.55);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
    font: 500 12.5px/14px var(--font-body);
    color: var(--white);
    white-space: nowrap;
}
/* baseCss `.kind`: the kind pill in tracked caps, its dot white unless coloured. */
.kind {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(21, 21, 21, 0.55);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
    font: 400 10.5px/1 var(--font-body);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--white);
    white-space: nowrap;
}
.chip i,
.kind i {
    flex: none;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--white);
}

/* TextBox.tsx: a pill input, a textarea rounded 22, white border and halo on focus. */
.textbox {
    width: 100%;
    height: 48px;
    padding: 0 18px;
    border: 1.5px solid var(--line-strong);
    border-radius: 999px;
    background: var(--field);
    color: var(--white);
    font: 400 16px/1.4 var(--font-body);
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}
textarea.textbox {
    height: auto;
    min-height: 120px;
    padding: 12px 18px;
    border-radius: var(--radius-hero);
    line-height: 22.4px;
    resize: vertical;
}
.textbox::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.textbox:focus {
    border-color: var(--white);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
    outline: none;
}

/* SearchField.tsx `.search`: a pill field with the magnifier inside it. */
.search {
    position: relative;
    display: flex;
    align-items: center;
}
.search .textbox {
    height: 42px;
    padding-left: 46px;
}
.search > svg {
    position: absolute;
    left: 17px;
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
}

/* Segment.tsx `.seg`: pills on a raised track, the chosen one white. */
.seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    max-width: 100%;
    padding: 4px;
    border-radius: 999px;
    background: var(--raise);
}
.seg > * {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 15px;
    border: 0;
    border-radius: 999px;
    background: none;
    font: 600 14px/1 var(--font-body);
    color: rgba(255, 255, 255, 0.66);
    text-decoration: none;
    cursor: pointer;
}
.seg > [aria-selected='true'],
.seg > [aria-current] {
    background: var(--white);
    color: var(--charcoal);
}

/* TopBar.tsx `.nav`: the desktop bar on frosted ink, its bottom corners rounded. */
.nav-wrap {
    position: relative;
    z-index: 50;
    padding: 0 32px;
}
.nav {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 1760px;
    min-height: var(--nav-h);
    margin: 0 auto;
    padding: 8px 8px 8px 22px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-top: 0;
    border-radius: 0 0 24px 24px;
    background: rgba(21, 21, 21, 0.86);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
}
.nav-link {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 15px;
    border-radius: 999px;
    font: 500 14.5px/1 var(--font-body);
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
}
.nav-link:hover,
.nav-link[aria-current] {
    color: var(--white);
}
.nav-link[aria-current] {
    background: rgba(255, 255, 255, 0.1);
}
@media (max-width: 640px) {
    .nav-wrap {
        padding: 0 12px;
    }
    .nav {
        padding-left: 16px;
        gap: 10px;
    }
}

/* HelpMenu.tsx: a panel menu under its button. */
.menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    min-width: 220px;
    padding: 6px;
    border-radius: 16px;
    background: var(--panel);
    box-shadow:
        inset 0 0 0 1px var(--line),
        var(--shadow-float);
}
.menu a,
.menu button {
    display: flex;
    align-items: center;
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: none;
    font: 500 14.5px/1 var(--font-body);
    color: var(--white);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.menu a:hover,
.menu button:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* LabsMark.tsx `.pmark`: the Anorak A cut from the spectrum, the word in tracked caps. */
.pmark {
    display: inline-flex;
    align-items: center;
    gap: 0.75em;
    font: 700 13px/1 var(--font-display);
    color: var(--white);
    text-decoration: none;
}
.pmark-a {
    flex: none;
    width: 2.12em;
    height: 1.8em;
    background: var(--spectrum);
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.pmark-word {
    letter-spacing: 0.2em;
    margin-right: -0.2em;
}

/* Empty.tsx / baseCss `.empty`: a panel saying there is nothing here, and what to do. */
.empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 26px;
    border-radius: 24px;
    background: var(--panel);
}
.empty-title {
    margin: 0;
    max-width: 520px;
    font: 800 20px/23px var(--font-display);
    letter-spacing: -0.03em;
    text-wrap: balance;
    color: var(--white);
}
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Toast.tsx: a white pill with charcoal words; a red dot when it went wrong. */
.labs-toast {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 6px 18px;
    border-radius: 999px;
    background: var(--white);
    box-shadow: var(--shadow-float);
    font: 600 14px/20px var(--font-body);
    color: var(--charcoal);
}
.labs-toast.bad::before {
    content: '';
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
}

@keyframes labs-pulse {
    50% {
        opacity: 0.35;
    }
}
