/* static/css/histoire.css - Mise en page centrée et lisible */

/* Layout principal */
.histoire-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* Content wrapper centré */
.content-wrapper {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-main, #fff);
  padding: 0;
}

.histoire-content {
  width: 100%;
  line-height: 1.8;
  color: var(--text-secondary, #444);
  font-size: 1rem;
  text-align: left;
  margin: 0;
  padding: 0;
}

.histoire-content h2.section-title {
  font-size: 2rem;
  color: var(--text-main, #222);
  margin: 3rem 0 2rem 0;
  border-bottom: 2px solid var(--border-color, #ddd);
  padding-bottom: 0.75rem;
  text-align: center;
  font-weight: 600;
  scroll-margin-top: 120px;
}

.histoire-content p {
  margin-bottom: 1.8rem;
  text-align: justify;
  text-justify: inter-word;
}

.histoire-content em {
  color: var(--text-muted, #666);
  font-style: italic;
}

.histoire-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.histoire-content pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

/* Thumbnails */
.thumbnail {
  margin: 2.5rem 0;
  text-align: center;
}

.thumbnail figcaption {
  margin-top: 1rem;
  padding: 0 1rem;
  font-style: italic;
  color: var(--text-muted, #666);
  font-size: 0.9rem;
  line-height: 1.4;
}

.thumbnail img {
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Table compact */
.table-compact table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  line-height: 1.1;
}

.table-compact td {
  padding: 0.1em 0.2em;
  border: 1px solid #ddd;
  vertical-align: top;
}

figure.table-compact {
  margin-bottom: 2rem;
}

/* TOC mobile pour très petits écrans */
.toc-mobile-wrapper {
  display: none;
  margin: 1rem 0;
  text-align: center;
}

#toc-toggle {
  display: inline-block;
  width: 100%;
  max-width: 300px;
  padding: 0.75rem 1rem;
  background-color: #a66107;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#toc-toggle:hover {
  background-color: #8a5306;
}

#toc-toggle:focus {
  outline: 2px solid #a66107;
  outline-offset: 2px;
}

.toc-mobile {
  display: none;
  margin-top: 0.5rem;
  background-color: var(--bg-secondary, #fafafa);
  border: 1px solid var(--border-color, #ddd);
  border-radius: 0.5rem;
  max-height: 50vh;
  overflow-y: auto;
  padding: 0.5rem;
}

.toc-mobile ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-mobile li {
  margin-bottom: 0.5rem;
}

.toc-mobile a {
  text-decoration: none;
  color: var(--text-main, #333);
  font-size: 0.95rem;
  display: block;
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: background-color 0.2s ease;
}

.toc-mobile a:hover {
  background-color: rgba(166, 97, 7, 0.1);
  color: #a66107;
}

/* Thème sombre */
:root.theme-dark .histoire-content {
  color: var(--text-alt);
}

:root.theme-dark .histoire-content h2.section-title {
  color: var(--text-alt-muted);
  border-bottom-color: var(--border-dark, #444);
}

:root.theme-dark .histoire-content em {
  color: var(--text-alt-muted);
}

:root.theme-dark .toc-mobile {
  background-color: var(--bg-secondary);
  border-color: var(--border-dark, #444);
}

:root.theme-dark .toc-mobile a {
  color: var(--text-alt);
}

:root.theme-dark .toc-mobile a:hover {
  background-color: rgba(166, 97, 7, 0.2);
}

:root.theme-dark #toc-toggle {
  background-color: var(--btn-return-bg, #444);
  color: var(--btn-return-text, #fff);
}

:root.theme-dark #toc-toggle:hover {
  background-color: #555;
}

/* Responsive */
@media (max-width: 768px) {
  .histoire-body {
    padding: 2rem 1rem;
  }
  
  .content-wrapper {
    max-width: 100%;
    padding: 0;
  }
  
  .histoire-content h2.section-title {
    font-size: 1.5rem;
    margin: 2rem 0 1.5rem 0;
  }
  
  .histoire-content p {
    text-align: left;
  }
}

@media (max-width: 1024px) {
  .toc-mobile-wrapper {
    display: block;
  }
}

@media (max-width: 480px) {
  .histoire-body {
    padding: 1.5rem 0.75rem;
  }
  
  .histoire-content {
    font-size: 0.95rem;
  }
  
  .histoire-content h2.section-title {
    font-size: 1.3rem;
  }
  
  .thumbnail figcaption {
    font-size: 0.85rem;
  }
}