/*!
 * Radoslav.online Design System
 * ============================================================================
 *
 * CANONICAL SOURCE. Platform owns this file (Architecture R1 section 18:
 * DESIGN_SYSTEM_OWNER = PLATFORM_SHELL_CANONICAL_SOURCE).
 *
 *   design-system-version: see assets/design-system/VERSION
 *   source-repo:           Digital-Union-Company/Radoslav.online-Platform
 *   source-path:           assets/design-system/radoslav-design-system.css
 *
 * ----------------------------------------------------------------------------
 * WHAT THIS FILE IS
 * ----------------------------------------------------------------------------
 *
 * One flattened, hand-authored, self-contained stylesheet. No build step, no
 * preprocessor, no package manager, no @import, no webfont, no remote request
 * of any kind. What you read here is exactly what is served.
 *
 * It is deployed through the Platform's release-scoped asset namespace at
 * `/platform-assets/r-<release-sha40>/design-system/radoslav-design-system.css`,
 * so every release serves its own immutable copy and no cache-busting
 * query string is needed.
 *
 * ----------------------------------------------------------------------------
 * HOW OTHER PROJECTS ADOPT IT  (the pinned-copy contract)
 * ----------------------------------------------------------------------------
 *
 * A project does NOT link to this file across origins. It copies these exact
 * bytes into its own repository, serves them from its own origin, and records
 * the provenance in a PINNED.json beside the copy. A Platform deploy therefore
 * cannot restyle or break an adopter, and an adopter can revert on its own.
 *
 *   RUNTIME_FETCH_FROM_PLATFORM       = NO
 *   CSS_LINK_TO_PLATFORM_ORIGIN       = NO
 *   CROSS_PROJECT_THEME_SYNC_REQUIRED = NO
 *
 * Every class is prefixed `rds-` and every custom property `--rds-` so a copy
 * can be dropped into an application that already owns `.card`, `.shell` or
 * `--bg` without colliding with it.
 *
 * ----------------------------------------------------------------------------
 * SCOPE
 * ----------------------------------------------------------------------------
 *
 * Ten primitive families. The first seven are the original set:
 *
 *   1. COLOUR TOKENS   2. TYPOGRAPHY   3. SPACING   4. PAGE SHELL
 *   5. CARD            6. BUTTON       7. FORM FIELD
 *
 * Revision 1.1.0 adds three, each because a Platform surface had composed the
 * same shape by hand and the shape is now shared by more than one of them:
 *
 *   8. BRAND LOCKUP    9. AUTH SURFACE   10. PROJECT LAUNCHER
 *
 * Revision 1.2.0 adds NO family and NO class. It adds one rule inside family
 * 10 — `.rds-launch .rds-button-row` — because the launcher gained a second
 * per-tile control and the stretched-anchor overlay made that control
 * unclickable. The row reuses family 6's existing `.rds-button-row`, so an
 * adopter gains a repair rather than a component.
 *
 * Revision 1.3.0 adds NO family. It adds two classes, each inside a family
 * that already exists, and each because a Platform surface could not be made
 * usable on a phone by composing what was already here:
 *
 *   `.rds-table-scroll`  family 2 — bounds a wide table's overflow inside
 *                        itself instead of letting it widen the document
 *   `.rds-button-icon`   family 6 — a `.rds-button` variant sized for a
 *                        fingertip when its label is a single glyph
 *
 * Both are deliberately small and generic, and neither is a reorder
 * component: the reorderable-list primitive named in the deferred list below
 * stays deferred — deliberately not spelled here, because this file's own
 * contract test scans these bytes for that name and prose about an absence
 * would read as the absence having ended. The Gateway Editor's reorder
 * controls are each just a family 6 `.rds-button` carrying the icon variant
 * above, grouped by an unclassed element so the group can be hidden until
 * script wires it up.
 *
 * Toggle, badge, modal, helper text, settings section, empty state,
 * reorderable list/grid and status feedback are STILL not in this revision.
 * Where a surface needs such an affordance today it composes one from the
 * families above rather than inventing a primitive here early.
 *
 * ----------------------------------------------------------------------------
 * THEME
 * ----------------------------------------------------------------------------
 *
 * System, Light or Dark, exactly as Architecture R1 section 18 and the Slice 8
 * Central Admin implementation established:
 *
 *   :root                                   light palette (the declared default)
 *   :root[data-theme="light"]               light, forced
 *   @media (prefers-color-scheme: dark)
 *     :root:not([data-theme])                dark, chosen by the OS
 *   :root[data-theme="dark"]                dark, forced
 *
 * Under System the `data-theme` attribute is ABSENT, which is what the
 * OS-driven branch keys on. There is no third `data-theme="system"` state.
 *
 * An application that never sets `data-theme` gets correct System behaviour
 * from this file alone, with no database, session or settings dependency. That
 * is what lets an adopter use this stylesheet without reaching into Platform.
 *
 * Every colour literal is declared exactly ONCE, in the palette block below.
 * The light/dark branches only re-point semantic tokens at palette entries, so
 * a colour can never drift between the forced and OS-driven paths.
 */

/* ===========================================================================
 * 1. COLOUR TOKENS
 * ======================================================================== */

:root {
    color-scheme: light dark;

    /* Raw palette. Each literal appears exactly once in this file. */
    --rds-palette-white: #ffffff;
    --rds-palette-grey-50: #f7f7f8;
    --rds-palette-grey-100: #eeeff1;
    --rds-palette-grey-200: #e3e4e8;
    --rds-palette-grey-400: #9a9ea6;
    --rds-palette-grey-500: #5f6368;
    --rds-palette-grey-700: #32343a;
    --rds-palette-grey-800: #232428;
    --rds-palette-grey-900: #1b1c1f;
    --rds-palette-ink: #17181b;
    --rds-palette-scrim: rgb(0 0 0 / 0.4);

    --rds-palette-accent: #2f6fdd;
    --rds-palette-accent-strong: #2459bb;
    --rds-palette-accent-light: #6b9ef5;

    --rds-palette-danger: #b3362c;
    --rds-palette-danger-light: #f0a39b;
    --rds-palette-danger-surface: #fdf1ef;
    --rds-palette-danger-surface-dark: #2f1d1a;

    --rds-palette-notice-surface: #fdf6e8;
    --rds-palette-notice-border: #e9d9b4;
    --rds-palette-notice-ink: #7a5a17;
    --rds-palette-notice-surface-dark: #2e2718;
    --rds-palette-notice-border-dark: #55492a;
    --rds-palette-notice-ink-dark: #e2c88e;

    /* Elevation and wash, added in 1.1.0. These are deliberately ALPHA values
       rather than new opaque greys: a shadow has to darken whichever surface it
       falls on, and a wash has to tint one, so neither can be expressed as a
       fixed colour without being wrong on the other theme. They still live in
       the palette like every other literal, so a shadow cannot be invented
       inline by a component. */
    --rds-palette-shadow-ambient: rgb(23 24 27 / 0.06);
    --rds-palette-shadow-key: rgb(23 24 27 / 0.09);
    --rds-palette-shadow-ambient-dark: rgb(0 0 0 / 0.32);
    --rds-palette-shadow-key-dark: rgb(0 0 0 / 0.45);
    --rds-palette-accent-wash: rgb(47 111 221 / 0.09);
    --rds-palette-accent-wash-dark: rgb(107 158 245 / 0.13);

    /* Semantic tokens. These are what components may use. */
    --rds-bg: var(--rds-palette-grey-50);
    --rds-panel: var(--rds-palette-white);
    --rds-panel-raised: var(--rds-palette-grey-100);
    --rds-fg: var(--rds-palette-ink);
    --rds-fg-muted: var(--rds-palette-grey-500);
    --rds-fg-faint: var(--rds-palette-grey-400);
    --rds-border: var(--rds-palette-grey-200);
    --rds-border-strong: var(--rds-palette-grey-400);

    --rds-accent: var(--rds-palette-accent);
    --rds-accent-hover: var(--rds-palette-accent-strong);
    --rds-on-accent: var(--rds-palette-white);

    --rds-danger: var(--rds-palette-danger);
    --rds-danger-surface: var(--rds-palette-danger-surface);

    --rds-notice-surface: var(--rds-palette-notice-surface);
    --rds-notice-border: var(--rds-palette-notice-border);
    --rds-notice-fg: var(--rds-palette-notice-ink);

    --rds-focus-ring: var(--rds-palette-accent);

    --rds-shadow-ambient: var(--rds-palette-shadow-ambient);
    --rds-shadow-key: var(--rds-palette-shadow-key);
    --rds-accent-wash: var(--rds-palette-accent-wash);

    --rds-radius: 0.5rem;
    --rds-radius-sm: 0.3rem;
    --rds-radius-lg: 0.85rem;

    /* Elevation composes the two shadow tokens above rather than naming a
       colour, so re-pointing those in a dark branch moves every elevation with
       them. Custom properties substitute at use time, which is what makes one
       declaration here correct in all three theme states. */
    --rds-elevation-1: 0 1px 2px var(--rds-shadow-ambient);
    --rds-elevation-2:
        0 1px 2px var(--rds-shadow-ambient),
        0 10px 28px -12px var(--rds-shadow-key);
    --rds-elevation-3:
        0 2px 4px var(--rds-shadow-ambient),
        0 24px 56px -20px var(--rds-shadow-key);

    /* One duration for every hover and focus transition in this file. Short
       enough to feel immediate; the reduced-motion branches below opt out of
       the transform entirely rather than merely shortening it. */
    --rds-transition: 140ms ease;
}

:root[data-theme="light"] {
    color-scheme: light;
}

/* Only when nothing is forced does the operating system decide. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --rds-bg: var(--rds-palette-grey-900);
        --rds-panel: var(--rds-palette-grey-800);
        --rds-panel-raised: var(--rds-palette-grey-700);
        --rds-fg: var(--rds-palette-grey-100);
        --rds-fg-muted: var(--rds-palette-grey-400);
        --rds-fg-faint: var(--rds-palette-grey-500);
        --rds-border: var(--rds-palette-grey-700);
        --rds-border-strong: var(--rds-palette-grey-500);

        --rds-accent: var(--rds-palette-accent-light);
        --rds-accent-hover: var(--rds-palette-accent);
        /* Dark re-points the accent at a LIGHT blue, which is what makes link
           text readable on a dark page. A light fill cannot also carry white
           text, so the accent FOREGROUND flips to ink here. The accent token
           itself is deliberately not darkened: that would fix the button by
           spoiling the link colour this branch exists to provide. */
        --rds-on-accent: var(--rds-palette-ink);

        --rds-danger: var(--rds-palette-danger-light);
        --rds-danger-surface: var(--rds-palette-danger-surface-dark);

        --rds-notice-surface: var(--rds-palette-notice-surface-dark);
        --rds-notice-border: var(--rds-palette-notice-border-dark);
        --rds-notice-fg: var(--rds-palette-notice-ink-dark);

        --rds-focus-ring: var(--rds-palette-accent-light);

        /* A dark page needs a deeper shadow to read as elevation at all, and a
           wash built on the light accent rather than the dark one. */
        --rds-shadow-ambient: var(--rds-palette-shadow-ambient-dark);
        --rds-shadow-key: var(--rds-palette-shadow-key-dark);
        --rds-accent-wash: var(--rds-palette-accent-wash-dark);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --rds-bg: var(--rds-palette-grey-900);
    --rds-panel: var(--rds-palette-grey-800);
    --rds-panel-raised: var(--rds-palette-grey-700);
    --rds-fg: var(--rds-palette-grey-100);
    --rds-fg-muted: var(--rds-palette-grey-400);
    --rds-fg-faint: var(--rds-palette-grey-500);
    --rds-border: var(--rds-palette-grey-700);
    --rds-border-strong: var(--rds-palette-grey-500);

    --rds-accent: var(--rds-palette-accent-light);
    --rds-accent-hover: var(--rds-palette-accent);
    /* Same flip as the OS-driven branch above, for the same reason. The two
       dark paths must agree token for token or a forced theme and an OS theme
       would disagree about the same button. */
    --rds-on-accent: var(--rds-palette-ink);

    --rds-danger: var(--rds-palette-danger-light);
    --rds-danger-surface: var(--rds-palette-danger-surface-dark);

    --rds-notice-surface: var(--rds-palette-notice-surface-dark);
    --rds-notice-border: var(--rds-palette-notice-border-dark);
    --rds-notice-fg: var(--rds-palette-notice-ink-dark);

    --rds-focus-ring: var(--rds-palette-accent-light);

    /* Same three as the OS-driven branch above, for the same reason the colour
       tokens are repeated: the two dark paths must agree token for token. */
    --rds-shadow-ambient: var(--rds-palette-shadow-ambient-dark);
    --rds-shadow-key: var(--rds-palette-shadow-key-dark);
    --rds-accent-wash: var(--rds-palette-accent-wash-dark);
}

/* ===========================================================================
 * 2. TYPOGRAPHY
 * ======================================================================== */

:root {
    --rds-font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --rds-font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

    --rds-text-sm: 0.85rem;
    --rds-text-base: 1rem;
    --rds-text-lg: 1.25rem;
    --rds-text-xl: 1.6rem;
    --rds-text-2xl: 2rem;

    --rds-leading: 1.5;
}

.rds-root {
    font-family: var(--rds-font-sans);
    font-size: var(--rds-text-base);
    line-height: var(--rds-leading);
    color: var(--rds-fg);
    background: var(--rds-bg);
    -webkit-text-size-adjust: 100%;
}

.rds-root *,
.rds-root *::before,
.rds-root *::after {
    box-sizing: border-box;
}

.rds-root h1,
.rds-root h2,
.rds-root h3 {
    margin: 0 0 var(--rds-space-3);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.rds-root h1 { font-size: var(--rds-text-xl); }
.rds-root h2 { font-size: var(--rds-text-lg); }
.rds-root h3 { font-size: var(--rds-text-base); }

.rds-root p { margin: 0 0 var(--rds-space-3); }

.rds-root a {
    color: var(--rds-accent);
    text-decoration: none;
}

.rds-root a:hover { text-decoration: underline; }

.rds-root code,
.rds-root kbd,
.rds-root samp { font-family: var(--rds-font-mono); font-size: var(--rds-text-sm); }

/* Secondary text. The one typographic modifier the seven families need. */
.rds-muted { color: var(--rds-fg-muted); }
.rds-small { font-size: var(--rds-text-sm); }

.rds-title {
    font-size: var(--rds-text-2xl);
    margin: 0 0 var(--rds-space-2);
}

/* Definition lists carry Platform's diagnostics and facts tables. Element-level
   because they are structure, not a component. */
.rds-root dl { margin: 0; }
.rds-root dt { font-weight: 600; }
.rds-root dd { margin: 0 0 var(--rds-space-3); color: var(--rds-fg-muted); }

.rds-root table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--rds-text-sm);
}

.rds-root th,
.rds-root td {
    text-align: left;
    padding: var(--rds-space-2) var(--rds-space-3);
    border-bottom: 1px solid var(--rds-border);
    vertical-align: middle;
}

.rds-root th { font-weight: 600; color: var(--rds-fg-muted); }

/* A TABLE THAT SCROLLS INSIDE ITSELF INSTEAD OF WIDENING THE PAGE.
 *
 * `table` above is `width: 100%`, which sets the *preferred* width and not a
 * maximum: a cell holding an unbreakable string — a destination URL, say —
 * pushes the table past its container, and because nothing between it and
 * `<body>` establishes a scroll container the whole document grows a
 * horizontal scrollbar. On a phone that drags the header, the heading and
 * every form sideways to read one column of one table.
 *
 * Two rules, because they fix two different halves of it. The container bounds
 * the overflow so it can never reach the page, and the wrap lets long values
 * break so there is usually no overflow left to scroll. The container alone
 * would leave a narrow screen permanently scrolled away from the Actions
 * column; the wrap alone cannot help a table whose columns genuinely do not
 * fit.
 *
 * Not a new family and not a component: it is the element-level table styling
 * above, given the containing block it always needed. */
.rds-table-scroll {
    overflow-x: auto;
    /* Room for a focus ring on a control at the very edge of the strip, which
       `overflow` would otherwise clip. */
    padding-bottom: var(--rds-space-1);
}

.rds-table-scroll td { overflow-wrap: anywhere; }

/* ===========================================================================
 * 3. SPACING
 * ======================================================================== */

:root {
    --rds-space-1: 0.25rem;
    --rds-space-2: 0.5rem;
    --rds-space-3: 0.75rem;
    --rds-space-4: 1rem;
    --rds-space-5: 1.5rem;
    --rds-space-6: 2rem;
    --rds-space-7: 3rem;

    --rds-measure: 60rem;
    --rds-measure-narrow: 28rem;

    /* A card grid wants more room than a column of prose. Added in 1.1.0 for
       the project launcher, which looks starved at the 60rem prose measure. */
    --rds-measure-wide: 74rem;
    --rds-measure-prose: 44rem;
}

.rds-stack > * + * { margin-top: var(--rds-space-4); }
.rds-stack-tight > * + * { margin-top: var(--rds-space-2); }

/* ===========================================================================
 * 4. PAGE SHELL
 * ======================================================================== */

/* The page background is declared on BOTH the root and the body, deliberately.
   The root paints the canvas, which is what makes over-scroll and short pages
   look right. The body declaration is the page-shell contract proper: it is
   what `getComputedStyle(document.body).backgroundColor` reports, and it is
   what Slice 8 established before the design system existed. Setting it only on
   the root leaves body transparent, which looks identical and reads as a
   missing background to anything that inspects the document. */
.rds-root body,
body.rds-root {
    margin: 0;
    min-height: 100vh;
    background: var(--rds-bg);
}

.rds-shell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--rds-space-4);
    padding: var(--rds-space-3) var(--rds-space-5);
    background: var(--rds-panel);
    border-bottom: 1px solid var(--rds-border);
    box-shadow: var(--rds-elevation-1);
}

.rds-shell-brand {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.rds-shell-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rds-space-4);
}

/* Pushes everything after it to the far edge of the shell. */
.rds-shell-spacer { margin-left: auto; }

.rds-shell-meta {
    color: var(--rds-fg-muted);
    font-size: var(--rds-text-sm);
}

.rds-main {
    max-width: var(--rds-measure);
    margin: 0 auto;
    padding: var(--rds-space-6) var(--rds-space-5);
}

/* The launcher's wider measure. A modifier rather than a second shell class,
   so everything else about the main column stays one declaration. */
.rds-main-wide { max-width: var(--rds-measure-wide); }

/* A single centred column: the anonymous landing and the sign-in surface. */
.rds-centred {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: var(--rds-space-6);
}

.rds-centred-inner {
    width: 100%;
    max-width: var(--rds-measure-narrow);
    text-align: center;
}

.rds-section + .rds-section { margin-top: var(--rds-space-7); }

@media (max-width: 40rem) {
    .rds-main { padding: var(--rds-space-5) var(--rds-space-4); }
    .rds-shell { padding: var(--rds-space-3) var(--rds-space-4); }
}

/* ===========================================================================
 * 5. CARD
 * ======================================================================== */

.rds-card {
    background: var(--rds-panel);
    border: 1px solid var(--rds-border);
    border-radius: var(--rds-radius);
    padding: var(--rds-space-5);
}

.rds-card > :last-child { margin-bottom: 0; }

.rds-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: var(--rds-space-4);
    list-style: none;
    margin: 0;
    padding: 0;
}

.rds-card-title {
    display: block;
    font-weight: 600;
    font-size: var(--rds-text-base);
    margin-bottom: var(--rds-space-1);
}

.rds-card-icon {
    display: block;
    font-size: var(--rds-text-lg);
    margin-bottom: var(--rds-space-2);
}

.rds-card-muted {
    opacity: 0.6;
}

/* Card variants used for inline messages. Composing a notice from the card
   primitive is deliberate: it avoids introducing a status-feedback primitive
   before the visual contract is settled. */
.rds-card-notice {
    background: var(--rds-notice-surface);
    border-color: var(--rds-notice-border);
    color: var(--rds-notice-fg);
}

.rds-card-danger {
    background: var(--rds-danger-surface);
    border-color: var(--rds-danger);
    color: var(--rds-danger);
}

.rds-card-quiet {
    background: transparent;
    border-style: dashed;
    text-align: center;
    color: var(--rds-fg-muted);
}

/* An inline message is a card with the padding of a line of text rather than
   the padding of a panel. Added in 1.1.0 because all three notice variants
   above were being used for single sentences at panel padding. */
.rds-card-compact { padding: var(--rds-space-3) var(--rds-space-4); }

/* Opt-in elevation. Not on .rds-card itself: the editor and Central Admin are
   pages of stacked panels, and lifting every one of them off the page reads as
   noise rather than hierarchy. */
.rds-card-raised { box-shadow: var(--rds-elevation-2); }

/* A native <dialog> is a card the browser positions. Without this it keeps the
   user agent's white background, which is wrong in dark mode; this is the
   minimum needed for the card family to be coherent, and it is deliberately
   NOT a modal primitive — no backdrop choreography, no sizing system, no
   open/close behaviour. */
.rds-root dialog {
    background: var(--rds-panel);
    color: var(--rds-fg);
    border: 1px solid var(--rds-border);
    border-radius: var(--rds-radius);
    padding: var(--rds-space-5);
    max-width: var(--rds-measure-narrow);
}

.rds-root dialog::backdrop { background: var(--rds-palette-scrim); }

/* ===========================================================================
 * 6. BUTTON
 * ======================================================================== */

.rds-button {
    display: inline-block;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    padding: var(--rds-space-2) var(--rds-space-4);
    border: 1px solid var(--rds-border-strong);
    border-radius: var(--rds-radius-sm);
    background: var(--rds-panel);
    color: var(--rds-fg);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition:
        background-color var(--rds-transition),
        border-color var(--rds-transition),
        color var(--rds-transition);
}

.rds-button:hover {
    background: var(--rds-panel-raised);
    text-decoration: none;
}

.rds-button:focus-visible,
.rds-field-input:focus-visible,
.rds-root a:focus-visible {
    outline: 2px solid var(--rds-focus-ring);
    outline-offset: 2px;
}

.rds-button-primary {
    background: var(--rds-accent);
    border-color: var(--rds-accent);
    color: var(--rds-on-accent);
}

.rds-button-primary:hover {
    background: var(--rds-accent-hover);
    border-color: var(--rds-accent-hover);
}

/* An ANCHOR styled as a button. This is not a variant — it is a specificity
 * repair, and it fixes a real defect rather than a hypothetical one.
 *
 * The element rule `.rds-root a` sets link colour and scores (0,1,1). Every
 * class in this family scores (0,1,0), so for an `<a class="rds-button …">`
 * the link colour WON and the button's own colour was discarded. On the
 * primary variant that meant `--rds-accent` text on an `--rds-accent` fill:
 * a contrast ratio of 1, an invisible label. The anonymous landing page's
 * "Sign in" — the one control on the one page a visitor can always reach —
 * rendered exactly that way.
 *
 * Note that the token-level contrast rules were never violated:
 * `--rds-on-accent` and `--rds-accent` are a correct pair in all three themes.
 * The foreground simply never reached the element, which is why this is
 * repaired at the selector and is regression-tested by reading COMPUTED colour
 * in a browser rather than by comparing tokens.
 */
.rds-root a.rds-button { color: var(--rds-fg); }

.rds-root a.rds-button-primary { color: var(--rds-on-accent); }

.rds-root a.rds-button-danger { color: var(--rds-danger); }

.rds-root a.rds-button-quiet { color: var(--rds-fg-muted); }

.rds-root a.rds-button-quiet:hover { color: var(--rds-fg); }

.rds-button-danger {
    color: var(--rds-danger);
    border-color: var(--rds-danger);
}

.rds-button-quiet {
    background: transparent;
    border-color: transparent;
    font-weight: 400;
    color: var(--rds-fg-muted);
    padding-left: var(--rds-space-2);
    padding-right: var(--rds-space-2);
}

.rds-button-quiet:hover {
    background: var(--rds-panel-raised);
    color: var(--rds-fg);
}

.rds-button[disabled],
.rds-button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: default;
}

/* A SQUARE BUTTON WHOSE LABEL IS A GLYPH, sized for a fingertip.
 *
 * `.rds-button`'s padding is tuned for a word. Give it a single character and
 * the result is roughly 2rem square — fine for a mouse, under the ~2.75rem a
 * touch target wants, and the Gateway Editor's reorder arrows are precisely
 * the controls a phone has to hit. The minimums are floors rather than fixed
 * sizes, so the button still grows with the user's font size.
 *
 * `inline-flex` replaces family 6's `inline-block` only here, because a
 * min-height box has to centre its glyph vertically and `inline-block` cannot.
 *
 * The accessible name of such a button lives in `aria-label`: the glyph is
 * decoration and is marked `aria-hidden`, so without that label the control
 * would announce as nothing at all. */
.rds-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: var(--rds-space-2);
    line-height: 1;
}

.rds-button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--rds-space-2);
}

/* A full-width call to action. The sign-in button is the one control on its
   page, and a 7rem button floating in a 28rem card reads as an afterthought.
   Taller too: this is the primary target on a phone. */
.rds-button-block {
    display: block;
    width: 100%;
    padding-top: var(--rds-space-3);
    padding-bottom: var(--rds-space-3);
}

/* ===========================================================================
 * 7. FORM FIELD
 * ======================================================================== */

.rds-form { margin: 0; }

.rds-field {
    display: block;
    margin-bottom: var(--rds-space-4);
}

.rds-field-label {
    display: block;
    font-weight: 600;
    font-size: var(--rds-text-sm);
    margin-bottom: var(--rds-space-1);
}

.rds-field-input {
    display: block;
    width: 100%;
    font: inherit;
    color: var(--rds-fg);
    background: var(--rds-panel);
    border: 1px solid var(--rds-border-strong);
    border-radius: var(--rds-radius-sm);
    padding: var(--rds-space-2) var(--rds-space-3);
    transition: border-color var(--rds-transition);
}

.rds-field-input::placeholder { color: var(--rds-fg-faint); }

/* The border tracks focus as well as the ring, so the active field is obvious
   even where a platform draws a faint outline. */
.rds-field-input:focus { border-color: var(--rds-accent); }

/* Password-manager autofill, kept WORKING and kept readable.
 *
 * This does not suppress or interfere with autofill — the field fills exactly
 * as it would without these rules. It only repaints what Chromium paints over
 * the field once it has: the user-agent autofill background is an opaque light
 * colour, which on a dark panel leaves dark text on it unreadable. Repainting
 * with the panel token keeps the filled field identical to an unfilled one in
 * both themes.
 *
 * AUTOFILL_SUPPRESSED = NO. The `inset` box-shadow is the only way to override
 * that background; `background` itself is ignored for this pseudo-class.
 */
.rds-field-input:-webkit-autofill,
.rds-field-input:-webkit-autofill:hover,
.rds-field-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--rds-fg);
    -webkit-box-shadow: 0 0 0 100px var(--rds-panel) inset;
    box-shadow: 0 0 0 100px var(--rds-panel) inset;
    caret-color: var(--rds-fg);
}

/* Checkboxes and radios are intrinsically sized; the full-width rule above is
   for text-like controls only. */
.rds-field-choice {
    display: flex;
    align-items: center;
    gap: var(--rds-space-2);
    margin-bottom: var(--rds-space-2);
    font-size: var(--rds-text-base);
}

.rds-field-choice input {
    width: auto;
    margin: 0;
    accent-color: var(--rds-accent);
}

.rds-field-hint {
    display: block;
    margin-top: var(--rds-space-1);
    font-size: var(--rds-text-sm);
    color: var(--rds-fg-muted);
}

.rds-field-error {
    display: block;
    margin-top: var(--rds-space-1);
    font-size: var(--rds-text-sm);
    color: var(--rds-danger);
}

.rds-field-input[aria-invalid="true"] { border-color: var(--rds-danger); }

.rds-fieldset {
    border: 0;
    margin: 0 0 var(--rds-space-4);
    padding: 0;
    min-width: 0;
}

/* A fieldset that is ALSO a card keeps the card's frame.
 *
 * `.rds-fieldset` strips the user-agent border and padding, which is right for
 * a bare grouping. But both of its rules score (0,1,0) and so does `.rds-card`,
 * and this family is declared later in the file — so for
 * `<fieldset class="rds-card rds-fieldset">` the stripping WON and the card lost
 * the padding and border it had just asked for. The Gateway Editor's add/edit
 * form and its capability panel are both that combination: their labels sat on
 * the card's top edge and their inputs ran flush to its sides.
 *
 * Restored at (0,2,0) rather than by reordering the two families, because the
 * order is not the bug — either order breaks one of the two cases, and an
 * explicit rule for the combination says which one is intended.
 *
 * This is a long-standing defect, not a 1.1.0 regression: the two families have
 * been in this order since the stylesheet was written.
 */
.rds-card.rds-fieldset {
    padding: var(--rds-space-5);
    border: 1px solid var(--rds-border);
}

.rds-fieldset > legend {
    padding: 0;
    font-weight: 600;
    font-size: var(--rds-text-sm);
    margin-bottom: var(--rds-space-2);
}

.rds-field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--rds-space-3);
}

.rds-field-row .rds-field { margin-bottom: 0; }

/* ===========================================================================
 * 8. BRAND LOCKUP
 *
 * Added in 1.1.0. Three surfaces — sign-in, the anonymous landing and the
 * Gateway shell — all need to say "Radoslav.online Platform" with the same
 * weight and the same mark, and before this they each spelled it differently.
 *
 * The mark is a typographic monogram, not an image: `url()` is forbidden in
 * this file, and a letter in a tinted tile needs no asset, no second request
 * and no alt text.
 * ======================================================================== */

.rds-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--rds-space-3);
    color: var(--rds-fg);
    text-decoration: none;
}

.rds-brand:hover { text-decoration: none; }

.rds-brand-mark {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--rds-radius-sm);
    background: var(--rds-accent);
    color: var(--rds-on-accent);
    font-weight: 700;
    line-height: 1;
}

.rds-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.rds-brand-name {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.rds-brand-sub {
    font-size: var(--rds-text-sm);
    color: var(--rds-fg-muted);
}

/* The larger lockup, for a page whose only subject is the brand. */
.rds-brand-lg { gap: var(--rds-space-4); }

.rds-brand-lg .rds-brand-mark {
    width: 3rem;
    height: 3rem;
    border-radius: var(--rds-radius);
    font-size: var(--rds-text-lg);
}

.rds-brand-lg .rds-brand-name { font-size: var(--rds-text-lg); }

/* ===========================================================================
 * 9. AUTH SURFACE
 *
 * Added in 1.1.0. The full-height, single-card layout shared by sign-in and the
 * anonymous landing. It supersedes `.rds-centred` for those two pages, which is
 * kept because it is a general primitive and an adopter may be using it.
 *
 * The backdrop is a gradient over the page token, not an image, and it is built
 * from `--rds-accent-wash` so it re-points with the theme like everything else.
 * ======================================================================== */

.rds-auth {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    /* Preferred where supported: on a phone `100vh` is the pre-scroll viewport,
       which leaves the card visually low. Declared second so a browser that
       does not know the unit keeps the line above. */
    min-height: 100dvh;
    padding: var(--rds-space-6) var(--rds-space-4);
    background-image: radial-gradient(
        48rem 32rem at 50% -8%,
        var(--rds-accent-wash),
        transparent 72%
    );
    background-repeat: no-repeat;
}

.rds-auth-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--rds-space-5);
    width: 100%;
    max-width: var(--rds-measure-narrow);
}

.rds-auth-brand { align-self: center; }

.rds-auth-card {
    padding: var(--rds-space-6);
    border-radius: var(--rds-radius-lg);
    box-shadow: var(--rds-elevation-2);
}

.rds-auth-head { margin-bottom: var(--rds-space-5); }

.rds-auth-head > :last-child { margin-bottom: 0; }

.rds-auth-head h1 { margin-bottom: var(--rds-space-1); }

.rds-auth-foot {
    margin: 0;
    text-align: center;
}

@media (max-width: 30rem) {
    .rds-auth { padding: var(--rds-space-5) var(--rds-space-3); }
    .rds-auth-card { padding: var(--rds-space-5); }
}

/* ===========================================================================
 * 10. PROJECT LAUNCHER
 *
 * Added in 1.1.0. The Gateway is a launcher, and `.rds-card-grid` — a generic
 * grid of panels — was never that. A launcher tile differs in three ways that
 * matter: the whole tile navigates, the icon is a treatment rather than a
 * character, and a tile that cannot be navigated has to say so visibly.
 *
 * ## The whole tile navigates
 *
 * The anchor covers the tile with an absolutely positioned `::after` overlay.
 * That is deliberate, and the alternative was worse: wrapping the description
 * inside the anchor would fold it into the link's accessible name, so a screen
 * reader would announce the entire paragraph as the link text. With the overlay
 * the accessible name is exactly the project name, the description stays
 * ordinary prose, and every pixel of the tile is still the same click target.
 *
 * The focus ring is drawn on that overlay rather than the anchor, so keyboard
 * focus outlines the whole tile and not the few characters of the name.
 *
 *   FULL_TILE_CLICK_TARGET      = YES
 *   DESCRIPTION_IN_LINK_NAME    = NO
 *   FOCUS_RING_MATCHES_TARGET   = YES
 * ======================================================================== */

.rds-page-head { margin-bottom: var(--rds-space-6); }

.rds-page-head > :last-child { margin-bottom: 0; }

/* The one-line introduction under a page title. Slightly larger than body text
   and held to a prose measure so it does not run the full grid width. */
.rds-lede {
    font-size: var(--rds-text-lg);
    max-width: var(--rds-measure-prose);
}

.rds-launch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: var(--rds-space-4);
    list-style: none;
    margin: 0;
    padding: 0;
}

.rds-launch {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: var(--rds-space-5);
    background: var(--rds-panel);
    border: 1px solid var(--rds-border);
    border-radius: var(--rds-radius-lg);
    box-shadow: var(--rds-elevation-1);
    transition:
        border-color var(--rds-transition),
        box-shadow var(--rds-transition),
        transform var(--rds-transition);
}

/* Hover is declared on the tile, not the anchor: the overlay means a pointer
   anywhere over the tile is already over the link, and a parent cannot be
   styled from its child. */
.rds-launch:hover {
    border-color: var(--rds-border-strong);
    box-shadow: var(--rds-elevation-2);
    transform: translateY(-2px);
}

.rds-launch-icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: var(--rds-space-4);
    border: 1px solid var(--rds-border);
    border-radius: var(--rds-radius);
    background: var(--rds-accent-wash);
    font-size: var(--rds-text-xl);
    line-height: 1;
}

.rds-launch-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.rds-launch-link:hover { text-decoration: none; }

.rds-launch-link::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--rds-radius-lg);
}

/* The anchor's own ring is replaced, not removed: the overlay below carries a
   ring of the same weight around the whole tile. */
.rds-launch-link:focus-visible { outline: none; }

.rds-launch-link:focus-visible::after {
    outline: 2px solid var(--rds-focus-ring);
    outline-offset: 3px;
}

.rds-launch-name {
    display: block;
    font-weight: 600;
    font-size: var(--rds-text-lg);
    letter-spacing: -0.01em;
    color: var(--rds-fg);
}

.rds-launch-text {
    margin: var(--rds-space-2) 0 0;
    font-size: var(--rds-text-sm);
    color: var(--rds-fg-muted);
}

/* A tile that is not navigable — a disabled project, or one whose stored
   destination the read model refused. Dashed and flat rather than merely faded:
   `opacity` alone would dim the text below the contrast floor, and would read
   as "loading" rather than "unavailable". */
.rds-launch-inert {
    background: transparent;
    border-style: dashed;
    box-shadow: none;
}

.rds-launch-inert:hover {
    border-color: var(--rds-border);
    box-shadow: none;
    transform: none;
}

.rds-launch-inert .rds-launch-name { color: var(--rds-fg-muted); }

.rds-launch-inert .rds-launch-icon { background: transparent; }

.rds-launch-note {
    margin: var(--rds-space-3) 0 0;
    font-size: var(--rds-text-sm);
    color: var(--rds-fg-faint);
}

/* A SECOND control inside a launch tile. Added in 1.2.0, and it is a
 * specificity-free stacking repair rather than a new component: the row itself
 * is the plain `.rds-button-row` from family 6.
 *
 * `.rds-launch-link::after` stretches the project link over the entire tile, so
 * every later control sits UNDER it. Without this rule such a control is still
 * focusable and still announced, but neither clickable nor tappable — a
 * keyboard user could reach an action a pointer user could not, which is worse
 * than not offering it at all. Lifting the row out from under the overlay fixes
 * pointer, touch and hit-testing in one place; tab order needs nothing, because
 * the row follows the anchor in document order, and the focus ring needs
 * nothing, because `.rds-button:focus-visible` already applies.
 *
 * `margin-top: auto` pushes the row to the bottom of the tile's flex column, so
 * tiles whose descriptions differ in length still line their actions up. */
.rds-launch .rds-button-row {
    position: relative;
    z-index: 1;
    margin: auto 0 0;
    padding-top: var(--rds-space-4);
}

/* Honour a reduced-motion preference by dropping the movement, not by making
   it faster. The colour and shadow changes stay: they are the affordance. */
@media (prefers-reduced-motion: reduce) {
    .rds-launch {
        transition:
            border-color var(--rds-transition),
            box-shadow var(--rds-transition);
    }

    .rds-launch:hover { transform: none; }
}
