@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap");

:root {
  --primary-color: #efb93d;
  --secondary-color: #777;
  --dark-color: #333;
  --light-color: #f9f9f9;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Montserrat", sans-serif;
}

body {
  line-height: 1.6;
  color: var(--dark-color);
  background-color: white;
}

.article-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px;
}

h1 {
  font-size: 2.2rem;
  color: var(--dark-color);
  margin-bottom: 25px;
  line-height: 1.3;
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 15px;
}

h2 {
  font-size: 1.8rem;
  margin-top: 40px;
  margin-bottom: 20px;
  color: var(--dark-color);
  display: flex;
  align-items: center;
}

h2::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 25px;
  background-color: var(--primary-color);
  margin-right: 12px;
}

p {
  font-size: 1.05rem;
  margin-bottom: 20px;
  text-align: justify;
}

.current {
  border-left: 4px solid var(--primary-color);
  background-color: rgba(239, 185, 61, 0.1);
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 50px;
  flex-wrap: wrap;
  gap: 15px;
}

.nav-button {
  padding: 12px 20px;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.primary-button {
  background-color: var(--primary-color);
  color: white;
}

.secondary-button {
  background-color: var(--secondary-color);
  color: white;
}

.nav-button:hover {
  color: black;
  opacity: 0.9;
  transform: translateY(-2px);
}

.highlight-box {
  background-color: rgba(239, 185, 61, 0.1);
  border-left: 4px solid var(--primary-color);
  padding: 15px;
  margin: 25px 0;
  border-radius: 0 5px 5px 0;
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .nav-buttons {
    flex-direction: column;
  }
}
/* =====================================================
   ADDITIONS v1.7 - Article Fonctions Mathématiques
   Nouveautés: .time .time-content
               (variante flex horizontale de .timeline-item)
   ===================================================== */

/* ===== TIMELINE VARIANTE FLEX (avec .time + .time-content) ===== */
/* Différent de v1.4 (blocs empilés avec .timeline-date) */

/* Le .timeline-item en mode flex est détecté
   si ses enfants directs sont .time et .time-content */

.article-container .timeline-item .time {
  min-width: 100px;
  font-weight: 700;
  color: var(--article-primary);
  font-size: 0.95rem;
  padding-top: 2px;
  flex-shrink: 0;
}

.article-container .timeline-item .time-content {
  flex: 1;
  font-size: 1rem;
  line-height: 1.6;
}

.article-container .timeline-item .time-content p {
  margin-bottom: 0;
  font-size: 1rem;
}

/* Active le layout flex sur .timeline-item
     uniquement quand il contient .time + .time-content */
.article-container .timeline-item:has(.time) {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 15px;
  padding: 15px 20px;
}

/* Fallback sans :has() — override du padding hérité de v1.4 */
/* (si .timeline-item contient .time, le layout flex est appliqué) */

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .article-container .timeline-item:has(.time) {
    flex-direction: column;
    gap: 6px;
  }

  .article-container .timeline-item .time {
    min-width: unset;
    font-size: 0.9rem;
  }
}

/* =====================================================
   ADDITIONS v1.8 - Article Algorithmique (index chapitres ACF)
   Correction: suppression transform translateY (décalait footer)
   ===================================================== */

/* ===== CHAPTER LIST ===== */
.article-container .chapter-list {
  list-style: none;
  padding: 0;
  margin: 30px 0;
}

.article-container .chapter-item {
  margin-bottom: 10px;
  background-color: var(--article-light);
  border-radius: 8px;
  /* ❌ Supprimé: transform + overflow:hidden (causaient le décalage footer) */
  transition: box-shadow 0.3s ease;
}

.article-container .chapter-item:hover {
  /* ✅ box-shadow uniquement — ne déplace PAS l'élément dans le flux */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.09);
}

.article-container .chapter-link {
  display: block;
  padding: 15px 20px;
  color: var(--article-dark);
  text-decoration: none;
  font-weight: 500;
  font-family: var(--article-font);
  font-size: 1rem;
  border-left: 4px solid transparent;
  border-radius: 8px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.article-container .chapter-link:hover {
  border-left-color: var(--article-primary);
  background-color: rgba(239, 185, 61, 0.06);
  color: var(--article-dark);
  text-decoration: none;
}

/* Chapitre actif */
.article-container .chapter-link.current {
  border-left-color: var(--article-primary);
  background-color: rgba(239, 185, 61, 0.1);
  font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .article-container .chapter-link {
    padding: 12px 15px;
    font-size: 0.95rem;
  }
}
