/* Accessibilité : règles communes à toutes les pages (19/11/2026). Feuille chargée en dernier. */

/* Focus visible au clavier là où aucune règle ne le prévoit (RGAA 10.7). Poids nul (:where) : toute règle existante,
   y compris une règle qui retire le contour, garde la main. */
:where(:focus-visible):where(:not([tabindex="-1"])) {
    outline: 3px solid #1565c0;
    outline-offset: 2px;
}

/* Fenêtre ou panneau visé par programme à son ouverture (js/a11y-base.js) : pas de cadre autour de toute la fenêtre */
.a11y-cible:focus {
    outline: none;
}

/* Titre de carte : le lien rend la carte atteignable au clavier sans changer son aspect (RGAA 7.3) */
.carte-lien,
.carte-lien:visited,
.carte-lien:hover {
    color: inherit;
    text-decoration: none;
}

/* Panneaux « Collections » et « Portfolio » fermés : glissés hors écran, donc aussi retirés du parcours au clavier et
   de la lecture d'écran (RGAA 10.8). La visibilité ne change qu'à la fin du glissement de fermeture. */
.favorites-panel,
.portfolio-panel {
    visibility: hidden;
    transition: transform var(--duration-medium4, 0.4s) var(--easing-emphasized, ease),
        visibility 0s linear var(--duration-medium4, 0.4s);
}

.favorites-panel.open,
.portfolio-panel.open {
    visibility: visible;
    transition: transform var(--duration-medium4, 0.4s) var(--easing-emphasized, ease), visibility 0s;
}

/* Trois champs retiraient leur contour au focus et ne gardaient qu'un changement de bordure ou d'ombre peu visible */
.search-input:focus-visible,
.hero-section .search-input:focus-visible,
.modal-body textarea:focus-visible,
.form-group textarea:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
}

/* ── Corrections après l'audit RGAA du 19/11/2026 ───────────────────────────────────────────────────── */

/* RGAA 10.8, 10.7, 12.8 — Alerte IDT fermée : glissée hors écran, donc aussi retirée du parcours au clavier et de la
   lecture d'écran. La visibilité ne change qu'à la fin du glissement de fermeture. */
.idt-alert {
    visibility: hidden;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.5s;
}

.idt-alert.show {
    visibility: visible;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
}

/* RGAA 3.2 — Alerte IDT : texte blanc sur un dégradé de mêmes teintes, assombri jusqu'à 4,5:1 en tout point
   (avant : #b42276, #e27ea9, #12b1df, soit 2,5:1 sur le cyan). Le lien n'éclaircit plus son fond. */
.idt-alert {
    background: linear-gradient(135deg, #b42276 0%, #d2397b 50%, #0d80a2 100%);
}

.idt-alert-text p {
    opacity: 1;
}

.idt-link {
    background: rgba(0, 0, 0, 0.15);
}

.idt-link:hover {
    background: rgba(0, 0, 0, 0.28);
}

/* RGAA 10.7 — Alerte IDT : contour de focus blanc sur le dégradé */
.idt-alert :focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* RGAA 3.2 — Accueil, pastille « Avec IA » : texte blanc sur le dégradé assombri (avant : #d0559a, #12b2de, 2,5:1) */
.home-mode-thumb {
    background: linear-gradient(120deg, #ac2777 0%, #ca408e 48%, #0d80a0 100%);
}

/* RGAA 3.2 — Rouge des messages d'erreur sur leur fond rose (#ffebee) : #d32f2f (4,36:1) devient #c62828 (4,92:1) */
:root {
    --error: #c62828;
}

/* RGAA 3.3 — Bordure des zones de texte des fenêtres : seul repère du champ (avant : #c0c4c8, 1,75:1) */
.modal-body textarea {
    border-color: #8a8f98;
}

/* RGAA 10.6 — Lien placé dans une phrase du pied de page : souligné, il ne se distingue plus par la seule couleur */
.footer-section p a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* RGAA 3.3, 10.7 — Focus sur un fond sombre : contour blanc (le contour bleu par défaut ne s'y voit pas).
   Bandeau des fiches (boutons Collections, Note, PDF), bandeau du plan d'action, en-tête de la fiche structure. */
.article-header .article-actions :focus-visible,
.implementation-header :focus-visible,
#institutionalModal .imodal-header :focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* RGAA 10.7 — Boutons flottants (IDT, « Vos données ») : posés sur un fond clair ou sombre selon la page et le
   défilement, ils prennent un contour double, bleu nuit puis blanc, visible dans les deux cas */
.idt-float-btn:focus-visible,
.gdpr-choix-btn:focus-visible {
    outline: 3px solid #193461;
    outline-offset: 2px;
    box-shadow: 0 0 0 8px #fff !important;
}

/* RGAA 10.12 — Carte de ressource : un titre au texte espacé ne pousse plus le label IDT hors de la carte */
.resource-card-header .resource-card-title {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* RGAA 10.14 — Cartes de l'explorateur : le libellé des boutons, montré au survol, l'est aussi au focus du clavier */
.resource-card-actions .btn-secondary:focus-visible {
    padding: 10px 16px;
    gap: 8px;
}

.resource-card-actions .btn-secondary:focus-visible .btn-text {
    opacity: 1;
    max-width: 120px;
}

/* RGAA 8.9 — Fiche d'une ressource de réflexion : l'astuce passe à la ligne sans double <br> */
.implementation-content .texte-suite {
    display: block;
    margin-top: 1.5em;
}

/* ════ 20/11/2026 ═══════════════════════════════════════════════════════════════════════════════════════════════ */

/* RGAA 10.7 — Focus du clavier toujours visible, sur fond clair comme sur fond sombre : contour bleu nuit doublé d'un
   liseré blanc. Règle prioritaire : elle l'emporte sur les règles qui retiraient ou affaiblissaient le contour. */
:focus-visible:not([tabindex="-1"]):not(.a11y-cible) {
    outline: 3px solid #193461 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 5px #fff !important;
}

/* Bouton « Contraste renforcé », à côté du lien « Accessibilité » (js/a11y-base.js) : même aspect qu'un lien du pied */
.a11y-contraste {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.a11y-contraste[aria-pressed="true"]::after {
    content: " (activé)";
}

/* RGAA 3.2 et 3.3 — Contraste renforcé, au choix de l'utilisateur : texte noir sur fond blanc partout, liens soulignés
   en bleu foncé, contour noir des boutons et des champs, ni dégradé, ni image de fond, ni ombre. Les images, les
   pictogrammes dessinés et la carte restent tels quels. Les éléments sélectionnés passent en blanc sur noir. */
html.contraste-renforce,
html.contraste-renforce body {
    background: #fff !important;
    color: #000 !important;
}

html.contraste-renforce body :where(*:not(img, svg, svg *, video, canvas, iframe, picture, .leaflet-container, .leaflet-container *)) {
    color: #000 !important;
    -webkit-text-fill-color: currentColor !important;
    background-color: #fff !important;
    background-image: none !important;
    background-clip: border-box !important;
    border-color: #000 !important;
    text-shadow: none !important;
    box-shadow: none !important;
    filter: none !important;
}

html.contraste-renforce body :where(*:not(img, svg, svg *, video, canvas, iframe, .leaflet-container *))::before,
html.contraste-renforce body :where(*:not(img, svg, svg *, video, canvas, iframe, .leaflet-container *))::after {
    color: #000 !important;
    -webkit-text-fill-color: currentColor !important;
    background: transparent !important;
    border-color: #000 !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

html.contraste-renforce body a,
html.contraste-renforce body a * {
    color: #0b2a6b !important;
}

html.contraste-renforce body a {
    text-decoration: underline !important;
}

html.contraste-renforce body :is(button, select, textarea, summary, [role="button"], [role="tab"],
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"])) {
    box-shadow: inset 0 0 0 2px #000 !important;
}

html.contraste-renforce body :is(input[type="checkbox"], input[type="radio"], input[type="range"]) {
    accent-color: #000 !important;
}

html.contraste-renforce body ::placeholder {
    color: #4d4d4d !important;
    -webkit-text-fill-color: #4d4d4d !important;
    opacity: 1 !important;
}

html.contraste-renforce body :is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], [aria-current="true"], [aria-current="step"]),
html.contraste-renforce body :is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], [aria-current="true"], [aria-current="step"]) :where(*:not(img, svg, svg *)) {
    background-color: #000 !important;
    color: #fff !important;
}

/* Calques décoratifs repérés par js/a11y-base.js : transparents, pour ne jamais cacher la page */
html.contraste-renforce body .a11y-decor,
html.contraste-renforce body .a11y-decor::before,
html.contraste-renforce body .a11y-decor::after {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

/* Choix fait par un bouton radio ou une case dont le repère visuel est un calque décoratif (interrupteur « Avec IA /
   Sans IA » de l'accueil) : le libellé choisi passe en blanc sur noir */
html.contraste-renforce body input:checked + label,
html.contraste-renforce body input:checked + label * {
    background-color: #000 !important;
    color: #fff !important;
}

html.contraste-renforce body .a11y-contraste[aria-pressed="true"] {
    padding: 0 4px;
}

/* RGAA 10.4 et 10.11 — Sur un écran de 960 pixels de large ou moins (ou un grand écran agrandi à 200 %), le nom du
   site reste écrit et le menu garde ses libellés sous les pictogrammes, sur deux lignes si besoin. L'en-tête cesse
   alors d'être fixe : il remonte avec la page au lieu d'en cacher le haut. */
@media (max-width: 960px) {
    body {
        padding-top: 0 !important;
    }

    .header {
        position: relative !important;
        top: 0 !important;
    }

    .filter-bar,
    .cat-filters-panel,
    .phase-selector.impl-frise {
        top: 0 !important;
    }

    #main-navigation .nav-container {
        flex-wrap: wrap;
        row-gap: 4px;
        padding: 8px 12px !important;
    }

    #main-navigation .nav-brand .brand-text {
        display: inline !important;
        opacity: 1 !important;
        transform: none !important;
        width: auto !important;
        overflow: visible !important;
        font-size: 1.25rem !important;
    }

    #main-navigation .nav-actions {
        margin-left: auto;
    }

    #main-navigation .nav-menu {
        order: 3;
        flex: 1 1 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2px 4px !important;
    }

    #main-navigation .nav-link {
        font-size: 12px !important;
        line-height: 1.25 !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 2px !important;
        min-width: 0 !important;
        padding: 6px !important;
        white-space: normal !important;
        text-align: center !important;
    }

    #main-navigation .nav-link .material-icons {
        margin: 0 !important;
        font-size: 20px !important;
    }
}

/* RGAA 10.12 — Texte espacé par l'utilisateur : les mots longs des titres passent à la ligne au lieu de déborder de
   l'écran, les titres de « Mes plans en cours » ne sont plus coupés après deux lignes, les tuiles de chiffres et les
   onglets de l'explorateur s'adaptent à leur contenu. */
:is(h1, h2, h3, h4, h5, h6) {
    overflow-wrap: anywhere;
}

.my-plans-card-title {
    display: block !important;
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
    max-height: none !important;
}

.hero-stat > *,
.tab-btn,
.tab-btn * {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* RGAA 10.11 — Page « Interface de données » : les exemples de code passent à la ligne au lieu de défiler de côté */
@media (max-width: 960px) {
    .rgpd-section pre,
    .rgpd-section pre code {
        white-space: pre-wrap !important;
        overflow-wrap: anywhere !important;
        word-break: break-word;
    }
}
/* Contraste renforcé : le texte de la boîte de l'accueil ne touche pas le bord (20/11/2026) */
html.contraste-renforce #homeSituation{padding:14px 16px !important}
/* ════ 21/11/2026 : retours des huit parcours de test ════════════════════════════════════════════════════════════ */

/* Contraste renforcé — boutons d'aspect « lien » sans marge intérieure (repérés par js/a11y-base.js) : leur cadre noir
   collait au texte (« Modifier », « Nouvelle recherche », « Enregistrer dans un fichier », « Retirer »…) */
html.contraste-renforce body .a11y-marge {
    padding: 4px 10px !important;
    border-radius: 6px !important;
}

/* Contraste renforcé — messages flottants : fond blanc opaque et bordure noire (sans bordure, ils se confondaient avec
   le texte de la page qu'ils recouvraient) */
html.contraste-renforce body :is(.toast, .gdpr-toast, .dossier-toast) {
    border: 2px solid #000 !important;
    background-color: #fff !important;
}

/* La zone qui les contient reste transparente (en blanc, elle cachait la pastille « Vos données ») */
html.contraste-renforce body .toast-container {
    background-color: transparent !important;
    border-color: transparent !important;
}

/* Contraste renforcé — fenêtres : voile sombre derrière (la page passait en blanc et la fenêtre s'y confondait), cadre
   noir épais autour */
html.contraste-renforce body :is(.modal, .modal-overlay, .splash-overlay, .help-modal),
html.contraste-renforce body .construction-modal > .construction-modal-overlay,
html.contraste-renforce body .confirmation-modal > .confirmation-modal-overlay {
    background-color: rgba(0, 0, 0, 0.65) !important;
}

html.contraste-renforce body :is(.modal-content, .imodal-card, .splash-modal, .help-modal-content, .construction-modal-content, .confirmation-modal-content) {
    border: 3px solid #000 !important;
}

/* Contraste renforcé — interrupteur « Avec IA / Sans IA » de la page d'analyse : le mode actif en blanc sur noir */
html.contraste-renforce body .as-mode-etat,
html.contraste-renforce body .as-mode-etat * {
    background-color: #000 !important;
    color: #fff !important;
}

html.contraste-renforce body .as-mode-etat {
    padding: 4px 10px;
    border-radius: 999px;
}

html.contraste-renforce body .as-mode-puce {
    padding: 4px;
}

/* Bandeau « Vos données » sur téléphone et tablette (21/11/2026 : 30 % d'un écran de 640 px, un tiers d'une tablette) :
   le titre et « En savoir plus » sur une ligne, le texte replié (trois lignes, deux sur un écran bas), marges réduites.
   Le texte entier reste lu par les lecteurs d'écran ; « En savoir plus » le déplie (js/splash-screens.js). */
@media (max-width: 900px) {
    .gdpr-banner-content {
        gap: 8px !important;
    }

    .gdpr-banner-text {
        gap: 0;
    }

    .gdpr-text-content {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 12px;
    }

    .gdpr-text-content h4,
    .gdpr-text-content h2 {
        flex: 1 1 auto;
        margin-bottom: 2px;
        font-size: 15px;
    }

    .gdpr-text-content .gdpr-plus {
        order: 1;
        display: inline-flex;
        align-items: center;
        min-height: 36px;
        margin: 0;
        padding: 4px 0;
        border: 0;
        background: none;
        color: var(--primary-color);
        font: inherit;
        font-size: 13px;
        font-weight: 600;
        text-decoration: underline;
        cursor: pointer;
    }

    .gdpr-text-content p {
        order: 2;
        flex: 1 1 100%;
        line-height: 1.45;
    }

    .gdpr-banner:not(.is-deplie) .gdpr-text-content p {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        overflow: hidden;
    }

    .gdpr-banner.is-deplie .gdpr-text-content p {
        max-height: 45vh;
        overflow-y: auto;
    }
}

@media (max-width: 900px) and (max-height: 760px) {
    .gdpr-banner:not(.is-deplie) .gdpr-text-content p {
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .gdpr-banner-actions .gdpr-btn {
        padding-top: 8px;
        padding-bottom: 8px;
    }
}

/* Cibles tactiles (21/11/2026) : 44 px pour les boutons du menu et du portfolio, liens du pied de page plus hauts */
@media (max-width: 900px), (pointer: coarse) {
    #main-navigation .nav-link {
        min-width: 44px;
        min-height: 44px;
    }

    .portfolio-item-actions .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }

    .gdpr-btn,
    .gdpr-toast-btn {
        min-height: 44px;
    }

    .footer-section li a {
        display: inline-block;
        padding-top: 6px;
        padding-bottom: 6px;
    }
}
