/* ==========================================================================
   FikrLab — Inklyuziv ta'lim uslublari (WCAG 2.2 AA)
   ========================================================================== */

/* Yuqori kontrast */
body.a11y-contrast {
  --ink: #000; --ink-soft: #1a1a1a; --paper: #fff; --surface: #fff; --line: #000;
  --critical: #00308F; --creative: #A63603; --accent: #005F56;
}
body.a11y-contrast[data-theme="dark"], body.a11y-contrast.dark {
  --ink: #fff; --ink-soft: #eee; --paper: #000; --surface: #0a0a0a; --line: #fff;
}
body.a11y-contrast .card, body.a11y-contrast .btn { border-width: 2px; }

/* Daltonizm — rangga qo'shimcha shakl/naqsh ishoralari */
body.a11y-colorblind {
  --critical: #0072B2; --creative: #D55E00; --accent: #009E73;
  --success: #009E73; --danger: #D55E00;
}
body.a11y-colorblind .badge-critical::before { content: "◆ "; }
body.a11y-colorblind .badge-creative::before { content: "● "; }
body.a11y-colorblind .quiz-option.is-correct::before { content: "✓ "; font-weight: 700; }
body.a11y-colorblind .quiz-option.is-wrong::before { content: "✗ "; font-weight: 700; }

/* Disleksiya shrifti */
body.a11y-dyslexia { --font-body: 'Comic Sans MS', 'Trebuchet MS', Verdana, sans-serif; --font-display: 'Trebuchet MS', Verdana, sans-serif; }
body.a11y-dyslexia { letter-spacing: .04em; word-spacing: .12em; line-height: 1.85; }
body.a11y-dyslexia p, body.a11y-dyslexia li { max-width: 62ch; }

/* Matn o'lchami */
body.a11y-text-lg { font-size: 18px; }
body.a11y-text-xl { font-size: 21px; }
body.a11y-text-xl .page-title { font-size: 2rem; }

/* Katta tugmalar (motorika) */
body.a11y-bigbtn .btn, body.a11y-bigbtn .quiz-option, body.a11y-bigbtn .nav-item { min-height: 56px; font-size: 1.05rem; }
body.a11y-bigbtn .icon-btn { width: 52px; height: 52px; }

/* Minimal rejim (autizm spektri) — kam bezak, tinch ranglar */
body.a11y-minimal { --shadow: none; --shadow-lg: none; }
body.a11y-minimal .card, body.a11y-minimal .btn { box-shadow: none; }
body.a11y-minimal .duality-critical { background: #3B5BA5; }
body.a11y-minimal .duality-creative { background: #C7683E; }
body.a11y-minimal * { animation: none !important; transition: none !important; }

/* Diqqat rejimi — kuchli fokus ko'rsatkichi */
body.a11y-attention :focus-visible { outline: 4px solid var(--creative); outline-offset: 3px; }
body.a11y-attention a, body.a11y-attention .nav-item { text-underline-offset: 3px; }

/* Fokus rejimi — chalg'ituvchilarни yashirish */
body.a11y-focus .xp-pill, body.a11y-focus .topbar-search, body.a11y-focus .nav-group-label { opacity: .35; }
body.a11y-focus .card:not(.lesson-section):not(:hover) { opacity: .9; }

/* O'qish chizg'ichi */
#reading-ruler {
  position: fixed; left: 0; width: 100%; height: 34px; pointer-events: none; z-index: 90;
  background: rgba(13,148,136,.12); border-top: 2px solid rgba(13,148,136,.5);
  border-bottom: 2px solid rgba(13,148,136,.5); display: none;
}
body.a11y-ruler #reading-ruler { display: block; }

/* ---------- A11y FAB va panel ---------- */
.a11y-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 120;
  width: 56px; height: 56px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; font-size: 1.5rem; cursor: pointer;
  box-shadow: var(--shadow-lg); display: grid; place-items: center;
}
.a11y-fab:hover { transform: scale(1.05); }

.a11y-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 120;
  width: min(360px, calc(100vw - 40px)); max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 18px;
}
.a11y-panel h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 1.1rem; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.a11y-row:last-child { border-bottom: none; }
.a11y-row span { font-size: .9rem; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .2s; cursor: pointer; }
.switch .track::before { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: var(--shadow); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }
