/* V2 accessibility preferences (F50 50.9, Web#369): increased contrast and
   forced colours, under a material only.

   Why a file of its own rather than app.css. Both answers are written in V2
   roles -- the transparency fallback's two levers and the border roles --
   which exist only under a material, and the current theme must not move in
   any mode while V2 is off (Web#362). Here every rule sits under
   :root[data-dw-material], so with no material attribute this file matches
   nothing, which V2ThemeTokenTests holds for every theme file. It is linked
   last, after primitives.css, so a rule here wins a tie with the primitive it
   adjusts.

   Reduced transparency and reduced motion are v2.css's; this file does not
   restate them.

   Specificity, said once. The deepest material block is Glass Indigo dark,
   :root plus three attribute conditions. A token set here must beat it without
   !important, which this codebase keeps for print, so the token blocks repeat
   the material condition five times. That is the whole trick: it reads oddly
   and does nothing else.

   Linked with media="screen": print never sees a material. */

/* Increased contrast (Web#361 "Accessibility overrides"): the reduced-
   transparency answer -- every surface, header and navigation lifted to .96,
   no blur, no saturation -- plus the material's Strong border on every
   surface. The levers carry the same values as v2.css's fallback blocks, so
   this is that one override applied for a second reason, not a second one. */
@media (prefers-contrast: more) {
    :root[data-dw-material] {
        --dw-alpha-floor: .96;
        --dw-transparency: 0;
    }

    /* Every border role reads Border strong: the header's hairline, the
       drawer's edge, panels, sections, tables, notices and fields all draw the
       material's border through these, so one re-pointing reaches all of them. */
    :root[data-dw-material][data-dw-material][data-dw-material][data-dw-material][data-dw-material] {
        --dw-color-border: var(--dw-color-border-strong);
        --dw-color-border-subtle: var(--dw-color-border-strong);
        --dw-color-border-muted: var(--dw-color-border-strong);
    }

    /* The one surface with no border of its own: MudBlazor's dropdowns are
       told apart from the page by a shadow, which is decoration. */
    :root[data-dw-material] .mud-popover {
        border: 1px solid var(--dw-color-border-strong);
    }
}

/* Forced colours (Windows contrast themes). The platform repaints the page in
   the person's own colours; the interface's job is to get out of the way and
   to keep its boundaries. So: the platform adjusts everything (auto, said
   explicitly so nothing on the page can opt out), and every border role
   is a system colour, so a surface whose edge was a translucent white hairline
   or a shadow keeps a visible edge. The selected page's rail is Highlight, the
   colour the platform gives selection. Nothing else is overridden. */
@media (forced-colors: active) {
    /* On body rather than the root, whose block holds tokens only; the
       property is inherited, and everything drawn -- dialogs and dropdowns
       included -- is inside body. */
    :root[data-dw-material] body {
        forced-color-adjust: auto;
    }

    :root[data-dw-material][data-dw-material][data-dw-material][data-dw-material][data-dw-material] {
        --dw-color-border: CanvasText;
        --dw-color-border-subtle: CanvasText;
        --dw-color-border-muted: CanvasText;
        --dw-color-border-strong: CanvasText;
    }

    :root[data-dw-material] .mud-popover {
        border: 1px solid CanvasText;
    }

    :root[data-dw-material] .dw-module-nav a.active {
        border-left-color: Highlight;
    }
}
