/*
 * Display options a reader turns on for themselves (docs/ACCESSIBILITY.md "Display options").
 * home/includes/display-options-boot.html puts the a11y-* classes on <html> before the first
 * paint; nothing here applies until a reader chooses it. Higher contrast is mostly a token
 * overlay (.a11y-contrast-more in ds-tokens.css); the rules below cover what tokens cannot.
 * Tokens only.
 */

/* Less motion: the same calm as the device setting (home/css/a11y.css), on any device. */
html.a11y-reduce-motion,
html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* Higher contrast: one dark focus ring everywhere, readable placeholders and disabled controls. */
html.a11y-contrast-more :focus-visible {
  outline: 3px solid var(--ds-focus) !important;
  outline-offset: 2px !important;
}

html.a11y-contrast-more ::placeholder {
  color: var(--ds-ink-faint);
  opacity: 1;
}

html.a11y-contrast-more button:disabled,
html.a11y-contrast-more input:disabled,
html.a11y-contrast-more select:disabled,
html.a11y-contrast-more textarea:disabled,
html.a11y-contrast-more [aria-disabled="true"] {
  opacity: 0.8;
}

/*
 * Larger text: most page styles are set in px, so a larger root font size would miss them;
 * the page's main content is zoomed instead. The top bar keeps its height, and the map shell
 * (#search-results) is never zoomed, because the map measures its own canvas: inside it only
 * memory and story text grows.
 */
html.a11y-larger-text main:not(#search-results, #search-results main),
html.a11y-larger-text #search-results .memory-prose,
html.a11y-larger-text #search-results .rich-text-view {
  zoom: 1.125;
}

/* Underlined links: every text link, not the controls that are drawn as buttons, tabs or cards. */
html.a11y-underline-links a[href]:not([role="button"]):not([role="tab"]):not([role="menuitem"]):not([class*="btn"]):not([class*="button"]):not([class*="card"]):not([class*="chip"]):not([class*="pill"]) {
  text-decoration: underline !important;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
