/* ===== Base ===== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f6;
  color: #111827;
}

.wrapper {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
  counter-reset: section;
}

/* ===== Header ===== */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #ddd;
  padding: 0.7rem 1rem 0.9rem;
  margin-bottom: 1rem;
  background: #ffffff;
  border-radius: 12px 12px 0 0;
  gap: 0.75rem;
}

.header img {
  max-height: 60px;
  width: auto;
}

.header-center {
  text-align: center;
}

.header-center h1 {
  margin: 0;
  font-size: 1.5rem;
}

.header-center small {
  color: #666;
}

/* Responsive header */
@media (max-width: 720px) {
  .header {
    flex-direction: column;
    text-align: center;
  }
}

/* ===== Intro ===== */

.intro {
  background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 0.8rem 0 1.2rem;
}

.intro h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

/* ===== Table des matières ===== */

.toc {
  background: #ffffff;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 1.2rem;
  border: 1px solid #e5e7eb;
}

.toc h3 {
  margin: 0 0 0.4rem;
  font-size: 0.98rem;
}

.toc p {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  color: #4b5563;
}

.toc-list {
  list-style: none;
  padding-left: 0;
  margin: 0.3rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  font-size: 0.9rem;
}

.toc-list a {
  text-decoration: none;
  color: #1d4ed8;
}

.toc-list a:hover {
  text-decoration: underline;
}

/* ===== Blocs bonnes pratiques ===== */

.bp-details {
  margin-bottom: 0.9rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #ddd;
  background: #ffffff;
  counter-increment: section;
}

.bp-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.98rem;
  color: #263238;
}

.bp-summary::-webkit-details-marker {
  display: none;
}

.bp-summary-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.bp-summary-icon {
  font-size: 1.2rem;
}

/* Numérotation automatique avant le titre (après l’icône) */
.bp-summary-title::before {
  content: counter(section) ". ";
  font-weight: 700;
  color: #4b5563;
}

/* Flèche */
.bp-summary-arrow {
  font-size: 1rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.bp-details[open] .bp-summary-arrow {
  transform: rotate(90deg);
}

/* Panneau interne */

.bp-panel {
  padding: 0.8rem 1.2rem 1rem;
  font-size: 0.95rem;
  background-color: #fafafa;
}

.bp-panel ul {
  padding-left: 1.2rem;
  margin: 0.3rem 0;
}

.bp-panel h3,
.bp-panel h4 {
  margin: 0.7rem 0 0.3rem;
  font-size: 0.98rem;
}

/* Badge */

.bp-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #e3f2fd;
  color: #1e88e5;
  margin-bottom: 0.35rem;
}

/* GIF */

.bp-gif-wrapper {
  margin: 0.7rem 0;
  text-align: center;
}

.bp-gif-wrapper img {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Callout */

.bp-callout {
  margin-top: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

/* Couleurs spécifiques par bloc (header uniquement) */

#sec-composant    > .bp-summary { background: #e8eaf6; }
#sec-esquisseplan > .bp-summary { background: #e8f5e9; }
#sec-parametres   > .bp-summary { background: #f1f8e9; }
#sec-contraintes  > .bp-summary { background: #e3f2fd; }
#sec-extrusion    > .bp-summary { background: #fff3e0; }
#sec-vue          > .bp-summary { background: #e3f2fd; }
#sec-esquisseface > .bp-summary { background: #f3e5f5; }
#sec-cut          > .bp-summary { background: #ffebee; }
#sec-historique   > .bp-summary { background: #ede7f6; }
#sec-sauvegarde   > .bp-summary { background: #fce4ec; }

/* ===== Footer ===== */

.footer {
  margin-top: 1.6rem;
  border-top: 2px solid #ddd;
  padding: 0.7rem 1rem 0.3rem;
  font-size: 0.85rem;
  color: #666;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: #ffffff;
  border-radius: 0 0 12px 12px;
}

.footer strong {
  font-weight: 600;
}

/* Responsive TOC & blocs */

@media (max-width: 640px) {
  .toc-list {
    flex-direction: column;
    gap: 0.2rem;
  }
}
