/* ═══════════════════════════════════════════════════════════════════
   MOBILE.CSS — Pergolas Caraïbes
   STRATÉGIE : MINIMAL. On COMPLÈTE le CSS desktop, on ne l'écrase pas.

   Le CSS desktop d'origine a déjà des breakpoints responsifs pour :
   - .zones-grid, .prod-grid, .cta-sec, .ft-top, .swrap, .tc, .test-grid
   - .hero, .hero-c, .hero-scroll-ind, .par-nums
   - .pillars-sec, .intro-sec, .mat-sec, .inst-sec, .tech-sec, .opt-sec
   - .seo-hero, .seo-cta-final, .seo-sec, .blog-hero, .blog-cta-card
   - .n-mid (caché à 768px par le desktop natif)

   Mon mobile.css ajoute UNIQUEMENT ce que desktop ne gère pas :
   - Header mobile (hamburger, drawer, call-btn gold)
   - Override du curtain-effect (body dark + footer fixed) sur mobile
   - Anti-zoom iOS sur input
   - Cookie banner adapté
═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
   1. RESET MOBILE & TABLETTE (≤ 1024px)
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  /* Pas de scroll horizontal */
  html, body {
    max-width: 100vw;
    overflow-x: hidden;
  }
  img, video, iframe {
    max-width: 100%;
    height: auto;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   2. MOBILE (≤ 768px) — Override curtain-effect & ajustements
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ─── Body cream (pas dark) sur mobile + 0 padding (fix bande blanche) ─── */
  body {
    background: var(--bg, #F5F4F0) !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* ─── Curtain-wrap plat sans shadow sur mobile ─── */
  .curtain-wrap {
    box-shadow: none !important;
    background: var(--bg, #F5F4F0) !important;
  }

  /* ─── Footer en flow normal mobile (pas fixed comme desktop) ─── */
  footer {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: auto !important;
    transform: none !important;
    will-change: auto !important;
  }

  /* ─── Cacher le mega menu desktop (le drawer mobile prend le relais) ─── */
  #mm,
  #mm.on {
    display: none !important;
  }

  /* ─── Anti-zoom iOS sur les inputs ─── */
  input, textarea, select {
    font-size: 16px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   3. HEADER MOBILE — Hamburger + Bouton call gold
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Cacher items menu desktop (.n-mid) sur mobile — pas toutes les pages le font */
  /* On utilise le hamburger + drawer mobile à la place */
  .n-mid {
    display: none !important;
  }
  /* Cacher toggle EN (manque de place) */
  #lang-toggle,
  .lang-btn,
  .n-r .lang-btn {
    display: none !important;
  }

  /* Bouton appel : cercle gold premium */
  .btn-nav,
  #contact-btn,
  .n-r .btn-nav,
  nav button[onclick*="openContact"] {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    font-size: 0 !important;
    background: var(--gold, #D4A843) !important;
    color: var(--dark, #0A0A0A) !important;
    border: none !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 12px rgba(212, 168, 67, .25) !important;
    flex-shrink: 0 !important;
  }
  .btn-nav svg,
  #contact-btn svg,
  nav button[onclick*="openContact"] svg {
    width: 17px !important;
    height: 17px !important;
    margin: 0 !important;
    stroke: var(--dark, #0A0A0A) !important;
  }
  .btn-nav:active,
  #contact-btn:active {
    transform: scale(.94);
    box-shadow: 0 1px 6px rgba(212, 168, 67, .2) !important;
  }

  /* Hamburger (créé dynamiquement par mobile.js) */
  .nav-burger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(10, 10, 10, .18);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: border-color .3s, background .3s;
    position: relative;
    z-index: 1200;
    margin-left: .5rem;
  }
  .nav-burger:active { background: rgba(10, 10, 10, .04); }

  .nav-burger span {
    display: block;
    width: 16px;
    height: 1.5px;
    background: var(--dark, #0A0A0A);
    transition: transform .35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity .25s ease,
                background .35s ease;
    border-radius: 2px;
  }
  /* Burger état "ouvert" → croix */
  .nav-burger.on {
    background: var(--dark, #0A0A0A);
    border-color: var(--dark, #0A0A0A);
  }
  .nav-burger.on span { background: #fff !important; }
  .nav-burger.on span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav-burger.on span:nth-child(2) { opacity: 0; }
  .nav-burger.on span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  /* Sur hero sombre (nav transparente non scrollée) : burger blanc */
  nav:not(.s) .nav-burger {
    border-color: rgba(255, 255, 255, .35);
  }
  nav:not(.s) .nav-burger span {
    background: rgba(255, 255, 255, .95);
  }
  nav:not(.s) .nav-burger.on {
    background: #fff;
    border-color: #fff;
  }
  nav:not(.s) .nav-burger.on span { background: var(--dark, #0A0A0A) !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   4. DRAWER MOBILE (créé dynamiquement par mobile.js)
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1140;
    opacity: 0;
    pointer-events: none;
    transition: opacity .55s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-drawer-overlay.on {
    opacity: 1;
    pointer-events: all;
  }

  .mobile-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(88vw, 440px);
    max-width: 440px;
    background: var(--bg, #F5F4F0);
    z-index: 1150;
    transform: translateX(100%);
    transition: transform .55s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -20px 0 60px rgba(0, 0, 0, .22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .mobile-drawer.on { transform: translateX(0); }

  .mobile-drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.4rem 1.6rem;
    border-bottom: 1px solid rgba(10, 10, 10, .08);
    flex-shrink: 0;
  }
  .mobile-drawer-logo {
    font-family: var(--serif, 'Inter', sans-serif);
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--dark, #0A0A0A);
    letter-spacing: .04em;
  }
  .mobile-drawer-logo i {
    font-style: normal;
    color: var(--gold, #D4A843);
  }
  .mobile-drawer-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(10, 10, 10, .15);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
  }
  .mobile-drawer-close:active {
    background: rgba(10, 10, 10, .04);
  }
  .mobile-drawer-close svg {
    width: 14px;
    height: 14px;
    stroke: var(--dark, #0A0A0A);
  }

  .mobile-drawer-body {
    flex: 1 1 auto;
    padding: 1.4rem 0 .5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .mobile-drawer-section {
    padding: 0 1.6rem;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity .55s cubic-bezier(0.16, 1, 0.3, 1),
                transform .55s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mobile-drawer.on .mobile-drawer-section {
    opacity: 1;
    transform: none;
  }
  .mobile-drawer.on .mobile-drawer-section:nth-child(1) { transition-delay: .15s; }
  .mobile-drawer.on .mobile-drawer-section:nth-child(2) { transition-delay: .22s; }
  .mobile-drawer.on .mobile-drawer-section:nth-child(3) { transition-delay: .29s; }
  .mobile-drawer.on .mobile-drawer-section:nth-child(4) { transition-delay: .36s; }
  .mobile-drawer.on .mobile-drawer-section:nth-child(5) { transition-delay: .43s; }

  .mobile-drawer-h {
    font-size: .58rem;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--gold, #D4A843);
    margin: 1.5rem 0 .7rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .7rem;
  }
  .mobile-drawer-h::before {
    content: '';
    width: 18px;
    height: 1px;
    background: var(--gold, #D4A843);
    flex-shrink: 0;
  }
  .mobile-drawer-section:first-child .mobile-drawer-h { margin-top: 0; }

  .mobile-drawer a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 0;
    font-size: 1rem;
    color: var(--dark, #0A0A0A);
    text-decoration: none;
    border-bottom: 1px solid rgba(10, 10, 10, .06);
    transition: padding-left .3s, color .3s;
    font-weight: 400;
    line-height: 1.3;
  }
  .mobile-drawer a::after {
    content: '→';
    color: rgba(10, 10, 10, .25);
    font-size: .9rem;
    transition: transform .3s, color .3s;
    flex-shrink: 0;
    margin-left: 1rem;
  }
  .mobile-drawer a:active {
    color: var(--gold, #D4A843);
    padding-left: .35rem;
  }
  .mobile-drawer a:active::after {
    color: var(--gold, #D4A843);
    transform: translateX(3px);
  }

  .mobile-drawer-foot {
    padding: 1.4rem 1.6rem 1.6rem;
    border-top: 1px solid rgba(10, 10, 10, .08);
    flex-shrink: 0;
    background: var(--bg, #F5F4F0);
  }
  .mobile-drawer-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 100%;
    padding: 1.1rem 1.4rem;
    background: var(--dark, #0A0A0A);
    color: #fff;
    border-radius: 6px;
    font-size: .72rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background .25s, transform .15s;
  }
  .mobile-drawer-cta::after { display: none; }
  .mobile-drawer-cta:active {
    background: var(--gold, #D4A843);
    color: var(--dark, #0A0A0A);
    transform: scale(.98);
  }
  .mobile-drawer-cta svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
  }
  .mobile-drawer-foot-hint {
    margin-top: .85rem;
    text-align: center;
    font-size: .65rem;
    color: var(--gray, #828487);
    letter-spacing: .04em;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   5. COOKIE BANNER + STICKY CTA mobile
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Cookie banner adapté — sélecteurs précis (pas [class*="cookie"] qui matche body.cookie-dismissed !) */
  .cc-banner, #cookie-consent, #pcc-cc {
    width: calc(100% - 1.6rem) !important;
    right: .8rem !important;
    left: .8rem !important;
    bottom: .8rem !important;
    max-width: none !important;
    padding: 1rem 1.2rem !important;
    font-size: .78rem !important;
  }
  /* Sticky CTA remonté pour ne pas chevaucher cookie banner */
  .sticky-cta {
    bottom: 5.5rem !important;
    z-index: 998 !important;
  }
  body.cookie-dismissed .sticky-cta {
    bottom: 1rem !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   6. Anti-débordement parallax iOS (background-attachment fixed bug)
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .parallax,
  .blog-hero,
  .seo-hero,
  .seo-cta-final,
  .liv-hero,
  .liv-cta {
    background-attachment: scroll !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   7. FIX BUGS desktop natifs (CSS original a des conflits)
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 520px) {
  /* Bug index.html ligne 1060 : .zones-grid { 1fr 1fr } écrase la 1fr de ligne 766
     → on force 1 colonne sur petit mobile */
  .zones-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  /* Hero home : "Bioclimatique" trop large à 44.8px sur 375px viewport
     → on réduit la font à 38px max */
  .hero-big-l1, .hero-big-l2 {
    font-size: clamp(2rem, 9vw, 2.6rem) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   8. Desktop reset (≥ 769px) — Cacher éléments mobile
═══════════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
  .nav-burger,
  .mobile-drawer,
  .mobile-drawer-overlay {
    display: none !important;
  }
}
