/* ==========================================================================
   ACCESSIBILITY TOOLBAR — Yayasan Pelajaran Johor
   ========================================================================== */

/* ── Floating Button ──────────────────────────────────────────────────────── */
.a11y-fab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10001;
  background: #0d2b6e;
  color: #fff;
  border: none;
  width: 44px;
  padding: 16px 0;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: -3px 0 16px rgba(0, 0, 0, 0.25);
  transition: width 0.2s, background 0.2s;
  font-family: inherit;
}

.a11y-fab:hover {
  background: #1a3a8f;
  width: 50px;
}

.a11y-fab-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.a11y-fab-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  line-height: 1;
}

/* ── Panel ────────────────────────────────────────────────────────────────── */
.a11y-panel {
  position: fixed;
  right: -310px;
  top: 50%;
  transform: translateY(-50%);
  width: 288px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 16px 0 0 16px;
  box-shadow: -4px 0 32px rgba(0, 0, 0, 0.18);
  z-index: 10000;
  padding: 22px 18px;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.a11y-panel.a11y-open {
  right: 44px;
}

/* Panel scrollbar */
.a11y-panel::-webkit-scrollbar { width: 4px; }
.a11y-panel::-webkit-scrollbar-track { background: transparent; }
.a11y-panel::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* Panel header */
.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}

.a11y-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #0d2b6e;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
}

.a11y-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 5px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}

.a11y-close:hover {
  background: #f3f4f6;
  color: #374151;
}

/* ── Section ──────────────────────────────────────────────────────────────── */
.a11y-section {
  margin-bottom: 16px;
}

.a11y-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9ca3af;
  margin-bottom: 8px;
  font-family: inherit;
}

/* ── Text Size Buttons ────────────────────────────────────────────────────── */
.a11y-text-group {
  display: flex;
  gap: 6px;
}

.a11y-text-btn {
  flex: 1;
  padding: 10px 4px;
  border: 2px solid #e5e7eb;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  color: #374151;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: inherit;
  line-height: 1;
  text-align: center;
}

.a11y-text-btn:hover {
  border-color: #0d2b6e;
  color: #0d2b6e;
}

.a11y-text-btn.a11y-active {
  border-color: #0d2b6e;
  background: #0d2b6e;
  color: #fff;
}

/* ── Toggle Buttons ───────────────────────────────────────────────────────── */
.a11y-toggle-btn {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: inherit;
  margin-bottom: 6px;
  text-align: left;
}

.a11y-toggle-btn:last-child { margin-bottom: 0; }

.a11y-toggle-btn:hover {
  border-color: #0d2b6e;
  color: #0d2b6e;
  background: #f0f4ff;
}

.a11y-toggle-btn.a11y-active {
  border-color: #0d2b6e;
  background: #0d2b6e;
  color: #fff;
}

.a11y-toggle-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Toggle switch indicator */
.a11y-indicator {
  margin-left: auto;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: #d1d5db;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.a11y-indicator::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.a11y-toggle-btn.a11y-active .a11y-indicator {
  background: #f0b429;
}

.a11y-toggle-btn.a11y-active .a11y-indicator::after {
  transform: translateX(14px);
}

/* ── Reset Button ─────────────────────────────────────────────────────────── */
.a11y-reset {
  width: 100%;
  padding: 10px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
  margin-top: 4px;
}

.a11y-reset:hover {
  border-color: #dc2626;
  color: #dc2626;
  background: #fef2f2;
}

/* ==========================================================================
   ACCESSIBILITY BODY EFFECTS (applied via <html> classes)
   ========================================================================== */

/* Text sizes */
html.a11y-text-lg { font-size: 112.5%; }
html.a11y-text-xl { font-size: 125%; }

/* Greyscale */
html.a11y-greyscale { filter: grayscale(100%); }

/* High Contrast — invert + hue-rotate keeps images natural */
html.a11y-contrast { filter: invert(1) hue-rotate(180deg); }
html.a11y-contrast img,
html.a11y-contrast video,
html.a11y-contrast iframe { filter: invert(1) hue-rotate(180deg); }

/* Highlight links */
html.a11y-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px;
}

/* Pause all animations and transitions */
html.a11y-no-anim *,
html.a11y-no-anim *::before,
html.a11y-no-anim *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .a11y-panel { width: 260px; }
}
