/* Blocs de présentation des articles (Nelson, 10/11/2026, maquette 1hxhaGBNh6E7SFvUPyT9PS).
   Insérés par « Ajouter un bloc » dans l'éditeur de texte, ou écrits à la main (consigne du centre d'aide). Chaque bloc
   porte data-bloc et sa classe art-… ; un chapitre peut prendre un fond de section du thème.
   Branchés sur le thème : titres (--bs-heading-font-family, --bs-heading-color), surtitre (.eyebrow-text), fin de titre
   en couleur (.title-accent-color, --bs-hero-accent-color-zone), fonds de section (.bg-primary, .bg-secondary,
   .bg-tertiary, qui redéfinissent couleurs du texte, des titres et de l'accent).
   Chargée par la base des sites (templates/commerce/core/layout/base.html) et par l'éditeur (iframe de Jodit). */

.text-rich [data-bloc] {
  margin-block: clamp(2rem, 1.2rem + 3vw, 4rem);
}
.text-rich [data-bloc] > :first-child { margin-top: 0; }
.text-rich [data-bloc] > :last-child { margin-bottom: 0; }
.text-rich [data-bloc] figure { margin: 0; }
.text-rich [data-bloc] a:has(> img) { display: block; height: 100%; }
/* Photo d'un bloc : sa taille est celle du bloc. Une taille écrite sur la photo (fenêtre « Propriétés de l'image » de
   l'éditeur, ou height: auto ajouté à l'affichage par commerce/texte_riche.py) ne la fait ni déborder ni rapetisser. */
.text-rich :is(.art-entete__photo, .art-photo, .art-photo-texte) img {
  width: 100% !important;
  max-width: none !important;
}

/* Couleur d'accent : celle du fond le plus proche (thème), sinon la couleur principale. */
.text-rich [data-bloc] {
  --art-accent: var(--bs-hero-accent-color-zone, var(--bs-hero-accent-color-page, var(--bs-primary)));
  --art-surtitre: var(--bs-eyebrow-color-zone, var(--bs-eyebrow-color-page, var(--art-accent)));
}

/* Texte de la page en « Pleine largeur » (.tp--pleine, text_page.html) : un texte qui contient des blocs passe en colonne de lecture ; l'en-tête, la
   grande photo et les chapitres avec un fond prennent toute la largeur (html et body : overflow-x: clip). */
.tp--pleine > .text-rich:has(> [data-bloc]) > * {
  max-width: 46rem;
  margin-inline: auto;
}
.tp--pleine > .text-rich > :is(.art-entete, .art-photo, .art-chapitre:is(.bg-primary, .bg-secondary, .bg-tertiary)) {
  width: 100vw;
  max-width: none;
  margin-inline: calc(50% - 50vw);
}
.tp--pleine > .text-rich > :is(.art-photo-texte, .art-phrase) { max-width: 64rem; }

/* En-tête d'article : surtitre, grand titre (fin en couleur), chapeau, signature ; photo à côté. */
.text-rich .art-entete {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: color-mix(in srgb, currentColor 5%, transparent);
}
.text-rich .art-entete__texte {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(2rem, 1rem + 4vw, 5rem) clamp(1.25rem, 1rem + 3vw, 4rem);
}
.text-rich .art-entete .art-entete__titre {
  margin: 0 0 1.25rem;
  font-family: var(--bs-heading-font-family, inherit);
  font-size: clamp(2.3rem, 1.4rem + 3.4vw, 4.4rem);
  line-height: 1.05;
  text-wrap: balance;
}
.text-rich .art-entete__chapeau {
  margin: 0 0 1rem;
  font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem);
  line-height: 1.55;
  font-style: italic;
}
.text-rich .art-entete__signature { margin: 0; font-size: .875rem; opacity: .75; }
.text-rich .art-entete__photo {
  position: relative;
  min-height: clamp(320px, 42vw, 640px);
}
.text-rich .art-entete__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100% !important;
  max-width: none;
  object-fit: cover;
  border-radius: 0;
}

/* Introduction en grand : deux ou trois phrases d'accroche, la dernière peut passer en couleur. */
.text-rich .art-intro p {
  margin: 0 0 1rem;
  font-family: var(--bs-heading-font-family, inherit);
  font-size: clamp(1.35rem, 1rem + 1.3vw, 1.9rem);
  line-height: 1.4;
  color: var(--bs-heading-color, inherit);
}
.text-rich .art-intro .art-intro__accent { color: var(--art-accent); font-style: italic; }

/* Grande photo avec sa légende. */
.text-rich .art-photo img {
  display: block;
  width: 100%;
  height: clamp(260px, 42vw, 620px) !important;
  max-width: none;
  object-fit: cover;
  border-radius: var(--bs-border-radius, .375rem);
}
.tp--pleine > .text-rich > .art-photo img { border-radius: 0; }
.text-rich .art-photo figcaption {
  margin-top: .65rem;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .75;
}
.tp--pleine > .text-rich > .art-photo figcaption { padding-inline: max(1rem, calc(50vw - 23rem)); }

/* Début de chapitre : numéro (surtitre du thème), titre en deux temps ; le texte du chapitre suit dans le bloc.
   Fond au choix (fonds de section du thème). */
.text-rich .art-chapitre > h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.8rem, 1.2rem + 2vw, 2.75rem);
  line-height: 1.15;
  text-wrap: balance;
}
.text-rich .art-chapitre:is(.bg-primary, .bg-secondary, .bg-tertiary) {
  padding: clamp(2rem, 1rem + 4vw, 4.5rem) clamp(1.25rem, 1rem + 3vw, 3rem);
  border-radius: var(--bs-border-radius-lg, .5rem);
}
.tp--pleine > .text-rich > .art-chapitre:is(.bg-primary, .bg-secondary, .bg-tertiary) {
  padding-inline: max(1rem, calc(50vw - 23rem));
  border-radius: 0;
}

/* Citation : une parole et son auteur. Les présentations « Magazine » et « Colonne » donnent leur propre allure aux
   citations simples (filet à gauche) : celle du bloc l'emporte. */
.text-rich blockquote.art-citation {
  margin-inline: 0;
  padding: clamp(1.25rem, 1rem + 2vw, 2.25rem) clamp(1.25rem, 1rem + 2.5vw, 2.75rem) !important;
  border: 0 !important;
  border-radius: var(--bs-border-radius, .375rem);
  background: color-mix(in srgb, currentColor 6%, transparent);
  font-size: inherit !important;
  font-style: normal !important;
}
.text-rich .art-citation p {
  margin: 0 0 .85rem;
  font-family: var(--bs-heading-font-family, inherit);
  font-size: clamp(1.3rem, 1rem + 1vw, 1.75rem);
  line-height: 1.4;
  font-style: italic;
  color: var(--bs-heading-color, inherit);
}
.text-rich .art-citation cite {
  display: block;
  font-size: .8rem;
  font-style: normal;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--art-surtitre);
}

/* Phrase forte : une phrase seule, très grande. */
.text-rich .art-phrase {
  margin-inline: auto;
  font-family: var(--bs-heading-font-family, inherit);
  font-size: clamp(1.75rem, 1.1rem + 2.4vw, 3rem);
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
  color: var(--art-accent);
}

/* Photo et texte, côte à côte ; data-cote="droite" : photo à droite. */
.text-rich .art-photo-texte {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 1rem + 3vw, 3.5rem);
  align-items: center;
}
.text-rich .art-photo-texte[data-cote="droite"] > figure { order: 2; }
.text-rich .art-photo-texte img {
  display: block;
  width: 100%;
  height: auto !important;
  max-width: none;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--bs-border-radius, .375rem);
}
.text-rich .art-photo-texte__texte > :last-child { margin-bottom: 0; }

/* Conclusion : encadré de fin, avec un bouton. */
.text-rich .art-conclusion {
  padding: clamp(1.5rem, 1rem + 3vw, 3rem);
  border: 1.5px solid color-mix(in srgb, currentColor 45%, transparent);
  border-radius: var(--bs-border-radius, .375rem);
  text-align: center;
}
.text-rich .art-conclusion p {
  margin: 0 0 1.25rem;
  font-family: var(--bs-heading-font-family, inherit);
  font-size: clamp(1.2rem, 1rem + .8vw, 1.6rem);
  line-height: 1.4;
  color: var(--bs-heading-color, inherit);
}
.text-rich .art-conclusion .art-conclusion__action { font-family: inherit; font-size: 1rem; }

/* Téléphone : l'en-tête et la photo et texte s'empilent, photo au-dessus. */
@media (max-width: 767.98px) {
  .text-rich .art-entete,
  .text-rich .art-photo-texte { grid-template-columns: minmax(0, 1fr); }
  .text-rich .art-entete__photo { order: -1; min-height: 300px; }
  .text-rich .art-photo-texte[data-cote="droite"] > figure { order: 0; }
}
