/* layout.css — structure physique pure (reset, conteneurs, grille, ratios). */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

img,
iframe {
    max-width: 100%;
    display: block;
}

ul {
    list-style: none;
}

button {
    font: inherit;
    cursor: pointer;
}

/* L'attribut hidden l'emporte toujours sur un display de composant (menus
   de l'en-tête, menu mobile, alerte, messages du formulaire). */
[hidden] {
    display: none !important;
}

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

/* Conteneur générique (design nv2) : 1200 px de large au plus, centré,
   marges latérales de 16 px sur mobile et 32 px dès 760 px. */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

@media (min-width: 760px) {
    .container {
        padding: 0 32px;
    }
}

/* Contenu principal : les pages commencent par le hero commun (sans marge
   au-dessus) ; les sections portent leurs propres espacements. */
main {
    padding: 0;
}

/* Ratio fluide pour les images (les vidéos : façade .video-youtube) */
.img-fluid {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* =================================================================
   Mécanique du lecteur photo (components/media/gallery.php) :
   défilement horizontal à crans (scroll-snap), barre de défilement
   masquée. Largeurs et ratios par variante : components.css (le nombre
   de photos visibles y est fixé par palier, en % du conteneur, pour
   qu'aucune photo ne soit coupée au repos).
   ================================================================= */
.gallery-scroll {
    --gallery-gap: 12px;
    display: flex;
    gap: var(--gallery-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    /* Scrollbar masquée (le défilement souris/tactile reste actif). */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-scroll::-webkit-scrollbar {
    display: none;
    height: 0;
}

.gallery-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-trigger {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

/* Contour de focus clavier (règle globale :focus-visible, voir theme.css) :
   le bouton remplit tout .gallery-item (overflow: hidden), un contour
   extérieur serait rogné — on le rentre à l'intérieur de l'image. */
.gallery-item-trigger:focus-visible {
    outline-offset: -4px;
}

/* Flèches gauche/droite (style unique .gallery-arrow, theme.css) : rondes,
   centrées verticalement, en position absolue dans la lightbox ; dans le
   lecteur photo, en ligne de part et d'autre des photos (components.css). */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

/* Butée (début ou fin de liste) : même bleu, nettement estompé, sans
   survol possible (jamais confondu avec l'état survolé blanc). */
.gallery-arrow.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* Lecteur grand écran (lightbox photo) */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    /* `visibility` ne bascule sur "hidden" qu'une fois le fondu de sortie
       terminé (délai = durée du fondu) : sans ce décalage, la disparition
       serait instantanée et couperait la transition d'opacity à la
       fermeture. À l'ouverture (.is-open), le délai est remis à 0 pour que
       l'élément redevienne interactif immédiatement. */
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--border-radius);
    transform: scale(0.97);
    transition: transform 0.3s ease;
}

.lightbox.is-open .lightbox-image {
    transform: scale(1);
}

/* Mode une image (photos des solutions, prompt 024 ; lecteur-produit.html) :
   pas de flèches, nom de la solution sous la photo (#lightbox-caption, créé
   par gallery.js). La légende laisse passer les clics vers le voile : un
   clic hors de la photo et des boutons ferme le lecteur. */
.lightbox--single {
    flex-direction: column;
    gap: 18px;
    padding: 72px 16px 32px;
}

.lightbox--single .lightbox-image {
    min-height: 0;
    max-height: calc(100% - 50px);
    box-shadow: var(--shadow-lightbox);
}

.lightbox-caption {
    margin: 0;
    color: var(--color-white);
    font-family: var(--font-condensed);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    pointer-events: none;
}

@media (min-width: 760px) {
    .lightbox--single {
        padding: 80px 60px 48px;
    }

    .lightbox-caption {
        font-size: 24px;
    }
}

/* Croix ✕ en haut à droite : rond .gallery-arrow (forme et couleurs),
   seule sa position change (prompt 023). */
.lightbox-close {
    top: 16px;
    right: 16px;
    z-index: 2;
    transform: none;
}

/* Flèches précédente/suivante : mêmes ronds de 46 px que le lecteur photo
   de l'accueil (style unique .gallery-arrow, theme.css), en position fixe
   de part et d'autre de la photo, quelle que soit sa largeur affichée (voir
   .lightbox-image, centrée par le flex de .lightbox) -- ne bougent donc
   jamais pendant le glissement entre 2 photos (voir assets/js/gallery.js). */
.lightbox-arrow {
    z-index: 1;
    width: 46px;
    height: 46px;
}

.lightbox-arrow--prev {
    left: 1rem;
}

.lightbox-arrow--next {
    right: 1rem;
}

@media (max-width: 640px) {
    .lightbox-arrow--prev {
        left: 0.5rem;
    }

    .lightbox-arrow--next {
        right: 0.5rem;
    }
}

/* =================================================================
   Page Formations (design nv2, prompt 022 ; maquette formations.html) :
   référent, carte Qualiopi (logo officiel + mention obligatoire à gauche,
   mentions légales à droite dès 760 px), thèmes en lignes numérotées,
   cartes des indicateurs de résultats. Galerie portrait : components.css.
   ================================================================= */
.formation-referent {
    margin-top: 6px;
    padding: 12px 22px;
    border-radius: 10px;
    background-color: var(--color-section-alt);
    color: var(--color-navy);
}

.section-text .formation-referent {
    color: var(--color-navy);
}

.qualiopi-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    max-width: 980px;
    margin: 40px auto 0;
    padding: 26px 22px;
    border: 2px solid var(--color-navy);
    border-radius: var(--border-radius);
    background-color: var(--color-white);
}

.qualiopi-card-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.qualiopi-card-logo img {
    display: block;
    width: 220px;
    max-width: 100%;
    height: auto;
}

.qualiopi-card-mention {
    margin: 0;
    color: var(--color-text-body);
    font-size: 13px;
    line-height: 1.45;
}

.qualiopi-card-mention strong {
    color: var(--color-navy);
    letter-spacing: 0.02em;
}

.qualiopi-card-infos {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.qualiopi-mentions p {
    margin: 0 0 12px;
    color: var(--color-text-body);
    font-size: 16px;
    line-height: 1.6;
}

.qualiopi-certificat-btn {
    --btn-cut: 14px;
    gap: 12px;
    padding: 14px 28px 14px 22px;
    font-size: 18px;
}

.indicateurs-grid {
    max-width: 820px;
    margin: 40px auto 0;
}

.indicateur-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 28px;
    border: 2px solid var(--color-navy);
    border-radius: var(--border-radius);
    background-color: var(--color-white);
    text-align: center;
}

.indicateur-card-label {
    margin: 0;
    color: var(--color-link);
    font-family: var(--font-condensed);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.indicateur-card-year {
    margin: 0;
    color: var(--color-navy);
    font-family: var(--font-heading);
    font-size: 52px;
    line-height: 1;
}

@media (min-width: 760px) {
    .qualiopi-card {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 40px;
        padding: 34px 38px;
    }
}

/* =================================================================
   Vidéo YouTube — façade (voir components/media/video-youtube.php et
   assets/js/video.js, D-035). Boîte 16:9 FIXE : la vignette, le bouton, la
   mention puis l'iframe occupent la même surface, sans décalage de mise en
   page. Le bouton couvre toute la vignette (grande cible) ; la mention est
   un bandeau au bas de la vignette, au-dessus du bouton (lien cliquable).
   Style PROVISOIRE (étape 5).
   ================================================================= */
.video-youtube {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

/* Dans une carte déjà dimensionnée en 16:9 (accueil, page produit), la
   façade en prend toute la hauteur. */
.about-video .video-youtube {
    height: 100%;
}

.video-youtube-poster,
.video-youtube-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-youtube-poster {
    object-fit: cover;
}

.video-youtube-play {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
}

.video-youtube-play:focus-visible {
    outline-offset: -4px;
}

.video-youtube-play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
}

.video-youtube-notice {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    margin: 0;
    padding: 0.4rem 0.75rem;
    text-align: center;
}

.video-youtube-notice a {
    display: inline-block;
    padding: 0.25rem 0;
}

.video-youtube-noscript {
    position: absolute;
    top: 0.75rem;
    left: 0;
    right: 0;
    z-index: 2;
    text-align: center;
}

/* Barre de suggestion de langue (voir components/ui/lang-suggest.php, D-023) :
   NON modale, fixe en bas de l'écran (aucun décalage de mise en page), au-
   dessus de l'en-tête mais sous le menu mobile et la lightbox. Tant qu'elle
   est visible, lang.js pose html.has-lang-suggest et la variable
   --lang-suggest-offset (hauteur de la barre) : le bas de page reste
   atteignable et un élément focalisé n'est jamais masqué (WCAG 2.4.11).
   Style minimal : design final à l'étape 5. */
.lang-suggest {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem 1rem;
    padding: 0.5rem max(1rem, env(safe-area-inset-right)) calc(0.5rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    text-align: center;
}

.lang-suggest[hidden] {
    display: none;
}

.lang-suggest-message {
    margin: 0;
}

.lang-suggest-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Cibles tactiles ≥ 44 px (WCAG 2.5.8 / 2.5.5). */
.lang-suggest-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.75rem;
}

.lang-suggest-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    cursor: pointer;
    font-size: 1.125rem;
    line-height: 1;
}

html.has-lang-suggest {
    scroll-padding-bottom: var(--lang-suggest-offset, 0px);
}

html.has-lang-suggest body {
    padding-bottom: var(--lang-suggest-offset, 0px);
}

@keyframes lang-suggest-in {
    from {
        transform: translateY(100%);
    }

    to {
        transform: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .lang-suggest:not([hidden]) {
        animation: lang-suggest-in 0.2s ease-out both;
    }
}

/* Fil d'Ariane (voir components/catalogue/breadcrumb.php, D-07) : en haut des pages
   catégorie et produit ; libellés longs renvoyés à la ligne (aucun
   débordement). Style minimal : placement et design finaux à l'étape 5. */
.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.breadcrumb-item a {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
}

/* Page 404 (components/errors/error-404.php, maquette page-404.html,
   prompt 030) : fond « reflet métallique » quadrillé du bandeau, contenu
   centré sur 560 px de haut au moins ; grand « 404 » décoratif en bleu
   principal, titre en bleu texte (contraste AA), barrette, phrase en noir,
   bouton de retour (.btn-primary--back, components.css). */
.error-404 {
    position: relative;
    background: var(--hero-gradient);
    border-bottom: 1px solid var(--color-border);
}

.error-404::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--hero-grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--hero-grid-line) 1px, transparent 1px);
    background-size: 48px 48px;
}

.error-404-inner {
    position: relative;
    max-width: 900px;
    min-height: 560px;
    margin: 0 auto;
    padding: 72px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-404-code {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(110px, 16vw, 200px);
    line-height: 0.9;
    letter-spacing: 0.02em;
    color: var(--color-blue);
}

.error-404-title {
    margin: 10px 0 0;
    font-size: clamp(36px, 5vw, 60px);
    line-height: 1.04;
    text-transform: uppercase;
    color: var(--color-link);
    overflow-wrap: break-word;
    max-width: 100%;
}

.error-404-bar {
    display: block;
    width: 72px;
    height: 6px;
    margin-top: 18px;
    background-color: var(--color-blue);
    clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}

.error-404-message {
    max-width: 560px;
    margin: 24px 0 0;
    font-size: 19px;
    line-height: 1.6;
    color: var(--color-black);
}

.error-404-home {
    margin-top: 34px;
}

/* Mouvement réduit : pas de défilement animé (l'animation d'entrée en
   cascade des sections est supprimée par le design nv2 : animations
   sobres, aucune animation lourde). */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    /* Lightbox : ouverture et fermeture sans fondu ni zoom (le voile,
       lui, reste identique). */
    .lightbox,
    .lightbox.is-open,
    .lightbox-image {
        transition: none;
    }
}
