/* ═══════════════════════════════════════════════════════════════
   MOBILE PREMIUM — Pinapp
   Mobile-first : même graphisme Pandora que desktop, adapté tactile
   ═══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────
   1. DRAWER MOBILE — premium glassmorphism
   ────────────────────────────────────────────────────────────── */

/* Fond overlay sombre */
.mobile-drawer {
  background: rgba(0, 0, 0, 0.55) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Panel drawer — même style que nav */
.mobile-drawer-panel {
  background: var(--glass-thin-bg, rgba(2, 8, 20, 0.92)) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  border-left: 0.5px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.4) !important;
  padding: calc(env(safe-area-inset-top, 20px) + 60px) 28px 40px !important;
  width: min(20rem, 88vw) !important;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Mode jour */
body.mode-jour .mobile-drawer-panel,
html[data-theme='light'] .mobile-drawer-panel {
  background: rgba(255, 255, 255, 0.97) !important;
  border-left: 0.5px solid rgba(15, 23, 41, 0.08) !important;
  box-shadow: -16px 0 48px rgba(15, 23, 41, 0.1) !important;
}

/* Bouton close — icône SVG propre */
#drawerClose {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 16px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text, #eef8ff);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 160ms ease;
  -webkit-tap-highlight-color: transparent;
}
#drawerClose:hover,
#drawerClose:active {
  background: rgba(255, 255, 255, 0.12);
}
body.mode-jour #drawerClose,
html[data-theme='light'] #drawerClose {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.04);
  color: #0f1729;
}

/* Liens du drawer */
.mobile-drawer-panel .nav-links {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  width: 100% !important;
  padding: 0 !important;
  margin-top: 8px;
}

.mobile-drawer-panel .nav-link,
.mobile-drawer-panel a.nav-link {
  display: flex !important;
  align-items: center;
  min-height: 52px;
  padding: 0 0 0 4px !important;
  font-size: 1rem !important;
  font-weight: 500 !important;
  color: var(--text, #eef8ff) !important;
  opacity: 1 !important;
  text-decoration: none !important;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.07) !important;
  transition:
    color 160ms ease,
    padding-left 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

body.mode-jour .mobile-drawer-panel .nav-link,
html[data-theme='light'] .mobile-drawer-panel .nav-link {
  color: #0f1729 !important;
  border-bottom-color: rgba(0, 0, 0, 0.07) !important;
}

.mobile-drawer-panel .nav-link:hover,
.mobile-drawer-panel .nav-link:active {
  color: var(--teal, #00e5cc) !important;
  padding-left: 12px !important;
}

body.mode-jour .mobile-drawer-panel .nav-link:hover,
body.mode-jour .mobile-drawer-panel .nav-link:active,
html[data-theme='light'] .mobile-drawer-panel .nav-link:hover,
html[data-theme='light'] .mobile-drawer-panel .nav-link:active {
  color: #0f766e !important;
}

/* CTA dans drawer */
.mobile-drawer-panel .btn-primary,
.mobile-drawer-panel a.btn-primary {
  width: 100% !important;
  justify-content: center !important;
  margin-top: 24px !important;
  min-height: 50px !important;
  border-bottom: none !important;
  font-size: 1rem !important;
  padding: 14px 24px !important;
  border-radius: 100px !important;
}

/* ──────────────────────────────────────────────────────────────
   2. BOTTOM BAR — premium, même style que nav
   ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .bottom-bar {
    background: var(--glass-thin-bg, rgba(2, 8, 20, 0.88)) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    border-top: 0.5px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2) !important;
    min-height: calc(3.5rem + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 2800;
  }

  body.mode-jour .bottom-bar,
  html[data-theme='light'] .bottom-bar {
    background: rgba(255, 255, 255, 0.94) !important;
    border-top-color: rgba(15, 23, 41, 0.08) !important;
    box-shadow: 0 -4px 20px rgba(15, 23, 41, 0.06) !important;
  }

  .bottom-bar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 44px;
    min-width: 44px;
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-3, rgba(238, 248, 255, 0.45)) !important;
    opacity: 1 !important;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 160ms ease;
  }

  body.mode-jour .bottom-bar a,
  html[data-theme='light'] .bottom-bar a {
    color: rgba(15, 23, 41, 0.45) !important;
  }

  .bottom-bar a.active,
  .bottom-bar a:active {
    color: var(--teal, #00e5cc) !important;
  }

  body.mode-jour .bottom-bar a.active,
  body.mode-jour .bottom-bar a:active,
  html[data-theme='light'] .bottom-bar a.active {
    color: #0f766e !important;
  }

  /* Bouton CTA bottom-bar — zone tactile ≥ 44×44 pt (HIG) */
  .bottom-bar .bottom-bar-cta {
    background: linear-gradient(135deg, var(--violet, #7b4fe8), #9b6ff8) !important;
    color: #fff !important;
    padding: 10px 18px !important;
    border-radius: 100px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    min-height: 44px !important;
    min-width: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 16px rgba(123, 79, 232, 0.35) !important;
    -webkit-tap-highlight-color: transparent;
    border: none !important;
    touch-action: manipulation;
  }

  body.mode-jour .bottom-bar .bottom-bar-cta,
  html[data-theme='light'] .bottom-bar .bottom-bar-cta {
    background: linear-gradient(135deg, #5b3fd8, #7b5fe8) !important;
    box-shadow: 0 4px 16px rgba(91, 63, 216, 0.3) !important;
  }
}

/* ──────────────────────────────────────────────────────────────
   3. BOUTONS — touch targets Apple HIG (44px minimum)
   ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .btn,
  .btn-primary,
  .btn-secondary,
  [class*='-pill'],
  .filtre-pill,
  .secteur-pill {
    min-height: 44px !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  /* Exceptions : pills en ligne - pas full width */
  .filtre-pill,
  .secteur-pill,
  .pill-choice,
  .pill-btn,
  .quiz-opt,
  [class*='-pill'] {
    width: auto !important;
    flex-shrink: 0;
  }

  /* Calculateur & config : pills hors grille « -pill » dans le nom de classe */
  .pill-choice,
  .pill-btn {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 18px !important;
  }

  /* Padding tactile généreux */
  .btn {
    padding: 14px 28px !important;
    font-size: 1rem !important;
  }
}

/* ──────────────────────────────────────────────────────────────
   4. CARTES MOBILE — même premium que desktop
   ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .block,
  .card,
  .offre-card,
  .etape-card,
  .tech-card {
    /* Même glassmorphism que desktop */
    background: var(--glass, rgba(0, 15, 30, 0.5)) !important;
    -webkit-backdrop-filter: var(--glass-blur, blur(24px) saturate(140%)) !important;
    backdrop-filter: var(--glass-blur, blur(24px) saturate(140%)) !important;
    border: 1px solid var(--border-card, rgba(0, 180, 216, 0.14)) !important;
    border-radius: 20px !important;
    /* Hover transformations désactivées sur mobile (tactile) */
    transform: none !important;
    transition: box-shadow 200ms ease !important;
  }

  body.mode-jour .block,
  body.mode-jour .card,
  body.mode-jour .offre-card,
  html[data-theme='light'] .block,
  html[data-theme='light'] .card,
  html[data-theme='light'] .offre-card {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(15, 23, 41, 0.09) !important;
  }
}

/* ──────────────────────────────────────────────────────────────
   5. SECTION ENTER — sécurité mobile (visible si JS lent)
   ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .section-enter {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ──────────────────────────────────────────────────────────────
   6. TYPOGRAPHIE — mobile-first cohérente avec desktop
   ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* Titres : clamp dynamique, même police que desktop */
  h1,
  .hero-titre {
    font-size: clamp(1.75rem, 7.5vw, 3rem) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.03em !important;
  }

  h2,
  [class*='-titre-section'] {
    font-size: clamp(1.375rem, 5.5vw, 2rem) !important;
    line-height: 1.2 !important;
    letter-spacing: -0.02em !important;
  }

  h3,
  .card-titre,
  [class*='-titre-card'] {
    font-size: clamp(1.0625rem, 4vw, 1.375rem) !important;
    line-height: 1.3 !important;
  }

  p,
  .body-text {
    font-size: clamp(0.9375rem, 3.8vw, 1.0625rem) !important;
    line-height: 1.65 !important;
  }
}

/* ──────────────────────────────────────────────────────────────
   7. NAVIGATION — cohérence nav desktop/mobile
   ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* Nav top : visible, même glassmorphism */
  .nav {
    background: var(--glass-thin-bg, rgba(2, 8, 20, 0.72)) !important;
    -webkit-backdrop-filter: var(--glass-thin-blur, blur(20px) saturate(180%)) !important;
    backdrop-filter: var(--glass-thin-blur, blur(20px) saturate(180%)) !important;
  }

  body.mode-jour .nav,
  html[data-theme='light'] .nav {
    background: rgba(255, 248, 238, 0.9) !important;
  }

  /* Burger — visible et bien dimensionné */
  .burger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    color: var(--text, #eef8ff);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
  }

  body.mode-jour .burger,
  html[data-theme='light'] .burger {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #0f1729;
  }

  /* Thème clair/sombre : zone tactile ≥ 44px (HIG) */
  .nav .mode-toggle {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}

/* ──────────────────────────────────────────────────────────────
   8. ESPACEMENT — pas trop de scroll
   ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  section.section,
  [class*='-section'],
  [class*='-hero'] {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
  }

  /* Première section sous la nav */
  .pinapp-hero-viewport {
    padding-top: calc(env(safe-area-inset-top, 0px) + 64px) !important;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 80px) !important;
    min-height: 85svh !important;
  }

  /* Espace respiratoire avant le footer — la bottom-bar est déjà compensée sur body.page-with-bottom-nav (grid.css) */
  body.page-with-bottom-nav main > *:last-child {
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Grilles : 1 colonne sur mobile sauf exception */
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
  }
  .grid-2 {
    grid-template-columns: 1fr !important;
  }
}

/* ──────────────────────────────────────────────────────────────
   9. PANDORA EFFECTS MOBILE — garder la magie
   ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* Fond photo — garder le blur même sans animations */
  body::before {
    transform: scale(1.15) !important;
    will-change: auto !important;
  }

  /* Orbes réduits mais présents */
  .orb-1,
  .orb-2 {
    width: 60vw !important;
    height: 40vh !important;
    filter: blur(60px) !important;
  }
  .orb-3,
  .orb-4 {
    display: none !important;
  }

  /* Grille holo — subtile sur mobile */
  .holo-grid {
    opacity: 0.4 !important;
    animation: none !important;
  }

  /* Shapes Pandora jour — visibles mais allégées */
  .pandora-shape {
    animation: forest-sway 20s ease-in-out infinite !important;
    filter: blur(50px) !important;
  }
}
