/* ============================================================
   EliCart Accessibility Widget — accessibility.css
   Bundle budget: ≤ 6 KB. Zero runtime deps.
   ============================================================ */

/* ── OpenDyslexic self-hosted font ───────────────────────────────────────── */
@font-face {
  font-family: 'OpenDyslexic';
  src: url('/assets/fonts/opendyslexic/OpenDyslexic-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Skip link ───────────────────────────────────────────────────────────── */
.eli-skip {
  position: absolute;
  top: -44px;
  left: 8px;
  z-index: 9999;
  padding: 8px 16px;
  background: #000;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border-radius: 0 0 6px 6px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.eli-skip:focus {
  top: 0;
  outline: 3px solid #ff6b00;
  outline-offset: 2px;
}

/* ── Floating Action Button (FAB) ────────────────────────────────────────── */
.eli-a11y-fab {
  position: fixed;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
  z-index: 60;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  padding: 0;
}
.eli-a11y-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
}
.eli-a11y-fab:focus-visible {
  outline: 3px solid #ff6b00;
  outline-offset: 3px;
}

/* ── Panel ───────────────────────────────────────────────────────────────── */
#eli-a11y-panel {
  position: fixed;
  bottom: 84px;
  right: 20px;
  width: 320px;
  max-height: 80vh;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
  z-index: 61;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: eli-a11y-slide-up 0.2s ease;
}
#eli-a11y-panel[hidden] { display: none; }

@keyframes eli-a11y-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.eli-a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
  flex-shrink: 0;
}
.eli-a11y-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #1e293b;
}
.eli-a11y-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.eli-a11y-close:hover { background: #e2e8f0; color: #0f172a; }
.eli-a11y-close:focus-visible { outline: 3px solid #ff6b00; }

.eli-a11y-panel-body {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}
.eli-a11y-panel-body::-webkit-scrollbar { width: 4px; }
.eli-a11y-panel-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.eli-a11y-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}

/* ── Toggle rows ─────────────────────────────────────────────────────────── */
.eli-a11y-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 6px 16px;
  gap: 8px;
}
.eli-a11y-row:hover { background: #f8fafc; }
.eli-a11y-row-label {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  flex: 1;
  cursor: pointer;
}

/* Button groups (text size + contrast) */
.eli-a11y-btn-group {
  display: flex;
  gap: 2px;
}
.eli-a11y-size-btn,
.eli-a11y-contrast-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  min-height: 30px;
}
.eli-a11y-size-btn:hover,
.eli-a11y-contrast-btn:hover {
  background: #e0e7ff;
  border-color: #6366f1;
  color: #4f46e5;
}
.eli-a11y-size-btn[aria-pressed="true"],
.eli-a11y-contrast-btn[aria-pressed="true"] {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

/* Boolean switch */
.eli-a11y-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #cbd5e1;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.eli-a11y-switch[aria-checked="true"] { background: #4f46e5; }
.eli-a11y-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: left 0.2s;
}
.eli-a11y-switch[aria-checked="true"] .eli-a11y-switch-thumb { left: 21px; }
.eli-a11y-switch:focus-visible { outline: 3px solid #ff6b00; outline-offset: 2px; }

/* Footer buttons */
.eli-a11y-reset {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  transition: background 0.12s;
}
.eli-a11y-reset:hover { background: #fee2e2; }
.eli-a11y-statement-link {
  font-size: 11px;
  color: #6366f1;
  text-decoration: underline;
  white-space: nowrap;
}

/* ── Reading guide ───────────────────────────────────────────────────────── */
.eli-a11y-reading-guide {
  position: fixed;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 107, 0, .65);
  pointer-events: none;
  z-index: 9998;
  top: 0;
  transform: translateY(0);
  transition: none;
}
.eli-a11y-reading-guide[hidden] { display: none; }

/* ── Body-class toggles ──────────────────────────────────────────────────── */

/* Text size */
body.a11y-text-125 { font-size: 1.125rem !important; }
body.a11y-text-125 p, body.a11y-text-125 li, body.a11y-text-125 span, body.a11y-text-125 td { font-size: inherit !important; }
body.a11y-text-150 { font-size: 1.25rem !important; }
body.a11y-text-150 p, body.a11y-text-150 li, body.a11y-text-150 span, body.a11y-text-150 td { font-size: inherit !important; }
body.a11y-text-200 { font-size: 1.5rem !important; }
body.a11y-text-200 p, body.a11y-text-200 li, body.a11y-text-200 span, body.a11y-text-200 td { font-size: inherit !important; }

/* Contrast — light (increases contrast on light bg) */
body.a11y-contrast-light { background: #fffef0 !important; color: #000 !important; }
body.a11y-contrast-light a  { color: #00008b !important; }
body.a11y-contrast-light button { background: #003087 !important; color: #fff !important; }

/* Contrast — dark */
body.a11y-contrast-dark { background: #000 !important; color: #fff !important; }
body.a11y-contrast-dark a, body.a11y-contrast-dark button { color: #ffe600 !important; }
body.a11y-contrast-dark .bg-white, body.a11y-contrast-dark .bg-gray-50, body.a11y-contrast-dark .bg-slate-50 { background: #111 !important; }
body.a11y-contrast-dark header, body.a11y-contrast-dark nav, body.a11y-contrast-dark footer { background: #0a0a0a !important; }

/* Contrast — inverted */
body.a11y-contrast-inverted { filter: invert(1) hue-rotate(180deg) !important; }
body.a11y-contrast-inverted img,
body.a11y-contrast-inverted video,
body.a11y-contrast-inverted svg:not(.eli-a11y-fab svg):not(#eli-a11y-panel svg) { filter: invert(1) hue-rotate(180deg) !important; }

/* Dyslexia font */
body.a11y-dyslexia,
body.a11y-dyslexia p,
body.a11y-dyslexia li,
body.a11y-dyslexia span,
body.a11y-dyslexia td,
body.a11y-dyslexia input,
body.a11y-dyslexia button {
  font-family: 'OpenDyslexic', system-ui, sans-serif !important;
}

/* Links highlight */
body.a11y-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  color: #0066cc !important;
}

/* Pause animations */
body.a11y-pause-anim *,
body.a11y-pause-anim *::before,
body.a11y-pause-anim *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Big cursor */
body.a11y-big-cursor,
body.a11y-big-cursor * {
  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 d='M4 2L4 26L11 19L15 28L18 27L14 18L22 18Z' fill='black' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E") 0 0, auto !important;
}

/* Focus ring */
body.a11y-focus-ring *:focus-visible {
  outline: 3px solid #ff6b00 !important;
  outline-offset: 2px !important;
}

/* Screen reader optimize: make sure aria-hidden items truly don't appear */
body.a11y-sr-optimize [aria-hidden="true"] { visibility: hidden !important; }

/* ── Alt tooltip ─────────────────────────────────────────────────────────── */
.eli-a11y-alt-tooltip {
  position: fixed;
  background: rgba(0,0,0,.85);
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 9999;
  max-width: 280px;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* ── Mobile: full-width bottom drawer ───────────────────────────────────── */
@media (max-width: 640px) {
  #eli-a11y-panel {
    right: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: 72vh;
    border-radius: 16px 16px 0 0;
    animation: eli-a11y-slide-up-mobile 0.22s ease;
  }
  @keyframes eli-a11y-slide-up-mobile {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
  .eli-a11y-fab,
  #eli-a11y-panel,
  .eli-a11y-reading-guide,
  .eli-skip { display: none !important; }
}
