/*
 * Garde-fous de mise en page (thème 0.8.0, complétés en 0.8.5).
 * Les textes se modifient depuis l'administration : ces règles gardent le design propre
 * quand un texte devient plus long, plus court, ou contient un mot très long.
 * Avec les textes d'origine, elles ne changent rien à l'affichage.
 */

/* 1. Un mot trop long passe à la ligne au lieu de sortir de son bloc. */
main :is(h1, h2, h3, p, li, summary, blockquote, figcaption, a, span, small, label, .contact-title, .hero-title, .pilier) {
  overflow-wrap: anywhere;
}

/* 2. Boutons et liens fléchés : retour à la ligne propre si le libellé s'allonge. */
main .button {
  white-space: normal;
  text-align: center;
  max-width: 100%;
  height: auto;
}
main .text-link { max-width: 100%; }
main .text-link-label { min-width: 0; }

/* 3. Grilles : une colonne ne s'élargit jamais à cause d'un texte. */
main :is(.pillars, .service-grid, .methode-pillar-grid, .methode-step-grid) > * { min-width: 0; }
.pillars { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 600px) { .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 4. Grande photo d'accueil : le bandeau grandit avec le texte au lieu de le couper,
      et le texte reste sur la partie sombre, à gauche de la photo. */
@media (min-width: 851px) {
  .hero { height: auto; min-height: clamp(510px, 43vw, 740px); }
}
@media (min-width: 1500px) {
  .hero { min-height: max(660px, clamp(510px, 43vw, 740px)); }
}
@media (min-width: 601px) and (max-width: 850px) {
  .hero { height: auto; min-height: 570px; }
}
@media (min-width: 601px) {
  .hero .eyebrow { max-width: min(100%, 640px); }
  .hero .hero-title { max-width: 12em; }
}

/* 5. Titre de la FAQ : chaque ligne peut se replier si elle s'allonge. */
.faq-hero h1 span { white-space: normal; overflow-wrap: normal; }
@media (max-width: 600px) { .faq-hero h1 span { overflow-wrap: anywhere; } }

/* 6. Liens écrits dans les textes ([mots](page)) : toujours soulignés, pour qu'on voie qu'ils sont cliquables. */
main a.lien-texte {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
main a.lien-texte:hover,
main a.lien-texte:focus-visible { text-decoration-thickness: 2px; }

/* 7. Noms de communes jamais coupés en fin de ligne (« La / Baule-Escoublac »).
      Le thème entoure automatiquement chaque commune d'un <span class="commune">, y compris dans les textes saisis. */
.commune,
.faq-hero h1 span.commune { white-space: nowrap; }
.signature span.commune { color: inherit; }
.text-link span.commune { font-size: inherit; transition: none; }
.text-link:hover span.commune { transform: none; }

/* 8. Texte justifié (0.8.9).
      Le script reference/justification.js ajoute la classe « justifie » seulement aux paragraphes
      d'au moins 3 lignes dont aucune ligne n'est trop courte : un paragraphe court, une colonne étroite
      ou une énumération de noms restent alignés à gauche (sinon de grands blancs entre les mots).
      Coupure des mots limitée aux mots longs (10 lettres ou plus, jamais « no-tamment »),
      jamais deux lignes coupées de suite. Sur téléphone, tout reste aligné à gauche. */
@media (min-width: 601px) {
  main :is(.hero-intro, .about-copy > p, .intervention-copy > p, .contact-intro > p, .methode-hero-copy > p,
           .methode-copy > p, .tarifs-family-copy > p, .tarifs-bach-intro, .faq-intro, details > p,
           .contact-zone-copy > p, .contact-stage-copy > p) {
    -webkit-hyphens: auto;
    hyphens: auto;
    hyphenate-limit-chars: 10 4 4;
    -webkit-hyphenate-limit-before: 4;
    -webkit-hyphenate-limit-after: 4;
    -webkit-hyphenate-limit-lines: 1;
    hyphenate-limit-lines: 1;
  }
  main p.justifie { text-align: justify; text-align-last: start; }
}
