/* a11y-modes.css: the page in the reader's high-contrast and forced-colors modes, one focus ring in those modes, and
   tap targets of at least 24 px. Linked after page-frame.css on every page with the shared menu. Sections 1 and 2
   apply only when the reader's system asks for more contrast or forces its own colors (Windows High Contrast and the
   like); section 3 applies to everyone (WCAG 2.2, 2.5.8). */

/* ---- 1. forced colors: keep the shapes the colors used to draw ---- */
@media (forced-colors: active) {
  /* the menu bar, its panels, the search and the light/dark button keep an edge */
  .site-nav-shared { border-bottom: 1px solid CanvasText; }
  .site-nav-shared .group-menu, .cknz-q .results, .theme-toggle-fab, .cknz-q .cknz-toggle { border: 1px solid CanvasText; }
  /* pills, chips, cards, doors, badges and buttons that were told apart by their ground get a border */
  :is([class*="pill"], [class*="chip"], [class*="card"], [class*="badge"], .door, .bk-pager a, .stx-pills a):not(html, body, [class*="pills"], [class*="chips"], [class*="cards"]) {
    border: 1px solid CanvasText;
  }
  /* the grade marks are drawn with a filled ground; the system would blank it, so they keep the text color */
  html .gk-i:not(#_) { forced-color-adjust: none; color: CanvasText !important; }
  html :is(.gk-p, .gk-v, .gk-n):not(#_) { background: CanvasText !important; }
  html .gk-c:not(#_) { background: linear-gradient(90deg, CanvasText 50%, transparent 50%) !important; }
  /* one focus ring, in the system's own highlight */
  :focus-visible { outline: 3px solid Highlight !important; outline-offset: 2px !important; box-shadow: none !important; }
  /* the icons of the search and the light/dark button take the text color, not their gold */
  .theme-toggle-fab svg, .cknz-q svg { color: CanvasText !important; }
  /* the skip link keeps its text visible when it appears */
  .skip-link:focus { background: Canvas !important; color: LinkText !important; }
}

/* ---- 2. more contrast: darker soft text and rules, every running-text link underlined, a heavier focus ring ---- */
@media (prefers-contrast: more) {
  :root { --bk-ink-soft: #222222; --bk-rule: #555555; --bk-rule-light: #777777; --link: #102a4c; --link-hover: #0a1c33; }
  html.theme-dark { --bk-ink-soft: #f2ecdf; --bk-rule: #b9c2d0; --bk-rule-light: #8d99ab; }
  /* on paper only: nothing on the navy bar, the navy footer, a navy page head or another dark ground */
  html:not(.theme-dark) body :is(figcaption, .credit, small, .lede, .bk-summary-note, .chx-edition):not(.site-nav-shared *, .site-foot-shared *, header *, .bg-deep *, [data-ground="dark"] *) { color: #1a1a1a !important; opacity: 1 !important; }
  html.theme-dark body :is(figcaption, .credit, small, .lede, .stx-stand, .bk-summary-note, .chx-edition) { color: #f6f1e7 !important; opacity: 1 !important; }
  .site-foot-shared .foot-credit { color: #f6f1e7 !important; opacity: 1 !important; }
  :is(p, li, td, dd, figcaption, blockquote) a:not([class*="btn"]):not([class*="pill"]):not([class*="chip"]) { text-decoration-line: underline !important; text-decoration-color: currentColor !important; }
  :is([class*="pill"], [class*="chip"], [class*="card"], [class*="badge"], .door):not(html, body, [class*="pills"], [class*="chips"], [class*="cards"]) { border-color: currentColor !important; }
  :focus-visible { outline-width: 3px !important; outline-style: solid !important; }
}

/* ---- 3. tap targets of 24 px or more outside running text (WCAG 2.2, 2.5.8) ---- */
/* lists of links, one link to a line: the chapter's own contents, the supplements, the tree's list of everyone */
html body :is(details.chx-toc, section.bk-supp, details.ft-all) li > a:not(#_) { display: inline-block; padding-block: 0.15rem; }
/* a lone link in its own paragraph inside the tree's folded notes */
html body details.ft-ruled > p > a:only-child:not(#_) { display: inline-block; padding-block: 0.15rem; }
/* the footer's single links */
html body .site-foot-shared :is(.foot-by, .foot-meta) a:not(#_) { display: inline-block; padding-block: 0.25rem; }
/* the source keys beside a year on the walk and the day pages */
html body :is(a.wwx-c, a.wlk-c):not(#_) { display: inline-block; padding-block: 0.25rem; }
/* the lines of links under each correction */
html body :is(.er-meta, .er-evidence):not(#_) { line-height: max(1.8em, 1.6rem); }
