/* ============================================================
   SignalNids Référent V3.9.4 — shell FIXED optimisé performances
   ============================================================ */

:root{
  --sn-ref-header-height:0px;
  --sn-ref-nav-height:0px;
  --sn-ref-main-base-padding-top:0px;
}

html,
body{
  max-width:100%;
  overflow-x:hidden;
}

/*
 * Header réellement fixe, mais sans backdrop-filter :
 * le blur sur un élément fixed forçait des repaint/compositions
 * à chaque scroll et ralentissait fortement certaines machines.
 */
body.sn-ref-shell-fixed .ref-header{
  position:fixed!important;
  top:0!important;
  left:0!important;
  right:0!important;
  z-index:2200!important;

  width:auto!important;
  max-width:none!important;
  margin:0!important;

  background:#fff!important;
  border-bottom:1px solid #dce6df!important;
  box-shadow:0 2px 8px rgba(14,55,42,.06)!important;

  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;

  box-sizing:border-box!important;
  transform:translateZ(0);
  backface-visibility:hidden;
  contain:paint;
}

body.sn-ref-shell-fixed{
  padding-top:var(--sn-ref-header-height)!important;
}

/* Sous-menu fixe sous le header, fond opaque = scroll plus fluide. */
body.sn-ref-shell-fixed .member-nav{
  position:fixed!important;
  top:var(--sn-ref-header-height)!important;
  left:0!important;
  right:0!important;
  z-index:2100!important;

  display:flex!important;
  flex-wrap:nowrap!important;
  align-items:center!important;
  gap:8px!important;

  width:auto!important;
  max-width:none!important;
  min-width:0!important;

  margin:0!important;
  padding:8px max(24px,4vw)!important;

  overflow-x:auto!important;
  overflow-y:hidden!important;

  background:#f7faf8!important;
  border-bottom:1px solid #dce7e1!important;
  box-shadow:0 2px 7px rgba(14,55,42,.045)!important;

  white-space:nowrap!important;
  scrollbar-width:none!important;
  -ms-overflow-style:none!important;
  overscroll-behavior-x:contain!important;
  -webkit-overflow-scrolling:touch!important;

  /* suppression du mask-image coûteux de V3.9.3 */
  mask-image:none!important;
  -webkit-mask-image:none!important;

  box-sizing:border-box!important;
  transform:translateZ(0);
  backface-visibility:hidden;
  contain:layout paint style;
}

body.sn-ref-shell-fixed .member-nav::-webkit-scrollbar{
  display:none!important;
  width:0!important;
  height:0!important;
}

body.sn-ref-shell-fixed .member-nav a{
  flex:0 0 auto!important;
  min-width:max-content!important;
  max-width:none!important;

  margin:0!important;
  padding:10px 14px!important;

  border-radius:10px!important;
  white-space:nowrap!important;
  box-sizing:border-box!important;
}

body.sn-ref-shell-fixed .member-nav a.selected{
  background:#00664e!important;
  color:#fff!important;
  box-shadow:none!important;
}

/* Compensation de la place occupée par le sous-menu fixed. */
body.sn-ref-shell-fixed #main{
  padding-top:
    calc(
      var(--sn-ref-main-base-padding-top)
      + var(--sn-ref-nav-height)
      + 10px
    )!important;

  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}

/* Protection contre les débordements. */
body.sn-ref-shell-fixed,
body.sn-ref-shell-fixed #main,
body.sn-ref-shell-fixed .wrap,
body.sn-ref-shell-fixed .section,
body.sn-ref-shell-fixed #main > *{
  min-width:0!important;
}

body.sn-ref-shell-fixed #main > *,
body.sn-ref-shell-fixed .panel{
  max-width:100%!important;
  box-sizing:border-box!important;
}

/*
 * Pas de sélecteur global [id] sur toute la page :
 * il obligeait le navigateur à recalculer beaucoup trop d'éléments.
 */
body.sn-ref-shell-fixed #main section[id],
body.sn-ref-shell-fixed #main article[id]{
  scroll-margin-top:
    calc(
      var(--sn-ref-header-height)
      + var(--sn-ref-nav-height)
      + 14px
    );
}

@media(max-width:1100px){
  body.sn-ref-shell-fixed .member-nav{
    gap:5px!important;
    padding-left:14px!important;
    padding-right:14px!important;
  }

  body.sn-ref-shell-fixed .member-nav a{
    padding:9px 11px!important;
    font-size:.86rem!important;
  }
}

@media(max-width:760px){
  body.sn-ref-shell-fixed .member-nav{
    gap:5px!important;
    padding:
      7px
      max(10px,env(safe-area-inset-right))
      8px
      max(10px,env(safe-area-inset-left))!important;
  }

  body.sn-ref-shell-fixed .member-nav a{
    padding:9px 10px!important;
    font-size:.78rem!important;
  }

  body.sn-ref-shell-fixed #main{
    padding-top:
      calc(
        var(--sn-ref-main-base-padding-top)
        + var(--sn-ref-nav-height)
        + 7px
      )!important;
  }
}

/* Chrome natif Android/iOS : ne pas appliquer le shell web fixe. */
body.sn-native-android.sn-ref-shell-fixed,
body.sn-native-ios.sn-ref-shell-fixed{
  padding-top:0!important;
}

body.sn-native-android.sn-ref-shell-fixed .ref-header,
body.sn-native-ios.sn-ref-shell-fixed .ref-header,
body.sn-native-android.sn-ref-shell-fixed .member-nav,
body.sn-native-ios.sn-ref-shell-fixed .member-nav{
  position:relative!important;
  top:auto!important;
  left:auto!important;
  right:auto!important;
  transform:none!important;
  contain:none!important;
}

body.sn-native-android.sn-ref-shell-fixed #main,
body.sn-native-ios.sn-ref-shell-fixed #main{
  padding-top:var(--sn-ref-main-base-padding-top)!important;
}

@media print{
  body.sn-ref-shell-fixed{
    padding-top:0!important;
  }

  body.sn-ref-shell-fixed .ref-header,
  body.sn-ref-shell-fixed .member-nav{
    position:static!important;
    box-shadow:none!important;
    transform:none!important;
  }

  body.sn-ref-shell-fixed #main{
    padding-top:0!important;
  }
}
