/* ===== Pérène Mobile Menu - Apple-like (Drilldown) ===== */

@media (min-width: 1500px){
  .perene-mm{ display:none !important; }
}

@media (max-width: 1499px){
  .perene-mm{
    position: relative;
    z-index: 999999;
  }

  .perene-mm,
  .perene-mm a{
    font-family: 'Jost', Helvetica, Arial, Lucida, sans-serif !important;
  }

  /* Masquer le menu ordinateur */
  #menu{
    display: none;
  }

  /* Toggle */
  .perene-mm__toggle{
    position: static;
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    border: 0;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    margin: 0 0 0 auto !important;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    -webkit-appearance: none;
    right: auto !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    flex: 0 0 52px;
    align-self: center;
  }

  .perene-mm__toggle,
  .perene-mm__toggle *{
    pointer-events: auto;
  }

  .perene-mm__toggle::before{
    content: "";
    position: absolute;
    inset: 0;
  }

  .perene-mm__icon{
    display: block;
    position: relative;
    width: 24px;
    height: 2px;
    background: #fff;
    pointer-events: none;
  }

  .perene-mm__icon:before,
  .perene-mm__icon:after{
    content: "";
    position: absolute;
    left: 0;
    width: 24px;
    height: 2px;
    background: #fff;
    pointer-events: none;
  }

  .perene-mm__icon:before{ top: -8px; }
  .perene-mm__icon:after{ top: 8px; }

  .perene-mm.is-open .perene-mm__icon{
    background: transparent;
  }

  .perene-mm.is-open .perene-mm__icon:before{
    top: 0;
    transform: rotate(45deg);
  }

  .perene-mm.is-open .perene-mm__icon:after{
    top: 0;
    transform: rotate(-45deg);
  }

  .perene-mm.is-open .perene-mm__toggle{
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Overlay */
  .perene-mm__panel{
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255,255,255,0.98);
    z-index: 1000000;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 180ms ease, transform 180ms ease;
    padding-top: 64px;
  }

  .perene-mm__panel.is-visible{
    opacity: 1;
    transform: translateY(0);
  }

  /* Topbar */
  .perene-mm__topbar{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    z-index: 2;
    background: rgba(255,255,255,0.96);
  }

  .perene-mm__back{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    color: #ffa300 !important;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
    padding: 10px 8px;
  }

  .perene-mm__backicon{
    font-size: 28px;
    transform: translateY(-1px);
    color: #ffa300 !important;
  }

  .perene-mm__close{
    border: 0;
    background: transparent;
    color: #111;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    width: 44px;
    height: 44px;
  }

  .perene-mm.is-sublevel .perene-mm__back{
    opacity: 1;
    pointer-events: auto;
  }

  /* Contenu */
  .perene-mm__inner{
    position: absolute;
    inset: 56px 0 0 0;
  }

  .perene-mm__viewport{
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 24px 40px;
  }

  .perene-mm__track{
    max-width: 520px;
    margin: 0 auto;
  }

  /* Liste sans puces */
  .perene-mm__track ul,
  .perene-mm__track li{
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Liens */
  .perene-mm__track a{
    display: block;
    color: #111;
    text-decoration: none;
    font-size: 34px;
    line-height: 1.15;
    font-weight: 600;
    padding: 10px 0;
  }

  .perene-mm__track a:active{
    color: #ffa300 !important;
  }

  /* Items avec sous-menu */
  .perene-mm__track .menu-item-has-children{
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
  }

  .perene-mm__track .menu-item-has-children > a{
    flex: 1 1 auto;
    min-width: 0;
    padding-right: 12px;
  }

  /* Supprimer tout ancien chevron injecté sur le lien */
  .perene-mm__track .menu-item-has-children > a::after{
    content: none !important;
    display: none !important;
  }

  .perene-mm__submenu-toggle{
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 26px;
    color: #111;
    opacity: 0.6;
    -webkit-tap-highlight-color: transparent;
  }

  .perene-mm__submenu-toggle:active{
    opacity: 1;
  }

  .perene-mm__track .menu-item-has-children > ul{
    flex: 0 0 100%;
    width: 100%;
  }

  /* Quand le sous-menu est ouvert, masquer le bouton flèche */
  .perene-mm__track li.mm-open > .perene-mm__submenu-toggle{
    display: none !important;
  }

  /* Drilldown */
  .perene-mm__track ul ul{
    display: none;
  }

  .perene-mm__track li.mm-open > a{
    display: none;
  }

  .perene-mm__track li.mm-open > ul{
    display: block;
  }

  .perene-mm__track ul.mm-has-open > li{
    display: none;
  }

  .perene-mm__track ul.mm-has-open > li.mm-open{
    display: block;
  }

  .perene-mm__track ul ul a{
    font-size: 22px;
    font-weight: 600;
    padding: 10px 0;
  }

  .perene-mm__track ul.mm-anim-in{
    animation: pereneMmIn 180ms ease both;
  }

  .perene-mm__track ul.mm-anim-out{
    animation: pereneMmOut 180ms ease both;
  }

  @keyframes pereneMmIn{
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
  }

  @keyframes pereneMmOut{
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(10px); }
  }

  /* Lock scroll */
  html.perene-mm--lock,
  body.perene-mm--lock{
    overflow: hidden !important;
    height: 100% !important;
    touch-action: none !important;
  }

  body.perene-mm--lock{
    position: fixed !important;
    width: 100% !important;
  }

  /* SR */
  .perene-mm__sr{
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
  }

  /* Lien actif */
  .perene-mm__track .current-menu-item > a,
  .perene-mm__track .current-menu-ancestor > a{
    color: #111 !important;
    position: relative;
    padding-left: 16px;
  }

  .perene-mm__track .current-menu-item > a::before,
  .perene-mm__track .current-menu-ancestor > a::before{
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    background: #ffa300;
    border-radius: 50%;
    transform: translateY(-50%);
  }

  /* Barre fixe */
  .perene-mm__fixedbar{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #001f5b;
    z-index: 999990;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    text-align: left !important;
    padding: 0 14px;
    box-sizing: border-box;
  }

  /* Logo */
  .perene-mm__logo{
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-right: auto !important;
    flex: 0 1 auto;
  }

  .perene-mm__logoimg{
    height: 30px;
    width: auto;
    display: block;
  }

  .perene-mm__logotext{
    color: #fff;
    font-weight: 600;
  }

  .perene-mm__icon,
  .perene-mm__icon:before,
  .perene-mm__icon:after{
    background: #fff !important;
  }

  /* Décale le site sous la barre */
  body{
    padding-top: 64px;
  }
}