/* ========================================
 * WIDGET DE ACESSIBILIDADE
 * ========================================
 * Painel lateral com controles de acessibilidade.
 * Auto-inicializado via accessibility-widget.js
 */

/* OpenDyslexic font */
@font-face {
  font-family: "OpenDyslexic";
  src: url("https://cdn.jsdelivr.net/fontsource/fonts/opendyslexic@latest/latin-400-normal.woff2") format("woff2");
  font-display: swap;
}

/* ==================== */
/* TRIGGER              */
/* ==================== */

.a11y-trigger {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10000;
  width: 44px;
  height: 44px;
  background: var(--color-primary, #007f95);
  color: #fff;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
  transition:
    background 0.2s,
    transform 0.2s;
}

.a11y-trigger:hover {
  background: var(--color-primary-dark, #1f505a);
  transform: translateY(-50%) scale(1.05);
}

.a11y-trigger:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.a11y-trigger svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* ==================== */
/* OVERLAY              */
/* ==================== */

.a11y-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
}

.a11y-overlay.active {
  display: block;
}

/* ==================== */
/* PANEL                */
/* ==================== */

.a11y-panel {
  position: fixed;
  top: 0;
  left: -320px;
  width: 300px;
  height: 100%;
  background: #fff;
  z-index: 10001;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  transition: left 0.3s ease;
  overflow-y: auto;
  font-family: var(--font-family-primary, "Poppins", sans-serif);
}

.a11y-panel.open {
  left: 0;
}

.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--color-primary, #007f95);
  color: #fff;
}

.a11y-panel-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.a11y-panel-header h2 svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.a11y-panel-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 1.25rem;
  line-height: 1;
}

.a11y-panel-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.a11y-panel-body {
  padding: 12px 16px;
}

/* ==================== */
/* BUTTONS              */
/* ==================== */

.a11y-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 4px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  color: #333;
  text-align: left;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.a11y-btn:hover {
  background: #e9ecef;
  border-color: #dee2e6;
}

.a11y-btn:focus-visible {
  outline: 2px solid var(--color-primary, #007f95);
  outline-offset: 1px;
}

.a11y-btn.active {
  background: rgba(var(--color-primary-rgb, 0, 127, 149), 0.12);
  border-color: var(--color-primary, #007f95);
  color: var(--color-primary-dark, #1f505a);
  font-weight: 600;
}

.a11y-btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(var(--color-primary-rgb, 0, 127, 149), 0.1);
  color: var(--color-primary, #007f95);
  flex-shrink: 0;
  font-size: 1rem;
}

.a11y-btn.active .a11y-btn-icon {
  background: var(--color-primary, #007f95);
  color: #fff;
}

.a11y-separator {
  height: 1px;
  background: #e9ecef;
  margin: 10px 0;
}

.a11y-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin: 12px 0 6px 4px;
  font-weight: 600;
}

/* ==================== */
/* FONT-SIZE CONTROLS   */
/* ==================== */

.a11y-font-row {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.a11y-font-row .a11y-btn {
  flex: 1;
  justify-content: center;
  margin-bottom: 0;
}

/* ==================== */
/* UTILITY CLASSES      */
/* ==================== */

html.a11y-font-1 {
  font-size: 112%;
}

html.a11y-font-2 {
  font-size: 125%;
}

html.a11y-dyslexia,
html.a11y-dyslexia * {
  font-family: "OpenDyslexic", sans-serif !important;
}

html.a11y-contrast {
  filter: invert(1) hue-rotate(180deg);
}

html.a11y-contrast img,
html.a11y-contrast video,
html.a11y-contrast picture,
html.a11y-contrast svg:not(.a11y-icon) {
  filter: invert(1) hue-rotate(180deg);
}

html.a11y-no-transitions *,
html.a11y-no-transitions *::before,
html.a11y-no-transitions *::after {
  transition-duration: 0s !important;
  animation-duration: 0s !important;
}

/* ==================== */
/* RESPONSIVE           */
/* ==================== */

@media (max-width: 575px) {
  .a11y-panel {
    width: 280px;
    left: -300px;
  }

  .a11y-trigger {
    width: 38px;
    height: 38px;
  }

  .a11y-trigger svg {
    width: 18px;
    height: 18px;
  }
}
