/* =============================================================================
   Ledgergard element baseline ("reboot") — US 6958
   ---------------------------------------------------------------------------
   The normalization every page depends on and no component owns: box sizing,
   the body box, and the default margins / fonts / colors of bare HTML elements.

   Until US 6958 this layer came from Bootstrap Reboot, loaded from a CDN. That
   dependency was invisible precisely because it worked — remove the CDN link
   without replacing this and nothing errors, the app just quietly reverts to
   UA defaults: 1.2 line-height instead of 1.5, indented lists, browser-blue
   underlined links, native buttons and inputs dropping back to the small
   system font. So the reboot is re-homed here rather than deleted, and it is
   OURS: every value resolves through the design tokens (US 4953).

   Loaded immediately after tokens.css so component sheets can override it
   freely — specificity here is deliberately the lowest in the system (bare
   element selectors, no classes).

   Deliberately NOT set here: `body { font-size }`. The design system sets
   content density at the page primitive (`.lg-page`, layout.css) and the shell
   sets its own, so a base font-size would be a third source of truth for the
   same decision — and Bootstrap's 1rem matched the UA default anyway, so
   leaving it unset changes nothing.
   ========================================================================== */

/* ── Box model ───────────────────────────────────────────────────────────── */
/* Border-box everywhere: every width/padding pairing in the system is authored
   assuming it. Previously supplied by auth.css, which loaded app-wide and so
   was silently the app's reset sheet — the auth pages should not own that. */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ── Document ────────────────────────────────────────────────────────────── */
body {
    margin: 0;
    /* Running-text leading. The one Reboot value with no other home: without it
       body text and any unclassed element fall back to the UA's ~1.2, which
       reads as cramped against every component that sets --line-height-normal. */
    line-height: var(--line-height-normal);
    background: var(--color-background);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

/* ── Headings & running text ─────────────────────────────────────────────
   Margins reset to zero rather than to a bottom margin: the system spaces
   siblings with .lg-stack / gap (see layout.css), and per-element margins
   collapse and double. Sizes are intentionally left to the UA here — a heading
   that needs the system's scale uses <TextDefault> / .lg-text--*, and one that
   does not is chrome inside a component that sizes it. */
h1, h2, h3, h4, h5, h6,
p,
figure,
blockquote,
dl, dd {
    margin: 0;
}

/* ── Lists ───────────────────────────────────────────────────────────────
   Bare lists keep their markers and indentation (a real bulleted list — e.g. an
   import's error list — should look like one), but lose the UA's oversized
   padding in favour of the spacing scale. Component lists (nav, menus, grid
   chrome) strip markers themselves. */
ul, ol {
    margin: 0;
    padding-left: var(--spacing-xl);
}

/* ── Links ───────────────────────────────────────────────────────────────
   Bootstrap was supplying link color app-wide; without this every anchor that
   is not a shell/auth component reverts to UA blue. Underline on hover only:
   the app is dense and most anchors sit in chrome where a permanent underline
   is noise — but it must be present on hover/focus so links are not identified
   by color alone (design-system: never color-only). */
a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    text-decoration: underline;
}

/* ── Programmatic focus targets ──────────────────────────────────────────
   An element made focusable only so code can move focus to it — Blazor's
   <FocusOnNavigate> puts tabindex="-1" on each page's <h1> and focuses it after
   every navigation — must not draw a focus ring: the user did not tab there, and
   a box around the page title on every single navigation reads as a rendering bug.
   Reboot carried this rule; without it the UA ring reappeared on every page.

   Scoped to :not(:focus-visible), so genuine keyboard focus is untouched and still
   gets the shared indicator from a11y.css. */
[tabindex="-1"]:focus:not(:focus-visible) {
    outline: 0;
}

/* ── Form controls ───────────────────────────────────────────────────────
   Native controls do not inherit typography — they use a small UA system font.
   Most design-system controls set --font-family-base explicitly, but every raw
   or structural control (a native <button> acting as a sort header, a nav
   toggle, a dialog close) relied on Reboot's inherit. */
button,
input,
optgroup,
select,
textarea {
    font: inherit;
    color: inherit;
    margin: 0;
}

/* A native <button> is a structural control here (design-system: actions are
   Buttons, structural controls are native buttons), so it starts from nothing
   and its own component sheet dresses it. */
button {
    background: none;
    border: none;
    padding: 0;
    text-align: inherit;
}

button:not(:disabled) {
    cursor: pointer;
}

/* ── Tables ──────────────────────────────────────────────────────────────
   Collapsed borders app-wide: `.lg-table` sets this itself, but a bare <table>
   (the grid's own shell, showcase examples) otherwise renders with UA border
   spacing and misaligns against every other table on screen. */
table {
    border-collapse: collapse;
}

/* ── Code ────────────────────────────────────────────────────────────────
   The mono token exists and JetBrains Mono is loaded, but nothing applied it to
   bare <code>/<pre> — Bootstrap's monospace stack was doing it. */
code,
kbd,
pre,
samp {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
}

pre {
    margin: 0;
    overflow-x: auto; /* the page body never scrolls sideways (design-system) */
}

/* A stack trace on the diagnostics page (US 7638): kept as written - line breaks are its structure -
   and boxed so a hundred-line trace scrolls inside itself instead of pushing the page. */
.lg-trace {
    padding: var(--spacing-sm);
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    color: var(--color-text);
    white-space: pre;
    max-height: 24rem;
    overflow: auto;
}

/* The failure codes on a usage row (US 7172): several side by side, each a link. */
.lg-usage-ref {
    margin-right: var(--spacing-xs);
    white-space: nowrap;
}

/* A problem report's own words (US 7639): line breaks as the reporter typed them, wrapped, boxed. */
.lg-report-text {
    padding: var(--spacing-sm);
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ── Rules & media ───────────────────────────────────────────────────────── */
hr {
    height: 0;
    margin: var(--spacing-lg) 0;
    border: 0;
    border-top: 1px solid var(--color-border);
}

img,
svg,
video {
    vertical-align: middle;
}

img,
video {
    max-width: 100%;
    height: auto;
}

/* Honour the attribute even when a component sets a competing `display`. */
[hidden] {
    display: none !important;
}
