/* ═══════════════════════════════════════════════════════════════
   GenAI Secured — Custom Accessibility Widget
   css/accessibility.css

   Sections:
     1. Reduced Motion (global override)
     2. Body modifier classes (.a11y-high-contrast, .a11y-grayscale)
     3. Widget container & trigger button
     4. Panel shell (header, body, footer)
     5. Text-size controls
     6. Toggle buttons (contrast / grayscale)
     7. Reset button
═══════════════════════════════════════════════════════════════ */


/* ── 1. Reduced Motion ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration:        0.01ms !important;
    animation-iteration-count: 1      !important;
    transition-duration:       0.01ms !important;
    scroll-behavior:           auto   !important;
  }
}


/* ── 2. Body Modifier Classes ──────────────────────────────── */

body.a11y-grayscale {
  filter: grayscale(100%);
}

body.a11y-high-contrast {
  /* Override design-token variables for maximum contrast */
  --canvas:          #000000;
  --surface:         #080808;
  --surface-alt:     #060606;
  --glass:           rgba(255, 255, 255, 0.13);
  --glass-hover:     rgba(255, 255, 255, 0.20);
  --glass-border:    rgba(255, 255, 255, 0.38);
  --glass-border-hv: rgba(255, 255, 255, 0.65);
  --text-primary:    #ffffff;
  --text-secondary:  #f0f0f0;
  --text-muted:      #cccccc;
  --accent:          #7aabff;
  --accent-teal:     #00ffe4;
  --accent-purple:   #d0b4ff;
}

/* When both modes are combined, stack the filters */
body.a11y-high-contrast.a11y-grayscale {
  filter: grayscale(100%) contrast(1.35);
}


/* ── 3. Widget Container & Trigger ─────────────────────────── */

.a11y-widget {
  position: fixed;
  bottom: 24px;
  left:   24px;
  z-index: 9999;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.a11y-trigger {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:  52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent, #1a4fd6); /* fallback passes WCAG AA with #fff (6.9:1) */
  color: #fff;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(79, 128, 255, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.a11y-trigger:hover {
  transform:  scale(1.1);
  box-shadow: 0 6px 26px rgba(79, 128, 255, 0.6);
}

.a11y-trigger:focus-visible {
  outline: 3px solid var(--accent-teal, #14d9c5);
  outline-offset: 4px;
}

.a11y-trigger svg {
  width:  26px;
  height: 26px;
  flex-shrink: 0;
}

/* Active indicator — any setting differs from default */
.a11y-trigger--active {
  background: var(--accent-teal, #14d9c5);
  box-shadow: 0 4px 18px rgba(20, 217, 197, 0.5);
}

.a11y-trigger--active:hover {
  box-shadow: 0 6px 26px rgba(20, 217, 197, 0.65);
}


/* ── 4. Panel Shell ────────────────────────────────────────── */

.a11y-panel {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 0;
  width: 288px;
  background: rgba(7, 13, 30, 0.97);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter:         blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(79, 128, 255, 0.08) inset;
  overflow: hidden;
}

/* Panel Header */
.a11y-panel-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.a11y-panel-title {
  font-size:   0.8rem;
  font-weight: 700;
  color: #eef1ff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.a11y-close-btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:  28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #8b9dc7;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.a11y-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #eef1ff;
}

.a11y-close-btn:focus-visible {
  outline: 2px solid var(--accent-teal, #14d9c5);
  outline-offset: 2px;
}

/* Panel Body */
.a11y-panel-body {
  padding: 0.85rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Panel Footer */
.a11y-panel-footer {
  padding: 0.75rem 1.1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* Control Group */
.a11y-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.a11y-group-label {
  font-size:   0.7rem;
  font-weight: 600;
  color: #4a5680;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin: 0;
}


/* ── 5. Text-Size Controls ─────────────────────────────────── */

.a11y-text-controls {
  display:     flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.35rem 0.5rem;
}

.a11y-size-btn {
  display:         flex;
  align-items:     center;
  gap: 0.2rem;
  flex: 1;
  justify-content: center;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  color: #8b9dc7;
  padding: 0.4rem 0.3rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.a11y-size-btn:hover:not(:disabled) {
  background: rgba(79, 128, 255, 0.15);
  color: #eef1ff;
}

.a11y-size-btn:focus-visible {
  outline: 2px solid var(--accent-teal, #14d9c5);
  outline-offset: 2px;
}

.a11y-size-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.a11y-size-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.a11y-size-letter {
  font-weight: 700;
  line-height: 1;
  font-family: inherit;
}

.a11y-size-letter--sm {
  font-size: 0.75rem;
}

.a11y-size-letter--lg {
  font-size: 1rem;
}

.a11y-size-display {
  font-size:   0.78rem;
  font-weight: 600;
  color: #eef1ff;
  min-width: 40px;
  text-align: center;
  flex-shrink: 0;
}


/* ── 6. Toggle Buttons ─────────────────────────────────────── */

.a11y-toggle {
  display:     flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  color: #8b9dc7;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  margin-bottom: 0.4rem;
}

.a11y-toggle:last-child {
  margin-bottom: 0;
}

.a11y-toggle:hover {
  background:   rgba(79, 128, 255, 0.1);
  border-color: rgba(79, 128, 255, 0.25);
  color: #eef1ff;
}

.a11y-toggle:focus-visible {
  outline: 2px solid var(--accent-teal, #14d9c5);
  outline-offset: 2px;
}

.a11y-toggle svg {
  width:  18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.65;
  transition: opacity 0.15s;
}

/* Active / pressed state */
.a11y-toggle[aria-pressed="true"] {
  background:   rgba(20, 217, 197, 0.1);
  border-color: rgba(20, 217, 197, 0.35);
  color: #14d9c5;
}

.a11y-toggle[aria-pressed="true"] svg {
  opacity: 1;
}

/* Checkmark indicator for pressed state */
.a11y-toggle[aria-pressed="true"]::after {
  content: '✓';
  margin-left: auto;
  font-size: 0.75rem;
  color: #14d9c5;
}


/* ── 7. Reset Button ───────────────────────────────────────── */

.a11y-reset-btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  color: #607da0;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.a11y-reset-btn:hover {
  background:   rgba(255, 80, 80, 0.08);
  border-color: rgba(255, 80, 80, 0.2);
  color: #ffb3b3;
}

.a11y-reset-btn:focus-visible {
  outline: 2px solid var(--accent-teal, #14d9c5);
  outline-offset: 2px;
}

.a11y-reset-btn svg {
  width:  15px;
  height: 15px;
  flex-shrink: 0;
}
