/* MAQUETTE — Accueil en carrés par catégorie (voir carres.js). Sur ordinateur : un titre par famille, puis deux pubs par ligne,
   chacune dans un carré arrondi. Une rangée de pastilles (collée sous le menu) mène à chaque famille. */

/* la rangée des familles : collée sous le menu, on la fait glisser si elle dépasse */
.mx-familles { position: sticky; top: 72px; z-index: 900; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; width: 100vw; margin-left: calc(50% - 50vw); padding: 12px max(20px, calc(50vw - 700px));
  background: rgba(255,255,255,.9); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid rgba(0,0,0,.06);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif; }
.mx-familles::-webkit-scrollbar { display: none; }
.mx-familles a { flex: none; height: 38px; padding: 0 16px; display: inline-flex; align-items: center; border-radius: 999px; background: #f2f2f5; color: #1d1d1f; font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background .2s, color .2s; }
.mx-familles a:hover { background: #e7e7ec; }
.mx-familles a.actif { background: #1d1d1f; color: #fff; }
@media (max-width: 991px) { .mx-familles { top: 56px; } }

/* le titre de chaque famille */
.mx-titre { padding: 46px 20px 6px; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif; scroll-margin-top: 150px; }
.mx-titre h2 { margin: 0; font-size: clamp(30px, 3.4vw, 46px); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; color: #1d1d1f; text-transform: none; }
.mx-titre span { display: block; margin-top: 6px; font-size: 16px; color: #6e6e73; }

@media (min-width: 992px) {
  .mx-carres { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: min(1440px, calc(100vw - 40px)); margin: 0 0 40px calc(50% - min(720px, 50vw - 20px)); position: relative; }
  .mx-titre { grid-column: 1 / -1; padding: 50px 6px 4px; }
  .mx-carre { position: relative; border-radius: 26px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.05); isolation: isolate; transform: translateZ(0); }
  /* la pub prend la largeur de son carré au lieu de toute la largeur de l'écran */
  .mx-carre > section { width: 100% !important; max-width: 100% !important; min-width: 0 !important; margin: 0 !important; padding-left: 0 !important; padding-right: 0 !important; padding-bottom: 18px !important; overflow: hidden !important; }
  /* la scène animée : même proportion que sur grand écran (16:9), mais à la taille du carré */
  .mx-carre > section [class$="-scene"] { width: 100% !important; height: auto !important; aspect-ratio: 16 / 9; max-height: none !important; }
  /* la ligne d'achat sous la pub : plus compacte */
  .mx-carre > section [class$="-achat"] { margin-top: 12px !important; padding-left: 16px !important; padding-right: 16px !important; gap: 10px 14px !important; flex-wrap: wrap; justify-content: center; }
  .mx-carre > section [class$="-achat"] img { width: 44px !important; height: 44px !important; }
  .mx-carre > section [class$="-achat"] strong { font-size: 15px !important; }
  .mx-carre > section [class$="-achat"] small { font-size: 13px !important; }
  /* les pubs avec beaucoup de texte restent en grand, sur toute la largeur */
  .mx-carre--large { grid-column: 1 / -1; }
  .mx-carre--large > section [class$="-scene"] { aspect-ratio: auto; }
  .mx-carre--seul { grid-column: 1 / -1; width: calc(50% - 8px); justify-self: center; }   /* le carré resté seul sur sa ligne, centré */
}
