/* ============================================
   Accessibility Widget - Floating Menu
   ============================================ */

/* Floating Toggle Button */
.a11y-toggle-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 99999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #1a4d8f;
  border: 3px solid #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.a11y-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.a11y-toggle-btn .a11y-toggle-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

/* Panel Overlay */
.a11y-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0,0,0,0.4);
}
.a11y-overlay.active {
  display: block;
}

/* Panel */
.a11y-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 370px;
  max-width: 95vw;
  height: 100vh;
  z-index: 100001;
  background: #fff;
  box-shadow: -5px 0 25px rgba(0,0,0,0.25);
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.a11y-panel.open {
  right: 0;
}

/* Panel Header */
.a11y-panel-header {
  background: #1a4d8f;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.a11y-panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.a11y-panel-header .a11y-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.a11y-panel-header .a11y-esc {
  font-size: 14px;
  opacity: 0.8;
}
.a11y-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.9;
  transition: opacity 0.15s;
}
.a11y-close-btn:hover {
  opacity: 1;
}

/* Panel Body */
.a11y-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Grid of Buttons */
.a11y-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.a11y-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 8px;
  border: 2px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  min-height: 100px;
}
.a11y-btn:hover {
  border-color: #1a4d8f;
  background: #f0f5ff;
}
.a11y-btn.active {
  border-color: #1a4d8f;
  background: #e0ecff;
  box-shadow: 0 0 0 2px rgba(26,77,143,0.2);
}
.a11y-btn .a11y-icon {
  font-size: 32px;
  color: #344054;
  line-height: 1;
}
.a11y-btn.active .a11y-icon {
  color: #1a4d8f;
}
.a11y-btn .a11y-label {
  font-size: 12px;
  font-weight: 500;
  color: #344054;
  line-height: 1.2;
}

/* Reset Button */
.a11y-reset-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 2px solid #e4e7ec;
}
.a11y-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  background: #f9fafb;
  border: 2px solid #d0d5dd;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: #344054;
  transition: all 0.15s ease;
}
.a11y-reset-btn:hover {
  background: #fee2e2;
  border-color: #dc2626;
  color: #dc2626;
}
.a11y-reset-btn i {
  font-size: 20px;
}

/* ============================================
   Accessibility Effects Applied to Body
   ============================================ */

/* 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='48' height='48' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1' d='M5 3l14 8-6.5 1L9 18.5z'/%3E%3C/svg%3E"), auto !important;
}

/* White Cursor */
body.a11y-white-cursor,
body.a11y-white-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' stroke='%23000' stroke-width='1.5' d='M5 3l14 8-6.5 1L9 18.5z'/%3E%3C/svg%3E"), auto !important;
}

/* Black Cursor */
body.a11y-black-cursor,
body.a11y-black-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1.5' d='M5 3l14 8-6.5 1L9 18.5z'/%3E%3C/svg%3E"), auto !important;
}

/* Stop Animations */
body.a11y-stop-animations,
body.a11y-stop-animations * {
  animation: none !important;
  transition: none !important;
}
body.a11y-stop-animations .carousel-item {
  transition: none !important;
}

/* Uncolor Display (Grayscale) */
body.a11y-uncolor {
  filter: grayscale(100%) !important;
}

/* Bright Contrast */
body.a11y-bright-contrast {
  filter: contrast(1.5) brightness(1.2) !important;
}

/* Reverse Contrast (Invert) */
body.a11y-reverse-contrast {
  filter: invert(1) hue-rotate(180deg) !important;
}
body.a11y-reverse-contrast img,
body.a11y-reverse-contrast video,
body.a11y-reverse-contrast .carousel-item {
  filter: invert(1) hue-rotate(180deg) !important;
}

/* Bigger Text — apply on root only to elak compounding */
html.a11y-bigger-text,
body.a11y-bigger-text {
  font-size: 118% !important;
}

/* Smaller Text — apply on root only to elak compounding */
html.a11y-smaller-text,
body.a11y-smaller-text {
  font-size: 88% !important;
}

/* Readable Text / Font */
body.a11y-readable-text,
body.a11y-readable-text * {
  font-family: "OpenDyslexic", "Comic Sans MS", Arial, Helvetica, sans-serif !important;
  letter-spacing: 0.05em !important;
  word-spacing: 0.15em !important;
  line-height: 1.8 !important;
}

/* Underline Links */
body.a11y-underline-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
}

/* Underline Headers */
body.a11y-underline-headers h1,
body.a11y-underline-headers h2,
body.a11y-underline-headers h3,
body.a11y-underline-headers h4,
body.a11y-underline-headers h5,
body.a11y-underline-headers h6 {
  text-decoration: underline !important;
  text-underline-offset: 4px !important;
}

/* Images Titles - show alt text overlay */
body.a11y-images-titles img[alt]:not([alt=""]) {
  outline: 3px solid #1a4d8f !important;
  outline-offset: 2px;
}

/* Zoom Screen */
body.a11y-zoom-screen {
  transform: scale(1.2);
  transform-origin: top left;
  width: 83.33%;
}

/* Keyboard Navigation highlight */
body.a11y-keyboard-nav *:focus {
  outline: 3px solid #ff6600 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 5px rgba(255,102,0,0.3) !important;
}

/* ============================================
   Panel does NOT get affected by body filters
   ============================================ */
.a11y-panel,
.a11y-toggle-btn,
.a11y-overlay {
  filter: none !important;
  transform: none !important;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
  .a11y-panel {
    width: 100vw;
    right: -100vw;
  }
  .a11y-toggle-btn {
    width: 50px;
    height: 50px;
    bottom: 20px;
    right: 20px;
  }
  .a11y-toggle-btn svg {
    width: 28px;
    height: 28px;
  }
  .a11y-grid {
    gap: 8px;
  }
  .a11y-btn {
    padding: 12px 6px;
    min-height: 85px;
  }
  .a11y-btn .a11y-icon {
    font-size: 26px;
  }
  .a11y-btn .a11y-label {
    font-size: 11px;
  }
}
