/* ============================================
   InfluenceHub – My profile action buttons a11y
   - Visible :focus-visible ring for #my-profile-create
     and #my-profile-edit inside the #mano-profilis
     section so keyboard users can see which profile
     action is focused.
   - 44px minimum touch target (WCAG 2.5.5) for mobile
     users on both buttons.
   - Dark mode, prefers-reduced-motion and forced-colors
     support.
   ============================================ */

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

#my-profile-create,
#my-profile-edit {
  /* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
}

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

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light button background and the dark-mode surface. */
#my-profile-create:focus-visible,
#my-profile-edit:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* Both buttons use a dark slate fill in light mode – add a white inner
   ring so the violet outline stays visible against the dark fill. */
#my-profile-create:focus-visible,
#my-profile-edit:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

/* ---------- Dark mode ---------- */

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

/* In dark mode both buttons use the brand violet fill – add a dark
   inner ring so the light violet outline stays visible. */
.dark #my-profile-create:focus-visible,
.dark #my-profile-edit:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

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

@supports not selector(:focus-visible) {
  #my-profile-create:focus,
  #my-profile-edit:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  .dark #my-profile-create:focus,
  .dark #my-profile-edit:focus {
    outline-color: #c4b5fd;
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

/* ---------- Small screens: keep the 44px target when stacked ---------- */

@media (max-width: 480px) {
  #my-profile-create,
  #my-profile-edit {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  #my-profile-create,
  #my-profile-edit {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Neutralise any hover/focus transform so no motion is perceived */
  #my-profile-create:hover,
  #my-profile-create:focus,
  #my-profile-create:active,
  #my-profile-edit:hover,
  #my-profile-edit:focus,
  #my-profile-edit:active {
    transform: none !important;
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  #my-profile-create:focus-visible,
  #my-profile-edit:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  .dark #my-profile-create:focus-visible,
  .dark #my-profile-edit:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }
}

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

@media (forced-colors: active) {
  #my-profile-create,
  #my-profile-edit {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  #my-profile-create:hover,
  #my-profile-edit:hover {
    background: Highlight;
    color: HighlightText;
  }

  #my-profile-create:focus-visible,
  #my-profile-edit:focus-visible,
  #my-profile-create:focus,
  #my-profile-edit:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}
