/*
 * Hop We Care — Layout
 * ─────────────────────────────────────────────────────────────────────────────
 * Wrapper, grille, helpers flex, structure de page.
 * Aucun style visuel (couleurs, typographie) ici — uniquement du structural CSS.
 * Dépend de tokens.css.
 * ─────────────────────────────────────────────────────────────────────────────
 */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.wrapper {
  width: 100%;
  max-width: var(--layout-max-width);
  margin-inline: auto;
  padding-inline: var(--layout-padding-x);
}

.wrapper--wide {
  max-width: var(--layout-wide-width);
}

.wrapper--narrow {
  max-width: 800px;
}

/* ── Structure de page ────────────────────────────────────────────────────── */
.page-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  /* Ancre de scroll au bon endroit sous le header fixe */
  scroll-margin-top: var(--header-height);
}

/* Règle Q1 : seuls les paragraphes de corps sont justifiés. Les textes des
   cartes et les descriptifs sous les titres conservent leur centrage. */
.page-body main p {
  text-align: justify;
  hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
}

.page-body main .section-title > p,
.page-body main :is(.news-card, .action-card, .epok-card, .immersion-entry,
  .epok26-card, .epok26-stat, .epok26-place, .epok26-team, .epok26-partner,
  .epok-tax__column, .nl-card, .nl-voice, .nl-social-card, .hub-card,
  .ca-card, .temoignage, .benv-reason, .benv-step, .benv-profiles-card,
  .benv-testi, .testimonial-card) p {
  text-align: center;
}

/* Descriptifs conservés centrés malgré la règle générale des paragraphes. */
.page-body main .ca-board__intro > p,
.page-body main .section-title__body > p,
.page-body main .nl-section-subtitle {
  text-align: center;
}

/* Sur les pages avec hero plein écran, pas de décalage top */
main.has-hero {
  padding-top: 0;
}

/* Pages sans hero : espace sous le header fixe */
main.no-hero {
  padding-top: var(--header-height);
}

/* ── Sections ─────────────────────────────────────────────────────────────── */
.section {
  padding-block: var(--space-16);
}

.section--sm {
  padding-block: var(--space-10);
}

.section--lg {
  padding-block: var(--space-24);
}

.section--light { background-color: var(--color-white-off); }
.section--teal  { background-color: var(--color-teal); color: var(--color-white-off); }
.section--navy  { background-color: var(--color-navy); color: var(--color-white-off); }

/* ── Grille ───────────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--space-8);
}

/* Colonnes fixes */
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* Auto-fit responsive (s'adapte à l'espace disponible) */
.grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ── Helpers flex ─────────────────────────────────────────────────────────── */
.flex              { display: flex; }
.flex-col          { display: flex; flex-direction: column; }
.items-center      { align-items: center; }
.items-start       { align-items: flex-start; }
.justify-between   { justify-content: space-between; }
.justify-center    { justify-content: center; }
.flex-wrap         { flex-wrap: wrap; }
.flex-shrink-0     { flex-shrink: 0; }
.flex-1            { flex: 1; }

/* Gaps standardisés */
.gap-2  { gap: var(--space-2); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.gap-12 { gap: var(--space-12); }

/* ── Utilitaires texte ────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

/* ── Utilitaires espacement ───────────────────────────────────────────────── */
.mt-auto     { margin-top: auto; }
.ml-auto     { margin-left: auto; }
.mx-auto     { margin-inline: auto; }

/* Fallback utilisable lorsque le système n'a pas de client mail configuré. */
.mailto-copy-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-inline-start: var(--space-2);
  vertical-align: middle;
}

.mailto-copy-address {
  font: inherit;
  overflow-wrap: anywhere;
  user-select: text;
}

.mailto-copy-button {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: var(--radius-full);
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.mailto-copy-button:hover,
.mailto-copy-button:focus-visible {
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.mailto-copy-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid--4,
  .grid--3,
  .grid--2 {
    grid-template-columns: 1fr;
  }

  .section,
  .section--lg {
    padding-block: var(--space-10);
  }
}
