/* ══════════════════════════════════════════════════════════════
   STELNEO — article-responsive.css
   Bloc responsive à ajouter après article.css + components.css
   Mobile  : ≤ 640px
   Tablette : 641px → 1024px
   Desktop : inchangé (article.css gère le reste)
══════════════════════════════════════════════════════════════ */


/* ══════════════════════════════════════════════════════════════
   FIX GLOBAL — Débordement horizontal
   Cause racine : .article-layout utilise grid-template-columns
   avec une colonne fixe 760px + sidebar → page plus large que
   100vw sur mobile/tablette → bloc vide visible à droite
══════════════════════════════════════════════════════════════ */

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* ── FIX DOUBLE SCROLL ────────────────────────────────────────
   .sommaire-list a un max-height + overflow-y:auto dans article.css
   ce qui crée une zone de scroll interne sur mobile/tablette
   → on neutralise ces propriétés sous 1024px
─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sommaire-list {
    max-height: none !important;
    overflow-y: visible !important;
    overflow: visible !important;
  }
}

@media (max-width: 1024px) {
  /* Ecrase la colonne fixe 760px et --content-max */
  :root { --content-max: 100%; }

  .article-layout {
    grid-template-columns: 1fr !important;
    width: 100%;
    max-width: 100%;
  }

  /* Tous les blocs susceptibles de depasser 100vw */
  .article-hero,
  .article-body,
  .hero-inner,
  .article-content,
  .article-sidebar,
  .hero-stats,
  .hero-intro,
  .callout,
  .schema-wrapper,
  .schema-body,
  .roi-wrapper,
  .criteria-grid,
  .obligations-list,
  .obligation-item,
  .article-conclusion,
  .article-qualif,
  .sources-list,
  .risques-list,
  .steps-list,
  .flow-steps,
  .flow-return {
    max-width: 100% !important;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Les tableaux gardent un scroll horizontal propre */
  .seuils-table,
  .terms-table,
  .comparatif-table {
    overflow-x: auto !important;
    overflow-y: visible;
    display: block;
    width: 100%;
  }
  .roi-wrapper {
    overflow-x: auto !important;
  }
}


/* ══════════════════════════════════════════════════════════════
   NAVBAR — HAMBURGER (commun mobile + tablette ≤ 768px)
   Le bouton .nav-toggle est injecté par components.js
   mais n'a aucun style CSS — on les définit ici
══════════════════════════════════════════════════════════════ */

/* Bouton hamburger — masqué par défaut en desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background .2s;
  flex-shrink: 0;
}
.nav-toggle:hover {
  background: rgba(244,238,223,.08);
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--beige);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease, width .2s ease;
  transform-origin: center;
}

/* État ouvert — animation en croix */
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; width: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menu mobile — panneau déroulant */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  /* On masque les liens desktop */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bleu);
    padding: 8px 20px 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    border-top: 1px solid rgba(244,238,223,.08);
    /* Animation slide-down */
    transform: translateY(-8px);
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
  }

  /* État ouvert */
  .nav-links.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links a {
    font-size: 15px;
    padding: 13px 0;
    border-bottom: 1px solid rgba(244,238,223,.07);
    color: rgba(244,238,223,.82);
    letter-spacing: .3px;
  }
  .nav-links a:last-child {
    border-bottom: none;
  }

  /* CTA dans le menu mobile */
  .nav-links .btn-nav {
    display: block;
    text-align: center;
    margin-top: 12px;
    padding: 12px 20px;
    background: var(--jaune);
    color: var(--bleu) !important;
    border-radius: 50px;
    font-weight: 500 !important;
    font-size: 14px;
  }

  /* Navbar elle-même toujours visible et en position relative pour le menu absolu */
  #navbar {
    position: fixed;
    flex-wrap: wrap;
    background: var(--bleu); /* Fond permanent sur mobile — pas de transparence */
    padding: 14px 20px;
    box-shadow: 0 2px 16px rgba(0,0,0,.18);
  }
}


/* ══════════════════════════════════════════════════════════════
   FOOTER — composant injecté par components.js
   Structure réelle : 3 colonnes (brand + 2 cols)
   → à adapter en mobile
══════════════════════════════════════════════════════════════ */

/* Social links — déjà bien stylés, on ajuste juste le spacing mobile */
@media (max-width: 640px) {
  .footer-social {
    gap: 10px;
    margin-top: 16px;
  }
  .social-link {
    width: 38px;
    height: 38px;
  }
  .social-icon {
    width: 18px;
    height: 18px;
  }
  .footer-logo-link {
    margin-bottom: 12px;
  }
}


/* ══════════════════════════════════════════════════════════════
   TABLETTE  641px → 1024px
══════════════════════════════════════════════════════════════ */

@media (min-width: 641px) and (max-width: 1024px) {

  /* ── Tokens ajustés ── */
  :root {
    --page-pad:    clamp(24px, 4vw, 48px);
    --section-pad: clamp(48px, 6vw, 80px);
  }

  /* ── Nav ── */
  #navbar {
    padding: 20px var(--page-pad);
  }
  .nav-links {
    gap: 20px;
  }
  .nav-links a {
    font-size: 13px;
  }

  /* ── Hero ── */
  .article-hero {
    padding: 120px var(--page-pad) 64px;
  }
  .article-hero h1 {
    font-size: clamp(32px, 4.5vw, 52px);
  }
  .hero-intro {
    font-size: 15px;
    max-width: 100%;
  }
  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
    max-width: 100%;
  }
  .stat-value {
    font-size: 30px;
  }

  /* ── Layout ── */
  /* Bascule en 1 colonne sur tablette aussi — la sidebar en dessous */
  .article-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .article-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
  }
  .sommaire {
    margin-bottom: 0;
  }
  /* Limite la hauteur du sommaire sur tablette */
  .sommaire-list {
    max-height: none;
    overflow-y: visible;
  }

  /* ── Tableaux ── */
  .seuils-table,
  .terms-table,
  .roi-table,
  .comparatif-table {
    font-size: 13px;
  }
  .seuils-table thead th,
  .terms-table thead th,
  .comparatif-table thead th {
    padding: 12px 14px;
    font-size: 14px;
  }
  .seuils-table tbody td,
  .terms-table tbody td,
  .comparatif-table tbody td,
  .roi-table tbody td {
    padding: 11px 14px;
  }

  /* ── ROI wrapper ── */
  .roi-header {
    padding: 16px 20px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .roi-header span {
    margin-left: 0;
    width: 100%;
    margin-top: 2px;
  }

  /* ── Conclusion ── */
  .article-conclusion {
    padding: 32px;
  }
  .conclusion-cta-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .btn-primary-lg,
  .btn-ghost-lg {
    width: 100%;
    text-align: center;
  }

  /* ── Footer ── */
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}


/* ══════════════════════════════════════════════════════════════
   MOBILE  ≤ 640px
══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {

  /* ── Tokens ── */
  :root {
    --page-pad:    20px;
    --section-pad: 40px;
  }

  /* ── Nav ── */
  /* Hamburger + menu .open gérés dans le bloc NAVBAR en haut du fichier */
  #navbar {
    padding: 14px 20px;
  }

  /* ── Hero ── */
  .article-hero {
    padding: 100px var(--page-pad) 48px;
  }
  .article-hero::before {
    width: 240px;
    height: 240px;
    top: -40px;
    right: -40px;
    border-width: 32px;
  }
  .article-hero::after {
    width: 160px;
    height: 160px;
    border-width: 24px;
  }
  .article-hero h1 {
    font-size: clamp(28px, 8.5vw, 38px);
    line-height: 1.0;
    margin-bottom: 18px;
  }
  .hero-intro {
    font-size: 14px;
    line-height: 1.75;
    margin-bottom: 28px;
  }
  .hero-meta {
    gap: 10px;
    margin-bottom: 18px;
  }

  /* Stat banner : 1 colonne centrée */
  .hero-stats {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
  .stat-block {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .stat-block:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
  .stat-block:last-child  { border-radius: 0 0 var(--radius-md) var(--radius-md); }
  .stat-value {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
  }
  .stat-label {
    font-size: 12px;
    margin-top: 0;
  }

  /* ── Body layout ── */
  .article-body {
    padding: var(--section-pad) var(--page-pad);
  }
  .article-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* ── Contenu article ── */
  .article-content h2 {
    font-size: clamp(22px, 6.5vw, 30px);
    margin: 36px 0 14px;
    padding-top: 36px;
  }
  .article-content h2:first-child {
    margin-top: 0;
    padding-top: 0;
  }
  .article-content h3 {
    font-size: 19px;
    margin: 24px 0 10px;
  }
  .article-content p {
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 16px;
  }
  .article-content ul li {
    font-size: 14px;
  }

  /* ── Callout ── */
  .callout {
    padding: 18px 20px;
    gap: 12px;
    flex-wrap: nowrap;
    align-items: flex-start;
  }
  .callout-icon {
    font-size: 18px;
    margin-top: 1px;
  }
  .callout p {
    font-size: 14px !important;
    line-height: 1.7 !important;
  }

  /* ── Schéma flow ── */
  .flow-steps {
    flex-direction: column;
    gap: 8px;
  }
  .flow-step {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 14px;
    background: rgba(0,47,75,.03);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
  }
  .flow-step:not(:last-child)::after {
    content: '↓';
    position: static;
    font-size: 14px;
    transform: none;
    right: auto;
    top: auto;
    display: none; /* L'empilement vertical suffit */
  }
  .step-icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
    flex-shrink: 0;
    margin-bottom: 0;
  }
  .step-label {
    font-size: 11px;
    margin-bottom: 2px;
  }
  .step-desc {
    font-size: 11px;
    padding: 0;
  }
  .flow-return {
    margin-top: 12px;
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 4px;
  }
  .return-arrow {
    font-size: 11px;
    letter-spacing: -1px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── Critères grid ── */
  .criteria-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .criteria-item {
    padding: 14px 16px;
  }
  .criteria-text {
    font-size: 14px;
  }

  /* ── Obligations / étude de cas ── */
  .obligations-list {
    gap: 10px;
  }
  .obligation-item {
    padding: 14px 16px;
    gap: 12px;
    align-items: flex-start;
  }
  .obligation-num {
    font-size: 26px;
    width: 26px;
    flex-shrink: 0;
  }
  .obligation-content h4 {
    font-size: 14px;
    margin-bottom: 4px;
  }
  .obligation-content p {
    font-size: 13px !important;
    line-height: 1.6 !important;
  }

  /* ── ROI wrapper ── */
  .roi-wrapper {
    margin: 24px 0;
    /* scroll horizontal pour le tableau interne */
    overflow: hidden;
  }
  .roi-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .roi-header h3 {
    font-size: 16px !important;
  }
  .roi-header span {
    margin-left: 0;
    width: 100%;
    font-size: 11px;
    margin-top: 2px;
  }
  /* Scroll horizontal conteneur tableau ROI */
  .roi-wrapper > .roi-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .roi-table thead th,
  .roi-table tbody td {
    padding: 10px 12px;
    font-size: 12px;
    white-space: nowrap;
  }
  .roi-note {
    font-size: 11px;
    padding: 12px 16px;
  }

  /* ── Tableaux généraux (scroll horizontal) ── */
  .seuils-table,
  .terms-table,
  .comparatif-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    border-radius: var(--radius-md);
  }
  .seuils-table thead th,
  .terms-table thead th,
  .comparatif-table thead th {
    padding: 11px 14px;
    font-size: 13px;
  }
  .seuils-table tbody td,
  .terms-table tbody td,
  .comparatif-table tbody td {
    padding: 10px 14px;
    font-size: 13px;
    white-space: normal;
    min-width: 110px;
  }
  .seuils-table tbody td:first-child {
    font-size: 15px;
  }

  /* ── Schema wrapper ── */
  .schema-wrapper {
    margin: 20px 0;
  }
  .schema-header {
    padding: 14px 16px;
    gap: 10px;
  }
  .schema-header h3 {
    font-size: 15px !important;
  }
  .schema-body {
    padding: 20px 16px;
  }

  /* ── Steps list ── */
  .steps-list li {
    font-size: 14px;
    padding-left: 32px;
  }
  .risques-list li {
    font-size: 14px;
    line-height: 1.6;
  }

  /* ── Sidebar — masquée sur mobile (déjà masquée via .sommaire display:none) ── */
  .article-sidebar {
    position: static;
  }
  /* Le .sommaire est déjà display:none à partir de 960px via article.css */
  /* On déplace le CTA sidebar sous le contenu, bien visible */
  .sidebar-cta {
    border-radius: var(--radius-md);
    padding: 20px 18px;
    text-align: center;
  }
  .sidebar-cta strong {
    font-size: 18px;
  }
  .sidebar-cta p {
    font-size: 13px !important;
    margin-bottom: 14px !important;
  }
  .btn-yellow {
    width: 100%;
    text-align: center;
    padding: 13px 20px;
    font-size: 14px;
  }
  .btn-ghost-sm {
    font-size: 12px;
    padding: 10px 16px;
    margin-top: 8px;
  }

  /* ── Conclusion ── */
  .article-conclusion {
    padding: 24px 20px;
    border-radius: var(--radius-md);
    margin-top: 36px;
  }
  .article-conclusion h2 {
    font-size: clamp(20px, 6vw, 26px);
    margin-bottom: 16px;
  }
  .conclusion-points {
    gap: 10px;
    margin-bottom: 20px;
  }
  .conclusion-points li {
    font-size: 14px;
    line-height: 1.6;
    padding-left: 22px;
  }
  .conclusion-cta-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .btn-primary-lg,
  .btn-ghost-lg {
    display: block;
    text-align: center;
    padding: 14px 20px;
    font-size: 14px;
  }

  /* ── Article qualif CTA ── */
  .article-qualif {
    margin-top: 36px;
    border-radius: var(--radius-md);
  }
  .article-qualif-header {
    padding: 14px 18px;
    gap: 8px;
  }
  .article-qualif-header h3 {
    font-size: 15px !important;
  }
  .article-qualif-body {
    padding: 18px 18px 20px;
  }
  .article-qualif-body > p {
    font-size: 13px;
    margin-bottom: 16px;
  }
  .qualif-items {
    gap: 8px;
    margin-bottom: 18px;
  }
  .qualif-items li {
    font-size: 13px;
    padding: 11px 14px 11px 42px;
    line-height: 1.55;
  }
  .qualif-items li::before {
    font-size: 18px;
    top: 10px;
  }
  .qualif-cta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-yellow {
    display: block;
    width: 100%;
    text-align: center;
  }

  /* ── Sources ── */
  .sources-list {
    padding-left: 16px;
    gap: 10px;
  }
  .sources-list li {
    font-size: 13px;
    line-height: 1.65;
  }

  /* ── Back link ── */
  .back-link {
    font-size: 12px;
    margin-bottom: 28px;
  }

  /* ── Footer ── */
  footer {
    padding: 48px var(--page-pad) 28px;
  }
  .footer-top {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-bottom: 32px;
    padding-bottom: 32px;
  }
  .footer-brand .logo {
    font-size: 26px;
  }
  .footer-brand p {
    font-size: 13px;
  }
  .footer-col h4 {
    margin-bottom: 12px;
  }
  .footer-col a {
    font-size: 13px;
    margin-bottom: 8px;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .footer-legal {
    flex-wrap: wrap;
    gap: 14px;
  }
  .footer-legal a {
    font-size: 12px;
  }
}