/*
 * Section « texte_media » — texte et images, deux mises en page.
 *
 * Classes du composant : .tm-grid, .tm-images, .tm-body, .tm-stats, .tm-feature,
 * .vf-image. Elles sont préfixées par .texte-media, qui porte le
 * fond, la mise en page et l'état de jointure. Valeurs reprises du socle, à
 * recaler sur la maquette Kiwanis à l'intégration.
 *
 * LE REGROUPEMENT (piège n° 3). Deux blocs voisins de même fond forment une seule
 * section aux yeux du visiteur :
 *
 *   .texte-media--joins-next  — pas d'espace bas, le suivant enchaîne ;
 *   .texte-media--joined      — pas de filet de tête ni d'espace haut ; à la
 *                               place, un filet INTERNE au conteneur et un titre
 *                               en h3.
 *
 * Ces classes sont posées par le PHP, qui connaît les voisins de chaque bloc. Une
 * règle d'adjacence CSS ne suffirait pas : retirer l'espace du bloc PRÉCÉDENT
 * demande « :has(+ …) », et son absence laisserait un trou au milieu de la section.
 *
 * Autre écart : les chiffres sont une liste de définitions (<dl>/<dt>/<dd>) et non
 * deux <div>. Un chiffre et son libellé sont une paire, l'ordre visuel (valeur
 * au-dessus) est obtenu par « flex-direction: column-reverse ».
 */

.texte-media {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--border);
}

.texte-media--fond-clair { background: var(--surface); }
.texte-media--fond-alterne { background: var(--surface-alt); }

/* ==========================================================================
   Regroupement
   ========================================================================== */

.texte-media--joins-next { padding-bottom: 0; }

.texte-media--joined {
  padding-top: 0;
  border-top: none;
}

/* Le filet passe à l'intérieur du conteneur. */
.texte-media--joined .tm-inner {
  margin-top: 88px;
  padding-top: 80px;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   Mise en page « mosaïque »
   ========================================================================== */

.tm-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 64px;
  align-items: center;
}

.tm-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  grid-template-rows: 280px 200px;
}

.tm-images .span2 { grid-column: 1 / -1; }

.tm-images figure {
  border-radius: var(--r-card-sm);
  overflow: hidden;
  background: var(--surface-alt);
  position: relative;
  margin: 0;
}

.tm-images img { width: 100%; height: 100%; object-fit: cover; }

.tm-images figcaption {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-family: var(--ff-label);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  /* Noir à 50 % sur n'importe quelle photo : le blanc reste au-dessus de 4.5:1. */
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  backdrop-filter: blur(4px);
}

/* --------------------------------------------------------------------------
   Corps de texte
   -------------------------------------------------------------------------- */

.tm-body h2,
.vf-body h2 {
  font-family: var(--ff-heading);
  font-size: clamp(34px, 4.2vw, 50px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 24px;
}

.tm-body h3,
.vf-body h3 {
  font-family: var(--ff-heading);
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.12;
  margin-bottom: 20px;
}

/* <em> sans italique : second ton du titre. */
.tm-body h2 em,
.tm-body h3 em,
.vf-body h2 em,
.vf-body h3 em {
  font-style: normal;
  color: var(--text);
  opacity: 0.55;
}

.tm-texte { color: var(--text-2); }

.tm-texte p {
  font-size: 16px;
  line-height: 1.65;
  margin-bottom: 16px;
}

.tm-texte p:last-child { margin-bottom: 0; }

.tm-texte a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tm-texte a:hover { color: var(--primary); }
.tm-texte strong { color: var(--text); font-weight: 600; }

.tm-texte ul,
.tm-texte ol {
  padding-left: 1.4em;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tm-texte ul { list-style: disc; }
.tm-texte ol { list-style: decimal; }
.tm-texte li::marker { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Chiffres
   -------------------------------------------------------------------------- */

.tm-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  margin-bottom: 32px;
}

/* La valeur est un <dd> et le libellé un <dt> : l'ordre du document suit la
   sémantique, l'ordre visuel est rétabli ici. */
.tm-stat {
  display: flex;
  flex-direction: column;
}

.tm-stat .num {
  font-family: var(--ff-heading);
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 0;
}

.tm-stat .lbl {
  font-family: var(--ff-label);
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ==========================================================================
   Mise en page « côte à côte »
   ========================================================================== */

.tm-feature {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 64px;
  align-items: center;
}

/* Photo à gauche : on inverse l'ordre visuel sans toucher au document, pour que
   le texte reste lu avant l'image. */
.texte-media--image-gauche .tm-feature .vf-body { order: 2; }
.texte-media--image-gauche .tm-feature .vf-image { order: 1; }

.vf-image {
  position: relative;
  border-radius: var(--r-card);
  overflow: hidden;
  height: 420px;
  margin: 0;
  box-shadow: 0 20px 46px rgba(20, 32, 57, 0.18);
}

.vf-image img { width: 100%; height: 100%; object-fit: cover; }

.vf-image figcaption {
  position: absolute;
  bottom: 12px;
  left: 12px;
  font-family: var(--ff-label);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(15, 22, 40, 0.55);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  backdrop-filter: blur(4px);
}

/* ==========================================================================
   Bouton primaire — commun à plusieurs layouts
   ========================================================================== */

/* Le bouton lui-même (.btn .btn-primary) est défini dans base.css. */

/*
 * Espace au-dessus du bouton : sans lui, il se retrouve collé au paragraphe ou à
 * la rangée de chiffres qui le précède.
 *
 * 24 px, la valeur déjà retenue pour le même bouton dans le layout « texte »
 * (sections/texte.css) — deux emplacements du même composant ne doivent pas
 * respirer différemment.
 */
.tm-body .btn-primary,
.vf-body .btn-primary { margin-top: 24px; }

/* ==========================================================================
   Sous 980 px
   ========================================================================== */

@media (max-width: 980px) {
  .tm-grid { grid-template-columns: 1fr; gap: 36px; }
  .tm-feature { grid-template-columns: 1fr; gap: 32px; }

  /* En une colonne, le texte repasse devant : une photo posée en tête de bloc
     n'annonce rien. */
  .texte-media--image-gauche .tm-feature .vf-body,
  .texte-media--image-gauche .tm-feature .vf-image { order: 0; }

  .vf-image { height: 300px; }

  .texte-media--joined .tm-inner { margin-top: 56px; padding-top: 48px; }
}

@media (max-width: 620px) {
  /* La mosaïque garde ses trois photos, mais en hauteurs réduites. */
  .tm-images { grid-template-rows: 200px 140px; gap: 10px; }
  .tm-stats { grid-template-columns: repeat(2, 1fr); }
  .tm-stat .num { font-size: 30px; }
}

/* ==========================================================================
   Mise en page « superposées » — « Notre club » de la maquette Kiwanis
   ==========================================================================

   Classes de la maquette : .qui-sommes, .presidente-grid, .qs-photos,
   .presidente-portrait, .qs-photo-overlay, .qs-body.

   Écart : les photos sont des <img> dans des <figure> (object-fit: cover), là où
   la maquette posait des background-image sur des <div role="img">.

   Le bouton au trait (.btn-outline) garde son trait --text : 16.4:1, bien
   au-dessus du seuil de 3:1 d'un composant d'interface.
   ========================================================================== */

.qui-sommes.texte-media--fond-clair { background: var(--surface); }
.qui-sommes.texte-media--fond-alterne { background: var(--surface-alt); }

.presidente-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}

.qs-photos {
  position: relative;
  padding-bottom: 56px;
  padding-left: 40px;
}

.presidente-portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  margin: 0;
  overflow: hidden;
  background: var(--primary-light);
  border: 6px solid var(--accent);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.22);
  transform: rotate(2deg);
}

.qs-photo-overlay {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 52%;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  border: 6px solid var(--accent);
  border-radius: 4px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  transform: rotate(-4deg);
}

.presidente-portrait img,
.qs-photo-overlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.qui-sommes .text_content {
  position: relative;
  z-index: 1;
  width: 100%;
}

.qs-body { margin-top: 20px; }

.qs-body p {
  max-width: none;
  margin-bottom: 1rem;
  font-family: var(--ff-body);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.85;
  color: var(--text);
}

.qs-body p strong { font-weight: 700; color: var(--text); }

.qs-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

.qui-sommes .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  max-width: 500px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .presidente-grid { grid-template-columns: 1fr; }
  .qs-photos { padding-left: 28px; }
  .qs-photo-overlay { width: 48%; }
}
