/* Accessibility toolbar: floating launcher + panel, plus the page-wide effects
   each toggle applies. Effects are scoped under html[data-a11y~="..."] attribute
   tokens so multiple can combine freely without specificity fights. */

@font-face {
  font-family: "OpenDyslexic";
  src: url("https://cdn.jsdelivr.net/gh/antijingoist/opendyslexic@0.91.12/compiled/OpenDyslexic-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("https://cdn.jsdelivr.net/gh/antijingoist/opendyslexic@0.91.12/compiled/OpenDyslexic-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Contrast/Black & White/Saturation render via backdrop-filter here rather
   than filter on body/html - see applyFilter() in dk-a11y.js for why. */
.dk-a11y-filter-overlay {
  position: fixed;
  inset: 0;
  z-index: 999990;
  pointer-events: none;
}

/* ---------- Launcher ---------- */

.dk-a11y-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: var(--dk-p, #0A85C7);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.16);
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 150ms ease-out;
}
.dk-a11y-btn:hover { transform: scale(1.05); }
.dk-a11y-btn:active { transform: scale(0.97); }
.dk-a11y-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.dk-a11y-btn svg { width: 26px; height: 26px; }

html[data-a11y-pos="left"] .dk-a11y-btn { right: auto; left: 20px; }

.dk-a11y-btn--hidden {
  width: 28px;
  height: 44px;
  border-radius: 8px 0 0 8px;
  right: 0;
}
html[data-a11y-pos="left"] .dk-a11y-btn--hidden { left: 0; right: auto; border-radius: 0 8px 8px 0; }
.dk-a11y-btn--hidden svg { width: 16px; height: 16px; }

/* Oversized-widget toggle enlarges the launcher itself (bigger target for
   low-vision / limited-dexterity users), independent of panel state. */
html[data-a11y~="big-widget"] .dk-a11y-btn:not(.dk-a11y-btn--hidden) {
  width: 68px;
  height: 68px;
}
html[data-a11y~="big-widget"] .dk-a11y-btn:not(.dk-a11y-btn--hidden) svg { width: 34px; height: 34px; }

/* ---------- Panel ---------- */

.dk-a11y-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 2147483000;
  width: min(336px, calc(100vw - 32px));
  max-height: min(600px, calc(100vh - 110px));
  overflow-y: auto;
  background: #0D1017;
  color: #F2F4F7;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 48px rgba(0, 0, 0, 0.4);
  font-family: "Figtree", system-ui, sans-serif;
  transform-origin: bottom right;
  transform: scale(0.96) translateY(6px);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
html[data-a11y-pos="left"] .dk-a11y-panel { right: auto; left: 20px; transform-origin: bottom left; }
.dk-a11y-panel[data-open="true"] {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.dk-a11y-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  background: #0D1017;
}
.dk-a11y-panel__title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.dk-a11y-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.dk-a11y-theme-row__label { font-size: 13px; font-weight: 500; color: #F2F4F7; }
/* .dk-themes itself (the four colour dots) is styled by dk-motion.css, loaded
   sitewide, so the same markup renders identically here as it did in the header. */
.dk-a11y-panel__close {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #F2F4F7;
  cursor: pointer;
}
.dk-a11y-panel__close:hover { background: rgba(255, 255, 255, 0.12); }
.dk-a11y-panel__close:focus-visible { outline: 2px solid var(--dk-p, #0A85C7); outline-offset: 2px; }

.dk-a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 16px;
}

.dk-a11y-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #F2F4F7;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  line-height: 1.25;
  transition: transform 100ms ease-out, background 150ms ease-out, border-color 150ms ease-out;
}
.dk-a11y-item svg { width: 22px; height: 22px; flex: none; }
.dk-a11y-item:hover { background: rgba(255, 255, 255, 0.07); }
.dk-a11y-item:active { transform: scale(0.97); }
.dk-a11y-item:focus-visible { outline: 2px solid var(--dk-p, #0A85C7); outline-offset: 2px; }
.dk-a11y-item[aria-pressed="true"] {
  background: color-mix(in srgb, var(--dk-p, #0A85C7) 20%, transparent);
  border-color: var(--dk-p, #0A85C7);
  color: #fff;
}
.dk-a11y-item__step {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #A3ADBB;
}
.dk-a11y-item[aria-pressed="true"] .dk-a11y-item__step { color: #fff; }

.dk-a11y-panel__foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.dk-a11y-textbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #F2F4F7;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.dk-a11y-textbtn:hover { background: rgba(255, 255, 255, 0.06); }
.dk-a11y-textbtn:focus-visible { outline: 2px solid var(--dk-p, #0A85C7); outline-offset: 2px; }
.dk-a11y-textbtn svg { width: 16px; height: 16px; flex: none; }

@media (prefers-reduced-motion: reduce) {
  .dk-a11y-btn, .dk-a11y-panel, .dk-a11y-item { transition: none; }
}

/* ---------- Page-wide effects ---------- */

/* Contrast, Black & White and Saturation all drive the same CSS filter on
   <html>, and users can combine them - composing one filter string in JS
   (see dk-a11y.js applyState) avoids hand-writing every combination here. */

html[data-a11y~="links"] a:not(.dk-a11y-btn):not(.dk-a11y-item):not(.dk-a11y-textbtn) {
  outline: 2px solid #FFD400 !important;
  outline-offset: 2px;
  background: rgba(255, 212, 0, 0.18) !important;
  color: #FFD400 !important;
  text-decoration: underline !important;
}

/* Most of this site's type is set in px/clamp() inline styles, not rem, so a
   body font-size multiplier wouldn't reach it - zoom scales the rendered page
   (layout included) regardless of what unit the author used. The widget's own
   UI counter-zooms below so the toolbar itself stays a constant size. */
html[data-a11y-text="1"] { zoom: 1.1; }
html[data-a11y-text="2"] { zoom: 1.2; }
html[data-a11y-text="3"] { zoom: 1.32; }
html[data-a11y-text="4"] { zoom: 1.45; }

html[data-a11y-text="1"] .dk-a11y-btn, html[data-a11y-text="1"] .dk-a11y-panel { zoom: calc(1 / 1.1); }
html[data-a11y-text="2"] .dk-a11y-btn, html[data-a11y-text="2"] .dk-a11y-panel { zoom: calc(1 / 1.2); }
html[data-a11y-text="3"] .dk-a11y-btn, html[data-a11y-text="3"] .dk-a11y-panel { zoom: calc(1 / 1.32); }
html[data-a11y-text="4"] .dk-a11y-btn, html[data-a11y-text="4"] .dk-a11y-panel { zoom: calc(1 / 1.45); }

html[data-a11y-spacing="1"] body { letter-spacing: 0.02em; word-spacing: 0.12em; }
html[data-a11y-spacing="2"] body { letter-spacing: 0.04em; word-spacing: 0.2em; }
html[data-a11y-spacing="3"] body { letter-spacing: 0.08em; word-spacing: 0.3em; }

html[data-a11y-leading="1"] body, html[data-a11y-leading="1"] p { line-height: 1.7 !important; }
html[data-a11y-leading="2"] body, html[data-a11y-leading="2"] p { line-height: 2 !important; }
html[data-a11y-leading="3"] body, html[data-a11y-leading="3"] p { line-height: 2.3 !important; }

html[data-a11y~="pause-anim"] *,
html[data-a11y~="pause-anim"] *::before,
html[data-a11y~="pause-anim"] *::after {
  animation-play-state: paused !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
html[data-a11y~="pause-anim"] video { display: none; }

html[data-a11y~="hide-images"] img,
html[data-a11y~="hide-images"] picture,
html[data-a11y~="hide-images"] video,
html[data-a11y~="hide-images"] svg:not(.dk-a11y-panel svg):not(.dk-a11y-btn svg) {
  visibility: hidden !important;
}
html[data-a11y~="hide-images"] [style*="background-image"] {
  background-image: none !important;
}

/* Nearly every element on this site sets its own inline font-family, which
   wins over inheritance from body regardless of !important there - so this
   has to hit every element directly, not just rely on cascading down. */
html[data-a11y~="dyslexia"] * {
  font-family: "OpenDyslexic", "Figtree", sans-serif !important;
}

html[data-a11y~="big-cursor"],
html[data-a11y~="big-cursor"] a,
html[data-a11y~="big-cursor"] button {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24"><path d="M3 2l17 8.2-7.4 1.7L17 18.3l-2.3 1.3-4.4-6.3L6 17.4z" fill="black" stroke="white" stroke-width="1"/></svg>') 4 4, auto !important;
}

/* Excludes .dk-a11y-btn itself too, not just its descendants: this rule's
   `position: relative` has higher specificity than .dk-a11y-btn's own
   `position: fixed` and would otherwise knock the launcher out of fixed
   positioning the moment it ever gained a title attribute (see
   mirrorTooltips in dk-a11y.js for the matching JS-side guard). */
html[data-a11y~="tooltips"] [title]:not(.dk-a11y-panel [title]):not(.dk-a11y-btn) {
  position: relative;
}
html[data-a11y~="tooltips"] [title]:not(.dk-a11y-panel [title]):not(.dk-a11y-btn):hover::after,
html[data-a11y~="tooltips"] [title]:not(.dk-a11y-panel [title]):not(.dk-a11y-btn):focus-visible::after {
  content: attr(title);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  font-size: 12px;
  line-height: 1.3;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 2147483001;
  pointer-events: none;
}

html[data-a11y~="align-left"] h1,
html[data-a11y~="align-left"] h2,
html[data-a11y~="align-left"] h3,
html[data-a11y~="align-left"] h4,
html[data-a11y~="align-left"] p,
html[data-a11y~="align-left"] li,
html[data-a11y~="align-left"] span {
  text-align: left !important;
}

