/* ============================================================
   Surcouche de mise en page
   Chargée après le CSS du thème (voir baseof.html, param customCSS).
   Pour tout désactiver : customCSS: false dans config.yaml
   ============================================================ */

/* ---------- 1. Largeur de lecture ----------
   Le texte tenait sur ~120 caractères par ligne dans col-lg-9.
   On plafonne à une mesure confortable, centrée pour rester
   alignée avec le titre de l'article. */

#single .page-content {
  max-width: 40rem;      /* ~70 caracteres par ligne a 18px */
  margin-inline: auto;
}

#single .title,
#single .featured-image {
  max-width: 44rem;      /* titre et banniere legerement plus larges */
  margin-inline: auto;
}

#single {
  padding: 48px 0 96px;
  font-size: 18px;
  line-height: 1.75;
}

/* ---------- 2. Rythme vertical ---------- */

#single .page-content p {
  margin-bottom: 1.35em;
}

#single .page-content > *:first-child {
  margin-top: 0;
}

/* ---------- 3. Titres ----------
   Le thème peignait h1..h6 en --text-link-color, soit la même
   couleur que les liens. On rend la couleur d'accent aux liens
   et on redonne une échelle aux titres. */

#single .page-content h1,
#single .page-content h2,
#single .page-content h3,
#single .page-content h4,
#single .page-content h6 {
  color: var(--text-color) !important;
  opacity: 1;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

/* Titre d'accroche dans le corps, sous le titre de page */
#single .page-content > h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.6em;
  line-height: 1.25;
}

/* Chapeau : le h5 en gras italique qui suit l'accroche */
#single .page-content > h1 + h5 {
  color: var(--text-secondary-color) !important;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.6;
  margin: 0 0 0.5em;
}

/* Sections A. B. C. */
#single .page-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.6em 0 0.9em;
  padding-top: 1.4em;
  border-top: 1px solid var(--secondary-background-color);
  line-height: 1.3;
}

/* Premiere section : on resserre, le chapeau vient juste avant */
#single .page-content > h1 + h5 + h2 {
  margin-top: 1.6em;
}

#single .page-content h3 {
  font-size: 1.18rem;
  font-weight: 700;
  margin: 2.2em 0 0.7em;
}

/* Sous-questions et citations mises en exergue */
#single .page-content h5 {
  color: var(--text-color) !important;
  font-size: 1.06rem;
  font-weight: 700;
  margin: 2em 0 0.8em;
  opacity: 1;
}

/* ---------- 4. Liens ----------
   Le thème les passait en display:inline-block, ce qui empêche
   un lien long de se couper en fin de ligne. */

#single .page-content a {
  display: inline !important;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(37, 99, 235, 0.4);
  transition: text-decoration-color 0.15s ease, text-decoration-thickness 0.15s ease;
}

#single .page-content a::after {
  display: none !important;
}

#single .page-content a:hover,
#single .page-content a:focus {
  text-decoration-thickness: 2px;
  text-decoration-color: var(--primary-color);
}

/* Titres cliquables éventuels : pas de soulignement */
#single .page-content h1 a,
#single .page-content h2 a,
#single .page-content h3 a {
  text-decoration: none;
}

/* ---------- 5. Listes ----------
   list-style-position: inside alignait le texte des lignes
   suivantes sous la puce. On repasse en outside. */

#single .page-content ul,
#single .page-content ol {
  list-style-position: outside;
  padding-left: 1.3em;
  margin-bottom: 1.5em;
  opacity: 1;
}

#single .page-content li {
  margin-bottom: 0.55em;
  padding-left: 0.2em;
}

#single .page-content li > p {
  margin-bottom: 0.5em;
}

/* ---------- 6. Code ---------- */

#single .page-content code {
  background-color: var(--secondary-background-color);
  padding: 0.12em 0.38em;
  border-radius: 0.3em;
  font-size: 0.88em;
  word-break: break-word;
}

#single .page-content pre {
  max-height: none;
  margin: 0 0 1.8em;
  padding: 1.25rem 1.4rem;
  font-size: 0.92rem;
  line-height: 1.6;
  overflow-x: auto;
  border: 1px solid var(--secondary-background-color);
  border-radius: 0.6em !important;
}

#single .page-content pre > code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  word-break: normal;
}

/* ---------- 7. Citations ---------- */

#single .page-content blockquote {
  font-size: 1.05em;
  font-weight: 400;
  font-style: italic;
  padding: 0.2em 0 0.2em 1.4em;
  margin: 1.8em 0;
  border-left: 3px solid var(--primary-color) !important;
  border-radius: 0;
}

#single .page-content blockquote,
#single .page-content blockquote * {
  background-color: transparent !important;
}

/* ---------- 8. Image à la une ---------- */

#single .featured-image {
  padding: 0;
  margin-bottom: 2.5em;
}

#single .featured-image img {
  box-shadow: 0 4px 24px rgba(15, 80, 100, 0.12);
  border-radius: 0.7rem;
  margin-bottom: 0;
}

/* ---------- 9. Titre de page et métadonnées ---------- */

#single .title {
  margin-bottom: 2.5rem !important;
}

#single .title > h1 {
  opacity: 1;
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

#single .title > div.text-center {
  color: var(--text-secondary-color);
  font-size: 0.9rem;
}

/* ---------- 10. Tableaux ---------- */

#single .page-content table {
  width: 100%;
  border-collapse: collapse;
  opacity: 1;
  font-size: 0.95em;
  margin-bottom: 1.8em;
}

#single .page-content table > thead > tr > th,
#single .page-content table > tbody > tr > td {
  opacity: 1;
  border: 1px solid var(--secondary-background-color);
  text-align: left;
}

/* ---------- 11. Séparateurs ---------- */

#single .page-content hr {
  border: 0;
  height: 1px;
  background-color: var(--secondary-background-color);
  margin: 3em 0;
  opacity: 1;
}

/* ---------- 12. Barre latérale ---------- */

#single aside.toc,
#single aside.tags {
  overflow-y: auto;
  overflow-x: hidden;
}

#single aside.toc {
  max-height: 60vh;
}

#single aside h5 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary-color) !important;
}

#single aside.toc .toc-content ol li a,
#single aside.toc .toc-content ul li a {
  font-size: 0.88rem;
  line-height: 1.45;
  display: inline-block;
  padding: 0.15em 0;
  opacity: 1;
}

#single aside.toc .toc-content > ul,
#single aside.toc .toc-content > ol {
  margin-bottom: 0;
}

/* ---------- 13. Petits écrans ---------- */

@media (max-width: 767px) {
  #single {
    font-size: 17px;
    padding: 24px 0 64px;
  }

  #single .title > h1 {
    font-size: 1.75rem;
  }

  #single .page-content > h1 {
    font-size: 1.45rem;
  }

  #single .page-content h2 {
    font-size: 1.3rem;
    margin-top: 2.2em;
  }

  #single .page-content pre {
    padding: 1rem;
    font-size: 0.85rem;
  }
}

/* ---------- 14. Pages de liste ---------- */

#list .card-title,
#list .card-text {
  text-wrap: pretty;
}

#list .card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#list .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(15, 80, 100, 0.12);
}

/* Hauteur de carte uniforme : le wrapper .card-columns empechait
   le h-100 de la carte de prendre effet dans la rangee. */
#list-page .card-columns {
  height: 100%;
}

#list-page .col-lg-4,
#recent-posts .col-lg-4 {
  display: flex;
}

#list-page .card-columns,
#recent-posts .card {
  width: 100%;
}

/* ---------- 15. Figures, légendes et graphes d'article ---------- */

#single .page-content figure {
  margin: 2.2em 0;
  text-align: center;
}

#single .page-content figure img {
  margin: 0 auto;
}

#single .page-content figcaption {
  color: var(--text-secondary-color);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 0.7em;
  text-align: left;
}

#single .page-content figcaption a {
  text-decoration-thickness: 1px;
}

/* Graphe : palette divergente validée (rouge/bleu), texte en jetons de texte */
#single .viz svg {
  width: 100%;
  height: auto;
  display: block;
}

#single .viz .viz-neg { fill: #e34948; }
#single .viz .viz-pos { fill: #2a78d6; }
#single .viz .viz-axis {
  stroke: #d9d8d4;
  stroke-width: 1;
}
#single .viz .viz-cat {
  fill: var(--text-color);
  font-size: 15px;
  font-weight: 700;
}
#single .viz .viz-val {
  fill: var(--text-color);
  font-size: 19px;
  font-weight: 800;
}
#single .viz .viz-note {
  fill: var(--text-secondary-color);
  font-size: 13px;
}

body.dark #single .viz .viz-neg { fill: #e66767; }
body.dark #single .viz .viz-pos { fill: #3987e5; }
body.dark #single .viz .viz-axis { stroke: #3a3a38; }

/* Chute d'article : la derniere phrase, detachee et agrandie */
#single .page-content p.chute {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 1.8em 0 0;
  padding-top: 1.2em;
  border-top: 1px solid var(--secondary-background-color);
}

/* ---------- 16. Carte auteur dans la barre latérale ---------- */

#single aside.author-card {
  padding: 1rem;
}

#single .author-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

#single .author-card-avatar {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0;
}

#single .author-card-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#single .author-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  color: var(--text-color);
}

#single .author-card-role {
  font-size: 0.78rem;
  line-height: 1.35;
  margin-top: 0.15rem;
  color: var(--text-secondary-color);
}

#single .author-card-pitch {
  font-size: 0.82rem;
  line-height: 1.55;
  font-style: italic;
  color: var(--text-secondary-color);
  margin: 0 0 0.9rem;
}

#single .author-card-link {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-link-color) !important;
  border: 1px solid var(--primary-color);
  border-radius: 10px;
  padding: 0.35rem 0.8rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#single .author-card-link:hover,
#single .author-card-link:focus {
  background-color: var(--primary-color);
  color: var(--secondary-color) !important;
}

/* Sur écrans étroits la colonne passe pleine largeur : on étale la carte
   au lieu de laisser une colonne de texte étriquée sous l'avatar. */
@media (max-width: 991px) {
  #single aside.author-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "title title"
      "head  pitch"
      "link  link";
    column-gap: 1.2rem;
    align-items: center;
  }
  #single aside.author-card > h5 { grid-area: title; }
  #single .author-card-head { grid-area: head; margin-bottom: 0; }
  #single .author-card-pitch { grid-area: pitch; margin: 0; }
  #single .author-card-actions { grid-area: link; margin-top: 0.9rem; }
}

@media (max-width: 575px) {
  #single aside.author-card {
    display: block;
  }
  #single .author-card-head { margin-bottom: 0.8rem; }
  #single .author-card-pitch { margin-bottom: 0.9rem; }
}

/* Bouton "en savoir plus" et liens sociaux sur une meme ligne, GitHub en tete */
#single .author-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
}

#single .author-card-socials {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.05rem;
}

#single .author-card-socials a {
  color: var(--text-secondary-color) !important;
  text-decoration: none;
  transition: color 0.15s ease;
}

#single .author-card-socials a:hover,
#single .author-card-socials a:focus {
  color: var(--primary-color) !important;
}

/* ---------- 17. Section projets : renvoi vers le compte GitHub ---------- */

#projects .projects-github {
  text-align: center;
  margin-top: 2.2rem;
}

#projects .projects-github a {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--primary-color);
  border-radius: 0.5rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#projects .projects-github a:hover,
#projects .projects-github a:focus {
  background-color: var(--primary-color);
  color: var(--secondary-color) !important;
}

/* Les cartes projets heritaient de la couleur de texte Bootstrap (#212529),
   presque noire sur l'ardoise du mode sombre. On les raccroche aux variables. */
#projects .card,
#projects .card-title {
  color: var(--text-color);
}

#projects .card-text {
  color: var(--text-secondary-color);
}
