/* ==========================================================================
   ALTENSIA — BETA 5 · version mobile (validée le 2026-11-20)
   Pages concernées : toutes (menu, barre d'actions) ; réglages propres à l'accueil et aux notes.
   Tout est limité aux écrans de 760 px et moins : l'affichage ordinateur ne change pas.
   Le comportement (replis, carrousels, menu, barre d'actions) est posé par js/mobile.js,
   qui ajoute la classe « m-actif » au <body>.
   ========================================================================== */

.m-seul, .m-barre, .m-sommaire, .m-points { display: none; }

@media (max-width: 760px) {
  /* le menu fermé, caché à droite de l'écran, ne fait plus glisser la page sur le côté */
  html, body { overflow-x: clip; }
  .m-actif img { max-width: 100%; }
  .m-seul { display: block; }

  /* ---------- En-tête : une seule bande fine ; le bandeau du haut passe dans le menu ---------- */
  .m-actif .bandeau-haut { display: none; }
  .m-actif .entete .conteneur { min-height: 60px; }
  .m-actif .entete .logo img { height: 40px; width: auto; }
  .m-actif .nav-principale { padding-bottom: 110px; }

  /* ---------- Menu en accordéon ---------- */
  .m-actif .nav-principale > ul > li { position: relative; }
  .m-actif .nav-principale > ul > li > a { padding: 16px 52px 16px 4px; font-weight: 600; }
  .m-deplier {
    position: absolute; top: 4px; right: 0; width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    border: 0; background: none; color: var(--orange); cursor: pointer;
  }
  .m-deplier::before { content: ""; width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
  .m-deplier[aria-expanded="true"]::before { transform: rotate(-135deg) translate(-2px, -2px); }
  .m-actif .nav-principale > ul > li > .sous-menu { display: none !important; }
  .m-actif .nav-principale > ul > li.m-ouvert > .sous-menu { display: block !important; }
  .m-actif .sous-menu a { display: block; padding: 11px 4px; }
  .m-actif .sous-menu .m-voir-domaine a { color: var(--orange); font-weight: 600; }
  .m-menu-plus { display: grid; gap: 0; margin-top: 8px; }
  .m-menu-plus > a { padding: 14px 4px; border-bottom: 1px solid var(--bordure); color: var(--bleu); text-decoration: none; font-weight: 600; font-size: .95rem; }
  .m-langues { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
  .m-langues a { min-width: 48px; padding: 10px 12px; border: 1px solid var(--bordure); border-radius: 6px; text-align: center; color: var(--bleu); text-decoration: none; font-size: .85rem; }
  .m-langues a.actif { background: var(--orange); border-color: var(--orange); color: #fff; }
  .m-langues a { display: inline-flex; align-items: center; justify-content: center; }
  .m-langues .drapeau { width: 26px; height: 17px; box-shadow: 0 0 0 1px rgba(14,42,71,.18); }

  /* ---------- Barre d'actions fixe en bas de l'écran ---------- */
  .m-actif .m-barre {
    display: grid; grid-template-columns: 1fr 1.7fr 1fr; gap: 8px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--bleu); box-shadow: 0 -6px 20px rgba(9, 26, 46, .25);
    transition: transform .25s;
  }
  .m-actif .m-barre.m-sans-tel { grid-template-columns: 2.7fr 1fr; }
  .m-barre a, .m-barre button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 50px; padding: 4px; border: 0; border-radius: 8px; background: none;
    color: #fff; font: inherit; font-size: .72rem; line-height: 1.1; text-decoration: none; cursor: pointer;
  }
  .m-barre svg { width: 22px; height: 22px; }
  .m-barre .m-principal { flex-direction: row; gap: 8px; background: var(--orange); font-size: .9rem; font-weight: 600; }
  .m-actif { padding-bottom: 72px; }
  .m-actif .b5-progression { display: none; }
  /* pied de page : les domaines sont déjà dans le menu */
  .m-actif .pied-grille > div:nth-child(2) { display: none; }
  .m-actif .pied-grille { gap: 24px; }
  .m-actif .pied .marque img { width: 56px; height: 56px; }

  /* ---------- « En savoir plus » ---------- */
  .m-cache { display: none !important; }
  .m-plus {
    display: inline-flex; align-items: center; gap: 10px; margin-top: 18px;
    min-height: 44px; padding: 10px 20px; border: 1.5px solid currentColor; border-radius: 999px;
    background: none; color: var(--orange); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  }
  .m-plus::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
  .m-plus[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-2px); }

  /* ---------- Carrousels : on fait glisser au lieu de défiler ---------- */
  .m-carrousel {
    display: flex !important; grid-template-columns: none !important; flex-wrap: nowrap !important;
    gap: 12px !important; overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding: 0 16px;
    margin-left: -16px !important; margin-right: -16px !important; padding: 4px 16px 10px !important;
    scrollbar-width: none;
  }
  .m-carrousel::-webkit-scrollbar { display: none; }
  .m-carrousel > * { flex: 0 0 84%; min-width: 0; margin: 0 !important; scroll-snap-align: start; }
  .m-carrousel.m-petit > * { flex-basis: 44%; }
  /* les cartes hors champ n'attendent pas l'animation d'apparition */
  .m-carrousel > .recit, .m-carrousel .recit { opacity: 1 !important; transform: none !important; filter: none !important; }
  .m-points { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 8px; }
  .m-points span { width: 6px; height: 6px; border-radius: 3px; background: currentColor; opacity: .25; transition: width .2s, opacity .2s; }
  .m-points span.actif { width: 18px; opacity: 1; background: var(--orange); }

  /* ---------- Accueil ---------- */
  .m-accueil .hero { min-height: 0; }
  .m-accueil .hero .intro, .m-accueil .hero-badges, .m-accueil .hero-schema { display: none; }
  .m-accueil .hero-texte { padding-bottom: 8px; }
  .m-accueil .section, .m-accueil .alt-sectors { padding-top: 48px; padding-bottom: 48px; }
  .m-accueil .entete-section { margin-bottom: 24px; }
  .m-accueil #domaines .carte.domaine { height: auto; }
  .m-accueil .alt-cat { display: block; margin-bottom: 28px; }
  .m-accueil .alt-cat-desc { display: none; }
  .m-accueil #zone .zone-carte { display: none; }
  .m-accueil #zone .zone-carte.m-visible { display: block; }
  .m-accueil #zone .pays-item.m-autre-pays { display: none; }
  .m-accueil #zone.m-tous-pays .pays-item.m-autre-pays { display: grid; }
  .m-lien-texte { display: inline-block; margin-top: 14px; padding: 8px 0; border: 0; background: none; color: var(--orange); font: inherit; font-weight: 600; font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

  /* ---------- Notes techniques ---------- */
  /* l'essentiel en 30 secondes */
  .m-essentiel { margin: 0; padding: 22px 16px 6px; background: var(--blanc, #fff); }
  .m-essentiel .m-essentiel-boite { border-left: 4px solid var(--orange); padding: 14px 16px; background: #F4F6F9; border-radius: 0 8px 8px 0; }
  .m-essentiel p.eyebrow { margin: 0 0 8px; }
  .m-essentiel ul { margin: 0; padding-left: 18px; }
  .m-essentiel li { margin: 6px 0; line-height: 1.45; }
  /* thèmes de l'Appui technique : une ligne de pastilles à faire glisser */
  .m-note .an-bandeaux-grille { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
  .m-note .an-bandeaux-grille::-webkit-scrollbar { display: none; }
  .m-note .an-bandeaux-grille .btn { flex: 0 0 auto; white-space: nowrap; min-height: 40px; padding: 8px 14px; font-size: .8rem; }
  .m-note .an-sousnav-titre { display: none; }
  .m-note .an-hero .ac-meta { display: none; }
  /* sommaire collant */
  .m-note .m-sommaire {
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
    position: sticky; top: 60px; z-index: 20; padding: 10px 16px;
    background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--bordure);
  }
  .m-note .m-sommaire::-webkit-scrollbar { display: none; }
  .m-sommaire a { flex: 0 0 auto; padding: 7px 12px; border: 1px solid var(--bordure); border-radius: 999px; color: var(--bleu); font-size: .78rem; text-decoration: none; white-space: nowrap; }
  .m-sommaire a.actif { border-color: var(--orange); color: var(--orange); }
  /* sections en accordéon : le titre et une phrase, le détail au toucher */
  .m-note .m-acc { padding-top: 0; padding-bottom: 0; border-bottom: 1px solid var(--bordure); scroll-margin-top: 112px; }
  .m-note .m-acc > .wrap { padding-top: 6px; padding-bottom: 6px; }
  .m-note .an-note .m-acc, .m-note .m-acc { padding: 0 !important; }
  .m-note .m-acc .sec-head.m-acc-tete {
    display: grid !important; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; gap: 12px;
    margin: 0 !important; padding: 16px 0; cursor: pointer;
  }
  .m-note .m-acc .sec-head > span:empty { display: none; }
  .m-note .m-acc .sec-head h2 { margin: 0; font-size: 1.15rem; line-height: 1.25; }
  .m-note .m-acc .sec-head .eyebrow { margin: 0 0 4px; font-size: .7rem; }
  .m-note .m-acc .m-chevron { width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1.5px solid var(--orange); background: none; display: flex; align-items: center; justify-content: center; color: var(--orange); cursor: pointer; }
  .m-note .m-acc .m-chevron::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .2s; }
  .m-note .m-acc.m-ouvert .m-chevron::before { transform: rotate(-135deg) translate(-2px, -2px); }
  .m-note .m-acc-corps { padding-bottom: 22px; }
  .m-note .m-acc:not(.m-ouvert) .m-acc-corps { display: none; }
  /* tableaux : une carte par ligne */
  .m-note .m-cartes table, .m-note .m-cartes tbody, .m-note .m-cartes tr, .m-note .m-cartes td { display: block; width: 100%; }
  .m-note .m-cartes thead { display: none; }
  .m-note .m-cartes tr { margin-bottom: 10px; padding: 12px 14px; border: 1px solid var(--bordure); border-radius: 8px; background: #fff; }
  .m-note .m-cartes table { min-width: 0 !important; table-layout: auto; }
  .m-note .m-cartes td { padding: 4px 0; border: 0; white-space: normal !important; overflow-wrap: anywhere; max-width: none; }
  .m-note .m-cartes td:first-child { font-weight: 600; color: var(--bleu); }
  .m-note .m-cartes td[data-libelle]:not(:first-child)::before { content: attr(data-libelle); display: block; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--orange); margin-bottom: 2px; }
  .m-note .table-box.m-cartes { overflow: visible; border: 0; }
  /* fin de note plus courte */
  .m-note .stance h2 { font-size: 1.25rem; }
  .m-note .cta p { display: none; }

  /* ---------- Accueil : panneaux « Donneur d'ordre » / « Installateur » en plein écran ---------- */
  .m-actif .hero-panneau {
    position: fixed; inset: 0; z-index: 200; width: auto; max-width: none; margin: 0;
    padding: calc(64px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
    border: 0; border-radius: 0; background: var(--bleu); box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    transform: translateY(16px);
  }
  .m-actif .hero-panneau.ouvert { transform: none; }
  .m-actif .hero-panneau .hs-fermer {
    position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 1;
    width: 44px; height: 44px; background: var(--orange); border-color: var(--orange);
  }
  .m-actif .hero-panneau .hs-fermer svg { width: 18px; height: 18px; }
  .m-actif .hero-panneau .hs-lien { display: block; margin-top: 18px; padding: 12px 0; }
  /* la page derrière ne défile plus et la barre d'actions s'efface */
  html:has(.m-actif .hero-panneau:not([hidden])), body.m-actif:has(.hero-panneau:not([hidden])) { overflow: hidden; }
  .m-actif:has(.hero-panneau:not([hidden])) .m-barre { display: none; }

  /* ---------- Toucher : liens assez hauts pour le doigt, champs sans zoom automatique (iOS < 16 px) ---------- */
  .pied-grille li a, .pied-bas nav a { display: inline-block; padding: 9px 0; }
  .pied-bas nav { gap: 2px 20px; }
  .fil-ariane a { display: inline-block; padding: 10px 0; margin: -10px 0; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px !important; }
}

/* Écrans tactiles (téléphones et tablettes) : zone de toucher agrandie autour des repères des carrousels */
@media (pointer: coarse) {
  .carrousel-point { box-sizing: content-box; padding: 14px 4px; background-clip: content-box; }
  .carrousel-points { gap: 0; }
}
