/* Lexi Accessibility Widget */

/* Toggle button */
.a11y-toggle {
  position: fixed !important;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999999;
  width: 48px;
  height: 48px;
  background: #141414;
  color: #fff;
  border: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -2px 2px 8px rgba(0,0,0,.15);
  transition: background .2s;
}
.a11y-toggle:hover {
  background: #333;
}
.a11y-toggle svg {
  width: 26px;
  height: 26px;
  pointer-events: none;
}

/* Panel */
.a11y-panel {
  position: fixed !important;
  right: -320px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 999999;
  width: 300px;
  max-height: 80vh;
  overflow-y: auto;
  background: #141414;
  color: #fff;
  border-radius: 12px 0 0 12px;
  box-shadow: -4px 4px 20px rgba(0,0,0,.25);
  padding: 24px;
  transition: right .3s ease;
}
.a11y-panel.open {
  right: 0;
}

.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.a11y-panel-title {
  font-size: 16px;
  font-weight: 700;
}
.a11y-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  opacity: .7;
}
.a11y-close:hover {
  opacity: 1;
}
.a11y-close svg {
  pointer-events: none;
}

/* Groups */
.a11y-group {
  margin-bottom: 20px;
}
.a11y-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-bottom: 10px;
}

/* Option buttons */
.a11y-option {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255,255,255,.08);
  border: 2px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  transition: background .2s;
}
.a11y-option:hover {
  background: rgba(255,255,255,.15);
}
.a11y-option.active {
  background: #FF6B35;
  border-color: #FF6B35;
}

/* Font size buttons */
.a11y-fontsize {
  display: flex;
  gap: 8px;
}
.a11y-fontsize button {
  flex: 1;
  padding: 12px;
  background: rgba(255,255,255,.08);
  border: 2px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.a11y-fontsize button:hover {
  background: rgba(255,255,255,.15);
}
.a11y-fontsize button.active {
  background: #FF6B35;
  border-color: #FF6B35;
}

/* Reset button */
.a11y-reset {
  width: 100%;
  padding: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
}
.a11y-reset:hover {
  background: rgba(255,255,255,.15);
}

/* ============================================
   Accessibility modes
   ============================================ */

/* Font size - use zoom (px values don't scale with font-size) */
html.a11y-font-large {
  zoom: 1.1;
}
html.a11y-font-xlarge {
  zoom: 1.2;
}

/* Filters - support both #root (display:contents) and no-root pages */
body.a11y-grayscale > *:not(#a11y-widget),
body.a11y-grayscale #root > * {
  filter: grayscale(100%);
}
body.a11y-high-contrast > *:not(#a11y-widget),
body.a11y-high-contrast #root > * {
  filter: contrast(1.4);
}
body.a11y-negative {
  background-color: #0d0806 !important;
}
body.a11y-negative > *:not(#a11y-widget),
body.a11y-negative #root > * {
  filter: invert(1) hue-rotate(180deg);
}

/* Invert images back in negative mode */
body.a11y-negative img,
body.a11y-negative video,
body.a11y-negative picture {
  filter: invert(1) hue-rotate(180deg);
}

/* Reading */
body.a11y-links-underline a {
  text-decoration: underline !important;
}
html.a11y-readable-font,
html.a11y-readable-font * {
  font-family: Arial, Helvetica, sans-serif !important;
}

/* Mobile */
@media (max-width: 767px) {
  .a11y-toggle {
    top: auto;
    bottom: 100px;
    transform: none;
    width: 44px;
    height: 44px;
  }
  .a11y-panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform .3s ease;
  }
  .a11y-panel.open {
    transform: translateY(0);
    right: 0;
  }
}

/* Hide old elements */
.a11y-bar { display: none !important; }
