/* Ajouts responsive / HTML5 - conservation du rendu historique sur desktop */
html, body { margin: 0; padding: 0; }
body { overflow-x: hidden; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
.mobile-menu-toggle, .mobile-nav-drawer, .mobile-nav-backdrop { display: none; }
.mobile-menu-toggle { appearance: none; border: 0; background: #003c66; color: #fff; border-radius: 999px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); cursor: pointer; }
.mobile-menu-toggle .mobile-menu-label { display: inline-block; margin-left: 10px; font-size: 12px; font-weight: bold; letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; }
.mobile-menu-toggle .bar { display: block; width: 22px; height: 2px; margin: 4px 0; background: currentColor; border-radius: 999px; }
.mobile-menu-toggle .bars { display: inline-block; vertical-align: middle; }
.mobile-nav-drawer { position: fixed; inset: 0 0 0 auto; width: min(88vw, 380px); max-width: 100%; background: #ffffff; z-index: 3000; box-shadow: -12px 0 32px rgba(0,0,0,.25); transform: translateX(100%); transition: transform .28s ease; overflow-y: auto; visibility: hidden; pointer-events: none; }
.mobile-nav-drawer.is-open { transform: translateX(0); visibility: visible; pointer-events: auto; }
.mobile-nav-backdrop { position: fixed; inset: 0; background: rgba(20,31,43,.26); z-index: 2990; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease; }
.mobile-nav-backdrop.is-open { display: block; opacity: 1; visibility: visible; pointer-events: auto; }
.mobile-nav-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; background: #f7d62a; border-bottom: 1px solid rgba(0,0,0,.08); }
.mobile-nav-header img { max-width: 190px; height: auto; }
.mobile-nav-close { appearance: none; border: 0; background: #003c66; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; }
.mobile-nav-content { padding: 12px 16px 24px; }
.mobile-nav-home, .mobile-nav-link, .mobile-nav details summary { display: block; padding: 14px 16px; margin-bottom: 10px; border-radius: 14px; text-decoration: none; color: #003c66; background: #f6f7f8; border: 1px solid #e5e8eb; font-weight: bold; }
.mobile-nav-home { background: #003c66; color: #fff; }
.mobile-nav details { margin-bottom: 10px; }
.mobile-nav details[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; background: #003c66; color: #fff; border-color: #003c66; }
.mobile-nav details summary { list-style: none; cursor: pointer; position: relative; }
.mobile-nav details summary::-webkit-details-marker { display: none; }
.mobile-nav details summary::after { content: '+'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 20px; line-height: 1; }
.mobile-nav details[open] summary::after { content: '−'; }
.mobile-nav-submenu { background: #f6f7f8; border: 1px solid #003c66; border-top: 0; border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; padding: 8px; }
.mobile-nav-submenu a { display: block; padding: 10px 12px; text-decoration: none; color: #003c66; border-radius: 10px; }
.mobile-nav-submenu a:hover, .mobile-nav-submenu a:focus { background: #f7d62a; }
@media (max-width: 920px) {
  html, body { background: linear-gradient(180deg, #ffe978 0%, #f7d62a 54%, #efc91f 100%) !important; }
  #superconteneur { position: relative; top: auto; left: auto; width: 100%; margin: 0; height: auto; }
  #headMain, #headBar, #headLogo, #menuTop, #mainconteneur { position: relative; top: auto; left: auto; width: 100%; height: auto; margin: 0; }
  #headMain { background: linear-gradient(180deg, rgba(255,248,202,.95) 0%, rgba(247,214,42,.82) 100%); overflow: hidden; }
  #headerslider, .lof-header, .lof-main-outer.lof-header, .lof-main-wapper.lof-header, .lof-main-wapper.lof-header li { width: 100% !important; height: auto !important; }
  #headerslider img, .lof-main-wapper.lof-header img { display: block; width: 100% !important; height: auto !important; }
  #headLogo { padding: 16px 16px 0; box-sizing: border-box; height: auto; }
  #headLogo a { display: block; max-width: 360px; }
  #headLogo img { display: block; width: 100%; height: auto; }
  #menuTop { display: none; }
  .mobile-menu-toggle { display: inline-block; position: fixed; top: 12px; right: 12px; z-index: 3010; }
  .mobile-nav-drawer, .mobile-nav-backdrop { display: block; }
  #mainconteneur { background: rgba(255,251,232,.94); padding: 18px 16px 24px; box-sizing: border-box; }
  #contenu, #rightBar { float: none; width: auto !important; margin: 0; }
  #rightBar { margin-top: 24px; }
  #rightBar > a, #rightBar > img { display: block; margin-left: auto !important; margin-right: auto !important; max-width: 100%; }
  #contenu h1 { font-size: 28px; line-height: 1.2; }
  #contenu h2 { font-size: 22px; line-height: 1.25; }
  #contenu h3 { font-size: 18px; line-height: 1.35; }
  #contenu p, #contenu li, #contenu td { font-size: 15px; line-height: 1.55; }
  #contenu img[style*="float: left"], #contenu img[style*="float:left"], #contenu img[style*="float: right"], #contenu img[style*="float:right"] { float: none !important; display: block; margin: 0 auto 16px !important; }
  #contenu table, #contenu iframe, #contenu object, #contenu embed { max-width: 100%; }
  #pied { background: #1d2a55; margin-top: 24px; }
  #pied table, #pied tbody, #pied tr, #pied td { display: block; width: auto !important; box-sizing: border-box; }
  #pied td { padding: 18px 20px !important; border-bottom: 1px solid rgba(255,255,255,.12); }
  #pied td:last-child { border-bottom: 0; text-align: left !important; }
  #news-slider, #news-slider .lof-main-outer, #news-slider .lof-main-wapper, #news-slider .lof-main-wapper li, #news-slider .lof-navigator-outer, #news-slider .lof-navigator { width: 100% !important; max-width: 100% !important; height: auto !important; box-sizing: border-box; }
  #news-slider .lof-main-wapper li img { width: 100% !important; height: auto !important; }
  #news-slider .lof-main-item-desc { position: static !important; width: auto !important; padding: 12px 14px 14px !important; background: #003c66 !important; }
  .lof-navigator-wapper { display: none !important; }
}


/* Renforts production */
:root { color-scheme: light; }
a, button { touch-action: manipulation; }
#contenu table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
#contenu td, #contenu th { white-space: normal; }
@media (max-width: 920px) {
  #headLogo { padding-right: 92px; }
  .mobile-menu-toggle { top: 10px; right: 10px; }
  #contenu { overflow-wrap: anywhere; }
  #contenu iframe { width: 100% !important; }
  #contenu object, #contenu embed { width: 100% !important; height: auto !important; }
  #contenu img { height: auto !important; }
  #contenu a.bt_action { display: inline-block; }
}
@media (max-width: 560px) {
  #mainconteneur { padding: 14px 12px 20px; }
  #headLogo { padding: 14px 78px 0 12px; }
  #contenu h1 { font-size: 24px; }
  #contenu h2 { font-size: 20px; }
  #contenu h3 { font-size: 17px; }
  #contenu p, #contenu li, #contenu td { font-size: 14px; line-height: 1.5; }
  .mobile-nav-content { padding: 10px 12px 18px; }
  .mobile-nav-home, .mobile-nav-link, .mobile-nav details summary { padding: 12px 14px; }
}


/* Carrousel d'accueil mobile moderne (desktop = slider historique conservé) */
.mobile-home-carousel { display: none; }
@media (max-width: 920px) {
  #news-slider { display: none !important; }
  .mobile-home-carousel {
    display: block;
    margin: 0 0 22px;
    background: #ffffff;
    border: 1px solid #d7dde3;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(0,0,0,.12);
  }
  .mobile-home-carousel-viewport {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobile-home-carousel-viewport::-webkit-scrollbar { display: none; }
  .mobile-home-slide {
    min-width: 100%;
    scroll-snap-align: start;
    background: #fff;
  }
  .mobile-home-slide figure { margin: 0; }
  .mobile-home-slide img {
    display: block;
    width: 100%;
    aspect-ratio: 400 / 291;
    object-fit: cover;
    background: #e8edf2;
  }
  .mobile-home-slide-body {
    padding: 16px 14px 18px;
    background: linear-gradient(180deg, #0d4c78 0%, #003c66 100%);
    color: #fff;
  }
  .mobile-home-slide-body h2 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 22px;
    line-height: 1.2;
  }
  .mobile-home-slide-body p {
    margin: 0;
    color: rgba(255,255,255,.96);
  }
  .mobile-home-slide-body .bt_action {
    display: inline-block;
    margin-top: 14px;
  }
  .mobile-home-carousel-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 14px;
    background: #fff;
  }
  .mobile-home-carousel-buttons {
    display: flex;
    gap: 8px;
  }
  .mobile-home-carousel-btn {
    appearance: none;
    border: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #003c66;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,.16);
  }
  .mobile-home-carousel-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 1;
  }
  .mobile-home-carousel-dot {
    appearance: none;
    border: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c4ced8;
    padding: 0;
    cursor: pointer;
  }
  .mobile-home-carousel-dot[aria-current="true"] { background: #f7d62a; }
}


/* V8 corrections: mobile plus propre et images mieux centrées */
@media (max-width: 920px) {
  #contenu img[src*="img/visuels/images/"] {
    display:block;
    float:none !important;
    width:min(100%, 360px) !important;
    max-width:100% !important;
    height:auto !important;
    margin:0 auto 18px !important;
  }
  #contenu img[src*="img/listing/"] {
    display:block;
    width:min(100%, 280px) !important;
    max-width:100% !important;
    height:auto !important;
    margin:0 auto 14px !important;
  }
  #news-slider .lof-main-wapper li img {
    width:100% !important;
    height:auto !important;
    object-fit:contain;
    background:#eef2f6;
  }
  .mobile-home-slide img {
    aspect-ratio:400 / 291;
    object-fit:contain;
    object-position:center center;
    background:#eef2f6;
  }
  #diaporama {
    width:100% !important;
    padding:12px 12px 14px !important;
    box-sizing:border-box;
  }
  #diaporama .scroll {
    width:100% !important;
    margin:0 !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    -webkit-overflow-scrolling:touch;
  }
  #diaporama .scrollContainer {
    display:flex !important;
    gap:10px;
    width:max-content !important;
    min-width:100%;
  }
  #diaporama .panel {
    float:none !important;
    width:220px !important;
    height:auto !important;
    padding:0 !important;
    flex:0 0 220px;
  }
  #diaporama .inside {
    padding:0 !important;
  }
  #diaporama .inside a {
    display:block;
  }
  #diaporama .inside img {
    width:100% !important;
    max-width:none !important;
    height:auto !important;
    margin:0 !important;
  }
  #diaporama img.scrollButtons {
    display:none !important;
  }
}
@media (max-width: 560px) {
  #contenu img[src*="img/visuels/images/"] {
    width:min(100%, 320px) !important;
  }
  #diaporama .panel {
    width:190px !important;
    flex-basis:190px;
  }
  .mobile-home-slide-body {
    padding:14px 12px 16px;
  }
  .mobile-home-slide-body h2 {
    font-size:20px;
  }
}


/* V9 corrections: hero accueil unifié + centrage mobile renforcé */
@media (max-width: 920px) {
  .modern-home-hero{
    margin:0 0 22px;
    border-radius:22px;
  }
  .modern-home-hero-media{
    padding:16px 52px;
  }
  .modern-home-hero-stage{
    min-height:240px;
  }
  .modern-home-hero-image{
    max-height:240px;
  }
  .modern-home-hero-arrow{
    width:42px;
    height:42px;
    font-size:24px;
  }
  .modern-home-hero-arrow.is-prev{left:8px;}
  .modern-home-hero-arrow.is-next{right:8px;}
  .modern-home-hero-caption{
    padding:16px 16px 18px;
  }
  .modern-home-hero-caption-top{
    display:block;
  }
  #contenu .modern-home-hero-title{
    font-size:24px;
    line-height:1.14;
  }
  #contenu .modern-home-hero-text{
    font-size:15px !important;
    line-height:1.52 !important;
  }
  .modern-home-hero-cta{
    margin-top:14px;
  }
  .modern-home-hero-meta{
    margin-top:14px;
  }

  #contenu img:not(.scrollButtons):not([src*="global/btn_"]):not([src*="pied_vhu"]):not([src*="phenix-recyclage.png"]){
    display:block;
    float:none !important;
    margin-left:auto !important;
    margin-right:auto !important;
  }
  #contenu p,
  #contenu h1,
  #contenu h2,
  #contenu h3,
  #contenu h4,
  #contenu table,
  #contenu iframe,
  #contenu object,
  #contenu embed,
  #diaporama,
  #downFiles,
  #rightBar{
    margin-left:auto !important;
    margin-right:auto !important;
  }
  #contenu .photo,
  #contenu .listingItem,
  #diaporama .panel,
  #downFiles li,
  #rightBar > a,
  #rightBar > img{
    text-align:center;
  }
  #contenu table.listingItem,
  #contenu table:not(.listingItem){
    width:100% !important;
  }
}
@media (max-width: 560px) {
  .modern-home-hero-media{
    padding:14px 44px;
  }
  .modern-home-hero-stage{
    min-height:200px;
  }
  .modern-home-hero-image{
    max-height:200px;
  }
  #contenu .modern-home-hero-title{
    font-size:21px;
  }
  .modern-home-hero-count{
    font-size:12px;
  }
}

/* V11 mobile corrections */
@media (max-width: 920px) {
  #headMain{
    display:block !important;
    height:128px !important;
    border-radius:0 0 26px 26px;
    background:linear-gradient(180deg, rgba(255,248,202,.92) 0%, rgba(247,214,42,.82) 100%);
  }
  #headerslider,
  .lof-header,
  .lof-main-outer.lof-header,
  .lof-main-wapper.lof-header,
  .lof-main-wapper.lof-header li{
    width:100% !important;
    height:128px !important;
  }
  #headerslider img,
  .lof-main-wapper.lof-header img{
    width:100% !important;
    height:128px !important;
    object-fit:cover !important;
    object-position:center center;
  }
  #headLogo{
    padding:14px 88px 0 14px;
  }
  #headLogo a{
    max-width:320px;
    background:linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,.06));
    border-radius:0 0 0 18px;
  }
  .modern-home-hero{
    margin:16px 0 22px;
    border-radius:18px;
  }
  .modern-home-hero-stage{
    min-height:220px;
  }
  .modern-home-hero-stage-inner{
    height:220px;
    padding:14px 52px;
  }
  .modern-home-hero-arrow{
    width:40px;
    height:40px;
    font-size:22px;
  }
  .modern-home-hero-arrow.is-prev{ left:8px; }
  .modern-home-hero-arrow.is-next{ right:8px; }
  .modern-home-hero-caption{
    padding:14px 14px 16px;
  }
  #contenu .modern-home-hero-title{
    font-size:20px;
  }
  #contenu .modern-home-hero-text{
    font-size:14px;
    line-height:1.5;
  }

  #contenu img:not(.scrollButtons):not([src*="global/btn_"]):not([src*="pied_vhu"]):not([src*="phenix-recyclage.png"]){
    display:block;
    float:none !important;
    margin:0 auto 14px !important;
    max-width:min(100%, 360px) !important;
    height:auto !important;
  }
  #contenu p,
  #contenu h1,
  #contenu h2,
  #contenu h3,
  #contenu h4{
    text-align:left;
  }
  #diaporama{
    width:100% !important;
  }
  #rightBar{
    width:auto !important;
    margin:20px 16px 28px !important;
    float:none !important;
  }
  .rightbar-top-grid,
  .rightbar-square-grid{
    gap:12px;
  }
}
@media (max-width: 560px) {
  #headMain{
    height:110px !important;
  }
  #headerslider,
  .lof-header,
  .lof-main-outer.lof-header,
  .lof-main-wapper.lof-header,
  .lof-main-wapper.lof-header li{
    height:110px !important;
  }
  #headerslider img,
  .lof-main-wapper.lof-header img{
    height:110px !important;
  }
  .modern-home-hero-stage{
    min-height:200px;
  }
  .modern-home-hero-stage-inner{
    height:200px;
    padding:12px 44px;
  }
  .rightbar-top-grid,
  .rightbar-square-grid{
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
}


/* V15 mobile header: keep logo on top of hero image */
@media (max-width: 920px) {
  #superconteneur{ position:relative; }
  #headMain{ position:relative; z-index:1; }
  #headLogo{
    position:absolute !important;
    top:14px;
    left:14px;
    right:88px;
    width:auto !important;
    height:auto !important;
    margin:0 !important;
    padding:0 !important;
    z-index:60;
  }
  #headLogo a{
    display:inline-block;
    max-width:min(72vw, 320px);
  }
  #menuTop,
  #mainconteneur{
    position:relative;
    z-index:2;
  }
}
@media (max-width: 560px) {
  #headLogo{
    top:12px;
    left:12px;
    right:76px;
  }
  #headLogo a{
    max-width:min(68vw, 270px);
  }
}


/* V16 mobile slider arrows: keep compact overlay */
@media (max-width: 920px){
  .modern-home-hero-stage{
    height: 250px !important;
    min-height: 250px !important;
    max-height: 250px !important;
    border-radius: 14px;
  }
  .modern-home-hero-stage-inner{
    height: 250px !important;
    min-height: 250px !important;
    max-height: 250px !important;
    padding: 0 44px !important;
  }
  .modern-home-hero-arrow{
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    font-size: 22px !important;
  }
  .modern-home-hero-arrow.is-prev{left:10px !important;}
  .modern-home-hero-arrow.is-next{right:10px !important;}
}


/* V17 : menu mobile réellement lié à la fenêtre, sans défilement horizontal. */
@media (max-width: 920px) {
  html, body {
    max-width: 100%;
    overflow-x: clip !important;
  }
  #superconteneur {
    /* Un filter sur un parent transforme le positionnement fixed de ses enfants. */
    filter: none !important;
    max-width: 100%;
  }
  .mobile-menu-toggle {
    position: fixed !important;
    top: 12px !important;
    right: 12px !important;
    left: auto !important;
    z-index: 5003 !important;
  }
  body.mobile-nav-active .mobile-menu-toggle {
    opacity: 0;
    pointer-events: none;
  }
  .mobile-nav-backdrop {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    box-sizing: border-box !important;
    z-index: 5001 !important;
  }
  .mobile-nav-drawer {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    left: auto !important;
    width: min(88vw, 360px) !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    box-sizing: border-box !important;
    z-index: 5002 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translate3d(105%, 0, 0) !important;
  }
  .mobile-nav-drawer.is-open {
    transform: translate3d(0, 0, 0) !important;
  }
  .mobile-nav-header,
  .mobile-nav-content,
  .mobile-nav {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .mobile-nav * {
    box-sizing: border-box;
    min-width: 0;
  }
  .mobile-nav a,
  .mobile-nav summary {
    overflow-wrap: anywhere;
  }
}
@media (max-width: 560px) {
  .mobile-menu-toggle {
    top: 10px !important;
    right: 10px !important;
  }
}
