/* Accessibility options for the whole giggzy.com site: text size (Big, Bigger, Biggest) and high-contrast colors.
   Loaded by every page. The choice is kept in the visitor's browser (see a11y.js). */

/* ---------- Text size: scales the whole page, including fixed pixel sizes ---------- */
html[data-a11y-size="big"] body     { zoom: 1.25; }
html[data-a11y-size="bigger"] body  { zoom: 1.5; }
html[data-a11y-size="biggest"] body { zoom: 1.9; }

/* ---------- High contrast: the pages colour themselves from variables, so we replace the variables ---------- */
:root:root:root[data-a11y-contrast="dark"] {
  color-scheme: dark;
  --bg: #000; --surface: #000; --ink: #fff; --fg: #fff; --muted: #fff; --line: #fff; --stripe: #000;
  --accent: #ffe600; --accent-ink: #000; --accent-fg: #000; --accent-soft: #000;
  --danger: #ff9a90; --warn: #ffe600; --warn-soft: #000;
  --a11y-fg: #fff; --a11y-bg: #000; --a11y-focus: #ffe600;
}
:root:root:root[data-a11y-contrast="light"] {
  color-scheme: light;
  --bg: #fff; --surface: #fff; --ink: #000; --fg: #000; --muted: #000; --line: #000; --stripe: #fff;
  --accent: #00338d; --accent-ink: #fff; --accent-fg: #fff; --accent-soft: #fff;
  --danger: #a00000; --warn: #5c3b00; --warn-soft: #fff;
  --a11y-fg: #000; --a11y-bg: #fff; --a11y-focus: #c40000;
}
html[data-a11y-contrast="dark"] body,
html[data-a11y-contrast="light"] body { background: var(--a11y-bg); color: var(--a11y-fg); }

html[data-a11y-contrast="dark"] *,
html[data-a11y-contrast="light"] * { box-shadow: none !important; text-shadow: none !important; }
html[data-a11y-contrast="dark"] a,
html[data-a11y-contrast="light"] a { text-decoration: underline; }
html[data-a11y-contrast="dark"] :where(.btn, .btn-outline, .back) { text-decoration: none; }
html[data-a11y-contrast="dark"] :where(h2, .pg, .muted, .subtitle, .count, .null, .cover-change, .clear),
html[data-a11y-contrast="light"] :where(h2, .pg, .muted, .subtitle, .count, .null, .cover-change, .clear) { opacity: 1; color: var(--a11y-fg); }
html[data-a11y-contrast="dark"] :where(input, select, textarea, button, .btn, .btn-outline, .card, details),
html[data-a11y-contrast="light"] :where(input, select, textarea, button, .btn, .btn-outline, .card, details) { border: 2px solid var(--a11y-fg); }
html[data-a11y-contrast="dark"] :where(input, select, textarea),
html[data-a11y-contrast="light"] :where(input, select, textarea) { background: var(--a11y-bg); color: var(--a11y-fg); }
html[data-a11y-contrast="dark"] :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
html[data-a11y-contrast="light"] :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 4px solid var(--a11y-focus) !important; outline-offset: 3px; }
html[data-a11y-contrast="dark"] table, html[data-a11y-contrast="light"] table { border-color: var(--a11y-fg); }
html[data-a11y-contrast="dark"] :where(td, th), html[data-a11y-contrast="light"] :where(td, th) { border-color: var(--a11y-fg); }
html[data-a11y-contrast="dark"] :where(tr:nth-child(even)), html[data-a11y-contrast="light"] :where(tr:nth-child(even)) { background: var(--a11y-bg); }

/* ---------- The options bar at the top of every page ---------- */
#a11y-bar {
  --c: var(--a11y-fg, var(--ink, var(--fg, #111)));
  --b: var(--a11y-bg, var(--surface, #fff));
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--b); color: var(--c); border-bottom: 3px solid var(--c);
  font: 600 18px/1.3 system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
#a11y-bar .grp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#a11y-bar .lbl { margin-right: 4px; }
#a11y-bar button {
  font: inherit; min-height: 46px; min-width: 46px; padding: 0 14px; cursor: pointer;
  background: var(--b); color: var(--c); border: 2px solid var(--c); border-radius: 8px;
}
#a11y-bar button[aria-pressed="true"] { background: var(--c); color: var(--b); }
#a11y-bar button:focus-visible { outline: 4px solid #2a6df4; outline-offset: 2px; }
html[data-a11y-contrast="dark"] #a11y-bar button:focus-visible { outline-color: #ffe600; }
html[data-a11y-contrast="light"] #a11y-bar button:focus-visible { outline-color: #c40000; }
/* keep the bar a comfortable size however large the page text is */
html[data-a11y-size="big"] #a11y-bar     { zoom: 1; }
html[data-a11y-size="bigger"] #a11y-bar  { zoom: .8333; }
html[data-a11y-size="biggest"] #a11y-bar { zoom: .6579; }
@media print { #a11y-bar { display: none; } }
