/* Contrast fixes for DORFic, loaded right after dorfic-bootstrap.min.css (storefront, admin and setup).
   WCAG 2.2 AA asks for 4.5:1 between text and what's behind it (3:1 for large text). The kit's white
   text on its light glossy fills reaches only 1.7–3.6:1 against the fill. The fills and the white text
   stay as DORFic made them; what changes is the faint shadow under that text, which becomes a tight halo
   in a deep shade of the fill's own colour. WCAG counts a halo that hugs the letters as their background
   (Understanding 1.4.3, on text with borders and halos), and white on these halos is 8–12:1.
   Automated checkers (axe, Lighthouse) ignore text shadows, so they still report these spots; the shop's
   own audit measures them against the halo. The kit's own files stay as shipped; this file is the change. */

:root {
  /* Orange text and links on white: one step darker (5.2:1 on white, 4.8:1 on the pale panels). */
  --bs-primary-fg: light-dark(oklch(from var(--bs-primary-base) calc(l - .16) c calc(h - 6)), oklch(from var(--bs-primary-base) calc(l + .1) c calc(h + 6)));

  /* Secondary and helper text ("optional", SKUs, "Excl. VAT"): readable on the panels in both modes. */
  --bs-fg-2: light-dark(oklch(46% 0.022 55), var(--bs-gray-400));
  --bs-fg-3: light-dark(oklch(53% 0.02 60), oklch(70% 0.015 72));
}

/* Every place the kit puts white text on a coloured fill (the ones it gives a faint dark shadow), except
   the light fills that already have dark text (warning, info, accent, inverse). The halo's colour is
   worked out on each element, so a red badge gets a dark red halo and a blue one dark blue. */
:is(
  .btn-solid, .btn-outline:hover, .badge[class*="theme-"]:not(.badge-subtle, .badge-outline), .theme-contrast, .alert-solid,
  .chip.active, .chip.selected, .chip[aria-selected="true"], .vc-date[data-vc-date-selected] .vc-date__btn, [data-vc-date-selected] > [data-vc-date-btn],
  .card[class*="theme-"]:not(.card-subtle) > .card-header, .accordion-item[open] > .accordion-header,
  .menu-item:hover, .menu-item:focus-visible, .menu-item.active, .menu-item:active, .menu-item[aria-selected="true"],
  .nav-pills .nav-link.active, .nav-pills .show > .nav-link, .nav-pills .nav-link[aria-selected="true"],
  .navbar[class*="theme-"], .page-link.active, .active > .page-link, .page-link[aria-current="page"],
  .list-group-item.active, .list-group-item[aria-current="true"], .list-group-item[aria-selected="true"],
  .dialog[class*="theme-"] .dialog-header, .toast[class*="theme-"], .toast-accent .toast-header, .popover-header,
  .glossy, .avatar[class*="theme-"], .navbar-brand-mark, .brand-mark, .progress-bar, .stepper-item.active > .stepper-indicator,
  .bg-aero
):not(.theme-warning, .theme-info, .theme-accent, .theme-inverse, .theme-warning *, .theme-info *, .theme-accent *, .theme-inverse *) {
  --a11y-halo: oklch(from var(--bs-theme-base, var(--bs-primary-base)) calc(l - .34) calc(c * .9) calc(h - 8) / .9);
  text-shadow: 0 0 1px var(--a11y-halo), 0 0 2px var(--a11y-halo), 0 1px 2px var(--a11y-halo);
}
/* On the orange "aero" banners the labels and headings are white like the rest of the banner, as the kit
   means them to be (its heading rule lost to the dark heading colour in light mode), with the same halo. */
.bg-aero .label { color: oklch(100% 0 0 / .92); }
.bg-aero :where(h1, h2, h3, h4, h5, h6) {
  color: inherit;
  --a11y-halo: oklch(from var(--bs-primary-base) calc(l - .34) calc(c * .9) calc(h - 8) / .9);
  text-shadow: 0 0 1px var(--a11y-halo), 0 0 2px var(--a11y-halo), 0 1px 2px var(--a11y-halo);
}

/* A focus outline on every control (WCAG 2.4.7). The kit's focus ring is a box-shadow, and cards, plastic
   panels, outline buttons and the custom radios and checkboxes replace it with their own shadows, so
   keyboard users lost track of where they were. Text fields keep their own focus style. */
:where(a, button, summary, [tabindex]:not([tabindex="-1"]), input[type="checkbox"], input[type="radio"], input[type="range"], input[type="file"]):focus-visible {
  outline: 2px solid var(--bs-primary-fg);
  outline-offset: 2px;
}
