/* ==========================================================================
   PAGE D'UN ARTICLE « NOS CONSEILS » (/conseils/<slug>)
   Gabarit : /conseils/_template/article.php. Chargé après theme.css, dont il
   reprend les jetons (--cs-blue, --cs-kraft, polices…) et les blocs partagés
   (.cs-title, .cs-articles, .cs-article pour « Nos autres conseils »).
   ========================================================================== */

.cs-post {
  --post-w: 1192px;
  --post-ink: #1c2434;
  --post-text: #2b2d33;
  --post-muted: #5d6f88;
  --post-line: #e3e6ec;
  --post-sticky-top: calc(158px + var(--cs-ticker-h, 0px) + 24px);
  color: var(--post-text);
}

/* --- Fil d'Ariane ------------------------------------------------------- */
.cs-post-crumbs {
  width: min(var(--post-w), 100% - 2 * var(--cs-gutter));
  margin: 22px auto 0;
  font-family: var(--cs-font-inter);
  font-size: 13.5px;
  color: var(--post-muted);
}

.cs-post-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-post-crumbs li {
  display: flex;
  align-items: center;
  min-width: 0;
}

.cs-post-crumbs li + li::before {
  content: '';
  width: 6px;
  height: 6px;
  margin: 0 10px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: .6;
}

.cs-post-crumbs a {
  color: var(--cs-blue);
  text-decoration: none;
}

.cs-post-crumbs a:hover {
  text-decoration: underline;
}

.cs-post-crumbs li[aria-current] {
  overflow: hidden;
  max-width: 46ch;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* --- En-tête de l'article ------------------------------------------------ */
.cs-post-head {
  width: min(880px, 100% - 2 * var(--cs-gutter));
  margin: 34px auto 0;
  text-align: center;
}

.cs-post-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0;
  font-family: var(--cs-font-inter);
  font-size: 14px;
  color: var(--post-muted);
}

.cs-post-cat {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--cs-blue-band);
  color: var(--cs-blue);
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  font-size: 12.5px;
}

.cs-post-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cs-post-time svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.cs-post-title {
  margin: 18px 0 0;
  color: var(--post-ink);
  font-family: var(--cs-font-poppins);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.cs-post-subtitle {
  margin: 16px auto 0;
  max-width: 720px;
  color: var(--post-muted);
  font-family: var(--cs-font-inter);
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.5;
  text-wrap: pretty;
}

.cs-post-meta {
  margin: 18px 0 0;
  color: var(--post-muted);
  font-family: var(--cs-font-inter);
  font-size: 14px;
}

/* --- Illustration --------------------------------------------------------- */
.cs-post-cover {
  width: min(var(--post-w), 100% - 2 * var(--cs-gutter));
  margin: 34px auto 0;
  overflow: hidden;
  border-radius: 10px;
  background: #eef1f6;
  aspect-ratio: 16 / 9;
  max-height: 560px;
}

.cs-post-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Corps + colonne latérale -------------------------------------------- */
.cs-post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 64px;
  width: min(var(--post-w), 100% - 2 * var(--cs-gutter));
  margin: 48px auto 0;
  align-items: start;
}

.cs-post-body {
  max-width: 780px;
  min-width: 0;
}

/* Typographie du contenu (HTML filtré venu de l'API) */
.cs-post-content {
  font-family: var(--cs-font-inter);
  font-size: 17.5px;
  line-height: 1.75;
  color: var(--post-text);
}

.cs-post-content > :first-child {
  margin-top: 0;
}

/* typography.css fixe police et taille de tous les <p> du site : dans
   l'article, paragraphes et puces suivent le corps de texte */
.cs-post-content p {
  margin: 0 0 1.15em;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Intertitres : pas de barre ni de bordure à gauche (choix de Maxence) */
.cs-post-content h2 {
  margin: 2.1em 0 .7em;
  color: var(--post-ink);
  font-family: var(--cs-font-poppins);
  font-size: clamp(22px, 2.2vw, 27px);
  font-weight: 700;
  line-height: 1.3;
  scroll-margin-top: calc(158px + var(--cs-ticker-h, 0px) + 20px);
}

.cs-post-content h3 {
  margin: 1.7em 0 .5em;
  color: var(--post-ink);
  font-family: var(--cs-font-poppins);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
}

.cs-post-content h4 {
  margin: 1.4em 0 .4em;
  color: var(--post-ink);
  font-size: 17.5px;
  font-weight: 700;
}

.cs-post-content strong,
.cs-post-content b {
  color: var(--post-ink);
  font-weight: 700;
}

.cs-post-content a {
  color: var(--cs-blue);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cs-post-content a:hover {
  color: var(--cs-blue-dark);
  text-decoration-thickness: 2px;
}

.cs-post-content ul,
.cs-post-content ol {
  margin: 0 0 1.3em;
  padding-left: 1.4em;
}

.cs-post-content li {
  margin: 0 0 .45em;
  padding-left: .3em;
}

.cs-post-content ul li::marker {
  color: var(--cs-blue);
}

.cs-post-content ol li::marker {
  color: var(--cs-blue);
  font-weight: 700;
}

/* Encadré « Astuce » / « À retenir » : bloc arrondi plein, sans bordure à gauche */
.cs-post-content blockquote {
  margin: 1.8em 0;
  padding: 18px 22px;
  border: 0;
  border-radius: 10px;
  background: var(--cs-kraft-soft);
  color: var(--post-ink);
}

.cs-post-content blockquote > :last-child {
  margin-bottom: 0;
}

.cs-post-content hr {
  margin: 2.2em 0;
  border: 0;
  border-top: 1px solid var(--post-line);
}

.cs-post-content figure {
  margin: 1.8em 0;
}

.cs-post-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.cs-post-content figcaption {
  margin-top: 8px;
  color: var(--post-muted);
  font-size: 14px;
  text-align: center;
}

/* Placement des images choisi dans l'éditeur du back-office (ArticleImageClasses) */
.cs-post-content figure img,
.cs-post-content img.cs-align-center {
  margin-left: auto;
  margin-right: auto;
}

.cs-post-content img.cs-wide,
.cs-post-content figure:has(> img.cs-wide) {
  width: 100%;
}

.cs-post-content img.cs-wide {
  object-fit: cover;
}

.cs-post-content img.cs-align-left,
.cs-post-content figure:has(> img.cs-align-left) {
  float: left;
  max-width: 45%;
  margin: 0.3em 1.6em 1em 0;
}

.cs-post-content img.cs-align-right,
.cs-post-content figure:has(> img.cs-align-right) {
  float: right;
  max-width: 45%;
  margin: 0.3em 0 1em 1.6em;
}

/* Dans une légende flottante, c'est la figure qui flotte, pas l'image */
.cs-post-content figure > img.cs-align-left,
.cs-post-content figure > img.cs-align-right {
  float: none;
  max-width: 100%;
  margin: 0;
}

.cs-post-content h2,
.cs-post-content h3,
.cs-post-content hr,
.cs-post-content table {
  clear: both;
}

.cs-post-content::after {
  content: "";
  display: table;
  clear: both;
}

@media (max-width: 640px) {
  .cs-post-content img.cs-align-left,
  .cs-post-content img.cs-align-right,
  .cs-post-content figure:has(> img.cs-align-left),
  .cs-post-content figure:has(> img.cs-align-right) {
    float: none;
    max-width: 100%;
    margin: 1.4em auto;
  }
}

/* Brouillon ou aperçu de l'éditeur */
.cs-post-draftbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 100000;
  padding: 8px 16px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

/* Tableaux : défilement horizontal sur petit écran plutôt que débordement */
.cs-post-content table {
  display: block;
  max-width: 100%;
  margin: 1.6em 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15.5px;
  line-height: 1.5;
}

.cs-post-content th,
.cs-post-content td {
  padding: 10px 14px;
  border: 1px solid var(--post-line);
  text-align: left;
  vertical-align: top;
}

.cs-post-content thead th,
.cs-post-content tr:first-child th {
  background: var(--cs-blue-band);
  color: var(--post-ink);
  font-weight: 700;
}

.cs-post-content tbody tr:nth-child(even) td {
  background: #fafbfc;
}

/* --- Pied de l'article : tags + partage ---------------------------------- */
.cs-post-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--post-line);
  font-family: var(--cs-font-inter);
}

.cs-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-post-tags li {
  padding: 0 12px;
  border: 1px solid var(--post-line);
  border-radius: 999px;
  background: #f9fafb;
  color: #2c3442;
  font-size: 13px;
  line-height: 28px;
}

.cs-post-share {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--post-muted);
  font-size: 14px;
}

.cs-post-share span {
  margin-right: 4px;
}

.cs-post-share a,
.cs-post-share button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--post-line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--post-ink);
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}

.cs-post-share a:hover,
.cs-post-share button:hover,
.cs-post-share button.is-done {
  border-color: var(--cs-blue);
  background: var(--cs-blue);
  color: #ffffff;
}

/* --- Colonne latérale : sommaire + aide ---------------------------------- */
.cs-post-aside {
  position: sticky;
  top: var(--post-sticky-top);
  display: grid;
  gap: 20px;
  font-family: var(--cs-font-inter);
}

.cs-post-aside-title {
  margin: 0 0 10px;
  color: var(--post-ink);
  font-family: var(--cs-font-poppins);
  font-size: 16px;
  font-weight: 700;
}

.cs-post-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.cs-post-toc li {
  counter-increment: toc;
}

.cs-post-toc a {
  display: flex;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--post-muted);
  font-size: 14.5px;
  line-height: 1.4;
  text-decoration: none;
  transition: color .15s, background .15s;
}

.cs-post-toc a::before {
  content: counter(toc) '.';
  flex: none;
  min-width: 1.4em;
  font-weight: 600;
}

.cs-post-toc a:hover,
.cs-post-toc a.is-active {
  background: var(--cs-blue-soft);
  color: var(--cs-blue);
}

.cs-post-help {
  padding: 22px;
  border-radius: 10px;
  background: var(--cs-blue-band);
}

.cs-post-help p {
  margin: 0 0 16px;
  color: var(--post-text);
  font-size: 14.5px;
  line-height: 1.55;
}

.cs-post-help .cs-post-aside-title {
  margin-bottom: 8px;
  color: var(--cs-blue-darker);
}

.cs-post-help .cs-post-btn {
  width: 100%;
}

.cs-post-help .cs-post-btn + .cs-post-btn {
  margin-top: 8px;
}

/* Sommaire repliable au-dessus du texte (petits écrans seulement) */
.cs-post-toc--inline {
  display: none;
}

/* --- Boutons -------------------------------------------------------------- */
.cs-post-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 2px solid var(--cs-blue);
  border-radius: var(--cs-radius);
  background: var(--cs-blue);
  color: #ffffff;
  font-family: var(--cs-font);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .02em;
  transition: background .2s, color .2s, border-color .2s;
}

.cs-post-btn:hover {
  border-color: var(--cs-blue-dark);
  background: var(--cs-blue-dark);
  color: #ffffff;
}

.cs-post-btn.is-ghost {
  background: transparent;
  color: var(--cs-blue);
}

.cs-post-btn.is-ghost:hover {
  background: var(--cs-blue);
  color: #ffffff;
}

.cs-post-btn.is-light {
  border-color: #ffffff;
  background: #ffffff;
  color: var(--cs-blue);
}

.cs-post-btn.is-light:hover {
  border-color: var(--cs-kraft);
  background: var(--cs-kraft);
  color: #ffffff;
}

.cs-post-btn.is-outline {
  border-color: rgba(255, 255, 255, .7);
  background: transparent;
  color: #ffffff;
}

.cs-post-btn.is-outline:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, .12);
}

/* --- Bandeau bleu « on a mis le paquet » --------------------------------- */
.cs-post-band {
  margin-top: 72px;
  background: var(--cs-blue);
  color: #ffffff;
}

.cs-post-band-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  width: min(var(--post-w), 100% - 2 * var(--cs-gutter));
  margin: 0 auto;
  padding: 40px 0;
}

.cs-post-band-inner p {
  margin: 8px 0 0;
  max-width: 560px;
  font-family: var(--cs-font-inter);
  font-size: 15.5px;
  line-height: 1.55;
  opacity: .92;
}

.cs-post-band .cs-post-band-title {
  margin: 0;
  max-width: none;
  font-family: var(--cs-font);
  font-size: 28px;
  font-weight: 300;
  line-height: 1.15;
  text-transform: uppercase;
  opacity: 1;
}

.cs-post-band-title strong {
  color: var(--cs-kraft);
  font-weight: 900;
}

.cs-post-band-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex: none;
}

/* --- Nos autres conseils -------------------------------------------------- */
.cs-post-related {
  padding-top: 64px;
  padding-bottom: 72px;
}

/* ==========================================================================
   PETITS ÉCRANS
   ========================================================================== */
@media (max-width: 1100px) {
  .cs-post-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .cs-post-body {
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
  }

  .cs-post-aside {
    position: static;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
  }

  .cs-post-aside .cs-post-toc {
    display: none;
  }

  .cs-post-toc--inline {
    display: block;
    margin: 0 0 28px;
    padding: 4px 16px;
    border: 1px solid var(--post-line);
    border-radius: 10px;
    background: #fafbfc;
    font-family: var(--cs-font-inter);
  }

  .cs-post-toc--inline summary {
    padding: 10px 0;
    color: var(--post-ink);
    font-family: var(--cs-font-poppins);
    font-weight: 700;
    cursor: pointer;
  }

  .cs-post-toc--inline ol {
    padding-bottom: 10px;
  }

  .cs-post-band-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .cs-post-crumbs {
    margin-top: 14px;
    font-size: 12.5px;
  }

  .cs-post-crumbs li[aria-current] {
    max-width: 24ch;
  }

  .cs-post-head {
    margin-top: 22px;
    text-align: left;
  }

  .cs-post-kicker {
    justify-content: flex-start;
  }

  .cs-post-cover {
    margin-top: 24px;
    border-radius: 8px;
  }

  .cs-post-layout {
    margin-top: 30px;
  }

  .cs-post-content {
    font-size: 16.5px;
    line-height: 1.7;
  }

  .cs-post-content h2 {
    scroll-margin-top: calc(var(--cs-header-h-mobile, 78px) + var(--cs-ticker-h, 0px) + 16px);
  }

  .cs-post-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .cs-post-band {
    margin-top: 48px;
  }

  .cs-post-band-inner {
    padding: 32px 0;
  }

  .cs-post-band .cs-post-band-title {
    font-size: 23px;
  }

  .cs-post-band-actions,
  .cs-post-band-actions .cs-post-btn {
    width: 100%;
  }

  .cs-post-related {
    padding-top: 40px;
    padding-bottom: 48px;
  }
}
