/* IMANA - Styles des pages articles du blog (/fr/blog/<slug>.html)
   Chargé uniquement sur les pages articles, en complément de design-system.css,
   header.css, sections.css et pages.css. Réutilise les tokens du design system :
   aucune nouvelle couleur, aucun nouvel espacement, aucune nouvelle police.*/

/*  EN-TÊTE D'ARTICLE (dans .page-hero)  */
.article-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.article-hero-meta .blog-badge--country { background: rgba(255,255,255,0.12); color: var(--white); }
.article-reading-time {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.65);
}
.article-reading-time svg { width: 15px; height: 15px; }

/*  IMAGE DE COUVERTURE  */
.article-cover {
  margin-inline: auto;
  margin-top: calc(-1 * var(--space-16) + 25px);
  margin-bottom: var(--space-10);
  max-width: 900px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  aspect-ratio: 960 / 540;
  background: var(--bg-subtle);
}
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 767px) {
  .article-cover { margin-top: calc(-1 * var(--space-10) + 25px); border-radius: var(--radius-lg); }
}

/*  MISE EN PAGE  */
.article-shell { max-width: 760px; margin-inline: auto; }

/*  SOMMAIRE  */
.article-toc {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-6);
  margin-bottom: var(--space-10);
}
.article-toc-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-dark);
  margin-bottom: var(--space-3);
}
.article-toc ol { display: flex; flex-direction: column; gap: var(--space-2); counter-reset: toc; }
.article-toc li { counter-increment: toc; }
.article-toc a {
  display: flex;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  transition: color var(--transition-fast);
}
.article-toc a::before {
  content: counter(toc);
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: var(--radius-full);
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--gold-dark);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  display: flex; align-items: center; justify-content: center;
}
.article-toc a:hover { color: var(--blue-main); }

/*  TYPOGRAPHIE DU CORPS  */
.article-body { color: var(--text-secondary); font-size: var(--text-lg); line-height: var(--leading-relaxed); }
.article-body > p, .article-body > ul, .article-body > ol, .article-body > table,
.article-body section > p, .article-body section > ul, .article-body section > ol {
  max-width: none;
  margin-bottom: var(--space-5);
}
.article-body h2 {
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
  color: var(--text-primary);
  margin-top: var(--space-12);
  margin-bottom: var(--space-5);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-light);
  scroll-margin-top: 96px;
}
.article-body section:first-of-type h2:first-child,
.article-body > h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.article-body h3 {
  font-size: var(--text-xl);
  color: var(--text-primary);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
  scroll-margin-top: 96px;
}
.article-body strong { color: var(--text-primary); font-weight: var(--fw-semibold); }
.article-body a:not(.btn) {
  color: var(--blue-mid);
  text-decoration: underline;
  text-decoration-color: rgba(26,63,94,0.35);
  text-underline-offset: 2px;
  font-weight: var(--fw-medium);
}
.article-body a:not(.btn):hover { color: var(--gold-dark); text-decoration-color: currentColor; }
.article-body ul, .article-body ol { display: flex; flex-direction: column; gap: var(--space-3); }
.article-body ul { list-style: none; }
.article-body ul > li { position: relative; padding-left: var(--space-6); }
.article-body ul > li::before {
  content: '';
  position: absolute; left: 0; top: 0.6em;
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  background: var(--gold);
}
.article-body ol { list-style: none; counter-reset: steps; }
.article-body ol > li { position: relative; padding-left: var(--space-8); counter-increment: steps; }
.article-body ol > li::before {
  content: counter(steps);
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px;
  border-radius: var(--radius-full);
  background: var(--blue-light);
  color: var(--blue-main);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  display: flex; align-items: center; justify-content: center;
}
.article-body li > strong:first-child { color: var(--text-primary); }
.article-body li ul, .article-body li ol { margin-top: var(--space-3); }

/*  ENCADRÉS (rappel, attention, conseil)  */
.article-callout {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid;
  margin-block: var(--space-8);
}
.article-callout-icon { flex-shrink: 0; width: 22px; height: 22px; margin-top: 2px; }
.article-callout-title { font-family: var(--font-display); font-weight: var(--fw-bold); color: var(--text-primary); margin-bottom: var(--space-1); }
.article-callout p, .article-callout ul { margin: 0; font-size: var(--text-base); }
.article-callout p + p { margin-top: var(--space-3); }
.article-callout--tip { background: var(--green-light); border-color: #BFE3D4; }
.article-callout--tip .article-callout-icon { color: var(--green-trust); }
.article-callout--warning { background: var(--warning-bg); border-color: #FDE68A; }
.article-callout--warning .article-callout-icon { color: var(--warning); }
.article-callout--info { background: var(--blue-light); border-color: #BFD9EC; }
.article-callout--info .article-callout-icon { color: var(--blue-mid); }

/*  TABLEAUX  */
.article-table-wrap { overflow-x: auto; margin-block: var(--space-8); border: 1px solid var(--border-light); border-radius: var(--radius-lg); }
.article-table { width: 100%; border-collapse: collapse; font-size: var(--text-base); min-width: 480px; }
.article-table caption { caption-side: bottom; padding: var(--space-3) var(--space-5); font-size: var(--text-xs); color: var(--text-muted); text-align: left; }
.article-table th, .article-table td { padding: var(--space-4) var(--space-5); text-align: left; border-bottom: 1px solid var(--border-light); }
.article-table thead th { background: var(--bg-subtle); font-family: var(--font-display); font-weight: var(--fw-bold); color: var(--text-primary); white-space: nowrap; }
.article-table tbody tr:last-child td { border-bottom: none; }
.article-table tbody tr:hover { background: var(--blue-xlight); }

/*  CTA INTERMÉDIAIRE (milieu d'article)  */
.article-cta-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  background: var(--cream);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin-block: var(--space-10);
}
.article-cta-inline-text { flex: 1 1 320px; }
.article-cta-inline-title { font-family: var(--font-display); font-weight: var(--fw-bold); color: var(--text-primary); margin-bottom: var(--space-1); }
.article-cta-inline-text p { margin: 0; font-size: var(--text-base); color: var(--text-secondary); }
.article-cta-inline .btn { flex-shrink: 0; }

/*  SOURCES / FRAÎCHEUR  */
.article-sources { margin-top: var(--space-10); }

/*  FAQ D'ARTICLE  */
.article-faq { margin-top: var(--space-12); }
.article-faq-title { font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl)); margin-bottom: var(--space-6); }

/*  PARTAGE / AUTEUR  */
.article-byline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-6);
  margin-top: var(--space-10);
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.article-byline-mark {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--blue-main);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: var(--fw-bold); font-size: var(--text-sm);
  flex-shrink: 0;
}

/*  ARTICLES LIÉS - slider dynamique 
    --related-visible pilote à la fois le CSS (largeur des cartes) et le JS
    (nombre de pages / pause du calcul) : seuils définis ici une seule fois. */
.related-articles-section { background: var(--cream); }

.related-noscript { text-align: center; padding: var(--space-10) 0; }

.related-slider { position: relative; --related-visible: 1; }
@media (min-width: 640px)  { .related-slider { --related-visible: 2; } }
@media (min-width: 1024px) { .related-slider { --related-visible: 3; } }

.related-slider-viewport {
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.related-slider-viewport:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.related-slider-track {
  display: flex;
  transition: transform var(--transition-slow);
}
@media (prefers-reduced-motion: reduce) { .related-slider-track { transition: none; } }

.related-slide {
  flex: 0 0 calc(100% / var(--related-visible));
  min-width: 0;
  padding-inline: var(--space-3);
  box-sizing: border-box;
}
.related-slide .blog-card { height: 100%; }

.related-slider-btn {
  position: absolute;
  top: 38%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.related-slider-btn:hover { background: var(--gold); color: var(--white); border-color: var(--gold); }
.related-slider-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.related-slider-btn svg { width: 18px; height: 18px; }
.related-slider-prev { left: -8px; }
.related-slider-next { right: -8px; }
@media (min-width: 1024px) {
  .related-slider-prev { left: -20px; }
  .related-slider-next { right: -20px; }
}

.related-slider-dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-6);
}
.related-slider-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--border);
  padding: 0;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.related-slider-dot[aria-selected="true"] { background: var(--gold); transform: scale(1.4); }
.related-slider-dot:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/*  RETOUR AU BLOG  */
.article-back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: var(--space-6);
}
.article-back-link:hover { color: var(--gold-dark); }
.article-back-link svg { width: 16px; height: 16px; }
