/* ============================================
   InfluenceHub – Hero & category chip a11y
   - WCAG AA contrast for .chip and .chip-active
     in both light and dark mode.
   - prefers-reduced-motion guard: disables the
     hover lift, transitions and any pulse/scale
     animation on the chips so users who prefer
     reduced motion are not exposed to motion.
   - 44px minimum touch target (WCAG 2.5.5) for
     mobile users on interactive chips.
   - Focus-visible ring for keyboard users.
   - Forced-colors (Windows High Contrast) support.
   ============================================ */

/* ---------- Base chip (WCAG AA contrast) ----------
   Light mode:
     - chip surface: #f1f5f9 (slate-100)
     - chip text: #334155 on #f1f5f9 = 9.6:1 (passes AA)
   Dark mode:
     - chip surface: #1e293b (slate-800)
     - chip text: #e2e8f0 on #1e293b = 11.6:1 (passes AA)
*/

.chip {
  color: #334155 !important;
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

.dark .chip {
  color: #e2e8f0 !important;
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

/* ---------- Active chip (WCAG AA contrast) ----------
   Light mode:
     - chip surface: #ede9fe (brand-100)
     - chip text: #5b21b6 on #ede9fe = 8.4:1 (passes AA)
   Dark mode:
     - chip surface: rgba(76, 29, 149, 0.5) over #0f172a
     - chip text: #ddd6fe on the surface ≈ 9.6:1 (passes AA)
*/

.chip-active {
  color: #5b21b6 !important;
  background-color: #ede9fe !important;
  border-color: #c4b5fd !important;
}

.dark .chip-active {
  color: #ddd6fe !important;
  background-color: rgba(76, 29, 149, 0.5) !important;
  border-color: rgba(139, 92, 246, 0.5) !important;
}

/* ---------- 44px minimum touch targets ----------
   Only interactive chips (buttons/links) need the larger target;
   purely decorative chips keep their compact size. */

button.chip,
a.chip,
[role="button"].chip {
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

.chip:focus-visible,
button.chip:focus-visible,
a.chip:focus-visible,
[role="button"].chip:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

.dark .chip:focus-visible,
.dark button.chip:focus-visible,
.dark a.chip:focus-visible,
.dark [role="button"].chip: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) {
  .chip:focus,
  button.chip:focus,
  a.chip:focus,
  [role="button"].chip:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  .dark .chip:focus,
  .dark button.chip:focus,
  .dark a.chip:focus,
  .dark [role="button"].chip:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* ---------- prefers-reduced-motion guard ----------
   The chips may animate on hover (lift/scale) and on state change
   (background/color transitions). Users who prefer reduced motion
   should see state changes instantly, with no motion. */

@media (prefers-reduced-motion: reduce) {
  .chip,
  .chip-active {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Neutralise any hover/focus/active transform on the chips */
  .chip:hover,
  .chip:focus,
  .chip:focus-visible,
  .chip:active,
  .chip-active:hover,
  .chip-active:focus,
  .chip-active:focus-visible,
  .chip-active:active {
    transform: none !important;
    transition: none !important;
  }

  /* Icons inside the chips must not animate either */
  .chip i,
  .chip svg,
  .chip-active i,
  .chip-active svg {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }

  /* Disable any pulse/scale animation on the chips */
  .chip,
  .chip::before,
  .chip::after,
  .chip-active,
  .chip-active::before,
  .chip-active::after {
    animation: none !important;
    transform: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  .chip:focus-visible,
  button.chip:focus-visible,
  a.chip:focus-visible,
  [role="button"].chip:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  .dark .chip:focus-visible,
  .dark button.chip:focus-visible,
  .dark a.chip:focus-visible,
  .dark [role="button"].chip:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

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

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

  .chip-active {
    background: Highlight !important;
    color: HighlightText !important;
    border: 1px solid HighlightText !important;
  }

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