* {
    box-sizing: border-box;
}

/* The compact interface register, declared once for every surface: a
   compliance tool is read in volume, so 12px is the size the whole product
   reads at, admin and settings included. A component that wants another step
   names one from the scale. */
html, body {
    margin: 0;
    padding: 0;

    background: var(--color-surface) no-repeat;
    color: var(--color-text-primary);

    font-family: var(--body-font);
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-normal);
}

/* global hyperlink styling */
a {
    color: var(--color-link);
    text-decoration: none;
}

/* Every focusable control takes the same ring, drawn from the tokens, declared
   once rather than per component. A component whose shape needs a different one
   overrides it on its own selector. */
:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* The chrome label: a tile's caption, a section heading, the rail's group name.
   It is a treatment applied to whatever element already carries the text, not a
   component wrapped around it. */
.bl-label {
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    font-weight: var(--weight-bold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

/* Centred reading, for the authentication card and anything else whose text is
   read down the middle. Centring a flex container aligns its children but not
   the lines inside a sentence that wraps, and this is the half that has to
   cross a component boundary, so it is a class rather than a parameter. */
.bl-centred {
    text-align: center;
}

/* The illustrations are monochrome line work — black strokes with white fills
   inside them — drawn on a white ground. The ground has been cut out of the
   files so the page's own surface shows through, which leaves the line work
   itself invisible on the dark theme. Inverting the whole image is what fixes
   it: the strokes come out white and the fills inside them come out dark, so
   the drawing keeps the internal contrast that recolouring the strokes alone
   would flatten. */
:root[data-theme="dark"] .bl-illustration {
    filter: invert(1);
}

/* Form controls are the platform's own elements, so the design system skins
   them here once rather than in eleven scoped stylesheets. What the reader types
   or chooses is set at the prose weight, apart from the bold labels above it. */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    width: var(--field-width, 100%);
    max-width: 100%;

    padding: var(--space-xs);

    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-primary);

    font-family: inherit;
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-prose);
}

/* The form decides a field's width; the reader may drag a textarea taller, never wider, so it cannot
   push past the form or out of line with the fields around it. */
textarea {
    resize: vertical;
}

/* A select showing its empty choice is a placeholder, not a choice made, so it is drawn in the muted
   ink a text field's placeholder is. The field marks itself empty; its options keep their own ink. */
select.empty {
    color: var(--color-text-muted);
}

select.empty option {
    color: var(--color-text-primary);
}

/* A single-line field stands at the control height, so a field beside a button - a row of fields
   ending in one, a list's line - is one height with it. Only a textarea grows with its content. */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select {
    height: var(--control-height);
    padding-block: 0;
}

/* A content list's search stands at the height of the controls around it, in their shape, and at its
   step of the width scale (Medium). In the filter group of a list's controls the field gives up its own
   border for the group's chrome, in its own sheet. */
input[type="search"] {
    width: var(--field-width, 100%);
    max-width: 100%;
    height: var(--control-height);

    padding: 0 var(--space-md);

    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-primary);

    font-family: inherit;
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    font-weight: var(--weight-prose);
}

input:not(:disabled):hover,
select:not(:disabled):hover,
textarea:not(:disabled):hover {
    background: var(--color-surface-sunken);
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* The framework puts these on an input once its field has been touched and
   found wanting, and renders the message beneath it. */
input.invalid,
select.invalid,
textarea.invalid {
    border-color: var(--color-critical-fg);
}

.validation-message {
    font-size: var(--text-xs);
    line-height: var(--leading-xs);
    color: var(--color-critical-fg);
}