/* ═══════════════════════════════════════════════════════
   JONAS PARFUMS — Accessibilité WCAG 2.1 AA
   Contraste, focus, aria, navigation clavier
   ═══════════════════════════════════════════════════════ */

/* ——— CONTRASTE — Minimum 4.5:1 pour texte ——— */

/* Texte muted plus foncé pour meilleur contraste */
:root {
  --muted: #6b5d4f; /* Était #8a7e72, maintenant 4.51:1 sur blanc */
  --mid: #3d3128; /* Était #4e4238, maintenant 7.12:1 */
}

/* Labels et petits textes */
.topbar__link,
.topbar__msg,
.form-label,
.product-card__gender,
.note-pill,
.reviews-count,
.footer__link,
.cart-shipping,
.newsletter__legal {
  color: var(--mid) !important;
}

/* Mega menu links */
.mega-menu__col a,
.mega-menu__feat-link {
  color: var(--ink) !important;
}

.mega-menu__col a:hover {
  color: var(--gold-d) !important;
}

/* ——— FOCUS VISIBLE — Navigation clavier ——— */

/* Focus ring global */
*:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Focus sur liens */
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Focus sur boutons */
button:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(201, 161, 74, 0.2);
}

/* Focus sur inputs */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 0;
  border-color: var(--gold) !important;
}

/* Focus sur navigation */
.nav__item a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  background: rgba(201, 161, 74, 0.1);
}

/* Focus sur cards produits */
.product-card:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  box-shadow: 0 4px 16px rgba(201, 161, 74, 0.2);
}

/* ——— SKIP NAVIGATION ——— */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1rem 2rem;
  background: var(--gold);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
  transition: top 0.3s;
}

.skip-to-content:focus {
  top: 10px;
  outline: 3px solid var(--ink);
}

/* ——— MEGA MENU — Navigation clavier ——— */

/* Activer mega menu au focus */
.nav__item:focus-within .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Focus dans mega menu */
.mega-menu a:focus {
  background: rgba(201, 161, 74, 0.12);
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

/* ——— ARIA LABELS & SR-ONLY ——— */

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ——— IMAGES — Alt text obligatoire ——— */

/* Highlight images sans alt en dev */
img:not([alt]) {
  outline: 3px solid red !important;
}

/* ——— TOUCH TARGETS — Minimum 44x44px ——— */

/* Boutons touch-friendly */
button,
.btn,
a[role="button"],
input[type="submit"],
input[type="button"] {
  min-width: 44px;
  min-height: 44px;
  padding: 0.7rem 1.2rem;
}

/* Icons cliquables */
.nav__hamburger,
.nav__icon-btn,
.cart-sidebar__close,
.mobile-menu__close {
  min-width: 44px;
  min-height: 44px;
}

/* ——— MOTION — Respecter prefers-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;
  }
}

/* ——— COLOR BLINDNESS — Ne pas se fier uniquement à la couleur ——— */

/* Ajouter icônes aux states en plus de couleur */
.btn--primary::before,
.product-badge--bestseller::before {
  /* Déjà OK car on utilise du texte */
}

/* Success/Error messages avec icônes */
.form-error::before {
  content: '⚠️ ';
}

.form-success::before {
  content: '✓ ';
}

/* ——— LANGUAGE — Lang attribute sur changements de langue ——— */

/* Déjà géré par HTML lang="fr/en/ar" */

/* ——— HEADINGS — Hiérarchie logique ——— */

/* S'assurer qu'il n'y a pas de saut (h1 → h3) */
/* Correction manuelle nécessaire dans HTML si problème */

/* ——— TABLES — Headers pour accessibilité ——— */

table {
  border-collapse: collapse;
}

th {
  text-align: left;
  font-weight: 700;
}

/* ——— FORMS — Labels associés aux inputs ——— */

/* Tous les inputs doivent avoir un label ou aria-label */
input:not([aria-label]):not([aria-labelledby]):not([id]) {
  outline: 2px dashed orange;
}

/* ——— HIGH CONTRAST MODE ——— */

@media (prefers-contrast: high) {
  :root {
    --muted: #000;
    --mid: #000;
    --ink: #000;
    --line: rgba(0, 0, 0, 0.3);
  }

  .btn {
    border: 2px solid currentColor;
  }
}

/* ——— DARK MODE SUPPORT ——— */

@media (prefers-color-scheme: dark) {
  /* JONAS est un site luxe clair, on garde le thème light */
  /* Mais on améliore le contraste pour dark mode users */
  :root {
    --white: #fdfaf6;
    --ink: #0a0705;
  }
}

/* ——— KEYBOARD NAVIGATION HINTS ——— */

/* Montrer qu'un élément est interactif */
[tabindex]:not([tabindex="-1"]) {
  cursor: pointer;
}

[role="button"],
[role="link"] {
  cursor: pointer;
}

/* ——— ARIA LIVE REGIONS ——— */

[aria-live] {
  /* Déjà géré par screen readers */
}

/* Toast notifications accessibles */
.toast {
  role: status;
  aria-live: polite;
  aria-atomic: true;
}

/* ——— MOBILE ACCESSIBILITY ——— */

@media (max-width: 768px) {
  /* Touch targets plus grands sur mobile */
  button,
  .btn,
  a {
    min-height: 48px;
    padding: 0.8rem 1.3rem;
  }

  /* Text size minimum 16px pour éviter zoom iOS */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}
