/* Accessibility tools (site/a11y.js): display options, Listen buttons, dialogs, Quick read. */

/* ------------------------------------------------------------ more contrast
 * On when the visitor turns it on, or when the device asks for more contrast and they haven't
 * turned it off. Light values first; the dark rules come after and are more specific. */
:root[data-contrast="more"] {
  --ink: #000; --ink-2: #2b2824; --muted: #45413a; --control-border: #45413a;
  --line: #a39c8c; --line-strong: #5f5a51; --grid: #c9c1b0; --axis: #5f5a51; --dim-dot: #8a8478;
  --brand-ink: #8f3f17; --accent-ink: #1b56a0;
}
@media (prefers-contrast: more) {
  :root:not([data-contrast="normal"]) {
    --ink: #000; --ink-2: #2b2824; --muted: #45413a; --control-border: #45413a;
    --line: #a39c8c; --line-strong: #5f5a51; --grid: #c9c1b0; --axis: #5f5a51; --dim-dot: #8a8478;
    --brand-ink: #8f3f17; --accent-ink: #1b56a0;
  }
}
:root[data-contrast="more"][data-theme="dark"] {
  --ink: #fff; --ink-2: #e3e8ee; --muted: #c4ccd5; --control-border: #95a1b0;
  --line: #4f5c6b; --line-strong: #8a97a8; --grid: #3c4857; --axis: #8a97a8; --dim-dot: #707c8b;
  --brand-ink: #ff9a66; --accent-ink: #6aa8f0;
}
@media (prefers-color-scheme: dark) {
  :root[data-contrast="more"]:not([data-theme="light"]) {
    --ink: #fff; --ink-2: #e3e8ee; --muted: #c4ccd5; --control-border: #95a1b0;
    --line: #4f5c6b; --line-strong: #8a97a8; --grid: #3c4857; --axis: #8a97a8; --dim-dot: #707c8b;
    --brand-ink: #ff9a66; --accent-ink: #6aa8f0;
  }
}
@media (prefers-contrast: more) {
  :root:not([data-contrast="normal"])[data-theme="dark"] {
    --ink: #fff; --ink-2: #e3e8ee; --muted: #c4ccd5; --control-border: #95a1b0;
    --line: #4f5c6b; --line-strong: #8a97a8; --grid: #3c4857; --axis: #8a97a8; --dim-dot: #707c8b;
    --brand-ink: #ff9a66; --accent-ink: #6aa8f0;
  }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-contrast="normal"]):not([data-theme="light"]) {
    --ink: #fff; --ink-2: #e3e8ee; --muted: #c4ccd5; --control-border: #95a1b0;
    --line: #4f5c6b; --line-strong: #8a97a8; --grid: #3c4857; --axis: #8a97a8; --dim-dot: #707c8b;
    --brand-ink: #ff9a66; --accent-ink: #6aa8f0;
  }
}
:root[data-contrast="more"] .card, :root[data-contrast="more"] .stat { border-color: var(--line-strong); }
:root[data-contrast="more"] :focus-visible { outline-width: 3px; outline-offset: 3px; }
@media (prefers-contrast: more) {
  :root:not([data-contrast="normal"]) .card, :root:not([data-contrast="normal"]) .stat { border-color: var(--line-strong); }
  :root:not([data-contrast="normal"]) :focus-visible { outline-width: 3px; outline-offset: 3px; }
}

/* ------------------------------------------------------------ easier-to-read text
 * A plain, open font (Verdana / Tahoma ship with nearly every system), more space between
 * letters, words and lines, bigger small print, and no condensed or all-caps headings. */
:root[data-text="readable"] {
  --font: Verdana, Tahoma, "Segoe UI", system-ui, sans-serif;
  --display: Verdana, Tahoma, "Segoe UI", system-ui, sans-serif;
}
:root[data-text="readable"] body { font-size: 16.5px; line-height: 1.7; letter-spacing: 0.012em; word-spacing: 0.06em; }
:root[data-text="readable"] :is(h1, h2, h3, .eyebrow, .brand-text, .brand-pre, .stat .value, .pr-h1) { text-transform: none !important; letter-spacing: 0 !important; }
:root[data-text="readable"] :is(.sub, .hint, .note, .legend, .meta, .muted, small, .tt-row, .tt-plain, .share-item, .a11y-desc, td, th) { font-size: max(14px, 1em); }
:root[data-text="readable"] .tick-label, :root[data-text="readable"] .axis-title { font-size: 12.5px; }
:root[data-text="readable"] .stat-row { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
:root[data-text="readable"] .stat .value { font-size: 24px; overflow-wrap: anywhere; }
:root[data-text="readable"] .stat .label { font-size: 13px; text-transform: none; letter-spacing: 0; }
:root[data-text="readable"] p, :root[data-text="readable"] li, :root[data-text="readable"] dd { max-width: 72ch; }

/* ------------------------------------------------------------ less motion */
:root[data-motion="reduce"] *, :root[data-motion="reduce"] ::before, :root[data-motion="reduce"] ::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="normal"]) *, :root:not([data-motion="normal"]) ::before, :root:not([data-motion="normal"]) ::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------ underline links */
:root[data-links="underline"] a:not(.btn):not(.brand):not(.tabs a) { text-decoration: underline !important; text-underline-offset: 2px; }

/* ------------------------------------------------------------ top-bar button */
.a11y-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.7; }
.a11y-toggle svg .fill { fill: currentColor; stroke: none; }

/* ------------------------------------------------------------ Listen button (cards with sound) */
.mod .listen-btn { display: none; }
.mod[data-sonify] .listen-btn { display: inline-flex; }
.listen-btn { align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); border: 1px solid var(--control-border); }
.listen-btn:hover { color: var(--ink); background: var(--surface-2); }
.listen-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.listen-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 640px) {
  .listen-btn { padding: 0; width: 34px; justify-content: center; }
  .listen-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ------------------------------------------------------------ dialogs */
.a11y-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pinned); }
.a11y-dialog::backdrop { background: rgba(10, 12, 16, 0.45); }
.a11y-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.a11y-head h2 { margin: 0; font: 700 24px/1.1 var(--display); text-transform: uppercase; }
.a11y-close svg { stroke-width: 2.2; }
.a11y-body { padding: 14px 18px 18px; }
.a11y-lead { margin: 0 0 14px; color: var(--ink-2); }
.a11y-group { border: 0; padding: 0; margin: 0 0 18px; }
.a11y-group legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; padding: 0; }
.a11y-opt { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.a11y-opt input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent-ink); }
.a11y-opt label { display: grid; gap: 2px; cursor: pointer; }
.a11y-desc { color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.a11y-group > .a11y-desc { margin: 0 0 6px; }
.a11y-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.a11y-row-label { font-weight: 600; min-width: 120px; }
.a11y-links { margin: 0; color: var(--ink-2); }
.linklike { border: 0; padding: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

.a11y-keys h3 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.a11y-keys dl { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 6px 16px; margin: 0; }
.a11y-keys dt { white-space: nowrap; color: var(--ink-2); }
.a11y-keys dd { margin: 0; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--ink); font: 600 12.5px/1.5 var(--mono); text-align: center; }
@media (max-width: 520px) { .a11y-keys dl { grid-template-columns: 1fr; gap: 2px; } .a11y-keys dd { margin-bottom: 8px; } }

/* ------------------------------------------------------------ Quick read */
.read-list { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 15.5px; line-height: 1.55; }
.read-list li::marker { color: var(--brand-ink); }
.prose-h1 { font: 700 44px/1 var(--display); text-transform: uppercase; margin: 0; }
