/* ============================================================
   A11y Widget V2 - Liquid Glass
   ============================================================ */

/*
 * FIX 1 : isolation: isolate confine le stacking context du widget.
 * Ses enfants (trigger, panel) ne compètent plus avec les menus du site.
 * FIX 2 : z-index abaissé à 500 pour passer sous la Drupal toolbar (600)
 * et les dropdowns de navigation. Ajuste selon ton thème si besoin.
 */
.a11y-widget {
  position: fixed;
  z-index: 601; /* au-dessus de la Drupal toolbar (600), isolation: isolate garantit que les menus (Bootstrap ~1000) passent quand même au-dessus */
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  isolation: isolate; /* FIX 1 : stacking context isolé */
}

.a11y-widget-trigger {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
  color: rgb(0, 0, 0, 0.75);
  border: 1px solid rgb(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgb(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(30px) saturate(1.5) brightness(1.2);
  backdrop-filter: blur(30px) saturate(1.5) brightness(1.2);
  box-shadow:
    0 4px 16px rgb(0, 0, 0, 0.12),
    inset 0 1px 0 rgb(255, 255, 255, 0.6);
}

.a11y-widget-trigger:hover {
  transform: scale(1.06);
  background: rgb(255, 255, 255, 0.45);
  box-shadow:
    0 6px 24px rgb(0, 0, 0, 0.16),
    inset 0 1px 0 rgb(255, 255, 255, 0.7);
}

.a11y-widget-trigger:focus-visible {
  outline: 3px solid rgb(0, 0, 0, 0.35);
  outline-offset: 3px;
}

.a11y-widget-panel {
  overflow-y: auto;
  width: 300px;
  max-height: 72vh;
  padding: 18px 16px;
  color: rgb(0, 0, 0, 0.82);
  border: 1px solid rgb(255, 255, 255, 0.4);
  border-radius: 20px;
  background: rgb(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(30px) saturate(1.9) brightness(1.08);
  backdrop-filter: blur(30px) saturate(1.9) brightness(1.08);
  box-shadow:
    0 8px 32px rgb(0, 0, 0, 0.14),
    0 2px 8px rgb(0, 0, 0, 0.08),
    inset 0 1px 0 rgb(255, 255, 255, 0.7),
    inset 0 -1px 0 rgb(0, 0, 0, 0.04);
  scrollbar-width: thin;
  scrollbar-color: rgb(0, 0, 0, 0.15) transparent;
}

.a11y-widget-panel[hidden] {
  display: none;
}

.a11y-section {
  margin-bottom: 16px;
}

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

.a11y-section-title {
  margin: 0 0 7px 4px;
  padding: 0;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(0, 0, 0, 0.38);
  font-size: 10px;
  font-weight: 700;
}

.a11y-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 5px;
  padding: 10px 12px;
  transition: background 0.15s ease;
  border: 1px solid rgb(255, 255, 255, 0.5);
  border-radius: 12px;
  background: rgb(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgb(255, 255, 255, 0.6);
}

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

.a11y-row:hover {
  background: rgb(255, 255, 255, 0.42);
}

.a11y-row-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 22px;
  color: rgb(0, 0, 0, 0.55);
}

.a11y-row-icon--text {
  color: rgb(0, 0, 0, 0.55);
  font-size: 12px;
  font-weight: 700;
}

.a11y-row-label {
  flex: 1;
  color: rgb(0, 0, 0, 0.82);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
}

.a11y-toggle {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  padding: 0;
  cursor: pointer;
  transition:
    background 0.25s ease,
    border-color 0.25s ease;
  border: 1px solid rgb(0, 0, 0, 0.1);
  border-radius: 13px;
  background: rgb(0, 0, 0, 0.14);
  box-shadow: inset 0 1px 3px rgb(0, 0, 0, 0.12);
}

.a11y-toggle:focus-visible {
  outline: 2px solid rgb(0, 0, 0, 0.4);
  outline-offset: 2px;
}

.a11y-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  display: block;
  width: 18px;
  height: 18px;
  transition: transform 0.25s ease;
  pointer-events: none;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 1px 4px rgb(0, 0, 0, 0.25),
    0 0 0 0.5px rgb(0, 0, 0, 0.06);
}

.a11y-toggle.is-active {
  border-color: rgb(52, 120, 246, 0.4);
  background: rgb(52, 120, 246, 0.75);
  box-shadow: inset 0 1px 3px rgb(0, 0, 0, 0.1);
}

.a11y-toggle.is-active .a11y-toggle-thumb {
  transform: translateX(18px);
}

.a11y-row--slider {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
}

.a11y-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.a11y-textsize-label {
  color: rgb(0, 0, 0, 0.4);
  font-size: 12px;
}

.a11y-textsize-value {
  color: rgb(0, 0, 0, 0.65);
  font-weight: 600;
}

.a11y-row-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
}

.a11y-textsize-small {
  flex-shrink: 0;
  color: rgb(0, 0, 0, 0.4);
  font-size: 11px;
  font-weight: 600;
}

.a11y-textsize-large {
  flex-shrink: 0;
  color: rgb(0, 0, 0, 0.4);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.a11y-textsize-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  cursor: pointer;
  border-radius: 2px;
  outline: none;
  background: rgb(0, 0, 0, 0.15);
}

.a11y-textsize-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  cursor: pointer;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 1px 5px rgb(0, 0, 0, 0.25),
    0 0 0 0.5px rgb(0, 0, 0, 0.08);
}

.a11y-textsize-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  cursor: pointer;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 1px 5px rgb(0, 0, 0, 0.25),
    0 0 0 0.5px rgb(0, 0, 0, 0.08);
}

.a11y-textsize-slider:focus-visible {
  outline: 2px solid rgb(0, 0, 0, 0.35);
  outline-offset: 4px;
}
