/* =====================================================
   article.css — Articles de type blog (modèle article)
   ===================================================== */

/* --- Conteneur général --- */
#article {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* --- Titre H1 --- */
.container_title {
  margin: 1.25rem 0 1.5rem;
}

.container_title h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text, #1a1a1a);
  margin-bottom: 0.6rem;
}

/* --- Temps de lecture --- */
.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.85rem;
  color: var(--color-muted, #888);
  margin: 0;
}

.reading-time svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/* --- Image hero --- */
.container_img {
  max-width: 660px;
  margin: 0 auto 1.75rem;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 3 / 2;
}

.container_img picture {
  display: block;
  width: 100%;
  height: 100%;
}

.container_img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* --- Intro --- */
.container_description {
  margin-bottom: 2rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--color-text, #1a1a1a);
}

/* --- Table des matières (sommaire) --- */
.toc {
  margin: 0 0 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--color-bg-alt, #f5f5f5);
  border-left: 4px solid var(--color-primary, #e63946);
  border-radius: 0 6px 6px 0;
}

.toc__title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted, #888);
  margin: 0 0 0.75rem;
}

.toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.toc__item a {
  font-size: 0.95rem;
  color: var(--color-text, #1a1a1a);
  text-decoration: none;
  line-height: 1.4;
}

.toc__item a:hover {
  color: var(--color-primary, #e63946);
}

/* --- Sections --- */
.container_content {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.container_content section {
  border-top: 2px solid var(--color-primary, #e63946);
  padding-top: 1.25rem;
}

/* --- Titre H2 --- */
.container_content section > h2 {
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text, #1a1a1a);
  margin: 0 0 1.1rem;
}

/* --- Titre H3 --- */
.paragraphs h3 {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text, #1a1a1a);
  margin: 1.5rem 0 0.6rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--color-primary, #e63946);
}

/* --- Paragraphes --- */
.paragraphs {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.paragraphs p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text, #1a1a1a);
  margin: 0;
}

/* --- Images dans les sections --- */
.paragraphs picture {
  display: block;
  max-width: 480px;
  margin: 0.5rem auto 1rem;
}

.paragraphs picture img,
.paragraphs > img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* --- Listes dans les sections --- */
.paragraphs ul,
.paragraphs ol {
  margin: 0;
  padding-left: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.paragraphs li {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text, #1a1a1a);
}

/* --- Liens internes / externes --- */
.paragraphs a,
.container_description a {
  color: var(--color-primary, #e63946);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.paragraphs a:hover,
.container_description a:hover {
  text-decoration: none;
}

/* --- Conclusion --- */
.container_conclusion {
  margin-top: 2.5rem;
  padding: 1.5rem;
  background: var(--color-bg-alt, #f5f5f5);
  border-left: 4px solid var(--color-primary, #e63946);
  border-radius: 0 6px 6px 0;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text, #1a1a1a);
}

.container_conclusion p {
  margin: 0;
}

/* --- Tableaux de données --- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.paragraphs table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  white-space: nowrap;
}

.paragraphs table th {
  position: sticky;
  top: 0;
  background: var(--color-primary, #37ED4A);
  color: #fff;
  font-weight: 600;
  padding: 0.7rem 0.8rem;
  text-align: center;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.paragraphs table th:first-child {
  text-align: left;
}

.paragraphs table td {
  padding: 0.55rem 0.8rem;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

.paragraphs table td:first-child {
  text-align: left;
  font-weight: 500;
  white-space: normal;
  min-width: 180px;
}

.paragraphs table tbody tr:hover {
  background: rgba(55, 237, 74, 0.06);
}

.paragraphs table tr.cat-row {
  background: var(--color-bg-alt, #f5f5f5);
}

.paragraphs table tr.cat-row td {
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary-dark, #2EB83D);
  border-bottom: 2px solid var(--color-primary, #37ED4A);
}

/* =====================================================
   IMC — Tableau de valeurs par taille / poids
   ===================================================== */

/* Couleurs des catégories IMC (variables CSS) */
#article {
  --sous-poids:   #60a5fa;
  --poids-normal: #4ade80;
  --surpoids:     #facc15;
  --grade-1:      #fb923c;
  --grade-2:      #f87171;
  --grade-3:      #f472b6;
}

/* Bloc global = légende + tableau scrollable */
.imc-table {
  margin: 1.25rem 0 1.75rem;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  overflow: hidden;
}

/* --- Légende couleurs --- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.9rem 1.1rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e5e5;
  font-size: 0.82rem;
  line-height: 1.4;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: #444;
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend b {
  font-weight: 600;
  color: var(--color-text, #161616);
}

/* --- Conteneur scrollable --- */
.table-scroller {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* --- Tableau couleur --- */
.table-scroller table {
  border-collapse: collapse;
  font-size: 0.78rem;
  white-space: nowrap;
  width: 100%;
}

.table-scroller table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.5rem 0.55rem;
  font-weight: 700;
  text-align: center;
  background: var(--color-text, #161616);
  color: #fff;
  border-right: 1px solid rgba(255,255,255,0.1);
}

.table-scroller table th:first-child {
  left: 0;
  z-index: 2;
  text-align: left;
  padding-left: 0.75rem;
  border-right: 2px solid rgba(255,255,255,0.2);
}

.table-scroller table td {
  padding: 0.42rem 0.55rem;
  text-align: center;
  border-right: 1px solid rgba(0,0,0,0.04);
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-weight: 500;
  font-size: 0.76rem;
  color: rgba(0,0,0,0.75);
}

.table-scroller table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f9fafb;
  font-weight: 700;
  font-size: 0.78rem;
  text-align: left;
  padding-left: 0.75rem;
  border-right: 2px solid #e5e5e5;
  color: var(--color-text, #161616);
}

/* Cellules colorées selon la catégorie IMC */
.table-scroller td.sous-poids  { background: rgba(96,  165, 250, 0.30); }
.table-scroller td.normal,
.table-scroller td.poids-normal { background: rgba(74,  222, 128, 0.28); }
.table-scroller td.surpoids    { background: rgba(250, 204,  21, 0.32); }
.table-scroller td.grade-1     { background: rgba(251, 146,  60, 0.32); }
.table-scroller td.grade-2     { background: rgba(248, 113, 113, 0.34); }
.table-scroller td.grade-3     { background: rgba(244, 114, 182, 0.34); }

/* span.unit dans les en-têtes (valeurs en kg) */
.table-scroller th .unit {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.75;
  margin-left: 1px;
}

/* --- Tableau d'interprétation OMS --- */
.table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}

.table > table.interpretation-imc {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table > table.interpretation-imc th {
  background: var(--color-text, #161616);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.9rem;
  text-align: left;
}

.table > table.interpretation-imc td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid #f0f0f0;
  line-height: 1.5;
  vertical-align: top;
}

.table > table.interpretation-imc tbody tr:hover {
  background: #fafafa;
}

/* --- H4 dans les articles --- */
.paragraphs h4 {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--color-text, #161616);
  margin: 1.25rem 0 0.4rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--color-primary, #37ED4A);
}

/* --- Formule de calcul --- */
p.formule {
  background: #f0fdf4;
  border-left: 4px solid var(--color-primary, #37ED4A);
  border-radius: 0 8px 8px 0;
  padding: 0.85rem 1.25rem;
  margin: 0.75rem 0;
  font-size: 1.05rem;
  text-align: center;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  #article {
    padding: 0 1rem 2rem;
  }

  .container_title {
    margin: 1rem 0 1rem;
  }

  .toc {
    padding: 1rem 1.1rem;
  }

  .legend {
    gap: 0.4rem 0.75rem;
    font-size: 0.78rem;
  }

  .table-scroller table {
    font-size: 0.72rem;
  }

  .table-scroller table th,
  .table-scroller table td {
    padding: 0.38rem 0.42rem;
  }
}
