/* Accessibility preferences widget — Regulation 35 compliant comfort tool */
#a11y-widget-trigger {
  position: fixed;
  bottom: 20px;
  inset-inline-start: 20px;
  z-index: 9999;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #0071e3;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  padding: 0;
  transition: transform 0.2s ease;
}
#a11y-widget-trigger:hover { transform: scale(1.06); }
#a11y-widget-trigger svg { width: 30px; height: 30px; fill: #fff; }

#a11y-widget-panel {
  position: fixed;
  bottom: 82px;
  inset-inline-start: 20px;
  z-index: 9999;
  width: 300px;
  max-width: calc(100vw - 40px);
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  color: #1d1d1f;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  padding: 18px;
  font-family: 'Rubik', 'Segoe UI', Arial, sans-serif;
  direction: rtl;
}
#a11y-widget-panel[hidden] { display: none; }

#a11y-widget-panel h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
  padding-inline-end: 30px;
}

#a11y-widget-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #6e6e73;
  padding: 4px;
}

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

.a11y-toggle {
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1.5px solid #d2d2d7;
  background: #fff;
  color: #1d1d1f;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  text-align: center;
  line-height: 1.3;
}
.a11y-toggle span.a11y-toggle-icon { font-size: 18px; }
.a11y-toggle small { font-size: 14px; }
.a11y-toggle[aria-pressed="true"] {
  border-color: #0071e3;
  background: rgba(0,113,227,0.08);
  font-weight: 600;
}

#a11y-reset {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1.5px solid #d2d2d7;
  background: #f5f5f7;
  color: #1d1d1f;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
}

#a11y-status {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---- Effect classes applied to <html> ---- */
html.a11y-contrast-high { filter: contrast(1.35) saturate(1.1); }
html.a11y-contrast-invert { filter: invert(1) hue-rotate(180deg); }
html.a11y-contrast-mono { filter: grayscale(1); }

html.a11y-contrast-invert #a11y-widget-panel,
html.a11y-contrast-invert #a11y-widget-trigger {
  filter: invert(1) hue-rotate(180deg);
}

html.a11y-links a { text-decoration: underline !important; text-underline-offset: 2px; }

body.a11y-text-115 { zoom: 1.15; }
body.a11y-text-130 { zoom: 1.3; }
body.a11y-text-150 { zoom: 1.5; }

body.a11y-lines-16 *:not(#a11y-widget-panel):not(#a11y-widget-panel *) { line-height: 1.6 !important; }
body.a11y-lines-20 *:not(#a11y-widget-panel):not(#a11y-widget-panel *) { line-height: 2 !important; }

body.a11y-readable-font *:not(#a11y-widget-panel):not(#a11y-widget-panel *) {
  font-family: Arial, Helvetica, sans-serif !important;
}

body.a11y-headings h1, body.a11y-headings h2, body.a11y-headings h3 {
  outline: 2px dashed #0071e3 !important;
  outline-offset: 4px;
}

html.a11y-cursor-big, html.a11y-cursor-big * { cursor: default !important; }
html.a11y-cursor-black * { caret-color: #000; }

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

@media print {
  html[class*="a11y-"] { filter: none !important; }
  body[class*="a11y-text-"] { zoom: 1 !important; }
}
