/*
 * The dashboard's only global stylesheet. MudBlazor does the styling; this file holds just what it has
 * no equivalent for. No colour is ever written here: anything visual reads a theme variable
 * (var(--mud-palette-...)), so both palettes stay correct by construction.
 */

/* Touch targets: every tappable control is at least 44 px tall (WCAG 2.5.5). MudBlazor's defaults for
   these run 32-40 px, which is right for a mouse and too small for a thumb. Icon buttons are 48 px
   already. With a mouse or a trackpad as the only pointer (pointer: fine), buttons, toggles and chips keep MudBlazor's
   own heights, a little over 36 px and 32 px, so screens read compact and professional (GitHub #295); a phone, a tablet
   or a touch screen keeps 44 px. Navigation links, list items and menu items keep 44 px everywhere. */
.mud-nav-link,
.mud-button-root.mud-button,
.mud-list-item-clickable,
.mud-menu-item,
.mud-toggle-item,
.mud-chip.mud-clickable {
    min-height: 44px;
}

@media (pointer: fine) {
    .mud-button-root.mud-button,
    .mud-toggle-item {
        min-height: 36px;
    }

    .mud-chip.mud-clickable {
        min-height: 32px;
    }
}

/* For a custom tappable area (the brand link, the account menu's avatar). */
.touch-target {
    min-height: 44px;
    min-width: 44px;
}

/* What only a keyboard can use - a button's key after its words, the review screen's keyboard shortcuts button, the guided
   tour's keys line - is decided here, once, by the pointer and never by the width (GitHub #400): hidden where the main
   pointer is a finger (pointer: coarse), a phone or a tablet however wide it is held; shown with a mouse or a trackpad
   however narrow the window, and where there is no pointer at all. The keys themselves still work wherever a keyboard is
   attached, and each control still names its key to a screen reader (aria-keyshortcuts). */
@media (pointer: coarse) {
    .hidden-on-touch {
        display: none !important;
    }
}

/* A date picker's calendar (GitHub #362), for every date field (DateField): MudBlazor draws each day 36 px with 2 px either
   side, a mouse's size, its month arrows and years 40 px, and the heading between the arrows 23 px. Without a fine pointer -
   a phone, a tablet, a touch screen - each day is a 44 px target like every other tappable control, its weekday heading as
   wide so the columns stay under it: seven of them, edge to edge, fill the calendar's 310 px (308). The arrows and the years
   are 44 px too, and so is the heading, which is the way to the months and the years now the toolbar above the calendar is
   gone (GitHub #370). With a mouse or a trackpad the calendar keeps MudBlazor's compact size (GitHub #295). Same strength
   as MudBlazor's rules, so this file, loaded after, decides (DatePickerTouchTests). */
@media not all and (pointer: fine) {
    .mud-picker-calendar .mud-day {
        width: 44px;
        height: 44px;
        margin: 0;
    }

    .mud-picker-calendar-header-day .mud-day-label {
        width: 44px;
        margin: 0;
    }

    .mud-picker-calendar-header-switch > .mud-icon-button {
        padding: 10px;
    }

    .mud-picker-calendar-header-switch .mud-picker-calendar-header-transition {
        height: 44px;
    }

    .mud-picker-year-container .mud-picker-year {
        height: 44px;
    }
}

/* A select's or an autocomplete's list is never taller than the room on one side of its field (GitHub #363). MudBlazor opens
   a list above its field where it does not fit below (#355), but its 300 px height is fixed, and once a phone's on-screen
   keyboard has shrunk the page (interactive-widget=resizes-content, App.razor) neither side had 300 px: the list was pushed
   back on screen over its own field, hiding what was being typed. Half the page less a field's height always fits on one
   side or the other, so the list hangs beside the field and scrolls. On any screen at least 680 px tall - every phone with no
   keyboard open, every laptop - this is still 300 px, so nothing else changes. It must beat the height MudBlazor writes on
   the list itself (MaxHeight, an inline style), hence !important; only these lists hang from the field's own width. */
.mud-popover.mud-popover-relative-width {
    max-height: min(300px, calc(50dvh - 40px)) !important;
}

/* A visible focus ring for keyboard users on every control (WCAG 2.4.7, GitHub #44), in the safety-orange highlight: 3:1
   or better against every layer a control sits on, in both palettes (ThemeContrastTests). The mouse and touch never
   trigger :focus-visible.
   It is written at specificity (0,3,0) - :root, :focus-visible and the :not() - because MudBlazor clears the browser's
   ring with rules a bare :focus-visible (0,1,0) loses to, however late it loads: a:focus-visible and button:focus at
   (0,1,1), an expansion panel's header at (0,2,0), the split panel's divider at (0,3,0), whose tie this file wins by
   loading after MudBlazor's (FocusRingTests). It is no stronger than that: a component's own scoped ring - the review
   table's cells, FieldTable.razor.css - is (0,3,0) too and loads after this file, so it keeps the last word.
   Left out by the :not():
   - an element only script focuses (tabindex="-1": the page title after a navigation), which is not a control;
   - the inside of an SVG drawing: the review screen's boxes show focus as a halo (SheetViewer.razor.css);
   - a text field or a select (MudBlazor's input root), whose outline already turns the primary colour at double width
     on focus - for a click too, since typing follows - so a ring as well would draw two edges around it.
   .focus-ring-pinned draws the same ring on a control without focus, for the gallery's still pictures (KeyboardFocusDemo);
   a navigation link takes it on the wrapper MudBlazor draws round the link, and a switch, a checkbox or a radio on the
   wrapper round its input (the last rule below). */
:root :focus-visible:not([tabindex="-1"], svg *, .mud-input-root),
:root .focus-ring-pinned:not(:has(input), .mud-nav-item),
:root .mud-nav-item.focus-ring-pinned > .mud-nav-link {
    outline: 2px solid var(--speccapture-highlight);
    outline-offset: 2px;
}

/* Just inside a control that reaches the edge of what holds it - a navigation link, a menu item, a list row, a panel's
   header, a tab, a toggle, a whole-row link, a box that scrolls sideways - or has no edge of its own, like an icon button
   without a fill, which often sits against its toolbar's edge: drawn outside, the scrolling container around it would cut
   the ring off. */
:root :is(.mud-nav-link, .mud-menu-item, .mud-list-item, .mud-expand-panel-header, .mud-tab, .mud-toggle-item, .row-link,
          .scroll-region, .mud-icon-button:not(.mud-button-filled)):is(:focus-visible, .focus-ring-pinned),
:root .mud-nav-item.focus-ring-pinned > .mud-nav-link {
    outline-offset: -2px;
}

/* A switch, a checkbox and a radio take focus on an invisible input inside MudBlazor's round button: the ring goes on
   that circle, around the thumb or the box. */
:root .mud-icon-button:has(input:focus-visible),
:root .focus-ring-pinned .mud-icon-button:has(input) {
    outline: 2px solid var(--speccapture-highlight);
    outline-offset: -2px;
}

/* A link inside a sentence is underlined at rest (WCAG 1.4.1, GitHub #98). A link's colour is the primary ink, which
   differs from the secondary text around it by only 2.2:1 in light and 1.8:1 in dark - colour alone would need 3:1 - and
   MudLink's default underline (Underline.Hover) appears only under a mouse, which a phone does not have. Running text is
   a paragraph, a list item, any MudText or an alert's message. A link that stands alone - a whole-row link, the brand
   mark, a list row's title - sits in none of them or sets Underline.None, and keeps MudBlazor's look (InlineLinkTests). */
p .mud-link.mud-link-underline-hover,
li .mud-link.mud-link-underline-hover,
.mud-typography .mud-link.mud-link-underline-hover,
.mud-alert-message .mud-link.mud-link-underline-hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* Layered surfaces: menus and dialogs float one step above the cards they open from. MudBlazor's palette
   has a single surface colour, so the raised one comes from the theme's own variable. */
.mud-popover.mud-paper,
.mud-dialog {
    background-color: var(--speccapture-surface-raised);
}

/* After each navigation the page title is focused so screen readers announce it; it is not a control,
   so it takes focus without drawing a ring. */
h1:focus,
h1:focus-visible {
    outline: none;
}

/* "Skip to content" (WCAG 2.4.1, GitHub #65): the signed-in shell's first Tab stop, off screen until the keyboard's Tab
   gives it focus, then over the app bar's corner. Focus a script puts there - a dialog closing hands focus back to what had
   it - leaves it off screen: wwwroot/js/skipLink.js marks it, and a phone showed it over the header after a dialog closed
   (GitHub #322). It moves focus to the page's main landmark, which - like the page title - is not a control and takes
   focus without a ring. */
.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: calc(var(--mud-zindex-appbar) + 1);
    transform: translateY(calc(-100% - 16px));
}

.skip-link:focus-visible:not([data-out-of-sight]) {
    transform: none;
}

.app-main:focus,
.app-main:focus-visible {
    outline: none;
}

/* A whole row that is one link (the document list). MudBlazor's list is a selection list (role=option),
   which would hide that each row navigates; a MudLink per row keeps link semantics and gets the same
   hover tint MudBlazor uses for its own clickable rows. */
.row-link {
    transition: background-color 150ms ease-out;
}

.row-link:hover {
    background-color: var(--mud-palette-action-default-hover);
}

/* Long unbroken text (a file name, a part number with no spaces) wraps instead of pushing the page
   sideways on a phone. */
.break-anywhere {
    overflow-wrap: anywhere;
    min-width: 0;
}

/* Text a person copies into a terminal or a config file - an API key, its prefix, an example request - in the
   system's monospace face, so look-alike characters (l, 1, I, 0, O) stay distinct. MudBlazor has no code style. */
.code-text,
.code-text .mud-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* A short list inside running text - the events an endpoint receives, the steps to check a signature: the browser's
   own bullets or numbers, indented to sit under the sentence that introduces them. MudBlazor's MudList is for
   interactive lists, not prose. */
.text-list {
    margin: 0;
    padding-left: 1.5rem;
}

.text-list > li + li {
    margin-top: 4px;
}

/* An example request: a block that keeps its lines exactly as they are to be typed - an address broken in the
   middle reads as two - and scrolls sideways on its own when a line is wider than a phone, never the page.
   Theme variables only, so it reads in both palettes. */
.code-sample {
    margin: 0;
    max-width: 100%;
    overflow-x: auto;
    padding: 12px 16px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-background-gray);
    color: var(--mud-palette-text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre;
}

/* Subtle entrance for page content: a short rise and fade, skipped for anyone who asks for less motion. */
@media (prefers-reduced-motion: no-preference) {
    .fade-in {
        animation: speccapture-rise 0.24s ease-out both;
    }
}

@keyframes speccapture-rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* The component gallery's preview frames: a frame is a real page, so a phone-width frame trips the same
   breakpoints a phone would. */
.preview-frame {
    display: block;
    width: 100%;
    border: 0;
}

/* The page inside a gallery frame (Admin/Gallery/PreviewFramePage) has no app bar: what sticks under it - a work screen's
   header - sticks to the very top there, rather than 64 px down over the screen it heads (GitHub #239). */
.preview-frame-page {
    --mud-appbar-height: 0px;
}

/* The upload drop zone. Its edge, hover and focus tint are MudBlazor's own drag-area classes
   (mud-file-upload-dragarea); this only gives it room to be an easy target for a thumb, the tint while a
   file is held over it, and the "choose a file" words their link look. */
.upload-zone {
    min-height: 13rem;
    width: 100%;
    color: inherit;
    font: inherit;
}

.upload-zone-dragging {
    background-color: var(--mud-palette-action-default-hover);
}

.upload-zone-link {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* The export-control sentence is three lines on a phone: its box sits by the first line, not the middle. */
.export-control-statement .mud-checkbox {
    align-items: flex-start;
}

/* The review screen's keyboard shortcuts panel (Features/Review/ShortcutsHelp; it renders in the popover layer, outside any
   component's scoped styles). It hangs from a zero-height anchor under the screen's header, right-aligned, so it covers only
   the selected value's panel - never under 300 px wide (GitHub #282 item 19) - and no more of the window's height than
   leaves its foot clear of the bottom: the list scrolls inside it. Its width is set on the content, because MudBlazor's
   popover script writes max-width: none on the popover itself. Compact: tight rows, small keycaps drawn in the theme's own
   lines and text colours. */
.shortcuts-anchor {
    position: relative;
    height: 0;
}

.shortcuts-panel {
    position: relative;
    width: min(300px, calc(100vw - 32px));
}

.shortcuts-heading {
    padding: 10px 44px 2px 12px;
}

.shortcuts-close {
    position: absolute;
    top: 4px;
    right: 4px;
}

.shortcuts-switch {
    padding: 0 12px 6px 6px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.shortcuts-switch-label {
    margin-left: 4px;
    font-size: 0.875rem;
}

.shortcuts-note {
    padding-left: 6px;
    line-height: 1.4;
}

.shortcuts-body {
    max-height: max(160px, calc(100dvh - 345px));
    overflow-y: auto;
    padding: 0 12px 10px;
}

.shortcuts-body:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: -2px;
}

/* A group the single-key switch turned off reads as not now (GitHub #212); its heading says "(off)" in words. */
.shortcuts-table--off td,
.shortcuts-table--off kbd {
    color: var(--mud-palette-text-disabled);
}

.shortcuts-group {
    margin-top: 6px;
    line-height: 2;
}

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
}

.shortcuts-table td {
    padding: 2px 0;
    vertical-align: top;
    font-size: 0.8125rem;
    line-height: 1.35;
}

.shortcuts-table td.shortcuts-keys {
    width: 1%;
    padding-right: 8px;
    white-space: nowrap;
}

/* One width for the keys of every group but the drawing's arrows, so the descriptions start in one line down the panel. */
.shortcuts-keycaps {
    display: inline-block;
    min-width: 54px;
}

.shortcuts-table kbd {
    display: inline-block;
    min-width: 1.5em;
    margin-right: 3px;
    padding: 0 5px;
    border: 1px solid var(--mud-palette-lines-default);
    border-bottom-width: 2px;
    border-radius: 4px;
    font-family: var(--mud-typography-default-family);
    font-size: 0.75rem;
    line-height: 1.45;
    text-align: center;
    color: var(--mud-palette-text-primary);
    background-color: var(--mud-palette-background);
}

/* A phone with a keyboard (? opens it): its Close is a full touch target, and its foot clears the bottom under the phone's
   taller header. */
@media (max-width: 599.98px) {
    .shortcuts-heading {
        padding-top: 14px;
        padding-right: 52px;
    }

    .shortcuts-body {
        max-height: max(160px, calc(100dvh - 500px));
    }

    .shortcuts-close {
        min-width: 44px;
        min-height: 44px;
    }
}

/* The "delayed" banner spans the content area edge to edge, above the page. */
.processing-delay {
    border-radius: 0;
}

/* The account button: one real MudButton (GitHub #65, #79) drawn as the person's initials in a circle, as a MudAvatar
   would draw them - a 44 px touch target. Its wrapper is the panel's anchor, the button's own size. */
.account-menu {
    display: inline-flex;
    position: relative;
}

.account-menu .account-menu-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 1rem;
    letter-spacing: 0;
}

/* The account panel (GitHub #79): one width wherever it is drawn, never wider than a phone's screen less its gutters.
   Under the app bar it scrolls inside itself when the screen is too short for it (a phone held sideways). */
.account-panel {
    width: 20rem;
    max-width: calc(100vw - 32px);
}

.account-popover {
    max-height: calc(100vh - var(--mud-appbar-height) - 16px);
    max-height: calc(100dvh - var(--mud-appbar-height) - 16px);
    overflow-y: auto;
}

/* The gallery's still picture of the panel, on the raised surface its popover gives it. */
.account-surface {
    background-color: var(--speccapture-surface-raised);
}

/* The gallery's phone frame: a real 360-pixel page inside a device-like border drawn in the theme's lines. */
.phone-frame {
    display: inline-block;
    max-width: 100%;
    padding: 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 28px;
    background-color: var(--mud-palette-background);
}

/* How much of the top of the page the fixed app bar covers, for what sticks below it as the page scrolls: the review
   screen's section headings (ReviewViewerLibrary's FieldList reads --field-list-page-top). The app bar's own height, by
   the same rules MudBlazor uses for the main content's top padding: 7/8 of the theme's height on a phone held upright,
   3/4 turned sideways, the full height from 600 px up. A page without the app bar (the gallery's frames) leaves it
   unset, and the headings stick to the very top. */
.mud-main-content {
    --field-list-page-top: calc(var(--mud-appbar-height) - var(--mud-appbar-height) / 8);
}

@media (orientation: landscape) {
    .mud-main-content {
        --field-list-page-top: calc(var(--mud-appbar-height) - var(--mud-appbar-height) / 4);
    }
}

@media (min-width: 600px) {
    .mud-main-content {
        --field-list-page-top: var(--mud-appbar-height);
    }
}

/* No control the keyboard reaches ends under a bar that stays on the screen (GitHub #213, WCAG 2.4.11). Each such bar says
   which edge it sticks to (data-sticky-bar: the app bar, the review screen's progress bar, the builder's publish bar, the
   Documents page's selection bar), and wwwroot/js/stickyBars.js measures how far into the screen they reach from the top
   and from the bottom. Those lengths are the page's scroll padding, with a little air for the focus ring, so the browser
   brings a focused control into view between the bars rather than under one. Until the script has measured, the top is
   the app bar's height. */
html {
    scroll-padding-top: calc(var(--sticky-bars-top-height, var(--mud-appbar-height)) + 8px);
    scroll-padding-bottom: calc(var(--sticky-bars-bottom-height, 0px) + 8px);
}

/* Where the bars would take more than a third of the screen - a short window, or 200% to 400% zoom - they stop sticking
   (the script sets data-sticky-bars="off", and both lengths above to 0): each scrolls with the page from its own place,
   and the page gets the whole screen. The app bar keeps its place at the top of the page, which already starts below it,
   and the review screen's section headings, which stuck under it, stick to the very top. */
:root[data-sticky-bars="off"] body [data-sticky-bar] {
    position: static;
}

:root[data-sticky-bars="off"] body .mud-appbar[data-sticky-bar] {
    position: absolute;
}

:root[data-sticky-bars="off"] .mud-main-content {
    --field-list-page-top: 0px;
}

/* The review screen's rail (a mini drawer): folded, icons only; opened (the pointer resting on it, focus inside it, or
   the menu button), the icons with their names. Opening and folding it is one change of width - MudBlazor's own 225 ms
   transition - and nothing else moves (GitHub #155): every icon keeps one place in both states, the names come in beside
   them on one line, fading in as the rail's edge slides past, and every section heading (Work, Set up, Workspace, Admin:
   GitHub #166) keeps its height folded, so the icons below it never move up or down - the empty band where a heading
   was is what groups the folded rail's icons. Folding, the names and the headings go at once (MudBlazor hides a folded
   rail's names for all but a screen reader), and nothing lingers while the rail narrows. Nothing scrolls sideways while
   the width changes. The folded rail's width inside its right-hand border (AppShell's border-r, 1px) is the one length both
   states place the icons by, below. */
/* How many drawings were sent to the person for review (GitHub #316): a small count beside Review's name, in the theme's
   own colours; on a folded rail, where names fade, a dot on its icon says the same. */
.nav-link-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    background-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}

.nav-link-counted .mud-nav-link {
    position: relative;
}

.mud-drawer-mini.mud-drawer--closed .nav-link-counted .mud-nav-link::after {
    content: "";
    position: absolute;
    top: 8px;
    inset-inline-start: calc((var(--folded-rail-inner-width) - 1rem) / 2 + 0.75rem);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--mud-palette-primary);
}

.mud-drawer-mini {
    overflow-x: hidden;
    --folded-rail-inner-width: calc(var(--mud-drawer-width-mini-left) - 1px);
}

.mud-drawer-mini .nav-section-heading,
.mud-drawer-mini .mud-nav-link-text {
    white-space: nowrap;
}

.mud-drawer-mini.mud-drawer--closed .nav-section-heading,
.mud-drawer-mini.mud-drawer--closed .mud-nav-link-text {
    opacity: 0;
}

.mud-drawer-mini.mud-drawer--open .nav-section-heading,
.mud-drawer-mini.mud-drawer--open .mud-nav-link-text {
    transition: opacity 150ms ease;
}

/* Folded, each icon sits on the rail's centre line (GitHub #109). MudBlazor's 16 px link padding centres a 24 px icon
   in its 56 px rail only when the links reach the rail's edges; the menu's own gutter (NavMenu's pa-2) keeps them 8 px
   in from each side, which put every icon 8.5 px right of centre, hard against the right edge of its highlight and its
   focus ring. Half the link's width less half the icon's puts the icon in the middle of the link, and so of the rail,
   whatever the rail's width or the gutter's, so long as the gutter is the same on both sides. */
.mud-drawer-mini.mud-drawer--closed .mud-nav-link {
    padding-inline-start: calc(50% - 0.75rem);
}

/* ...and it stays there while the rail is still narrowing: folded, the menu is the folded rail's width at once, so the
   half above is half of a folded link however wide the rail still is (GitHub #155). */
.mud-drawer-mini.mud-drawer--closed > .mud-drawer-content > .mud-navmenu {
    width: var(--folded-rail-inner-width);
}

/* Opened, each icon stays exactly where it was folded (GitHub #155): half a folded link - the folded rail's width less
   the menu's gutter on both sides (NavMenu's pa-2, 0.5rem) - less half the icon, the same length the rule above comes
   to. The names start beside the icons, and nothing animates the padding: MudBlazor eases a link's padding, which slid
   every icon sideways and back as the rail opened and folded. */
.mud-drawer-mini.mud-drawer--open .mud-nav-link {
    padding-inline-start: calc((var(--folded-rail-inner-width) - 1rem) / 2 - 0.75rem);
}

.mud-drawer-mini .mud-nav-link {
    transition-property: background-color, box-shadow, border;
}

.phone-frame iframe {
    display: block;
    width: 360px;
    max-width: calc(100vw - 72px);
    border: 0;
    border-radius: 18px;
    background-color: var(--mud-palette-background);
}

/* The gallery's screen frame (Admin/Gallery/ScreenFrame, GitHub #239): a laptop's or a monitor's window drawn smaller - its
   page laid out at the window's full size, then scaled - inside a border in the theme's lines. Never wider than the column. */
.screen-frame {
    box-sizing: content-box;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-background);
}

.screen-frame iframe {
    display: block;
    border: 0;
    transform-origin: 0 0;
    background-color: var(--mud-palette-background);
}

/* The guided tour (Shared/Guidance/GuidedTour.razor). MudOverlay blocks the page and MudPopover places the card;
   the one thing MudBlazor has no piece for is the spotlight: the part of the screen a step is about, left clear
   while everything around it is dimmed. It is a rectangle over that part whose shadow, in the theme's own overlay
   colour, covers the rest of the screen; its outline is the theme's highlight (the focus-ring colour, 3:1 against
   every surface in both palettes). It never takes a click: the page underneath is only shown, not used. Its place
   is written by wwwroot/js/guidedTour.js, which keeps it on its target; until then it is a point at the centre. */
.guided-tour-spotlight {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: var(--mud-default-borderradius);
    box-shadow: 0 0 0 200vmax var(--mud-palette-overlay-dark);
    outline: 3px solid var(--speccapture-highlight);
    outline-offset: 0;
    pointer-events: none;
}

.guided-tour-spotlight[data-target="none"] {
    outline: none;
}

@media (prefers-reduced-motion: no-preference) {
    .guided-tour-spotlight {
        transition: top 0.25s ease-out, left 0.25s ease-out, width 0.25s ease-out, height 0.25s ease-out;
    }
}

/* The step's card: beside its target from tablet width up, a little apart from it. */
.guided-tour-popover {
    width: min(380px, calc(100vw - 32px));
}

.guided-tour-popover.guided-tour-below {
    margin-top: 12px;
}

.guided-tour-popover.guided-tour-above {
    margin-top: -12px;
}

.guided-tour-popover.guided-tour-inside {
    margin-top: -16px;
}

/* On a phone the card sits at the bottom of the screen, where a thumb is, clear of the home indicator. */
.guided-tour-sheet {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    background-color: var(--speccapture-surface-raised);
}

.guided-tour-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 16px 12px;
}

.guided-tour-progress {
    margin: 8px 0 2px;
}

.guided-tour-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-right: -8px;
}

.guided-tour-keys {
    display: flex;
    align-items: center;
    gap: 6px;
}

.guided-tour-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

/* The export menu's note while a drawing is still being read: a narrow empty state inside the menu. */
.export-menu-note {
    max-width: min(320px, calc(100vw - 32px));
}

/* A menu's words when it has nothing to choose (MenuNote, GitHub #185): focused as the menu opens so the keyboard is
   inside the menu, it is not a control, and like the page's main landmark it takes focus without a ring. */
.menu-note:focus,
.menu-note:focus-visible {
    outline: none;
}

/* The Documents page's selection bar (GitHub #142): its Export button stays in sight under the app bar while a person
   scrolls the list ticking documents - on a phone the bar is far above the rows. The page's own surface, in both
   palettes. Its box and words keep to one line beside each other and wrap as a pair before the buttons do. */
.documents-selection-bar {
    position: sticky;
    top: calc(var(--mud-appbar-height) + 8px);
    z-index: 2;
    background-color: var(--mud-palette-surface);
}

.documents-selection-what {
    flex: 1 1 240px;
}

/* From 960 px the preview sits beside the editor and stays in sight as the editor scrolls. */
@media (min-width: 960px) {
    .template-preview-pane {
        position: sticky;
        top: calc(var(--mud-appbar-height) + 132px);
        max-height: calc(100dvh - var(--mud-appbar-height) - 148px);
        overflow-y: auto;
    }
}

/* An export file's heading row in the builder's preview (GitHub #177): each heading on one line, as a spreadsheet's
   column heading reads; the row scrolls sideways inside its own box. */
.template-export-heading {
    white-space: nowrap;
}

/* The builder's example files (GitHub #243): the JSON and a CSV file exactly as written, in a box that scrolls both ways
   rather than running the pane long - MudBlazor has no code view - and a workbook cell shaded as the file shades it,
   amber while it waits for a person and blue for a correction, from the theme's own warning and info colours so it reads
   in both palettes. */
.code-sample--tall {
    max-height: 22rem;
    overflow: auto;
}

.template-export-cell--waiting {
    background-color: rgba(var(--mud-palette-warning-rgb), 0.22);
}

.template-export-cell--corrected {
    background-color: rgba(var(--mud-palette-info-rgb), 0.22);
}

/* Why each amber cell waits (GitHub #278): a line each under the tab's rows, the cell's heading shaded as the cell is. */
.template-export-waits {
    margin: 2px 0 0;
    padding-left: 1.25rem;
}

.template-export-wait-where {
    padding: 0 4px;
    border-radius: 2px;
}

/* A box wider content scrolls sideways in, which the keyboard reaches (ScrollRegion, GitHub #216, WCAG 2.1.1): a named
   region with tabindex="0", so Tab stops on it and the arrow keys scroll it. The box is what scrolls - MudBlazor's table
   container inside it would otherwise scroll (overflow-y makes it a scroller), and nothing can focus that - and the
   table inside is as wide as its columns, its outline round every one of them. */
.scroll-region {
    max-width: 100%;
    overflow-x: auto;
}

.scroll-region > .mud-table {
    width: max-content;
    min-width: 100%;
}

.scroll-region > .mud-table > .mud-table-container {
    overflow: visible;
}

/* A field row being dragged: lifted on the theme's own surface, so a finger dragging it over the rows below never shows
   their words through it (GitHub #291). */
.template-field-dragging {
    position: relative;
    z-index: 2;
    background-color: var(--mud-palette-surface);
    box-shadow: var(--mud-elevation-4);
}

/* MudDropZone lays an invisible strip, 20 px high and above the rows, over the top of its first row, so a row can be
   dropped before it (GitHub #184). Left there, it took every tap and click on the top of the first row - on a phone the
   top half of the row, its chevron's centre included, so the first field's sheet never opened. It takes the pointer only
   while a row is being dragged, when the zone carries its DraggingClass; otherwise the row beneath it does. */
.template-field-zone > .mud-drop-item-preview-start {
    pointer-events: none;
}

.template-field-zone.template-field-zone--dragging > .mud-drop-item-preview-start {
    pointer-events: auto;
}

.template-field-keep {
    margin: -10px 0 !important;
}

/* ---- Work screens: the template builder, and the review screen after it (GitHub #275, #281) ------------------------ */

/* One row of a list of fields (Shared/Work/ValueRow): its name the one control, the whole row a tap target. The name's
   button is MudBlazor's, laid flat: left-aligned, as wide as its text, with the row's own padding. A selected row takes
   the theme's selection tint and a bar of the primary colour at its start edge, in both palettes. */
.value-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 12px;
    cursor: pointer;
    border-inline-start: 3px solid transparent;
    min-width: 0;
}

.value-row:hover {
    background-color: var(--mud-palette-action-default-hover);
}

.value-row--selected,
.value-row--selected:hover {
    background-color: var(--mud-palette-action-default-hover);
    border-inline-start-color: var(--mud-palette-primary);
}

.value-row-lead,
.value-row-trail {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 24px;
}

.value-row-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.value-row-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 6px;
    min-width: 0;
}

/* Compact (GitHub #295): a row's name is a line of text, not a button's height - the whole row is the tap target, and on
   a touch screen the row itself is never less than 44 px tall. */
.mud-button-root.value-row-name {
    padding: 1px 0;
    min-height: 0;
    line-height: 1.4;
    min-width: 0;
    justify-content: flex-start;
    text-align: start;
    text-transform: none;
    font-weight: 600;
    letter-spacing: normal;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
}

.mud-button-root.value-row-name:hover {
    background-color: transparent;
}

.value-row-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}

.value-row-value {
    display: block;
    line-height: 1.4;
}

@media (pointer: coarse) {
    .value-row {
        min-height: 44px;
    }
}

/* The chips a field carries in a list (Shared/Work/FieldBadge): a line of small type, not a control's height. */
.mud-chip.field-badge {
    height: 20px;
    padding: 0 6px;
    font-size: 0.75rem;
}

.mud-chip.field-badge .mud-chip-icon {
    font-size: 0.875rem;
    margin-inline-end: 3px;
}

/* "Read with <template>" (GitHub #24, #386): a template's name can be long, and a chip keeps its words on one line, so on a
   phone it ran off the screen's right-hand edge (GitHub #470). Its words wrap inside it instead, its height following its
   lines; the tap target's minimum above still holds. So does a review link's "With <reviewer>" or "Sent to <whom>" on a
   Review home row (GitHub #474): a reviewer is named with the email they gave when two gave one name, and a phone cut it off. */
.mud-chip.read-with-chip,
.mud-chip.review-link-chip {
    height: auto;
    padding-block: 3px;
    white-space: normal;
}

.mud-chip.read-with-chip .mud-chip-content,
.mud-chip.review-link-chip .mud-chip-content {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: start;
}

.value-row-note {
    display: block;
}

/* A field's grip in the builder's list (GitHub #291): the one place a drag starts, so a swipe anywhere else on a row
   scrolls. As big as a fingertip - 40 px square - with negative margins so the row keeps its height and the grip sits in
   the row's own start padding. The browser does not scroll or zoom from it: a finger on it moves the field. */
.template-row-grip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: -6px -8px -6px -12px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.template-row-grip:active {
    cursor: grabbing;
}

/* The selected thing's panel (Shared/Work/PanelShell). From 960 px a panel in its place: its heading and its foot stay in
   sight and its body scrolls, the whole no taller than the screen under the app bar. Below 960 px a sheet from the bottom
   edge, as the builder's field sheet (#176) is drawn. */
.panel-shell--side {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - var(--mud-appbar-height) - 24px);
    position: sticky;
    top: calc(var(--mud-appbar-height) + 12px);
    overflow: hidden;
}

.panel-shell-head {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 8px 6px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

/* Its Close is a small icon button, a mouse's size; without a fine pointer - a phone, where a sheet with no drawing kept puts
   the review screen's panel in the list's place (GitHub #393), a tablet - it is a 44 px target like every other control. */
@media not all and (pointer: fine) {
    .panel-shell-head .mud-icon-button {
        min-width: 44px;
        min-height: 44px;
    }
}

.panel-shell-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.panel-shell-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 12px;
}

.panel-shell-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 4px 12px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.mud-dialog.work-sheet {
    width: 100%;
    max-width: 600px;
    margin: 0 !important;
    max-height: calc(100dvh - 48px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.mud-dialog.work-sheet .mud-dialog-content {
    overflow-y: auto;
}

.mud-dialog-container:has(> .mud-dialog.work-sheet) {
    padding-bottom: 0;
}

/* A work screen's header row (Shared/Work/WorkHeader): the way back, the name and where it stands, the actions - one row
   from 600 px, and on a phone the actions on a row of their own under the name. It stays in sight under the app bar, on
   the page's own surface in both palettes. */
.work-header-bar {
    position: sticky;
    top: var(--mud-appbar-height);
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    padding: 4px 0;
    margin-bottom: 4px;
    background-color: var(--mud-palette-background);
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.work-header-titles {
    flex: 1 1 200px;
    min-width: 0;
}

.work-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

@media (max-width: 599.98px) {
    .work-header-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
    }
}

/* From 960 px the header is one line wherever it fits (GitHub #239): where the thing stands follows its name and chips on
   their line, and goes under them only when there is no room; with a mouse its icon buttons are the compact 36 px the other
   buttons are (GitHub #295), so they set no taller line than the name. A touch screen keeps 48 px. */
@media (min-width: 960px) {
    .work-header-titles {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        column-gap: 12px;
    }
}

@media (min-width: 960px) and (pointer: fine) {
    .work-header-bar .mud-icon-button {
        padding: 6px;
    }
}

/* Which view a work screen shows (Shared/Work/WorkViewSwitch): the screen's width on a phone, its words' width from 600 px. */
.work-view-switch {
    width: 100%;
}

.work-view-switch .mud-toggle-item {
    flex: 1 1 0;
}

@media (min-width: 600px) {
    .work-view-switch {
        width: auto;
    }

    .work-view-switch .mud-toggle-item {
        flex: 0 0 auto;
        min-width: 112px;
    }
}

/* A view's count beside its words ("Fields 8"): the item's own colour, a little quieter, so it reads on the chosen item too. */
.work-view-count {
    opacity: 0.72;
    font-weight: 400;
}

/* A work screen's panes (Shared/Work/WorkPanes, GitHub #292): one column on a phone, where the screen chooses which pane
   it shows and the page scrolls; from 960 px side by side, each its share of the width and never narrower than its least
   (--work-panes-columns, from the panes), all of them as tall as the screen under its sticky bars (--work-panes-height,
   measured by wwwroot/js/workPanes.js), each scrolling on its own - so a long list scrolls in its pane while the drawing
   and the panel beside it stay in sight. A pane whose content scrolls itself (a panel with its heading and foot) is given
   the whole height and does not scroll. A pane not shown keeps what it holds and takes no room. */
.work-panes {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

/* What the page keeps free under a work screen's panes (wwwroot/js/workPanes.js reads it): its own padding below them. From
   960 px a work screen's page has 4 px there (AppShell), so the panes - the drawing, the panel and its foot - reach down to the
   foot of the screen (GitHub #239); below 960 px, the 16 px they always had. */
[data-full-width] {
    --work-panes-space-below: 16px;
}

@media (min-width: 960px) {
    [data-full-width] {
        --work-panes-space-below: 4px;
    }
}

.work-pane {
    min-width: 0;
}

/* Below 960 px the panes stack and there is nothing to drag. */
.work-pane-divider {
    display: none;
}

@media (min-width: 960px) {
    .work-panes {
        grid-template-columns: var(--work-panes-columns, var(--work-panes-default-columns, minmax(0, 1fr)));
        gap: 6px;
        align-items: stretch;
        height: var(--work-panes-height, calc(100dvh - var(--sticky-bars-top-height, 64px) - 120px));
        min-height: var(--work-panes-least-height, 420px);
    }

    .work-pane {
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .work-pane--fills {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .work-pane--fills > * {
        min-height: 0;
    }

    .work-pane--hidden {
        display: none;
    }

    /* A side panel in a pane that gives it the whole height: its body scrolls between its heading and its foot. */
    .work-pane--fills .panel-shell--side {
        position: static;
        max-height: 100%;
    }

    /* The divider between two panes (GitHub #293): a hairline in the theme's line colour with a grip at its middle, as
       wide as the gap a person drags in; the primary colour, wider, while a pointer rests on it, it is dragged or it has
       the keyboard's focus. A finger on it moves it rather than scrolling the page. */
    .work-pane-divider {
        display: block;
        position: relative;
        cursor: col-resize;
        touch-action: none;
        outline: none;
        border-radius: var(--mud-default-borderradius);
    }

    .work-pane-divider::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        width: 1px;
        transform: translateX(-50%);
        background-color: var(--mud-palette-lines-default);
    }

    .work-pane-divider::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 6px;
        height: 40px;
        transform: translate(-50%, -50%);
        border-radius: 3px;
        background-color: var(--mud-palette-lines-inputs);
    }

    .work-pane-divider:hover::before,
    .work-pane-divider:focus-visible::before,
    .work-pane-divider--dragging::before {
        width: 3px;
        background-color: var(--mud-palette-primary);
    }

    .work-pane-divider:hover::after,
    .work-pane-divider:focus-visible::after,
    .work-pane-divider--dragging::after {
        background-color: var(--mud-palette-primary);
    }

    .work-pane-divider:focus-visible {
        outline: 2px solid var(--mud-palette-primary);
        outline-offset: 2px;
    }

    .work-pane-divider--hidden {
        display: none;
    }

    .work-panes--fixed {
        gap: 24px;
    }

    /* While a divider is dragged the panes take no pointer, so the drag never selects their text or wakes a hover. */
    .work-panes--resizing {
        cursor: col-resize;
        user-select: none;
        -webkit-user-select: none;
    }

    .work-panes--resizing > .work-pane {
        pointer-events: none;
    }
}


/* The builder's drawing (GitHub #275 piece 7): the drawing's choice takes the bar's room beside "Test your own fields",
   and a test's found and missed fields are a plain list under it. */
.template-drawing-choice {
    flex: 1 1 14rem;
    min-width: 0;
}

/* MudSelect puts its Class on the input control inside a wrapper of its own, and that wrapper is the bar's flex item: it is
   the one that must be free to shrink, so a long file name ends in an ellipsis rather than widening a phone's page (#278). */
.mud-select:has(> .template-drawing-choice) {
    flex: 1 1 14rem;
    min-width: 0;
}

.template-drawing-choice .mud-select-input {
    text-overflow: ellipsis;
}

/* Picking a caption on the drawing (GitHub #275 slice 2): what to do shares a line with its icon and Stop where there is
   room, and wraps under the icon on a phone. */
.template-pick-ask {
    flex: 1 1 14rem;
    min-width: 0;
}

.template-test-values {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* What the drawing lights round the selected field, in words (GitHub #278): its zone, caption and ruled cell in one compact
   line under the drawing, each with the review screen's icon, wrapping on a phone. Nothing takes room while nothing is said.
   A fact that lights its cue says so under the pointer, as the review screen's lines do. */
.template-drawing-facts {
    gap: 2px 12px;
    min-height: 0;
}

/* Out of the flow while nothing is said, never out of the accessibility tree: a live region hidden with display: none and shown
   with its words is a new region to a screen reader, which says nothing of it - the first field selected went unsaid. */
.template-drawing-facts:empty {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.template-drawing-fact {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    margin-left: -4px;
    color: var(--mud-palette-text-secondary);
    overflow-wrap: anywhere;
}

.template-drawing-fact .mud-icon-root {
    flex-shrink: 0;
}

.template-drawing-fact[data-cue-kind]:hover {
    background-color: var(--mud-palette-action-default-hover);
    border-radius: var(--mud-default-borderradius);
}

/* The builder's Files tab (GitHub #275 piece 8): what every file holds beside the three files and the chosen one's
   example, one column on a phone. The three files are one choice, each a full-width item with its title and what it is. */
.template-files {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

@media (min-width: 960px) {
    .template-files {
        grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.4fr);
    }
}

.template-files-choice {
    width: 100%;
}

/* The guided start (GitHub #275 decision 10): what a new template is for, a card each - one column on a phone, two from
   600 px, three in the dialog's full width. Each card is the radio itself, so a tap anywhere on it chooses it and the
   arrow keys move between them; the chosen one takes the primary edge, never a colour of its own. */
.template-purposes {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

@media (min-width: 600px) {
    .template-purposes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .template-purposes {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.template-purpose {
    margin: 0;
    height: 100%;
    align-items: flex-start;
    padding: 4px 12px 4px 0;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-surface);
}

.template-purpose .mud-input-control-input-container,
.template-purpose .mud-radio {
    width: 100%;
    height: 100%;
    align-items: flex-start;
}

.template-purpose .mud-radio {
    cursor: pointer;
}

.template-purpose--chosen {
    border-color: var(--mud-palette-primary);
    box-shadow: inset 0 0 0 1px var(--mud-palette-primary);
}

.template-purpose-copy {
    flex: 1 1 16rem;
    min-width: 0;
}

.template-files-choice .mud-toggle-item {
    justify-content: flex-start;
    text-transform: none;
    height: auto;
}

/* A heading of the Files tab's example renamed where it is shown (GitHub #275 slice 2): the heading's own words, as the
   file has them, on a quiet button with a pencil; the box that renames it takes the column's width and no less than a
   name's room. */
.template-export-heading-rename.mud-button-root {
    text-transform: none;
    letter-spacing: normal;
    font-weight: inherit;
    font-size: inherit;
    padding: 2px 6px;
    margin: -2px -6px;
    white-space: nowrap;
    justify-content: flex-start;
}

.template-export-heading-rename--tab.mud-button-root {
    font-weight: 700;
    margin-right: 0;
}

.template-export-heading-box {
    min-width: 12rem;
    margin: 0;
}

.add-fields-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
