/* Rythme de lecture partagé : espacements seulement, sans modifier la matière,
   les couleurs, les tailles de police ni les interactions des composants. */
:root {
  --content-reading-gap:16px;
  --content-group-gap:28px;
  --content-block-gap:40px;
}

/* Un retour de destination et son petit intitulé ont chacun leur place. */
main .page-intro > .text-link:first-child {
  margin-bottom:24px;
}
main .page-intro > h1 + p {
  margin-block-start:24px;
}

/* Les titres hors cartes flex ne disposaient pas tous d'une marge de lecture.
   Les cartes resource-card utilisent déjà leur propre gap, conservé ci-dessous. */
main :where(.section,.study-block,.editorial-detail,.contact-info,.reading-content article,
  .reading-content section,.split-intro > div,.program-panel > div,.study-budget,
  .section-heading > div)
  > :is(h2,h3) + :is(p,ul,ol) {
  margin-block-start:var(--content-reading-gap);
}
main .offering > :is(h2,h3) + :is(p,ul,ol) {
  margin-block-start:var(--content-reading-gap);
}
main .offering > :is(ul,ol) + p {
  margin-block-start:var(--content-reading-gap);
}

/* La classe study-block est aussi employée hors study-funding : elle doit y
   séparer les groupes de cartes, et pas uniquement les blocs de financement. */
main .section > .study-block:not(:first-child) {
  margin-block-start:var(--content-block-gap);
}

/* Une grille et le texte ou l'encadré qui la suit sont des groupes distincts.
   Les study-block gardent leur espacement de groupe, plus important. */
main :where(.section,.study-block,.editorial-detail)
  > :is(.resource-grid,.offer-grid,.service-grid,.study-two-columns,.study-field-grid,
    .vehicle-photo-grid,.vehicle-model-grid,.airline-groups,.complementary-grid)
  + :is(p,h2,h3,.notice):not(.study-block) {
  margin-block-start:var(--content-group-gap);
}
main :where(.section,.study-block,.editorial-detail)
  > :is(h2,h3)
  + :is(.resource-grid,.offer-grid,.service-grid,.study-two-columns,.study-field-grid) {
  margin-block-start:var(--content-group-gap);
}
main :where(.section,.study-block,.editorial-detail) > .notice + :is(h2,h3) {
  margin-block-start:var(--content-group-gap);
  margin-block-end:var(--content-reading-gap);
}

/* Les listes éditoriales sans classe ne doivent pas reprendre la hauteur de
   ligne compacte des styles natifs. Les listes de navigation gardent leurs règles. */
main .resource-card > :is(ul,ol):not([class]) {
  margin:0;
  padding-inline-start:1.35em;
  align-self:stretch;
}
main :where(.resource-card,.reading-content,.editorial-detail) > :is(ul,ol):not([class]) li,
main .reading-content :where(article,section) > :is(ul,ol):not([class]) li {
  line-height:1.75;
}
main .resource-card > :is(ul,ol):not([class]) > li + li,
main .reading-content :where(article,section) > :is(ul,ol):not([class]) > li + li {
  margin-block-start:8px;
}

/* Le style reading-content annulait la marge de tous ses paragraphes, y compris
   quand un article en contient plusieurs (conditions, confidentialité, conseils). */
main .reading-content :where(article,section) > p + p,
main .reading-content > p + p,
main .reading-content :where(article,section) > :is(ul,ol) + p {
  margin-block-start:var(--content-reading-gap);
}
main .reading-content :where(article,section) > p + :is(ul,ol) {
  margin-block-start:var(--content-reading-gap);
}

/* Un titre de formulaire, les champs et leur aide forment une séquence stable.
   Cela supprime la marge négative de field-note dans les champs dédiés, sans
   toucher aux contrôles conditionnels, aux grilles ou aux valeurs saisies. */
main .request-form > h2 {
  margin-block-end:var(--content-group-gap);
}
main .request-form > .request-field {
  margin-block-end:22px;
}
main .request-field > :is(input,select,textarea) {
  margin-block-end:0;
}
main .request-field > :is(.field-note,.field-error) {
  margin-block:8px 0;
}
main .request-form > .field-note {
  margin-block:0 20px;
}
main .review-public-form > h2 + fieldset {
  margin-block-start:var(--content-group-gap);
}
main .message-output > h3 + :is(textarea,pre,p),
main .message-output > [data-edit-message] + p {
  margin-block-start:var(--content-reading-gap);
}

/* Les longs libellés restent contenus à petite largeur, sans réduire la police. */
main :is(.resource-card,.offering,.reading-content,.study-block)
  > :is(h2,h3,p,ul,ol) {
  overflow-wrap:break-word;
}

@media(max-width:800px) {
  :root {
    --content-group-gap:24px;
    --content-block-gap:32px;
  }
  main .page-intro > .text-link:first-child {
    margin-bottom:20px;
  }
}
