/* =========================================================================
   Responsive enhancements + mobile navigation
   Loaded AFTER styles.css to override / extend
   ========================================================================= */

/* Pas de défilement horizontal (drawer mobile hors écran). `clip` n'établit
   pas de conteneur de défilement, contrairement à `hidden`. */
html, body { overflow-x: clip !important; }

/* === En-tête toujours visible au défilement ============================
   La structure Elementor casse `position:sticky` (en-tête dans un widget
   court) ; on passe en `position:fixed` — fiable quelle que soit la
   structure — et on compense la hauteur avec un padding sur le contenu. */
.site-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 200 !important;
}
body.admin-bar .site-header { top: 32px !important; }
/* Compense la hauteur de l'en-tête fixe (hors lecteur de cours plein écran).
   Ces valeurs sont un repli : mobile-nav.js mesure la hauteur réelle de
   l'en-tête et ajuste le padding au pixel près — à toutes les largeurs
   (mobile, tablette, bureau) et avec ou sans barre d'administration. */
body:not(.masterstudy-course-player-body-hidden) { padding-top: 106px; }
@media (max-width: 980px) {
  body:not(.masterstudy-course-player-body-hidden) { padding-top: 96px; }
}
@media (max-width: 782px) {
  body.admin-bar .site-header { top: 46px !important; }
}

/* ---------- Hamburger button (hidden on desktop) ---------- */
.burger {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: white;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.burger:hover { background: var(--bg-soft); }
.burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink-900);
  border-radius: 2px;
  transition: transform .25s, opacity .2s;
  transform-origin: center;
}
.burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 880px) {
  .burger { display: inline-flex; }
}

/* ---------- Mobile drawer ---------- */
.mnav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(12, 26, 43, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 90;
  backdrop-filter: blur(2px);
}
.mnav-scrim.is-open { opacity: 1; pointer-events: auto; }

.mnav-drawer {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  height: 100dvh;
  width: 320px;
  max-width: 88vw;
  background: white;
  z-index: 100;
  box-shadow: -8px 0 32px rgba(12, 26, 43, 0.15);
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
[dir="rtl"] .mnav-drawer {
  transform: translateX(-100%);
  box-shadow: 8px 0 32px rgba(12, 26, 43, 0.15);
}
.mnav-drawer.is-open { transform: translateX(0); }

.mnav-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-5);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.mnav-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--bg-soft);
  font-size: 20px;
  color: var(--ink-700);
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
}
.mnav-close:hover { background: var(--line); }

.mnav-links {
  display: flex;
  flex-direction: column;
  padding: var(--s-4) var(--s-3);
  gap: 2px;
  flex: 1;
}
.mnav-links a {
  padding: 14px 16px;
  border-radius: var(--r-sm);
  font-size: var(--t-16);
  font-weight: 600;
  color: var(--ink-700);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .15s, color .15s;
}
.mnav-links a:hover { background: var(--bg-soft); color: var(--ink-900); }
.mnav-links a.is-active { background: var(--bg-sky); color: var(--brand-blue-700); }

.mnav-foot {
  padding: var(--s-5);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  flex-shrink: 0;
}
.mnav-foot .btn { width: 100%; }
.mnav-lang {
  display: flex;
  background: var(--bg-soft);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
  margin-bottom: 4px;
}
.mnav-lang button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px;
  border-radius: var(--r-pill);
  font-size: var(--t-13);
  font-weight: 600;
  color: var(--ink-500);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mnav-lang button.is-active {
  background: white;
  color: var(--ink-900);
  box-shadow: var(--sh-xs);
}
.mnav-contact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  margin-top: var(--s-2);
}
.mnav-contact a {
  font-size: var(--t-13);
  color: var(--ink-500);
}

/* ---------- Hide desktop bits on tablet+mobile ---------- */
@media (max-width: 880px) {
  .site-nav { display: none !important; }
  .header-actions .lang-toggle { display: none; }
  .header-actions .btn--ghost { display: none; }
  .site-header__inner { gap: var(--s-3); }
  .brand-name small { display: none; }
}
@media (max-width: 480px) {
  .header-actions .btn--primary { display: none; }
}

/* ---------- HERO responsive polish ---------- */
@media (max-width: 920px) {
  .hero { padding: var(--s-10) 0 var(--s-12); }
  .hero__visual { margin-top: var(--s-6); }
}
@media (max-width: 720px) {
  .hero { padding: var(--s-8) 0 var(--s-12); }
  .hero__title { font-size: clamp(30px, 8vw, 40px); line-height: 1.1; }
  .hero__cta { flex-direction: column; align-items: stretch; }
  .hero__cta .btn { width: 100%; justify-content: center; }
  .hero__trust { flex-direction: column; align-items: flex-start; gap: 6px; }
  .hero__visual { height: 320px; }
  .mascot-slot { width: 220px; height: 250px; }
  .float-card { padding: 10px 12px; }
  .float-card__title { font-size: 12px; }
  .float-card__sub { font-size: 11px; }
  .float-card__eq { font-size: 18px; }
  .float-card__score { font-size: 22px; }
  .float-card__bar { width: 100px; }
}
@media (max-width: 480px) {
  .hero__visual { height: 280px; }
  .mascot-slot { width: 180px; height: 200px; }
  .float-card--eq { top: 8%; left: -6px; transform: scale(0.9); }
  .float-card--quiz { top: 14%; right: -6px; transform: scale(0.9); }
  .float-card--progress { bottom: 8%; left: -6px; transform: scale(0.9); }
  .float-card--streak { bottom: 4%; right: -6px; transform: scale(0.9); }
}

/* ---------- Trust strip ---------- */
@media (max-width: 720px) {
  .trust__inner { gap: var(--s-3) var(--s-5); padding: var(--s-4); }
  .trust__chip { font-size: var(--t-13); }
}

/* ---------- Levels ---------- */
@media (max-width: 720px) {
  .level-card { min-height: auto; }
  .level-card__title { font-size: var(--t-20); }
}

/* ---------- Stats ---------- */
@media (max-width: 720px) {
  .stats { padding: var(--s-10) 0; }
  .stat__v { font-size: clamp(28px, 9vw, 42px); }
  .stat__l { font-size: var(--t-12); }
}

/* ---------- Offers ---------- */
@media (max-width: 920px) {
  .offers__grid { gap: var(--s-8); }
  .plan--featured { transform: scale(1); }
  .plan--featured:hover { transform: translateY(-3px); }
}

/* ---------- Testimonials ---------- */
@media (max-width: 720px) {
  .testimonial { padding: var(--s-5); }
  .testimonial blockquote { font-size: var(--t-15); }
}

/* ---------- Contact CTA ---------- */
@media (max-width: 720px) {
  .contact-cta__inner { flex-direction: column; align-items: flex-start; text-align: start; }
  .contact-cta__inner .btn { width: 100%; }
}

/* ---------- Footer ---------- */
@media (max-width: 720px) {
  .footer-wave { height: 50px; margin-top: 40px; }
  .site-footer__top { padding: var(--s-8) 0 var(--s-6); gap: var(--s-6); }
  .site-footer__bottom { flex-direction: column; align-items: flex-start; }
  .site-footer__bottom .legal { flex-wrap: wrap; }
}

/* ---------- Section spacing on mobile ---------- */
@media (max-width: 720px) {
  .section-pad { padding: var(--s-10) 0; }
  .section-pad-sm { padding: var(--s-8) 0; }
  .section-title { font-size: clamp(24px, 6vw, 32px); }
  .section-lede { font-size: var(--t-16); }
}

/* ---------- Course detail ---------- */
@media (max-width: 720px) {
  .course-summary { gap: var(--s-4); }
  .resume-card { flex-direction: column; align-items: flex-start; padding: var(--s-5); gap: var(--s-3); }
  .resume-card .btn { width: 100%; }
  .progress-card__meta { grid-template-columns: 1fr 1fr 1fr; gap: var(--s-2); }
  .progress-card__meta b { font-size: var(--t-16); }
  .chapter__assets { grid-template-columns: 1fr; }
}

/* ---------- Dashboard ---------- */
@media (max-width: 720px) {
  .continue-card { grid-template-columns: 1fr; }
  .continue-card__visual { height: 140px; }
  .continue-card__cta { width: 100%; justify-content: center; }
  .my-course { grid-template-columns: 40px 1fr auto; gap: var(--s-3); }
  .my-course__bar { grid-column: 1 / -1; }
  .my-course__pct { font-size: var(--t-14); }
}

/* ---------- Auth ---------- */
@media (max-width: 540px) {
  .field-row { grid-template-columns: 1fr; }
  .plan-picker { grid-template-columns: 1fr; }
  .social-row { grid-template-columns: 1fr; }
  .auth-form-col { padding: var(--s-6) var(--s-5); }
}

/* ---------- Catalog ---------- */
@media (max-width: 720px) {
  .filter-bar { flex-direction: column; align-items: stretch; padding: var(--s-3); border-radius: var(--r-md); }
  .filter-search { padding: 8px 12px; }
  .filter-chips { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .filter-chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }
  .cycle-block__head { flex-direction: column; align-items: flex-start; }
}

/* ---------- Contact page ---------- */
@media (max-width: 720px) {
  .contact-form-card { padding: var(--s-5); }
}

/* ---------- Rationale doc ---------- */
@media (max-width: 720px) {
  .doc { padding: var(--s-8) var(--s-5) var(--s-12); }
  .doc h1 { font-size: clamp(28px, 7vw, 40px); }
  .doc h2 { font-size: var(--t-24); margin: var(--s-8) 0 var(--s-3); padding-top: var(--s-6); }
}

/* ---------- Better focus for mobile inputs ---------- */
@media (max-width: 720px) {
  input, textarea, select { font-size: 16px !important; } /* prevent iOS zoom */
}

/* ---------- Tablet breakpoint refinements (720-920) ---------- */
@media (min-width: 721px) and (max-width: 920px) {
  .hero__inner { gap: var(--s-8); }
  .why__grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================================
   Polish responsive — confort tactile & petits écrans
   ========================================================================= */
/* Évite l'inflation automatique du texte sur iOS / Android */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Surbrillance de tap discrète, aux couleurs de la marque */
a, button, summary { -webkit-tap-highlight-color: rgba(35, 137, 209, 0.15); }

/* Cible tactile du hamburger : 44px (recommandation accessibilité) */
@media (max-width: 880px) {
  .burger { width: 44px; height: 44px; }
}
/* Confort de tap dans le menu mobile */
.mnav-links a { min-height: 46px; }

/* Téléphones étroits : marges latérales resserrées, plus de place au contenu */
@media (max-width: 400px) {
  .container, .container-narrow { padding-inline: var(--s-4); }
  .btn { padding: 11px 16px; }
  .btn--lg { padding: 14px 20px; }
}
