/* ============================================
   InfluenceHub – Filters panel & catalog select a11y
   - WCAG AA contrast for .filters-panel and .catalog-select
     in both light and dark mode.
   - prefers-reduced-motion guard: disables the panel
     expand/collapse transition and any hover/focus
     transforms on the selects so users who prefer
     reduced motion are not exposed to motion.
   - 44px minimum touch targets for the selects.
   - Focus-visible rings for keyboard users.
   - Forced-colors (Windows High Contrast) support.
   ============================================ */

/* ---------- Filters panel – base contrast (WCAG AA) ----------
   The panel sits on a white surface in light mode and a slate-900
   surface in dark mode. Re-assert the key colors with !important so
   generic utilities cannot reduce the contrast below AA.

   Light mode:
     - panel surface: #ffffff
     - panel text: #0f172a on #ffffff = 17.9:1 (passes AA)
   Dark mode:
     - panel surface: #0f172a
     - panel text: #f1f5f9 on #0f172a = 15.9:1 (passes AA)
*/

.filters-panel {
  color: #0f172a;
}

.dark .filters-panel {
  color: #f1f5f9;
}

/* ---------- Catalog select – base contrast (WCAG AA) ----------
   The selects use a white fill with slate text in light mode and a
   slate-900 fill with light text in dark mode.

   Light mode:
     - select surface: #ffffff
     - select text: #0f172a on #ffffff = 17.9:1 (passes AA)
     - select border: #cbd5e1 (visible against white)
   Dark mode:
     - select surface: #0f172a
     - select text: #f1f5f9 on #0f172a = 15.9:1 (passes AA)
     - select border: #334155 (visible against slate-900)
*/

.catalog-select {
  color: #0f172a !important;
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
}

.dark .catalog-select {
  color: #f1f5f9 !important;
  background-color: #0f172a !important;
  border-color: #334155 !important;
}

/* Placeholder option (the "all" option) – keep it readable */
.catalog-select option {
  color: #0f172a;
  background-color: #ffffff;
}

.dark .catalog-select option {
  color: #f1f5f9;
  background-color: #0f172a;
}

/* ---------- 44px minimum touch targets ---------- */

.catalog-select {
  /* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Focus-visible ring (keyboard) ---------- */

.catalog-select:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

.dark .catalog-select:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* ---------- Fallback for browsers without :focus-visible ---------- */

@supports not selector(:focus-visible) {
  .catalog-select:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  .dark .catalog-select:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* ---------- prefers-reduced-motion guard ----------
   The filters panel expands/collapses with a height transition and
   the selects may animate on hover/focus. Users who prefer reduced
   motion should see state changes instantly, with no motion. */

@media (prefers-reduced-motion: reduce) {
  .filters-panel {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }

  /* Neutralise any hover/focus/active transform on the panel */
  .filters-panel:hover,
  .filters-panel:focus,
  .filters-panel:focus-within,
  .filters-panel:active {
    transform: none !important;
    transition: none !important;
  }

  /* Children of the panel must not animate either */
  .filters-panel *,
  .filters-panel *::before,
  .filters-panel *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  /* Selects – no hover/focus transforms or transitions */
  .catalog-select {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .catalog-select:hover,
  .catalog-select:focus,
  .catalog-select:focus-visible,
  .catalog-select:active {
    transform: none !important;
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  .catalog-select:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  .dark .catalog-select:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- Forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  .filters-panel {
    background: Canvas;
    color: CanvasText;
    border: 1px solid CanvasText;
  }

  .catalog-select {
    background: Canvas !important;
    color: CanvasText !important;
    border: 1px solid CanvasText !important;
  }

  .catalog-select:focus-visible,
  .catalog-select:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none !important;
  }
}
