/* ============================================================================
 * Fiche article (yp-article) — design 8a desktop / 8b mobile.
 * Dépend de hub.css pour les tokens partagés (.yp-hub-aside, .yp-hub-panel,
 * .yp-hub-shortcuts, .yp-hub-sitters, .yp-hub-sim, .yp-hub-newsletter,
 * .yp-badge-tilt, .yp-btn--*).
 * ========================================================================= */

/* Kill le block-gap par défaut de TT5 entre nos 2 shortcodes du template single.html
   (sans ça, un spacing de ~24-40 px s'intercale entre le hub-nav et le début de l'article). */
.yp-single-page { --wp--style--block-gap: 0; }
.yp-single-page > * { margin-block: 0; }

.yp-article { display: flex; flex-direction: column; gap: 32px; padding: 8px 0 48px; }

/* ---------- Intro : breadcrumb + pill sous-hub + titre + chapo + image héro ---------- */
/* Mobile : stack (text puis image en dessous). Desktop : grid 2-col 1.15fr / 1fr
   full-width, titre à gauche + visuel à droite — comme la maquette 8a. */
.yp-article__intro { display: flex; flex-direction: column; gap: 14px; }
.yp-article__intro-text { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Wrapper block pour éviter que wpautop ne wrappe le <a> isolé dans un <p> parasite. */
.yp-article__subpill-row { display: flex; }
.yp-article__subpill {
  align-self: flex-start;
  color: #363636;
  text-decoration: none;
  font-size: 13px;
  padding: 5px 10px;
  transform: rotate(-3deg);
}

.yp-article__title {
  margin: 0;
  font-size: 30px; line-height: 1.12; font-weight: 800;
  color: #363636; letter-spacing: -.01em;
  text-wrap: pretty;
}
.yp-article__chapo { margin: 0; font-size: 17px; line-height: 1.5; color: #5b7a8a; }

/* Image héro inclinée (design 8b). Rendu via background-image sur un enfant pour éviter
   le crop de la rotation sur l'image elle-même. */
.yp-article__hero {
  margin: 8px 4px 0;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(20, 72, 98, .16);
  transform: rotate(1.5deg);
}
.yp-article__hero-img {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background-color: rgba(50, 191, 163, .12);
  background-size: cover;
  background-position: center;
}

/* ---------- Mobile : stack unique colonne, aside vient APRÈS content ---------- */
.yp-article__cols { display: flex; flex-direction: column; gap: 32px; }

.yp-article__main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* Rendu du post_content (Gutenberg blocks). On fait minimal : on règle juste les
   tailles de titres + le line-height, le reste on hérite des defaults WP + ds-tokens. */
.yp-article__content { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.yp-article__content > * { margin: 0; }
.yp-article__content h2 { font-size: 24px; line-height: 1.2; font-weight: 800; color: #363636; letter-spacing: -.005em; margin-top: 8px; }
.yp-article__content h3 { font-size: 20px; line-height: 1.25; font-weight: 800; color: #363636; margin-top: 4px; }
.yp-article__content p,
.yp-article__content li { font-size: 17px; line-height: 1.65; color: #363636; }
.yp-article__content ul,
.yp-article__content ol { padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; }
.yp-article__content a { color: #32bfa3; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.yp-article__content a:hover { color: #144862; }
.yp-article__content img { max-width: 100%; height: auto; border-radius: 6px; }
.yp-article__content blockquote {
  border-left: 4px solid #32bfa3;
  padding: 8px 0 8px 16px;
  color: #144862;
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
}

/* ---------- Author box ---------- */
.yp-article__author {
  display: flex; gap: 14px; align-items: center;
  border-top: 1px solid #dbe5ea; border-bottom: 1px solid #dbe5ea;
  padding: 18px 0;
}
.yp-article__author-avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; object-fit: cover; background: #dbe5ea; }
.yp-article__author-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.yp-article__author-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: #5b7a8a; }
.yp-article__author-name { font-size: 16px; font-weight: 800; color: #363636; }
.yp-article__author-bio { font-size: 14px; line-height: 1.45; color: #5b7a8a; }

/* ---------- Aside : identique à .yp-hub-aside (hub.css) ----------
   On surcharge seulement si besoin — par défaut les blocs héritent du hub. */
.yp-article__aside { display: flex; flex-direction: column; gap: 20px; }

/* "Derniers articles" du sous-hub (bordered panel) */
.yp-article__sidelatest-panel { padding: 20px; }
.yp-article__sidelatest { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.yp-article__sidelatest li + li .yp-article__sidelatest-item { border-top: 1px solid #dbe5ea; }
.yp-article__sidelatest-item {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px;
  align-items: center; padding: 10px 0; text-decoration: none;
}
.yp-article__sidelatest-thumb {
  aspect-ratio: 1; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.yp-article__sidelatest-icon {
  width: 24px; height: 24px; background-color: #fa9856;
  -webkit-mask: var(--yp-icon) center / contain no-repeat;
  mask: var(--yp-icon) center / contain no-repeat;
}
.yp-article__sidelatest-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.yp-article__sidelatest-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #5b7a8a; }
.yp-article__sidelatest-title { font-size: 15px; font-weight: 800; line-height: 1.3; color: #363636; }
.yp-article__sidelatest-item:hover .yp-article__sidelatest-title { color: #32bfa3; }
.yp-article__sidelatest-all {
  display: inline-block; padding-top: 10px;
  font-size: 14px; font-weight: 700; color: #144862; text-decoration: none;
}
.yp-article__sidelatest-all:hover { color: #32bfa3; }

/* ---------- "À lire aussi" bas de page (derniers du HUB) ---------- */
.yp-article__related { display: flex; flex-direction: column; gap: 14px; }
/* Mobile : titre + lien stackés (lien sous le titre).
   Desktop (@media min-width 1024px plus bas) : side-by-side via `space-between`. */
.yp-article__related-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.yp-article__related-title { margin: 0; font-size: 22px; font-weight: 800; color: #363636; }
.yp-article__related-all { font-size: 14px; font-weight: 700; color: #144862; text-decoration: none; }
.yp-article__related-all:hover { color: #32bfa3; }

/* Mobile : carrousel horizontal (design 8b L1010). */
.yp-article__related-grid {
  display: flex; gap: 14px;
  overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px;
  scrollbar-width: none;
}
.yp-article__related-grid::-webkit-scrollbar { display: none; }
.yp-article__related-card {
  flex: 0 0 240px;
  display: flex; flex-direction: column; gap: 8px;
  text-decoration: none;
}
.yp-article__related-thumb {
  aspect-ratio: 3 / 2; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.yp-article__related-icon {
  width: 36px; height: 36px; background-color: #fa9856;
  -webkit-mask: var(--yp-icon) center / contain no-repeat;
  mask: var(--yp-icon) center / contain no-repeat;
}
.yp-article__related-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #5b7a8a; }
.yp-article__related-ttl { font-size: 16px; font-weight: 800; line-height: 1.3; color: #363636; }
.yp-article__related-card:hover .yp-article__related-ttl { color: #32bfa3; }

/* ---------- Newsletter wrapper (le bloc .yp-hub-newsletter est stylé dans hub.css) ---------- */
.yp-article__newsletter-wrap { }

/* ============================================================================
 * Desktop (≥ 1024px) : 2 colonnes article / aside (design 8a).
 * ========================================================================= */
@media (min-width: 1024px) {
  .yp-article { gap: 48px; padding: 12px 0 64px; }

  .yp-article__intro {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 56px;
    align-items: center;
  }
  .yp-article__intro-text { gap: 18px; }
  .yp-article__title { font-size: 44px; line-height: 1.08; letter-spacing: -.02em; }
  .yp-article__chapo { font-size: 19px; line-height: 1.5; color: #144862; }
  .yp-article__hero { max-width: none; margin: 0; padding: 10px; transform: rotate(2deg); box-shadow: 0 12px 40px rgba(20, 72, 98, .18); }

  .yp-article__cols {
    display: grid; grid-template-columns: minmax(0, 1fr) 360px;
    gap: 56px;
    /* PAS d'`align-items: start` : la cellule aside DOIT s'étirer à la hauteur
       de la colonne main pour laisser à `position: sticky` sur le dernier bloc
       (shortcuts) un espace vertical dans lequel glisser. */
  }
  /* L'aside flex-column s'étire sur toute la hauteur de la cellule grid étirée,
     ce qui crée du vide sous le dernier bloc = espace de glisse du sticky. */
  .yp-article__aside { height: 100%; }
  .yp-article__main { gap: 36px; }
  .yp-article__content { gap: 24px; }
  .yp-article__content h2 { font-size: 30px; }
  .yp-article__content h3 { font-size: 22px; }
  .yp-article__content p, .yp-article__content li { font-size: 18px; line-height: 1.7; }

  .yp-article__author { padding: 24px 0; gap: 18px; }
  .yp-article__author-avatar { width: 64px; height: 64px; }
  .yp-article__author-label { font-size: 13px; }
  .yp-article__author-name { font-size: 18px; }
  .yp-article__author-bio { font-size: 15px; line-height: 1.5; }

  .yp-article__aside { gap: 24px; }
  .yp-article__sidelatest-panel { padding: 24px; }

  /* "Trouvez l'intervenant qu'il vous faut" en dernier bloc de la colonne droite
     + sticky : il reste visible pendant que l'utilisateur scrolle le corps d'article.
     Offset = sticky-nav bar (64 px) + rangée hub pills (~68 px) + 16 px breathing. */
  .yp-article__aside .yp-hub-shortcuts {
    position: sticky;
    top: 148px;
    align-self: start;
  }

  /* "À lire aussi" : passe en grille 3 colonnes (fin du scroll horizontal). */
  .yp-article__related { gap: 24px; }
  .yp-article__related-head {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
  }
  .yp-article__related-title { font-size: 28px; }
  .yp-article__related-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px; overflow: visible; margin: 0; padding: 0;
  }
  .yp-article__related-card { flex: initial; }
  .yp-article__related-card:hover { transform: translateY(-4px); }
  .yp-article__related-card { transition: transform .2s cubic-bezier(.4, 0, .2, 1); }
  .yp-article__related-ttl { font-size: 18px; }
}

/* ---------- Masquer la pastille sous-hub si pas de sub (fallback silencieux) ---------- */
.yp-article__subpill:empty { display: none; }
