/* =============================================================
   PHONOMAKER — Couche responsive mobile  (v2)
   -------------------------------------------------------------
   Se pose PAR-DESSUS le build React. Ne touche pas au bundle.
   Chargée sur la home, APRÈS le CSS du build (voir functions.php).
   Breakpoint mobile : <= 768px.

   Nouveautés v2 :
   - Header allégé : les 2 boutons (Configurer / Réserver) quittent
     le header sur mobile et descendent dans le burger (via pm-mobile.js).
   - Logo réduit à gauche.
   - Burger : flèche de fermeture blanche en haut à gauche + bloc CTA en bas.
   - Services : photo en FOND du texte (filtre opaque) au lieu de blocs empilés ;
     correction du grand vide (min-height:100vh de la colonne texte) ;
     repositionnement de la note manuscrite d'intro qui chevauchait le titre.
   ============================================================= */

/* -------------------------------------------------------------
   0. GLOBAL — stoppe les débordements horizontaux (toutes tailles)
   ------------------------------------------------------------- */
html, body { max-width: 100%; }
img, svg, video { max-width: 100%; }

/* =============================================================
   MOBILE  ( <= 768px )
   ============================================================= */
@media (max-width: 768px) {

  /* 0bis. overflow-x mobile uniquement (sinon casse le sticky desktop)
     v13 : « clip » et non « hidden ». `hidden` fait de <html> un conteneur
     de défilement, ce qui NEUTRALISE position:sticky (cards Services).
     `clip` coupe le débordement sans créer de conteneur de scroll. */
  html, body { overflow-x: clip; }

  /* 1. Animations coupées ------------------------------------- */
  *, *::before, *::after {
    animation: none !important;
    animation-play-state: paused !important;
  }
  .pm-vinyl-spin { animation: none !important; }

  /* 1ter. EXCEPTION — bandeau défilant (marquee) sous le hero.
     La règle universelle ci-dessus le figeait : il restait immobile
     sur mobile. On le réactive explicitement (transform GPU, coût nul).
     @keyframes marquee est défini par le bundle React. */
  .sep-inner {
    animation: marquee 14s linear infinite !important;
    animation-play-state: running !important;
    will-change: transform;
  }

  /* 1bis. HERO — le disque entre en glissant de la GAUCHE vers le centre,
     rapidement, au lieu de rouler depuis l'extrême gauche pendant ~4,5 s.
     On remplace le roulement du bundle par une courte animation : il part
     d'un peu à gauche (12%), arrive au centre (50% = position finale du
     bundle => pas de saut), en fondu. Le vertical est figé pour supprimer
     le "glisse vers le haut". (:has non supporté = intro d'origine, pas de casse.) */
  @keyframes pm-disc-in {
    from { left: 12%; opacity: 0; }
    to   { left: 50%; opacity: 1; }
  }
  div:has(> .pm-vinyl-spin) {
    top: 54% !important;                                  /* fige le vertical */
    animation: pm-disc-in 0.85s cubic-bezier(0.22,0.61,0.36,1) both !important;
  }

  /* 1quater. HERO — suppression de la bande grise entre hero et marquee.
     L'artboard 1600x1000 du bundle est centré sur `top:46%` : mis à
     l'échelle « cover », il dépasse en haut et laisse voir le fond
     (#191815) sur ~5 % de la hauteur en BAS de la section. On le
     recentre à 50 % : l'artboard couvre alors exactement la section,
     et le marquee vient se coller au hero.
     (le scale est calculé par pm-mobile.js -> .pm-hero-lock) */
  .pm-hero-lock { top: 50% !important; }
  .pm-hero-sec  { margin-bottom: 0 !important; }

  /* 2. Curseur custom : filet de sécurité --------------------- */
  html, body, * { cursor: auto !important; }
  .cursor-none  { cursor: auto !important; }

  /* 2bis. PERF — éléments décoratifs très coûteux en GPU sur mobile
     (identifiés comme cause des lags au scroll) :
     - #bgCanvas : un <canvas> fixe plein écran animé en CONTINU.
     - 9 overlays de grain <svg feTurbulence> en mix-blend-mode:multiply,
       recalculés à chaque repaint. On ne vise que les svg qui CONTIENNENT
       un <rect> (les overlays) : les filtres utilitaires (#pm-roughen,
       sans rect) sont épargnés.
     La texture « papier » des fonds d'images conserve le grain visuel. */
  #bgCanvas { display: none !important; }
  svg:has(feTurbulence):has(rect) { display: none !important; }

  /* 2ter. PERF — le header fixe utilise backdrop-filter: blur()+saturate(),
     recomposé à CHAQUE frame de scroll (très coûteux sur mobile).
     On le remplace par un fond translucide opaque (rendu instantané). */
  .pm-chrome nav {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background-color: rgba(12, 15, 14, 0.92) !important;
  }

  /* 3. HEADER -------------------------------------------------- */
  .pm-chrome nav {
    padding-left: 18px !important;
    padding-right: 14px !important;
  }
  /* Logo réduit à gauche */
  .pm-chrome img[alt="Phonomaker"] { height: 24px !important; }

  /* Les 2 boutons CTA du header sont masqués sur mobile :
     pm-mobile.js ajoute cette classe à leur conteneur et les recopie
     dans le burger. */
  .pm-cta-group-mobile-hidden { display: none !important; }

  /* Bouton burger visible (construit par le JS) */
  .pm-burger-btn { display: inline-flex !important; }

  /* 4. SERVICES — cards empilées (sticky), comme en desktop -----
     v13.1 : CORRECTIF du sélecteur.
     Les <article> ont 3 à 4 enfants <div> :
       1. un div de dégradé, position:absolute   (card 1..4)
       2. un <svg> de grain, position:absolute   (card 4 seulement)
       3. la colonne TEXTE   (min-height:100vh)
       4. la colonne PHOTO   (min-height:100vh)
     `> div:first-of-type` visait donc le DÉGRADÉ, pas le texte : la
     colonne texte gardait son min-height:100vh et poussait la photo
     hors de l'écran (« les images ont disparu / glissé vers le bas »).
     On cible désormais par le CONTENU : la colonne texte contient le
     <h3>, la colonne photo contient l'<img>. Les deux div absolus ne
     sont de toute façon pas des items flex.
     Prérequis : html/body en `overflow-x: clip` (voir 0bis). */
  #phono-services article[data-i] {
    position: sticky !important;
    top: 0 !important;
    min-height: 100svh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  /* Colonne TEXTE : occupe la place restante, plus de vide de 100vh */
  #phono-services article[data-i] > div:has(h3) {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    justify-content: space-between !important;
    gap: 14px !important;
    padding: 30px 6vw 20px !important;
    position: relative !important;
    z-index: 2 !important;
  }
  /* Colonne PHOTO : bandeau visible en bas de la card */
  #phono-services article[data-i] > div:has(> img) {
    flex: 0 0 auto !important;
    height: 26svh !important;
    max-height: 230px !important;
    min-height: 150px !important;
    border-left: 0 !important;
    border-top: 1.5px solid rgba(26,24,21,0.25) !important;
  }
  /* échelles typographiques resserrées pour tenir dans une hauteur d'écran */
  #phono-services article[data-i] h3 { font-size: clamp(40px, 12vw, 78px) !important; margin: 14px 0 0 !important; }
  #phono-services article[data-i] p  { font-size: 14.5px !important; line-height: 1.42 !important; margin: 12px 0 0 !important; }
  #phono-services article[data-i] > div:has(h3) > div:last-of-type { flex-wrap: wrap !important; gap: 10px !important; margin-top: 14px !important; }
  #phono-services article[data-i] a[href] { flex: 1 0 auto !important; justify-content: center !important; font-size: 14px !important; padding: 12px 16px 10px !important; }

  /* Note manuscrite d'intro (« Un seul partenaire → … ») :
     en position:absolute, elle chevauche le titre. On la remet dans le flux. */
  #phono-services [style*="rotate(-2deg)"] {
    position: static !important;
    transform: none !important;
    text-align: left !important;
    max-width: 100% !important;
    margin-top: 14px !important;
    font-size: 18px !important;
  }

  /* v13.1 — L'EN-TÊTE « Donner vie à votre musique. » faisait ~1000 px
     de haut : la règle v12 le passe en flex-direction:column, or le
     <h2> porte `flex: 1 1 460px` — en colonne, ce flex-basis s'applique
     à la HAUTEUR. D'où l'immense vide sous le titre. On neutralise. */
  #services > div:first-child > span,
  #services > div:first-child > h2,
  #services > div:first-child > div { flex: 0 0 auto !important; }

  /* v13.1b — le badge « Nos Services · Produits » est en
     position:absolute top:48px : il chevauchait la 1re ligne du titre.
     Plutôt que de calibrer le padding-top contre un top codé en dur,
     on le remet DANS LE FLUX : il devient le 1er item de la colonne,
     au-dessus du titre. Robuste et plus compact. */
  #services > div:first-child > span {
    position: static !important;
    margin: 0 0 14px !important;
    align-self: flex-start !important;
  }
  #services > div:first-child { padding-top: 44px !important; padding-bottom: 40px !important; }

  /* 5. SECTION « EN PRESSE » / Night Dust (.projects) --------- */
  .projects { padding: 64px 5vw 72px !important; overflow: hidden !important; }
  .projects-grid { grid-template-columns: 1fr !important; gap: 28px !important; }
  .projects-head { flex-wrap: wrap !important; gap: 12px !important; }
  .projects-head h2 { font-size: clamp(34px, 11vw, 56px) !important; }
  .project-side { flex-direction: row !important; flex-wrap: wrap !important; gap: 10px !important; }

  /* 6. SECTION « Réserve ta session / Ton son taillé » (.cta-section)
        Image décorative flottante (position:absolute, z-index:2) qui
        empiétait sur le poster -> masquée sur mobile. Grille -> 1 colonne. */
  .cta-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  .cta-content { position: relative !important; z-index: 3 !important; }
  .cta-section > img { display: none !important; }
  .cta-chips { flex-wrap: wrap !important; }

  /* 7. FOOTER ------------------------------------------------- */
  footer .grid { grid-template-columns: 1fr !important; gap: 28px !important; }
  *:has(> .ig-tile) {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-snap-type: x mandatory !important;
    padding-bottom: 6px !important;
  }
  .ig-tile { flex: 0 0 28% !important; aspect-ratio: 1 / 1 !important; scroll-snap-align: start !important; }
  footer a, footer .small { white-space: normal !important; }

  /* 8. BOUTON « HAUT DE PAGE » flottant ----------------------- */
  [alt="Haut de page"] { width: 42px !important; height: 42px !important; }
  *:has(> [alt="Haut de page"]) { bottom: 14px !important; right: 14px !important; opacity: 0.92 !important; }

  /* 9. POLAROÏDS « Coulisses du studio » -> carrousel 1 par vue ------
        Le conteneur reçoit la classe .pm-pola-strip via pm-mobile.js
        (accroche fiable, pas de chaîne de style inline).
        Carrousel : un polaroïd plein écran, swipe gauche/droite. */
  .pm-pola-strip {
    height: auto !important;
    display: flex !important;
    gap: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-snap-type: x mandatory !important;
    padding: 8px 0 20px !important;
    scrollbar-width: none !important;          /* masque la scrollbar (Firefox) */
  }
  .pm-pola-strip::-webkit-scrollbar { display: none !important; }  /* Safari/Chrome */
  .pm-pola-strip > .pola-card {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    flex: 0 0 86% !important;        /* 1 polaroïd + léger aperçu du suivant */
    width: 86% !important;
    max-width: 360px !important;
    margin: 0 7% !important;         /* centre le polaroïd dans la vue */
    scroll-snap-align: center !important;
    cursor: default !important;
    box-shadow: 0 12px 28px -12px rgba(26,24,21,0.45) !important;
  }
  .pola-flash { display: none !important; }

  /* Points indicateurs du carrousel (injectés par pm-mobile.js) */
  .pm-pola-dots {
    display: flex !important;
    justify-content: center !important;
    gap: 8px !important;
    margin-top: -2px !important;
    padding: 2px 0 10px !important;
  }
  .pm-pola-dot {
    width: 8px; height: 8px;
    padding: 0; border: 0; border-radius: 50%;
    background: rgba(26,24,21,0.25);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
  }
  .pm-pola-dot.active {
    background: var(--orange, #cf3417);
    transform: scale(1.3);
  }

  /* 10. PROCESS 01/02/03 -> bande swipe scroll-snap -----------------
         Grille repeat(5,1fr) qui débordait -> défilement horizontal. */
  [style*="repeat(5, 1fr)"] {
    grid-template-columns: none !important;
    grid-auto-flow: column !important;
    grid-auto-columns: 76% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-snap-type: x mandatory !important;
    gap: 14px !important;
    padding-bottom: 10px !important;
  }
  [style*="repeat(5, 1fr)"] > div { scroll-snap-align: start !important; }

  /* 11. BANDEAU CHIFFRES +35 / 120k -> grille 2x2 -------------------
         Grille repeat(4,1fr) qui débordait (« 120k » coupé). */
  [style*="repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    padding: 0 18px !important;
  }
  [style*="repeat(4, 1fr)"] > div { border-right: 0 !important; }
  [style*="repeat(4, 1fr)"] > div:nth-child(odd) {
    border-right: 1px solid rgba(26,24,21,0.18) !important;
    padding-right: 14px !important;
  }
  [style*="repeat(4, 1fr)"] > div:nth-child(-n+2) {
    border-bottom: 1px solid rgba(26,24,21,0.18) !important;
  }

}

/* =============================================================
   BURGER — bouton, overlay, flèche de fermeture, bloc CTA
   (éléments injectés par pm-mobile.js)
   ============================================================= */

.pm-burger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  padding: 0; margin: 0;
  background: none; border: 0; cursor: pointer;
  z-index: 110;
}
.pm-burger-btn span,
.pm-burger-btn span::before,
.pm-burger-btn span::after {
  width: 24px; height: 2px; background: #eeeff1;
}
.pm-burger-btn span { position: relative; display: block; }
.pm-burger-btn span::before,
.pm-burger-btn span::after { content: ""; position: absolute; left: 0; display: block; }
.pm-burger-btn span::before { top: -7px; }
.pm-burger-btn span::after  { top:  7px; }

/* Overlay plein écran */
.pm-burger-overlay {
  position: fixed;
  inset: 0;
  z-index: 105;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 96px 32px 40px;
  background: #0c0f0e;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s linear 0.28s;
  overflow-y: auto;
}
.pm-burger-open .pm-burger-overlay {
  opacity: 1; visibility: visible; transform: translateY(0);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

/* Liens de page */
.pm-burger-overlay .pm-burger-link {
  font-family: var(--font-display, Impact, sans-serif);
  font-size: 30px; line-height: 1.15;
  text-transform: uppercase; letter-spacing: 0.01em;
  color: #f0e7d2; text-decoration: none;
  padding: 9px 0;
  border-bottom: 1px solid rgba(240, 231, 210, 0.12);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pm-burger-overlay .pm-burger-link.active { color: var(--orange, #cf3417); }

/* Sous-menus repliables (Vinyle / Produits) */
.pm-burger-overlay .pm-burger-caret {
  width: 12px; height: 12px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); transition: transform .2s ease; flex: none;
}
.pm-burger-overlay .pm-burger-group.is-open .pm-burger-caret { transform: rotate(225deg); }
.pm-burger-overlay .pm-burger-sub {
  display: none; padding: 4px 0 10px 14px; margin: 0; list-style: none;
  border-bottom: 1px solid rgba(240,231,210,.12);
}
.pm-burger-overlay .pm-burger-group.is-open .pm-burger-sub { display: block; }
.pm-burger-overlay .pm-burger-sub a {
  display: block; font-family: var(--font-body, Inter, sans-serif); font-weight: 600;
  font-size: 15px; letter-spacing: .04em; text-transform: uppercase;
  color: rgba(240,231,210,.8); text-decoration: none; padding: 10px 0;
}
.pm-burger-overlay .pm-burger-sub a.active { color: var(--orange, #cf3417); }

/* Croix de fermeture, en haut à DROITE */
.pm-burger-close {
  position: fixed;
  top: 18px; right: 18px;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(240,231,210,.08); border: 1.5px solid rgba(240,231,210,.25);
  border-radius: 50%; padding: 0;
  color: #f0e7d2; cursor: pointer;
  z-index: 310;
}
.pm-burger-close svg { width: 22px; height: 22px; display: block; }

/* Bloc des 2 boutons CTA, en bas du burger */
.pm-burger-cta {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pm-burger-cta button,
.pm-burger-cta a {
  width: 100% !important;
  justify-content: center !important;
  font-size: 15px !important;
  padding: 15px 18px 13px !important;
  cursor: pointer !important;
}

/* Bloque le scroll de la page quand le menu est ouvert */
body.pm-burger-open { overflow: hidden; }

/* Points du carrousel polaroïds : masqués hors mobile (le carrousel
   n'existe qu'en <=768px ; en desktop le collage d'origine reste). */
.pm-pola-dots { display: none; }

/* ============================================================
   HOME — sous-menus du header React (Vinyle ▾ / Produits ▾)
   Ajoutés pour le nouveau menu injecté dans home.js.
   Ouverture au survol via CSS (pas de state React).
   Ces règles ne s'appliquent qu'au header de la home (.pm-chrome).
   ============================================================ */
.pm-chrome .pmh-hassub { position: relative; }

/* petite flèche ▾ */
.pm-chrome .pmh-caret {
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s ease;
  flex: none;
}
.pm-chrome .pmh-hassub:hover .pmh-caret {
  transform: rotate(225deg) translate(1px,1px);
}

/* le dropdown */
.pm-chrome .pmh-sub {
  position: absolute;
  top: calc(100% + 16px);
  left: -14px;
  min-width: 230px;
  background: #F0E7D2;
  border: 1.5px solid #1F2221;
  box-shadow: 5px 5px 0 0 #CF3417;
  padding: 6px;
  margin: 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
  z-index: 120;
}
/* pont anti-survol : évite que le menu se ferme entre le lien et le dropdown */
.pm-chrome .pmh-sub::before {
  content: "";
  position: absolute;
  top: -16px; left: 0; right: 0;
  height: 16px;
}
.pm-chrome .pmh-hassub:hover .pmh-sub {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .18s ease, transform .18s ease;
}
.pm-chrome .pmh-sub li { margin: 0; }
.pm-chrome .pmh-sub a {
  display: block;
  padding: 11px 14px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #1F2221 !important;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.pm-chrome .pmh-sub a:hover {
  background: #1F2221;
  color: #F0E7D2 !important;
}

/* ============================================================
   HOME — unification header (mobile) & footer avec les autres pages
   ------------------------------------------------------------
   · Desktop  : header React (.pm-chrome) visible, header PHP masqué
   · Mobile   : header React masqué, header PHP (.pm-global-header) visible
                → même menu burger que toutes les pages
   · Partout  : footer React masqué, footer PHP (.st-footer + bandeau IG) visible
   ============================================================ */

/* Home : on masque le footer React ET le bandeau Instagram React
   (section séparée), pour n'garder que le footer PHP commun.
   Sinon on aurait deux bandeaux Instagram. */
#phonomaker-root > footer,
#phonomaker-root footer.px-12,
#phonomaker-root section.px-12.pb-16.pt-16 {
  display: none !important;
}

/* =============================================================
   v12 — CORRECTIFS HOME
   ============================================================= */

/* 1. Micro décoratif de la section « Ton son taillé selon tes exigences »
      Il débordait sur le titre selon le format d'écran.
      -> passé derrière le contenu, taille fluide, masqué < 1100px. */
.cta-section .pm-cta-mic {
  z-index: 0 !important;
  right: -8vw !important;
  top: clamp(60px, 15vw, 240px) !important;
  height: clamp(150px, 17vw, 280px) !important;
}
.cta-section .cta-grid,
.cta-section .cta-content { position: relative; z-index: 3; }

@media (max-width: 1100px) {
  .cta-section .pm-cta-mic { display: none !important; }
}

/* 2. En-tête « Donner vie à votre musique. » :
      la note manuscrite passe sous le titre quand la place manque. */
@media (max-width: 900px) {
  #services > div:first-child { flex-direction: column; align-items: flex-start !important; }
  #services > div:first-child > div:last-of-type {
    text-align: left !important;
    margin-left: 0 !important;
    max-width: 30ch !important;
  }
}
