/* ============================================
   ACCESSIBILITY WIDGET - accessibility.css
   Umieść w: static/accessibility/css/
   ============================================ */

/* ── Panel toggle button ── */
#a11y-toggle {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #1a56db;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(26, 86, 219, .45);
  transition: background .2s, transform .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#a11y-toggle:hover {
  background: #1e429f;
  transform: scale(1.08);
}

#a11y-toggle:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

/* ── Panel ── */
#a11y-panel {
  position: fixed;
  bottom: 5.5rem;
  left: 2rem;
  z-index: 9999;
  width: 300px;
  background: #fff;
  border: 2px solid #1a56db;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .18);
  padding: 1.25rem 1.25rem 1rem;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  transform: translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

#a11y-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

#a11y-panel h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Rows ── */
.a11y-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45rem 0;
  gap: .5rem;
}

.a11y-label {
  color: #374151;
  font-size: .875rem;
  flex: 1;
}

/* ── Font-size controls ── */
.a11y-font-controls {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.a11y-font-controls button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid #d1d5db;
  background: #f9fafb;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: #1a56db;
  transition: border-color .15s, background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.a11y-font-controls button:hover {
  border-color: #1a56db;
  background: #eff6ff;
}

.a11y-font-controls button:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

#a11y-font-size-val {
  min-width: 38px;
  text-align: center;
  font-weight: 600;
  color: #111827;
  font-size: .85rem;
}

/* ── Toggle switches ── */
.a11y-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.a11y-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.a11y-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}

.a11y-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.a11y-switch input:checked+.a11y-slider {
  background: #1a56db;
}

.a11y-switch input:checked+.a11y-slider::before {
  transform: translateX(20px);
}

.a11y-switch input:focus-visible+.a11y-slider {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* ── Reset button ── */
#a11y-reset {
  margin-top: .75rem;
  width: 100%;
  padding: .5rem;
  border: none;
  background: #f3f4f6;
  color: #374151;
  border-radius: 8px;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s;
  font-weight: 500;
}

#a11y-reset:hover {
  background: #e5e7eb;
}

#a11y-reset:focus-visible {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* ============================================
   GLOBAL ACCESSIBILITY STATES
   ============================================ */

/* Font size – applied on <html> */
html[data-a11y-font="110"] {
  font-size: 110% !important;
}

html[data-a11y-font="120"] {
  font-size: 120% !important;
}

html[data-a11y-font="130"] {
  font-size: 130% !important;
}

html[data-a11y-font="140"] {
  font-size: 140% !important;
}

html[data-a11y-font="150"] {
  font-size: 150% !important;
}

/* High contrast */
html[data-a11y-contrast="true"] {
  filter: contrast(1.6) brightness(.95);
}

/* Dark mode */
html[data-a11y-dark="true"] {
  filter: invert(1) hue-rotate(180deg);
}

html[data-a11y-dark="true"] img,
html[data-a11y-dark="true"] video {
  filter: invert(1) hue-rotate(180deg);
}

/* Dyslexia font */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;700&display=swap');

html[data-a11y-dyslexia="true"] body,
html[data-a11y-dyslexia="true"] p,
html[data-a11y-dyslexia="true"] li,
html[data-a11y-dyslexia="true"] span,
html[data-a11y-dyslexia="true"] a {
  font-family: 'Lexend', sans-serif !important;
  letter-spacing: .06em;
  word-spacing: .18em;
  line-height: 1.8 !important;
}

/* Big cursor */
html[data-a11y-cursor="true"],
html[data-a11y-cursor="true"] * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='6' cy='6' r='5' fill='%231a56db' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 6 6, auto !important;
}

/* Stop animations */
html[data-a11y-animations="false"] *,
html[data-a11y-animations="false"] *::before,
html[data-a11y-animations="false"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* Skip link */
.a11y-skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: #1a56db;
  color: #fff;
  padding: .6rem 1.2rem;
  border-radius: 0 0 8px 8px;
  font-weight: 700;
  text-decoration: none;
  z-index: 10000;
  transition: top .15s;
}

.a11y-skip-link:focus {
  top: 0;
}