/* =========================================
= DRAWER MOBILE — overlay + panel + slider interne (3 écrans)
========================================= */

/* État masqué par défaut (sur desktop on n'instancie pas le drawer) */
.nl-mobile--shell { display: none; }

@media (max-width: 64rem) {
  .nl-mobile--shell { display: block; }

  .nl-mobile--overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9997;
  }

  /* Drawer mobile : mêmes styles que .nl-cart--panel, mirroré côté gauche */
  .nl-mobile--drawer {
    position: fixed;
    top: 1rem;
    left: 1rem;
    bottom: 1rem;
    width: min(28rem, calc(100vw - 2rem));
    height: auto;
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9998;
    display: grid;
    grid-template-rows: auto auto 1fr;
    font-family: var(--SR);
  }

  .nl-mobile--drawer-inner { display: contents; }

  .nl-mobile--drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
  }

  .nl-mobile--title {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 500;
    font-family: var(--font-display);
    font-style: italic;
    color: var(--primary);
  }

  .nl-mobile--close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: opacity .2s ease, color .2s ease;
  }
  .nl-mobile--close svg { display: block; }
  .nl-mobile--close:hover { opacity: 0.65; }
  .nl-mobile--close:focus-visible {
    outline: 0.125rem solid var(--primary-40);
    outline-offset: 0.1875rem;
  }

  .nl-mobile--sep {
    margin: 0 1rem;
    border: 0;
    height: 1px;
    background: var(--muted);
  }

  .nl-mobile--nav {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  .nl-mobile--menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
    font-size: var(--text-sm);
  }

  .nl-mobile--menu a {
    display: block;
    padding: 1rem 0;
    text-decoration: none;
    border-bottom: 0.0625rem solid var(--muted);
    color: var(--primary);
  }

  /* Slider interne du drawer mobile : écrans empilés en absolute.
   L'écran actif est à x=0 ; les écrans déjà visités sont à x=-100%
   (sortis vers la gauche) et les suivants à x=100% (en attente à droite).
   Tous animent en lockstep → jamais de chevauchement visible. */

  .nl-mobile--viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    flex: 1;
    min-height: 0;
  }

  /* Remplit le viewport sans dépendre d'un height:% sur un parent flex
     (sinon hauteur non résolue → l'écran absolu ne scrolle pas). */
  .nl-mobile--slider {
    position: absolute;
    inset: 0;
  }

  .nl-mobile--screen {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transform: translateX(100%);
    padding: 0 1rem;
  }

  #mob-screen-root { transform: translateX(0); }

  .nl-mobile--screen-head {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.625rem;
    padding: 1rem 0;
    border-bottom: 0.0625rem solid var(--muted);
    background: transparent;
  }

  .nl-mobile--back {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: var(--primary);
  }

  .nl-mobile--screen .nl-mobile--screen-title { font-weight: 600; font-size: var(--text-sm); color: var(--primary); }

  .nl-mobile--next {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.625rem;
    padding: 1rem 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    font: inherit;
    color: var(--primary);
    border-bottom: 0.0625rem solid var(--muted);
  }
}


/* Même réduction de largeur que .nl-cart--panel sous 48rem */
@media (max-width: 48rem) {
  .nl-mobile--drawer { width: min(24rem, calc(100vw - 2rem)); }
}