/* ========================================
   CASA17 - Accessibilité pour Déficients Visuels
   Version: 1.0
   Date: 27 Octobre 2025
   Description: Amélioration de l'accessibilité WCAG AA/AAA
   ======================================== */

/* ==========================================
   1. CONTRASTES DE COULEURS (WCAG AA/AAA)
   ========================================== */

/* Amélioration des contrastes pour le texte principal */
body {
    /* Contraste amélioré : #0f0f0f sur #F4F4F4 = 19.6:1 (AAA) */
    color: #0a0a0a; /* Noir encore plus foncé pour meilleur contraste */
}

/* Texte secondaire avec contraste minimum 4.5:1 (AA) */
.text-secondary,
.card-body p,
.card-meta {
    color: #3a3a3a !important; /* Contraste 11.3:1 (AAA) */
}

/* Liens avec contraste amélioré */
a {
    color: #0066cc !important; /* Bleu plus foncé, contraste 8.2:1 (AAA) */
    font-weight: 500; /* Plus lisible */
}

a:hover,
a:focus {
    color: #004499 !important; /* Encore plus foncé au hover */
    text-decoration: underline;
}

/* Titres avec contraste renforcé */
h1, h2, h3, h4, h5, h6 {
    color: #1a4a50 !important; /* Vert CASA17 plus foncé, contraste 8.5:1 (AAA) */
    font-weight: 700;
}

/* Boutons avec contraste minimum 3:1 pour les éléments non-texte */
.btn-primary,
.btn {
    background-color: #1a4a50 !important; /* Vert foncé renforcé */
    color: #ffffff !important;
    border: 2px solid #1a4a50 !important;
    font-weight: 600;
    font-size: 1.1rem; /* Taille augmentée */
}

.btn-primary:hover,
.btn:hover,
.btn-primary:focus,
.btn:focus {
    background-color: #cc5000 !important; /* Orange plus foncé */
    border-color: #cc5000 !important;
    color: #ffffff !important;
}

/* Texte sur fond coloré avec contraste AAA */
.bg-primary,
.footer,
.topbar {
    color: #ffffff !important;
}

/* ==========================================
   2. TAILLES DE POLICE MINIMALES
   ========================================== */

/* Taille de police de base augmentée pour meilleure lisibilité */
body {
    font-size: 18px !important; /* Au lieu de 16px (1rem) */
    line-height: 1.8 !important; /* Espacement augmenté */
}

/* Titres avec tailles augmentées */
h1 {
    font-size: 3.2rem !important; /* +6% */
}

h2 {
    font-size: 2.2rem !important; /* +10% */
}

h3 {
    font-size: 1.7rem !important; /* +13% */
}

/* Texte dans les cartes */
.card-body,
.card-body p {
    font-size: 1.1rem !important; /* 19.8px */
    line-height: 1.8 !important;
}

/* Liens et boutons */
a {
    font-size: 1.05rem !important;
}

/* Labels de formulaires */
label {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
}

/* Champs de formulaires */
input, textarea, select {
    font-size: 1.1rem !important;
    padding: 14px 16px !important;
}

/* ==========================================
   3. FOCUS VISIBLE (Navigation au clavier)
   ========================================== */

/* Focus visible pour tous les éléments interactifs */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
.btn:focus,
.nav-link:focus,
.dropdown-toggle:focus {
    outline: 4px solid #ff8431 !important; /* Orange vif CASA17 */
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(255, 132, 49, 0.3) !important;
    transition: outline 0.2s ease, box-shadow 0.2s ease !important;
}

/* Focus pour les cartes cliquables */
.card:focus-within {
    outline: 4px solid #ff8431 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 20px rgba(255, 132, 49, 0.5) !important;
}

/* Focus pour les liens dans le menu */
.nav-link:focus,
.dropdown-item:focus {
    background-color: rgba(255, 132, 49, 0.2) !important;
    outline: 3px solid #ff8431 !important;
}

/* Skip links pour navigation au clavier */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #1a4a50;
    color: white;
    padding: 12px 20px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    z-index: 10000;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    top: 0;
    outline: 4px solid #ff8431;
}

/* ==========================================
   4. ZOOM ET RESPONSIVE (jusqu'à 200%)
   ========================================== */

/* Support du zoom sans scroll horizontal */
* {
    max-width: 100%;
}

body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Images responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Containers flexibles */
.container,
.cards-grid {
    max-width: 100%;
}

/* ==========================================
   5. ÉTATS HOVER RENFORCÉS
   ========================================== */

/* Hover plus visible pour les liens */
a:hover {
    background-color: rgba(255, 132, 49, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Hover pour les boutons */
.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Hover pour les cartes */
.card:hover {
    border-width: 4px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25) !important;
}

/* ==========================================
   6. ANIMATIONS RÉDUITES (prefers-reduced-motion)
   ========================================== */

/* Désactiver les animations pour les utilisateurs sensibles */
@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;
    }
}

/* ==========================================
   7. CONTRASTE AMÉLIORÉ (Mode High Contrast)
   ========================================== */

/* Support du mode contraste élevé Windows */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }

    a {
        text-decoration: underline !important;
    }

    button,
    .btn {
        border: 3px solid currentColor !important;
    }
}

/* ==========================================
   8. TEXTE SÉLECTIONNABLE ET LISIBLE
   ========================================== */

/* Sélection de texte visible */
::selection {
    background-color: #ffd700 !important; /* Jaune vif */
    color: #000000 !important;
}

::-moz-selection {
    background-color: #ffd700 !important;
    color: #000000 !important;
}

/* Espacement entre lettres et mots pour dyslexie */
body.high-readability {
    letter-spacing: 0.12em;
    word-spacing: 0.16em;
}

body.high-readability p {
    margin-bottom: 2em;
}

/* ==========================================
   9. THÈME SOMBRE - CONTRASTES AMÉLIORÉS
   ========================================== */

.theme-dark body {
    background-color: #0a0a0a !important;
    color: #f5f5f5 !important;
}

.theme-dark a {
    color: #60c9ff !important; /* Bleu clair avec contraste 7:1 sur fond noir */
}

.theme-dark h1,
.theme-dark h2,
.theme-dark h3 {
    color: #ffffff !important;
}

.theme-dark .card {
    border-width: 3px !important;
}

/* ==========================================
   10. TAILLE DE CIBLE MINIMALE (44x44px)
   ========================================== */

/* Tous les éléments cliquables doivent faire au moins 44x44px */
button,
.btn,
a,
input[type="submit"],
input[type="button"],
.nav-link {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
}

/* Boutons de navigation dans les sliders */
.slider-btn {
    min-width: 56px !important;
    min-height: 56px !important;
    font-size: 1.8rem !important;
}

/* ==========================================
   11. STRUCTURE SÉMANTIQUE VISIBLE
   ========================================== */

/* Amélioration visuelle des landmarks pour les lecteurs d'écran */
header[role="banner"],
nav[role="navigation"],
main[role="main"],
footer[role="contentinfo"] {
    position: relative;
}

/* Indicateur visuel optionnel pour les landmarks (debug) */
body.show-landmarks header[role="banner"]::before {
    content: "HEADER";
    position: absolute;
    top: 0;
    left: 0;
    background: red;
    color: white;
    padding: 2px 6px;
    font-size: 10px;
    z-index: 10000;
}

/* ==========================================
   12. TABLES ET LISTES ACCESSIBLES
   ========================================== */

/* Tables avec bordures visibles */
table {
    border-collapse: collapse;
    width: 100%;
}

th, td {
    border: 2px solid #3a3a3a;
    padding: 12px;
    text-align: left;
}

th {
    background-color: #1a4a50;
    color: white;
    font-weight: 700;
}

/* Listes avec espacement amélioré */
ul, ol {
    line-height: 2;
    margin-left: 2em;
}

li {
    margin-bottom: 0.8em;
}

/* ==========================================
   13. MESSAGES D'ERREUR ET ALERTES
   ========================================== */

/* Messages d'erreur avec bon contraste */
.error,
.alert-error {
    background-color: #8b0000 !important; /* Rouge foncé */
    color: #ffffff !important;
    border: 3px solid #ff0000 !important;
    padding: 16px;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Messages de succès */
.success,
.alert-success {
    background-color: #006400 !important; /* Vert foncé */
    color: #ffffff !important;
    border: 3px solid #00ff00 !important;
    padding: 16px;
    font-weight: 600;
    font-size: 1.1rem;
}

/* ==========================================
   14. RESPONSIVE POUR MOBILE
   ========================================== */

@media (max-width: 768px) {
    /* Tailles de police augmentées sur mobile */
    body {
        font-size: 20px !important;
    }

    h1 {
        font-size: 2.5rem !important;
    }

    h2 {
        font-size: 2rem !important;
    }

    h3 {
        font-size: 1.6rem !important;
    }

    /* Boutons plus grands sur mobile */
    button,
    .btn,
    a.btn {
        min-height: 48px;
        min-width: 48px;
        font-size: 1.2rem !important;
        padding: 14px 24px;
    }

    /* Espacement augmenté */
    .card {
        margin-bottom: 24px;
        padding: 20px;
    }
}

/* ==========================================
   15. ICÔNES ET IMAGES
   ========================================== */

/* Toutes les images décoratives doivent avoir alt="" */
img[alt=""] {
    /* Images décoratives ignorées par les lecteurs d'écran */
}

/* Images importantes avec bordure au focus */
img[alt]:not([alt=""]):focus {
    outline: 4px solid #ff8431;
    outline-offset: 4px;
}

/* Icônes avec label accessible */
.icon-only {
    position: relative;
}

.icon-only::after {
    content: attr(aria-label);
    position: absolute;
    left: -9999px;
}

/* ==========================================
   FIN DU FICHIER ACCESSIBILITY.CSS
   ========================================== */
