@font-face {
  font-family: "Atkinson Hyperlegible Local";
  src: url("../fonts/accessibility/AtkinsonHyperlegible-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "OpenDyslexic Local";
  src: url("../fonts/accessibility/OpenDyslexic3-Regular.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

.accessibility-widget {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 10000;
  font-family: Arial, Helvetica, sans-serif;
}

.accessibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #0756b5;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .25);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.accessibility-toggle i {
  font-size: 22px;
}

.accessibility-toggle:hover,
.accessibility-toggle:focus-visible {
  background: #063f85;
}

.accessibility-panel {
  position: absolute;
  left: 0;
  bottom: 62px;
  width: min(340px, calc(100vw - 36px));
  max-height: min(620px, calc(100vh - 100px));
  overflow-y: auto;
  padding: 18px;
  border: 2px solid #d8e5f4;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(0, 0, 0, .28);
  color: #17212b;
}

.accessibility-panel[hidden] {
  display: none;
}

.accessibility-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.accessibility-panel-header h2 {
  margin: 0;
  color: #17212b;
  font-size: 19px;
  font-weight: 700;
}

.accessibility-section-label {
  display: block;
  margin: 14px 0 8px;
  color: #536579;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.accessibility-profiles > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.accessibility-profiles button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  padding: 8px;
  border: 1px solid #9db8d6;
  border-radius: 10px;
  background: #eef6ff;
  color: #163d69;
  font-size: 12px;
  font-weight: 700;
}

.accessibility-profiles button[aria-pressed="true"] {
  border-color: #0756b5;
  background: #0756b5;
  color: #fff;
}

.accessibility-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #edf3f9;
  color: #17212b;
}

.accessibility-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.accessibility-controls > button,
.accessibility-font-control {
  min-height: 68px;
  padding: 10px;
  border: 1px solid #cfdae7;
  border-radius: 10px;
  background: #f8fbff;
  color: #17212b;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.accessibility-controls > button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.accessibility-controls > button i {
  color: #0756b5;
  font-size: 20px;
}

.accessibility-controls > button small {
  display: block;
  font-size: 10px;
  font-weight: 400;
}

.accessibility-controls > button[aria-pressed="true"] {
  border-color: #0756b5;
  background: #0756b5;
  color: #fff;
}

.accessibility-controls > button[aria-pressed="true"] i {
  color: #fff;
}

.accessibility-font-control {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
}

.accessibility-font-control div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.accessibility-font-control button {
  width: 38px;
  height: 34px;
  border: 1px solid #9db8d6;
  border-radius: 7px;
  background: #fff;
  color: #0756b5;
  font-weight: 700;
}

.accessibility-font-control output {
  min-width: 44px;
  font-size: 13px;
}

.accessibility-reset {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #b42318;
  border-radius: 9px;
  background: #fff;
  color: #b42318;
  font-weight: 700;
}

.accessibility-widget button:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 2px;
}

html.a11y-font-atkinson body,
html.a11y-font-atkinson body *:not(.bi) {
  font-family: "Atkinson Hyperlegible Local", Arial, sans-serif !important;
}

html.a11y-font-dyslexic body,
html.a11y-font-dyslexic body *:not(.bi) {
  font-family: "OpenDyslexic Local", Arial, sans-serif !important;
}

html.a11y-bold-text body > :not(.accessibility-widget) :where(p, a, li, label, button, input, textarea, select, th, td, span) {
  font-weight: 700 !important;
}

html.a11y-line-spacing body > :not(.accessibility-widget) :where(p, li, blockquote, label, th, td) {
  line-height: 1.9 !important;
}

html.a11y-letter-spacing body > :not(.accessibility-widget) :where(p, a, li, label, button, th, td, h1, h2, h3, h4, h5, h6) {
  letter-spacing: .075em !important;
}

html.a11y-underline-links a:not(.accessibility-toggle) {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px;
}

html.a11y-high-contrast body > :not(.accessibility-widget) {
  filter: contrast(1.35);
}

html.a11y-grayscale body > :not(.accessibility-widget) {
  filter: grayscale(1);
}

html.a11y-high-contrast.a11y-grayscale body > :not(.accessibility-widget) {
  filter: grayscale(1) contrast(1.35);
}

html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}

html.a11y-large-cursor body,
html.a11y-large-cursor body * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23fff' stroke='%23000' stroke-width='2' d='M5 2v23l6-6 4 10 5-2-4-9h9z'/%3E%3C/svg%3E") 5 2, default !important;
}

html.a11y-large-cursor a,
html.a11y-large-cursor button,
html.a11y-large-cursor [role="button"],
html.a11y-large-cursor input,
html.a11y-large-cursor select,
html.a11y-large-cursor textarea {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23fff' stroke='%23000' stroke-width='2' d='M5 2v23l6-6 4 10 5-2-4-9h9z'/%3E%3C/svg%3E") 5 2, pointer !important;
}

.accessible-image-description {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.accessibility-image-hidden {
  display: none !important;
}

.accessibility-image-replacement {
  display: flex;
  width: 100%;
  min-height: 96px;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border: 2px dashed #6b7f93;
  border-radius: .75rem;
  background: #f4f7fa;
  color: #17212b;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.6;
  text-align: left;
  white-space: normal;
}

.accessibility-image-replacement:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
}

.accessibility-image-replacement.is-compact {
  display: inline-flex;
  width: auto;
  min-height: 44px;
  padding: .5rem .75rem;
  font-size: .875rem;
}

a > .accessibility-image-replacement,
button > .accessibility-image-replacement {
  color: inherit;
}

.accessibility-reading-guide {
  position: fixed;
  left: 0;
  right: 0;
  top: 50%;
  z-index: 9998;
  height: 38px;
  border-top: 3px solid rgba(255, 191, 0, .95);
  border-bottom: 3px solid rgba(255, 191, 0, .95);
  background: rgba(255, 235, 130, .16);
  pointer-events: none;
  transform: translateY(-50%);
}

.accessibility-reading-guide[hidden],
.accessibility-magnifier[hidden] {
  display: none;
}

.accessibility-magnifier {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 9999;
  width: min(720px, calc(100vw - 32px));
  padding: 15px 20px;
  border: 3px solid #0756b5;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%);
}

.accessibility-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 575.98px) {
  .accessibility-widget {
    left: 12px;
    bottom: 12px;
  }

  .accessibility-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .accessibility-toggle {
    width: 50px;
    height: 50px;
    justify-content: center;
    padding: 0;
  }

  .accessibility-panel {
    bottom: 60px;
  }

  .accessibility-magnifier {
    bottom: 74px;
    padding: 12px 15px;
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
