/* ============================================================
   BARGHACH PICTURES — Version téléphone
   ------------------------------------------------------------
   Chargée en dernier sur chaque page. Tout ce qui suit est
   enfermé sous 768 px, sauf la règle .m-only juste en dessous
   (elle cache sur ordinateur les petits éléments ajoutés pour
   le téléphone : titre de rail, compteur, « Lire la suite »…).

   Direction : un site pensé pour l'iPhone, pas le site PC
   réduit. Premier écran plein cadre, en-tête qui s'efface,
   rails horizontaux de grandes cartes, peu de texte visible,
   des sections qui ne se ressemblent pas.
   (Première tentative, plus « réduite » : _archive/mobile-v1/.)
   ============================================================ */

.m-only { display: none !important; }

@media (max-width: 767px) {

    .m-only { display: revert !important; }

    /* ============================================================
       0. HYGIÈNE
       ============================================================ */
    html { font-size: 16px; -webkit-text-size-adjust: 100%; }
    :root {
        --header-height: 64px;
        --m-gouttiere: 20px;
        --m-carte: 80vw;
    }
    body { overflow-x: clip; }

    /* Un champ sous 16 px fait zoomer l'iPhone sur toute la page */
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    select,
    textarea { font-size: 16px !important; }

    /* Rien n'apparaît en glissant : le contenu est là, tout de suite */
    .peut-apparaitre .reveal,
    .mg-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    /* Le survol « colle » après un toucher : aucune carte ne saute */
    .wd-pack-card:hover, .wd-gallery-item:hover, .wd-gallery-item:hover img,
    .fi-poster-media:hover, .social:hover svg, .stage-link:hover::after {
        transform: none;
    }

    /* ============================================================
       1. EN-TÊTE — il accompagne, il n'occupe pas
       ------------------------------------------------------------
       Sur une page qui s'ouvre sur une image, aucune bande : seuls
       l'emblème et le menu flottent sur l'image. En descendant, une
       barre fine et translucide prend le relais.
       ============================================================ */
    .site-header { border-bottom: 0; }
    .site-header:not(.site-header--overlay),
    .site-header--overlay:not(.at-top) {
        background: rgba(255, 255, 255, 0.9);
        -webkit-backdrop-filter: saturate(1.6) blur(14px);
        backdrop-filter: saturate(1.6) blur(14px);
        box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
    }
    /* Pas de dégradé sombre sous l'en-tête : la photo reste intacte */
    .site-header--overlay.at-top:not(.nav-open)::before { display: none; }

    .header-inner { padding: 0 6px 0 18px; }

    /* L'emblème seul : le nom est déjà écrit en grand sur la page.
       Le logo est rogné sous la silhouette ; le mot « Barghach
       Pictures » qui suit serait illisible à cette taille. */
    .logo {
        height: 43px;
        overflow: hidden;
        align-items: flex-start;
    }
    .logo-img { height: 50px; }
    .site-header--overlay .logo-img--clair { top: 0; transform: none; }
    .site-header--overlay.at-top:not(.nav-open) .logo-img--clair {
        filter: drop-shadow(0 1px 8px rgba(0, 0, 0, 0.45));
    }

    .menu-toggle {
        width: 48px;
        height: 48px;
        padding: 15px 8px;
        box-sizing: border-box;
    }
    .menu-toggle span { height: 2px; }
    .menu-toggle span:nth-child(2) { width: 62%; margin-left: auto; }
    .menu-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .menu-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* ============================================================
       2. MENU — un écran noir, comme l'entrée d'une salle
       ============================================================ */
    .site-header.nav-open {
        background: transparent;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        box-shadow: none;
    }
    .site-header.nav-open .logo-img--sombre { filter: invert(1); }
    .site-header.nav-open .menu-toggle span { background-color: #ffffff; }
    body:has(.site-header.nav-open) { overflow: hidden; }

    .nav-collapse {
        position: fixed;
        inset: 0;
        z-index: -1;
        height: 100svh;
        flex-direction: column;
        justify-content: space-between;
        align-items: stretch;
        gap: 0;
        padding: calc(var(--header-height) + 34px) 28px calc(28px + env(safe-area-inset-bottom));
        background: #070707;
        border: 0;
        box-shadow: none;
        overflow-y: auto;
    }
    .main-nav { justify-content: flex-start; }
    .nav-list {
        align-items: stretch;
        gap: 0;
        counter-reset: rubrique;
    }
    .nav-list li { border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
    .nav-link {
        display: flex;
        align-items: baseline;
        gap: 18px;
        padding: 15px 0;
        font-size: 2rem;
        line-height: 1.1;
        letter-spacing: 0.01em;
        color: #f2f0ec;
    }
    .nav-link::before {
        counter-increment: rubrique;
        content: "0" counter(rubrique);
        font-size: 0.72rem;
        font-style: normal;
        letter-spacing: 0.2em;
        color: rgba(255, 255, 255, 0.38);
        min-width: 22px;
    }
    .nav-link::after { display: none; }
    .nav-link.active { font-style: normal; color: #ffffff; }
    .nav-link.active::before { color: #ffffff; }

    .header-actions {
        justify-content: space-between;
        align-items: center;
        gap: 0;
        padding-top: 26px;
    }
    .header-socials { gap: 0; margin-left: -12px; }
    .header-socials .social { width: 44px; height: 44px; }
    .header-socials .social svg { fill: #ffffff; opacity: 0.8; width: 19px; height: 19px; }
    .cart-btn {
        width: 46px;
        height: 46px;
        background: transparent;
        border-color: rgba(255, 255, 255, 0.3);
    }
    .cart-btn svg { fill: #ffffff; width: 20px; height: 20px; }
    .cart-count { background: #ffffff; color: #111111; }

    /* ============================================================
       3. RAILS HORIZONTAUX
       ------------------------------------------------------------
       Une carte occupe ~80 % de l'écran, la suivante dépasse sur
       le bord droit pour inviter à glisser. Le rail se cale sur une
       carte quand on lâche le doigt. Rien ne défile tout seul.
       ============================================================ */
    .m-rail {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: stretch;
        gap: 12px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: var(--m-gouttiere);
        padding: 0 var(--m-gouttiere);
        margin: 0;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .m-rail::-webkit-scrollbar { display: none; }
    .m-rail > * {
        flex: 0 0 var(--m-carte);
        scroll-snap-align: start;
        min-width: 0;
    }
    /* La dernière carte peut se caler, sans buter contre le bord */
    .m-rail::after { content: ""; flex: 0 0 1px; }

    /* Tête de rail : titre à gauche, compteur à droite */
    .m-rail-tete {
        display: flex !important;
        align-items: baseline;
        justify-content: space-between;
        gap: 16px;
        padding: 0 var(--m-gouttiere);
        margin-bottom: 18px;
    }
    .m-rail-titre {
        font-size: 1.55rem;
        font-weight: normal;
        line-height: 1.1;
        letter-spacing: 0.005em;
    }
    .m-compteur {
        font-size: 0.72rem;
        letter-spacing: 0.18em;
        color: var(--color-muted);
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    /* Lien d'action discret : texte + flèche */
    .m-lien {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-height: 44px;
        font-style: italic;
        font-size: 1.05rem;
    }
    .m-lien::after { content: "→"; font-style: normal; }

    /* ============================================================
       4. ACCUEIL
       ============================================================ */

    /* --- Héros : la vidéo garde son format d'origine (16:9) ---
       Choix du 03/10/2026 : plus grande, elle mangeait l'écran.
       Le titre reste centré dessus, comme sur ordinateur ; la
       pastille « Nos univers » n'y aurait pas sa place. */
    .hero-title {
        font-size: clamp(2rem, 9.6vw, 2.5rem);
        line-height: 1.05;
        letter-spacing: 0.02em;
    }
    .hero-slogan {
        margin-top: 8px;
        font-size: 0.95rem;
        line-height: 1.35;
    }
    .hero-cta { display: none !important; }
    .hero-sound {
        right: 12px;
        bottom: 12px;
        width: 38px;
        height: 38px;
    }
    .hero-sound svg { width: 17px; height: 17px; }

    /* --- Nos univers : 4 grandes cartes à faire glisser ---
       Sur téléphone chaque univers n'affiche que sa photo, son
       numéro, sa phrase et « Découvrir ». Le détail est sur sa page. */
    .stages-section {
        padding: 64px 0 72px;
        max-width: none;
        scroll-margin-top: 0;
    }
    .stages.m-rail { gap: 14px; }
    .stage,
    .stage:not(.stage--edition),
    .stage:not(.stage--edition):nth-child(even),
    .stage--edition {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }
    .stage-media,
    .stage--edition .stage-media {
        order: -1;
        aspect-ratio: 4 / 5;
        min-height: 0;
        border-radius: 6px;
    }
    .stage-head { order: 0; max-width: none; margin: 18px 0 0; }
    .stage-index {
        font-size: 0.7rem;
        letter-spacing: 0.22em;
    }
    .stage-index::before { display: none; }
    .stage-title,
    .stage--edition .stage-title {
        margin-top: 8px;
        font-size: 1.45rem;
        line-height: 1.18;
        white-space: normal;
    }
    .stage-body { order: 1; max-width: none; margin-top: 6px; }
    .stage-desc,
    .stage-thumbs,
    .stage-collections { display: none; }
    /* Le nom de l'univers est déjà au-dessus : « Découvrir → » suffit */
    .stage-link {
        padding: 0;
        min-height: 44px;
        border-bottom: 0;
        font-size: 0;
        gap: 0;
    }
    .stage-link::before { content: "Découvrir"; font-size: 1.05rem; font-style: italic; }
    .stage-link::after { font-size: 1.05rem; margin-left: 8px; }

    /* --- Citation : un temps de respiration, en grand --- */
    .quote-band { padding: 96px 28px; }
    .quote-band-text { font-size: 1.6rem; line-height: 1.32; }
    .q-last { white-space: normal; }
    .quote-band-sign { margin-top: 22px; font-size: 0.72rem; }

    /* --- Partenaires : une ligne de logos qui glisse --- */
    .confiance { padding: 64px 0 72px; }
    .confiance-titre {
        padding: 0 var(--m-gouttiere);
        margin-bottom: 26px;
        font-size: 1.55rem;
        text-align: left;
    }
    .confiance-grille.m-rail { --m-carte: 38vw; gap: 10px; }
    .confiance-lien {
        min-height: 92px;
        border: 1px solid var(--color-line);
        border-radius: 6px;
        padding: 14px;
    }
    .confiance-logo { height: calc(var(--h, 60px) * 0.62); }

    /* ============================================================
       9. PIED DE PAGE — l'essentiel, sur moins d'un écran
       ============================================================ */
    .site-footer { padding: 56px 0 30px; }
    .footer-inner {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 0 var(--m-gouttiere);
    }
    .footer-brand { margin: 0 0 30px; }
    .footer-mark { margin-bottom: 18px; }
    .footer-logo { height: 72px; margin-bottom: 8px; }
    .footer-tagline { font-size: 0.6rem; }
    .footer-baseline { margin-bottom: 14px; font-size: 1.15rem; }
    .footer-socials { gap: 0; margin-left: -12px; }
    .footer-socials .social { width: 44px; height: 44px; }

    /* Les rubriques du site sur une ligne, en grand ; les
       sous-rubriques (souvent sans page) restent sur ordinateur. */
    .footer-col { display: none; }
    /* Les mentions légales restent, en petit, sous la barre du bas */
    .footer-col[aria-label="Légal"] { display: block; order: 3; margin-top: 16px; }
    .footer-col[aria-label="Légal"] .footer-heading { display: none; }
    .footer-col[aria-label="Légal"] ul { flex-direction: row; flex-wrap: wrap; gap: 0 18px; }
    .footer-col[aria-label="Légal"] a { display: inline-block; padding: 6px 0; font-size: 0.85rem; color: #8a8a8a; }
    .footer-col[aria-label="Navigation"] { display: block; width: 100%; }
    .footer-col[aria-label="Navigation"] .footer-heading { display: none; }
    .footer-col[aria-label="Navigation"] ul {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0 22px;
        padding: 18px 0;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }
    .footer-col[aria-label="Navigation"] a {
        display: inline-block;
        padding: 7px 0;
        font-size: 1.15rem;
    }

    .footer-bottom {
        margin-top: 0;
        padding: 18px var(--m-gouttiere) 0;
        border-top: 0;
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 14px;
    }
    .footer-bottom-links { flex-wrap: wrap; gap: 0 20px; }
    .footer-bottom-links a { display: inline-block; padding: 6px 0; font-size: 0.95rem; white-space: nowrap; }
    .footer-copy { font-size: 0.8rem; }
}
