/* Orbit's page styles stop at a dashboard's root.
 *
 * A dashboard relies on nothing of the page it is mounted in (Documentation/THEMING.md, "The dashboard boundary"), so
 * it looks the same in Orbit and anywhere else. The framework gives the root its own neutral colour, font and scheme
 * (client/internal/dashboard-base.ts) — so nothing inherits from <body> — but it cannot know the host page's rules.
 * Keeping those out is the host's job, and this file is Orbit's half of it. Linked last in App.razor.
 *
 * WHAT IT UNDOES. Orbit's own app.css is scoped away from dashboards where it is written (@scope there). What is left
 * are the element rules of FluentUI's base stylesheet (default-fuib.css), a NuGet asset this repository cannot edit:
 * headings, links, kbd, mark, hr and tables. Those properties are set to `revert-layer` inside the dashboard root,
 * which rolls them back to the layered rules — the dashboard baseline and the UI packages' stylesheets — or to the
 * browser default where none sets them. Its `*` box-sizing rule needs nothing: the baseline says the same. Its
 * `table[data-selectable]` rules match only a table carrying FluentUI's own attribute, which no dashboard has cause to.
 * The body's typography and colours are not here: the root states its own, so they no longer inherit.
 *
 * SPECIFICITY. These rules are unlayered, like the ones they undo, so they win by specificity: one type selector more
 * than each FluentUI rule (`div h1` (0,0,2) over `h1`), never a class. A class-styled element — every UI library's,
 * and a dashboard's own `.x h1` — still outranks them. Only a dashboard's bare unlayered element rule (`h1 { … }`)
 * ties at most and loses; style an element through a class. A tie with FluentUI would not do: its link rules are
 * also adopted onto the document by script, after every <link>, and win ties.
 * `div` is the dashboard's content box and its overlay root, both <div>s inside the root.
 *
 * Re-check this list when the FluentUI package is upgraded: a new element rule in default-fuib.css leaks until it is
 * added here. */

:where([data-orbit-control="Dashboard"]) div :is(h1, h2, h3, h4, h5, h6) {
    margin-top: revert-layer;
    font-size: revert-layer;
    font-weight: revert-layer;
    line-height: revert-layer;
}

:where([data-orbit-control="Dashboard"]) div a,
:where([data-orbit-control="Dashboard"]) div a:hover,
:where([data-orbit-control="Dashboard"]) div a:active,
:where([data-orbit-control="Dashboard"]) div a:not([href]):not([class]),
:where([data-orbit-control="Dashboard"]) div a:not([href]):not([class]):hover {
    color: revert-layer;
    text-decoration: revert-layer;
}

:where([data-orbit-control="Dashboard"]) div kbd {
    color: revert-layer;
    background-color: revert-layer;
}

:where([data-orbit-control="Dashboard"]) div mark {
    background-color: revert-layer;
}

:where([data-orbit-control="Dashboard"]) div hr {
    color: revert-layer;
    border-top: revert-layer;
    opacity: revert-layer;
    width: revert-layer;
}

:where([data-orbit-control="Dashboard"]) div table {
    width: revert-layer;
    border-collapse: revert-layer;
    border-spacing: revert-layer;
}

:where([data-orbit-control="Dashboard"]) div table :is(td, th) {
    padding: revert-layer;
    text-align: revert-layer;
    vertical-align: revert-layer;
}

:where([data-orbit-control="Dashboard"]) div [dir=rtl] table :is(td, th) {
    text-align: revert-layer;
}
