/* Lacuna Software's typeface, served from this Server rather than from a font CDN (issue #106).
   Not a preference: an on-premises TrustBridge may be air-gapped, and the page shell already
   refuses fonts.googleapis.com for that reason, as the Scalar reference page refuses its own
   default fonts. A page that waits on a CDN is a page that takes seconds to paint or never does.

   Two files rather than one because Google's subsetting is per script, and the unicode-range
   below is what makes that better than a merged file: a browser fetches latin-ext only when a
   page actually contains a character from it. Both are variable fonts carrying Exo 2's whole
   100-900 weight axis, so every weight the theme asks for comes out of the one file.

   The declared range is that axis and not a narrower one, which is a decision rather than a
   copy. A face's declared range is what CSS clamps to, and it clamps rather than synthesizing —
   so declaring less than the files hold makes any weight outside the declaration render as its
   nearest legal neighbour, at 200 OK, looking almost right. Declaring the whole axis is what
   removes that failure instead of narrowing it. BrandAssetTests reads the range straight out of
   each file's fvar table and fails if this declaration ever exceeds it (issue #161).

   Exo 2 is licensed under the SIL Open Font License 1.1 — see fonts/OFL.txt, which travels with
   the files because the licence requires it to. */

@font-face {
    font-family: 'Exo 2';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/exo2-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
        U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Exo 2';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/exo2-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
        U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
        U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* The wordmark: two weights of one word, "Trust" heavy and "Bridge" light (issue #109). Global
   rather than scoped because all three placements need it and two of them are layouts, which a
   component's scoped styles do not reach.

   700/300, which is the brand sheet's own pair. It was 700/400 until issue #161, not because
   anyone wanted 400 but because the faces above were declared across 400-700 and CSS clamps
   rather than synthesizes: `font-weight: 300` rendered identically to 400. The files always
   held the 300 — the declaration was the only thing in the way.

   That is worth knowing because of how it failed. A clamped 300 was invisible beside the front
   door's 700 heading and looked like a two-weight wordmark. The app bar and the signed-out
   header inherit MudBlazor's 500 and 400 heading weights, so there the "light" half came out at
   the weight of the heavy one and the wordmark rendered with no split in it at all. Anything
   that narrows the declaration above brings that straight back, on those two surfaces only.

   Both halves are set here rather than one, so a placement gets the pair whatever the heading
   weight around it happens to be. The Tray renders the same pair, and must move with this one —
   TrayWordmarkTests is what makes that non-optional. And neither class belongs on anything but
   its own half of the word: at 400 a stray use of the light one was invisible, at 300 it is
   thin, which is what Each_wordmark_class_wraps_its_own_half_of_the_word_and_nothing_else is
   for. */
.tb-wordmark-heavy {
    font-weight: 700;
}

.tb-wordmark-light {
    font-weight: 300;
}

/* Routes' FocusOnNavigate moves focus to each page's <h1> after a navigation, so a screen reader
   starts at the heading — and the browser then draws its focus ring around the heading, which
   read as a box around the Landing Page's title. The heading is not a control and is never
   reached by Tab, so the ring tells a keyboard user nothing; the focus itself stays. Global
   because every page's heading takes that focus, and a scoped rule reaches one component's. */
h1:focus {
    outline: none;
}

/* The drawer's active entry. MudBlazor colours both the label and its 2px end-border from
   --mud-palette-primary; only the border moves to the brand orange here.

   The label deliberately stays navy: an active nav label is small text on a white field, and
   the brand orange measures 3.76:1 there — under the 4.5:1 that WCAG AA asks of body text. The
   border is a UI component rather than text, where the threshold is 3:1 and the orange passes.
   So the entry is marked in the brand colour and still readable, which is the whole point of
   the rule in TrustBridgeTheme.Orange.

   This file is linked after MudBlazor's own stylesheet, which is what lets an equally specific
   selector win. */
.mud-nav-link.active:not(.mud-nav-link-disabled) {
    border-inline-end-color: var(--mud-palette-secondary);
    --mud-ripple-color: var(--mud-palette-secondary);
}

/* The admin console's language switcher: a circle with the other language's two-letter code.
   The darker blue rather than the brand blue, because the code is small white text and white on
   #1992D1 measures 3.5:1 — under the 4.5:1 AA asks of it — where the darker one measures 4.7:1.
   Hover rings the circle rather than recolouring it, so no state of it drops below that. The
   white is the bar's own text colour, which Color.Inherit makes the anchor take with !important,
   so no colour is set here. Scoped to the app bar so the specificity beats the typography classes
   MudLink puts on the same anchor. */
.mud-appbar .tb-appbar-language {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--mud-palette-tertiary-darken);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1;
}

.mud-appbar .tb-appbar-language:hover,
.mud-appbar .tb-appbar-language:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mud-palette-appbar-text) 45%, transparent);
    outline: none;
}

/* The account menu in the app bar: a <details>, for the reason AdminLayout gives — its sign-out
   form has to be in the markup whether it is open or not, which a MudMenu's popover is not.

   The summary is the button, a lighter navy than the bar so it reads as one; the role beneath
   the name is the light blue, which measures 5.6:1 on it. Hover rings the button the way it rings
   the language circle, rather than lightening it: a fill 15% whiter takes the role down to 3.5:1. */
.tb-account {
    position: relative;
}

.tb-account > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 10px;
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-primary-lighten);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.tb-account > summary::-webkit-details-marker {
    display: none;
}

.tb-account > summary:hover {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mud-palette-appbar-text) 45%, transparent);
}

.tb-account > summary:focus-visible {
    outline: 2px solid var(--mud-palette-appbar-text);
    outline-offset: 2px;
}

/* What closes it on a click anywhere else. A <details> does not, so while it is open its summary
   is stretched across the viewport underneath the panel, and the click outside lands on the
   summary — which is what toggles a <details> shut. Fixed rather than absolute, so it covers the
   drawer and the screen as well as the bar; the bar sets no transform, so fixed here is the
   viewport. */
.tb-account[open] > summary::before {
    content: "";
    position: fixed;
    inset: 0;
    cursor: default;
}

/* And the bar above the drawer while the menu is open. Below 960px MudBlazor lifts an open
   responsive drawer to two above the bar, which would put it over the stretched summary, so a tap
   on it would not close the menu, and over the panel, whose sign-out a phone's drawer covers.
   Three above for as long as the menu is open, and the bar's own value the rest of the time. */
.mud-appbar:has(.tb-account[open]) {
    z-index: calc(var(--mud-zindex-appbar) + 3);
}

.tb-account-label {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

/* Cut short rather than wrapped, so a long name cannot push the wordmark off the bar; the panel
   shows the whole of it. */
.tb-account-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .875rem;
    font-weight: 600;
}

.tb-account-role {
    font-size: .75rem;
    color: var(--mud-palette-tertiary-lighten);
}

.tb-account-chevron {
    opacity: .7;
    transition: transform 150ms ease;
}

.tb-account[open] .tb-account-chevron {
    transform: rotate(180deg);
}

/* Above the stretched summary, which is why it carries a z-index and the summary does not. */
.tb-account-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1;
    min-width: 240px;
    max-width: 320px;
    padding: 4px 0;
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    box-shadow: var(--mud-elevation-8);
}

.tb-account-who {
    display: flex;
    flex-direction: column;
    padding: 8px 16px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    overflow-wrap: anywhere;
}

.tb-account-full-name {
    font-size: .875rem;
    font-weight: 600;
}

.tb-account-user-name {
    font-size: .75rem;
    color: var(--mud-palette-text-secondary);
}

/* One look for the link and the sign-out button, which are different elements for a reason:
   one navigates and the other posts. Justified to the start in so many words, because MudBlazor's
   reset centres every button's content and would set sign-out apart from the link above it. */
.tb-account-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 8px 16px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-size: .875rem;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}

.tb-account-item .mud-icon-root {
    color: var(--mud-palette-text-secondary);
}

.tb-account-item:hover,
.tb-account-item:focus-visible {
    background-color: var(--mud-palette-action-default-hover);
    outline: none;
}

/* On a phone the button shows only the icon and the chevron: the bar also holds the wordmark and
   the language circle, and the name and role are in the panel anyway. Hidden from sight rather
   than with display: none, because the label is the button's accessible name, and without it a
   screen reader announces a button that says nothing. */
@media (max-width: 599.98px) {
    .tb-account-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

/* The drawer's button on a screen with no circuit — today the Test Signature alone: a <details>
   rather than MudBlazor's icon button, for the reason AdminLayout gives. Drawn as that button is
   on every other screen — a 48px circle, pulled to the bar's edge — since a reader moves between
   them. */
.tb-drawer-toggle > summary {
    display: inline-flex;
    padding: 12px;
    margin-left: -12px;
    border-radius: 50%;
    cursor: pointer;
    list-style: none;
}

.tb-drawer-toggle > summary::-webkit-details-marker {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .tb-drawer-toggle > summary:hover {
        background-color: var(--mud-palette-action-default-hover);
    }
}

.tb-drawer-toggle > summary:focus-visible {
    outline: 2px solid var(--mud-palette-appbar-text);
    outline-offset: -2px;
}

/* Both halves keyed on MudBlazor's own query, (max-width: 959px), to the pixel, rather than on
   this file's usual .98 boundaries: at a fractional width between the two — 959.2px is a
   1199-pixel window at 125% — MudBlazor docks the drawer, and a toggle shown there would stretch
   its summary over the drawer's links.

   Not offered where the drawer is docked: AdminLayout says why. */
@media not all and (max-width: 959px) {
    .tb-drawer-toggle {
        display: none;
    }
}

/* Where it is not docked, the drawer itself. MudBlazor's stylesheet hides a responsive drawer
   there while it carries mud-drawer--initial, and only the circuit takes that class off — at the
   drawer's first change of open state once the circuit has read the viewport, not at the reading
   itself — so on a page with no circuit it never comes off. Shown over the screen
   while the button is open, where the circuit would show it; the selector outranks MudBlazor's
   own, which is !important too. The drawer sits two above the bar there, so its links are above
   the stretched summary that a tap anywhere else lands on and shuts it with, as the account
   menu's does. */
@media (max-width: 959px) {
    .tb-drawer-toggle[open] > summary::before {
        content: "";
        position: fixed;
        inset: 0;
        cursor: default;
    }

    .mud-layout:has(.tb-drawer-toggle[open]) .mud-drawer.mud-drawer-responsive.mud-drawer-md.mud-drawer--initial {
        display: flex !important;
    }
}

/* The Server's version at the foot of the drawer. The drawer's content is a flex column, so the
   auto margin is what pushes this to the bottom however many areas sit above it. */
.tb-drawer-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--mud-palette-lines-default);
}
