/* ── Accessibility layer (WCAG 2.1 Level A parity with Pawn Marketplace v2.1) ──
   Additive shared file (new file per UI-UX-STANDARDS §4 rule 2 — tokens.css/app.css
   untouched). Cross-cutting by nature: keyboard-focus visibility and error
   identification must apply to every interactive control, so this file is the
   one sanctioned exception to per-feature scoping. Ported from the reference's
   app.css `:focus-visible` / `aria-invalid` rules, re-expressed on v3's
   component vocabulary (MudBlazor + fc-* classes) and Momento tokens. */

/* ── Keyboard focus visibility ──
   BUTTONS follow v3.0.2 (Kelly, 2026-09-30: import v3.0.2's button rules, focus included). Every
   other control keeps the Momento focus looks of 2026-09-28 ("Keep the WCAG ruling, it's just that
   the look isn't consistent with the UI"):
     · Primary (filled) buttons  — 20% darker, no ring (v3.0.2; was a 3px Momento halo 09-28 → 09-30).
     · Outlined (Secondary)      — the border thickens by 2px in the button's own colour: the
                                   Secondary group's inset ring in PressFeedback.css, same in v3.0.2.
     · Every other button        — v3.0.2's 2px brand-blue outline, 2px outside the button.
     · Links, tabs, menu items   — a 2px border in the control's own colour (currentColor) that
                                   follows its shape (09-28).
     · Momento components        — checkbox: 2px dashed #918F8F. Accordions and filled toggles:
                                   2px #4B4B4B. Radios: a ring round the whole option row. Inputs and
                                   selects keep FocusRing.css's blue inset ring (Kelly's call).
   Rings are drawn as OUTLINES wherever possible. They follow border-radius, move no layout,
   don't collide with the no-shadow button rule, and survive forced-colours mode. The two
   values are Momento's (measured from the Sept 2026 PDFs / Figma). They live here, not in
   tokens.css, because tokens are report-only until Kelly reviews the token table. */
:root {
    --fc-focus-grey:   #4B4B4B;   /* Momento Accordions, Focused: 2px border        */
    --fc-focus-dashed: #918F8F;   /* Momento Checkbox, State=Focus (Figma "Gray 3") */
}

/* Base: a 2px border in the control's own colour, inside its edge — so it never gets clipped
   by an overflow parent or painted over a neighbour. Specificity stays low on purpose: every
   typed rule below and in PressFeedback.css replaces it rather than stacking on top of it.
   Loaded after MudBlazor, whose `button:focus { outline: none }` it therefore overrides.
   For buttons this is now only the fallback for the ones v3.0.2's rule below leaves out
   (accordion headers, the Stores sort options); every other button takes v3.0.2's look. */
button:focus-visible,
a:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="menuitem"]:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

/* ── Buttons: v3.0.2's generic focus outline — IMPORTED 2026-09-30 (Kelly) ──
   v3.0.2 Accessibility.css:36-44, button part verbatim: a 2px brand-blue outline, 2px out. Its own
   note: ".fc-btn-outlined excluded like the CTAs — its keyboard treatment is the press ring
   (PressFeedback.css), not the generic outline. The Primary and Secondary class groups are
   excluded for the same reason: Primary's focus is the brightness mirror below, Secondary's is the
   ring, and without these exclusions they would get the generic 2px outline on top and stop
   matching their own type."
   Exclusions added for v3.1 (after the v3.0.2 list): .fc-addr-closebtn (Secondary group,
   2026-09-29) for the same reason, and the controls that keep their 2026-09-28 Momento look
   because they are components, not buttons: accordion headers and the Stores sort-sheet radio rows.
   The :not() chain makes this (0,29,1), so it outranks the base rule above and the per-control
   rules below. [role="button"] (store cards) is v3.0.2's too. */
button:not(.mudbutton-ui):not(.mudbutton-danger):not(.mudbutton-grey):not(.fc-btn-outlined):not(.fc-home-hero-cta):not(.fc-filtermodal-apply):not(.fc-sortmodal-apply):not(.fc-setloc-apply):not(.fc-item-interest):not(.fc-rint-no):not(.fc-modal-cancel):not(.fc-setloc-current):not(.fc-setloc-close):not(.fc-filtermodal-clear):not(.fc-sortmodal-clear):not(.fc-item-wish):not(.fc-item-lightbox-closebtn):not(.drawer_close_button):not(.view-store-btn):not(.close_btn):not(.signout_btn_cls):not(.fc-addr-closebtn):not(.fc-ssort-opt):not(.fc-item-acc-head):not(.fc-acc-light-head):not(.fc-ipol-acc-head):not(.fc-filter-toggle):not(.sidebar-accordion-btn):focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--color-brand-primary);
    outline-offset: 2px;
}

/* No padding to draw inside of, so these sit just outside the text, rounded.
   button.fc-item-storelink: Item Detail's Phone Number + Address — <button>s since 2026-09-29 that still
   read as links, so they take the link ring.
   button.fc-profile-row: the Profile page's Phone Number / Password / Preferred Language rows —
   <button>s since 2026-09-29 with no side padding, so an inside ring would sit on the text. */
a:not(.mud-button-root):not(.fc-skip-link):focus-visible,
button.fc-item-storelink:focus-visible,
button.fc-profile-row:focus-visible,
.sidebar-accordion-btn:focus-visible {
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Buttons on the brand-blue surfaces — the header (☰, desktop Information Center button), the Set
   Location bar, the promo hero's arrows and pause button, and the Stores List/Map toggle. v3.0.2's
   brand-blue outline above is invisible on #004FAA (contrast 1:1, measured on each 2026-09-30), so
   the same 2px ring, 2px out, is drawn in white here. The 2026-09-28 looks drew these in the controls'
   own (white) colour; v3.0.2 has this defect. !important because the v3.0.2 rule is (0,29,1).
   .topbar-tab-container (the desktop header's Stores / Saved / Profile / Sign In) joined 2026-09-30,
   when the tabs became real <button>s and started taking the brand-blue outline.
   .fc-mega-link (the Mega Menu dropdown's links, on the same blue) joined 2026-10-06. */
.menu-btn:focus-visible,
.location_btn_cls:focus-visible,
.info-icon-container:focus-visible,
.topbar-tab-container:focus-visible,
.fc-home-hero-nav:focus-visible,
.fc-home-hero-playpause:focus-visible,
.view-button:focus-visible,
.fc-mega-link:focus-visible { outline-color: var(--color-surface-default) !important; }

/* Profile's Delete Account card: the same v3.0.2 outline in its own destructive red, not brand blue
   (Kelly, 2026-09-30: selecting it shows red "due to the nature of the action"). Its press ring is red
   too (ProfileMenu.css). */
#delete-account-card:focus-visible { outline-color: #D32F2F !important; }

/* Primary (filled) buttons — IMPORTED VERBATIM from v3.0.2 Accessibility.css:14-27 (Kelly,
   2026-09-30). "The reference mirrors :active on :focus-visible so keyboard users get the same
   feedback as pointer users": 20% darker, no ring. Replaces the 2026-09-28 darken + 3px Momento
   halo. Per v3.0.2, this list is the Primary focus group; any other filled button (.mud-button-filled,
   Store Details' Get Directions, the Go to Top FAB, .fc-storeloc-dir) takes the generic outline above.
   The 2026-09-28 per-control button rules (☰ ring on the glyph, inset ring on the info button and
   filter chips, rounded rings on the back and hero buttons) went with it: v3.0.2 has none of them. */
.mudbutton-ui:focus-visible,
.mudbutton-danger:focus-visible,
.mudbutton-grey:focus-visible,
/* Same Primary focus for the per-page filled CTAs, so every Primary matches (Kelly, 2026-07-30 —
   within-type consistency; the type-level hover/press groups live in PressFeedback.css). */
.fc-home-hero-cta:focus-visible,
.fc-filtermodal-apply:focus-visible,
.fc-sortmodal-apply:focus-visible,
.fc-setloc-apply:focus-visible,
.fc-item-interest:focus-visible,
.fc-rint-no:focus-visible {
    filter: brightness(0.8);
    outline: none;
}

/* Radios: browsers paint a native radio's focus ring square whatever its border-radius (measured in
   Chrome, desktop and phone modes), so the ring goes on the option ROW instead. Kelly, 2026-09-28:
   the row gets the 2px own-colour border, in the selected row's pill shape (the sidebar and
   Sort & Filter rows already carry that radius). The campaign sort rows have no padding, so their
   ring sits just outside. The transparent outline on the radio only shows in forced-colours mode.
   (The Stores sort sheet's options are <button> rows, so the base rule already rings the row.) */
input[type="radio"]:focus-visible { outline: 2px solid transparent; }
label:has(> input[type="radio"]:focus-visible) {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}
.fc-sortmodal-opt:has(> input[type="radio"]:focus-visible) {
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Checkbox — Momento State=Focus: 2px dashed Gray 3 around the box, 4px corners
   (Figma variable Components/Checkbox/Global/borderRadiusSM). */
input[type="checkbox"]:focus-visible {
    outline: 2px dashed var(--fc-focus-dashed);
    outline-offset: 0;
    border-radius: 4px;
}

/* Selects are input fields: same 2px blue inset ring as FocusRing.css (Kelly kept it). */
select:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--color-brand-primary);
}

/* Sliders: the thumb's own blue edge thickens by 2px. The track itself gets no ring. */
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--color-brand-primary); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--color-brand-primary); }

/* Toggles (Profile) — Momento's toggle focus was a halo; Kelly: halos are for Primary only, so the
   filled pill gets a 2px #4B4B4B border instead. :focus-visible, not :focus: the old rules in
   ProfileMenu.css also fired on a tap. */
.switch-button input:focus-visible + .slider {
    outline: 2px solid var(--fc-focus-grey);
    outline-offset: 0;
}

/* Accordions — Momento. Block (in-page card): the card's 1px border becomes 2px #4B4B4B; the
   header button draws nothing itself.
   Light (in sheets and modals): the hairline under the header becomes 2px #4B4B4B. The line is
   drawn on the HEADER, not the section: an open section's hairline sits below its content (or is
   hidden), and the last section has none, so a section-level line could end up off-screen.
   While it shows, the section's own 1px hairline steps aside, so it reads as one 2px line.
   The transparent outlines keep focus visible in forced-colours mode, which drops shadows. */
.fc-item-acc-head:focus-visible {
    outline: 2px solid transparent;
}
.fc-item-acc:has(> .fc-item-acc-head:focus-visible) {
    outline: 2px solid var(--fc-focus-grey);
    outline-offset: -2px;
}
.fc-acc-light-head:focus-visible,
.fc-ipol-acc-head:focus-visible,
#sort-filter-drawer .fc-filter-toggle:focus-visible {
    outline: 2px solid transparent;
    box-shadow: inset 0 -2px 0 var(--fc-focus-grey);
}
.fc-acc-light:has(> .fc-acc-light-head:focus-visible),
#sort-filter-drawer .fc-filter-section:has(> .fc-filter-toggle:focus-visible) {
    border-bottom-color: transparent;
}

/* Forced-colours (Windows High Contrast) drops box-shadows. Several focus looks above and in
   PressFeedback.css are inset shadows, so give every focused control a system-colour outline. */
@media (forced-colors: active) {
    :focus-visible {
        outline: 2px solid CanvasText !important;
        outline-offset: -2px !important;
    }
}

/* Focus target for FocusOnNavigate (router moves focus to the page h1).
   Headings are not pointer-interactive — suppress the outline there. */
h1[tabindex="-1"]:focus,
h1[tabindex="-1"]:focus-visible {
    outline: none;
}

/* ── Error identification (WCAG 3.3.1) ──
   Native inputs flagged invalid get the reference's +2px destructive ring.
   Trigger with either `.input-error` or `aria-invalid="true"`; search inputs
   excluded (transient filtering, not form submission). MudTextField errors are
   handled by the existing .fc-input-error pattern (UI-UX-STANDARDS §18).
   #D32F2F is the documented destructive-red exception (§12.1) — v3's tokens
   deliberately keep --color-error for its own semantics. */
input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=search]).input-error,
input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=search])[aria-invalid="true"],
select.input-error, select[aria-invalid="true"],
textarea.input-error, textarea[aria-invalid="true"] {
    border-color: #D32F2F !important;
    box-shadow: inset 0 0 0 2px #D32F2F !important;
}

/* ── EVERY errored MudBlazor field gets ONE border, in the field's own shape (reference 2026-08-20:
   "ALL errored input fields should be the same"). The rule above is right for a bare <input>, but a
   MudBlazor field's raw <input> is only the text slot — its real shape is the rounded <fieldset>
   `.mud-input-outlined-border`, which also spans the adornment (eye / Face-ID icon). Stamping the
   ring on the inner input drew a second, square red rectangle that stopped short of the adornment.
   So: clear the inner input's red, and put ONE 2px red border on the fieldset instead. The border
   class is repeated to reach (0,7,0) so it outranks each field family's own focus-ring !important. */
.mud-input input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=search])[aria-invalid="true"],
.mud-input input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=search]).input-error {
    border-color: transparent !important;
    box-shadow: none !important;
}

.mud-input.mud-input-outlined.mud-input-error .mud-input-outlined-border.mud-input-outlined-border.mud-input-outlined-border.mud-input-outlined-border,
.mud-input.mud-input-outlined.mud-input-error:focus-within .mud-input-outlined-border.mud-input-outlined-border.mud-input-outlined-border.mud-input-outlined-border {
    border: 2px solid #D32F2F !important;
    box-shadow: none !important;
}

/* ── Screen-reader utility + skip link (WCAG 2.4.1 Bypass Blocks) ──────────────── */
.fc-visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Hidden until keyboard-focused, then slides in at the top-left. */
.fc-skip-link {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1400;
    transform: translateY(-200%);
    display: inline-flex;
    align-items: center;
    padding: var(--space-2);
    background: var(--color-surface-default);
    color: var(--color-brand-primary);
    border: 2px solid var(--color-brand-primary);
    border-radius: 0 0 var(--radius-md) 0;
    font-family: var(--font-heading);
    font-size: var(--text-action-md-size);
    font-weight: var(--fw-bold);
    line-height: var(--text-action-md-lh);
    text-decoration: none;
    transition: transform 0.15s ease;
}
/* Its own 2px brand border is its focus look (it is only ever seen focused); the extra outline
   that used to sit 2px outside it made a second square (Kelly, 2026-09-28). */
.fc-skip-link:focus,
.fc-skip-link:focus-visible {
    transform: translateY(0);
    outline: none;
}

/* The scroll container carries tabindex="-1" (the skip link's target), so a click anywhere on the
   page focuses it, and any key after that (arrows, Space, Esc, even Shift) made the browser frame
   the whole page in its default focus ring. It is not a control — suppress the ring. Same rule as
   v3.0.2 (Kelly, 2026-09-28: keep the WCAG focus ring, drop the looks that don't match the UI). */
#main-scroll-container:focus { outline: none; }

/* ── KEPT FROM MAIN ──────────────────────────────────────────────
   Rules 3.2 does not have. Appended after its stylesheet so they still win on equal
   specificity, exactly as they did before the import. */
/* Buttons on the brand-blue surfaces — the header (☰, desktop Information Center button), the Set
   Location bar, the promo hero's arrows and pause button, and the Stores List/Map toggle. v3.0.2's
   brand-blue outline above is invisible on #004FAA (contrast 1:1, measured on each 2026-09-30), so
   the same 2px ring, 2px out, is drawn in white here. The 2026-09-28 looks drew these in the controls'
   own (white) colour; v3.0.2 has this defect. !important because the v3.0.2 rule is (0,29,1).
   .topbar-tab-container (the desktop header's Stores / Saved / Profile / Sign In) joined 2026-09-30,
   when the tabs became real <button>s and started taking the brand-blue outline. */
.menu-btn:focus-visible,
.location_btn_cls:focus-visible,
.info-icon-container:focus-visible,
.topbar-tab-container:focus-visible,
.fc-home-hero-nav:focus-visible,
.fc-home-hero-playpause:focus-visible,
.view-button:focus-visible { outline-color: var(--color-surface-default) !important; }
/* ── KEPT FROM MAIN ──────────────────────────────────────────────
   Rules the reference project does not have. Appended after its stylesheet so they
   still win on equal specificity, exactly as they did before the import. */
/* ── Accessibility layer (WCAG 2.1 Level A parity with Pawn Marketplace v2.1) ──
   Additive shared file (new file per UI-UX-STANDARDS §4 rule 2 — tokens.css/app.css
   untouched). Cross-cutting by nature: keyboard-focus visibility and error
   identification must apply to every interactive control, so this file is the
   one sanctioned exception to per-feature scoping. Ported from the reference's
   app.css `:focus-visible` / `aria-invalid` rules, re-expressed on v3's
   component vocabulary (MudBlazor + fc-* classes) and Momento tokens. */

/* ── Keyboard focus visibility ──
   The reference mirrors :active on :focus-visible so keyboard users get the
   same feedback as pointer users. Brand CTAs keep that exact treatment; every
   other interactive element gets a token-based outline (MudBlazor and the
   hand-rolled fc-* buttons ship no focus indicator of their own). */
.mudbutton-ui:focus-visible,
.mudbutton-danger:focus-visible,
.mudbutton-grey:focus-visible {
    filter: brightness(0.8);
    outline: none;
}
/* .fc-btn-outlined excluded like the CTAs — its keyboard treatment is the
   press ring (PressFeedback.css), not the generic outline. */
button:not(.mudbutton-ui):not(.mudbutton-danger):not(.mudbutton-grey):not(.fc-btn-outlined):focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
select:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 2px solid var(--color-brand-primary);
    outline-offset: 2px;
}
