/* ===========================================================================
   Page d'accueil magazine
   Toutes les couleurs et polices viennent des jetons du thème : cette feuille
   est identique sur les trois sites, chacun l'habille avec sa palette.
   =========================================================================== */

.mz {
  --mz-gap: clamp(1rem, 0.5rem + 1.4vw, 1.75rem);
  --mz-section: clamp(2.5rem, 1.5rem + 3vw, 4.25rem);
  padding-inline: clamp(1rem, 0.4rem + 2.4vw, 2.5rem);
  padding-block: clamp(1.75rem, 1rem + 2vw, 3rem) var(--mz-section);
}

/* Le magazine pose ses propres surfaces : le conteneur du thème doit s'effacer,
   sinon des cartes blanches se posent sur un fond blanc. */
.mz-home.one-container .container,
.mz-home.one-container .site-content { background: transparent; padding-inline: 0; }
.mz-home .site-main { margin: 0; padding: 0; background: transparent; }
.mz-home .inside-article { padding: 0; }

/* --- Bandeau de tête ----------------------------------------------------- */

.mz-masthead {
  padding-bottom: clamp(1.75rem, 1rem + 2vw, 2.75rem);
  margin-bottom: var(--mz-section);
  border-bottom: 1px solid var(--line);
}
.mz-masthead__kicker {
  margin: 0 0 0.6rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.mz-masthead__title {
  margin: 0 0 1rem;
  max-width: 24ch;
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: clamp(2rem, 1.1rem + 3.4vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.012em;
  color: var(--ink-strong);
  text-wrap: balance;
}
.mz-masthead__chapo {
  margin: 0 0 0.75rem;
  max-width: 64ch;
  color: var(--ink-mid);
  font-size: clamp(0.98rem, 0.95rem + 0.2vw, 1.075rem);
  line-height: 1.65;
}
.mz-masthead__chapo:last-of-type { margin-bottom: 0; }

/* --- Pastilles de rubriques ---------------------------------------------- */

.mz-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.mz-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42em 0.85em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}
.mz-chip:hover,
.mz-chip:focus-visible {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-accent);
}
.mz-chip__n {
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  transition: color 0.18s ease;
}
.mz-chip:hover .mz-chip__n,
.mz-chip:focus-visible .mz-chip__n { color: var(--on-accent); opacity: 0.8; }

/* --- En-tête de section -------------------------------------------------- */

.mz-section { margin-bottom: var(--mz-section); }
.mz-section:last-child { margin-bottom: 0; }

.mz-section__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  padding-bottom: 0.6rem;
  margin-bottom: var(--mz-gap);
  border-bottom: 2px solid var(--brand);
}
.mz-section__title {
  margin: 0;
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.9rem);
  line-height: 1.15;
  color: var(--ink-strong);
}
.mz-section__title a { color: inherit; text-decoration: none; }
.mz-section__title a:hover { color: var(--accent-ink); }
.mz-section__count {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.mz-section__more {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-ink);
  text-decoration: none;
  white-space: nowrap;
}
.mz-section__more:hover { color: var(--accent-deep); text-decoration: underline; }

/* --- Grilles ------------------------------------------------------------- */

.mz-grid {
  display: grid;
  gap: var(--mz-gap);
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
}

.mz-featured {
  display: grid;
  gap: var(--mz-gap);
  grid-template-columns: 1.75fr 1fr;
}
.mz-featured > .mz-card--hero { grid-row: span 3; }

@media (max-width: 860px) {
  .mz-featured { grid-template-columns: 1fr; }
  .mz-featured > .mz-card--hero { grid-row: auto; }
}

/* --- Carte --------------------------------------------------------------- */

.mz-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.mz-card:hover,
.mz-card:focus-within {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -16px rgb(0 0 0 / 0.3);
}

.mz-card__media {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
}
/* Les règles d'archive du socle ne doivent pas plafonner ces images. */
.mz-card__img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.mz-card:hover .mz-card__img { transform: scale(1.045); }

.mz-card__media-vide {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--surface-2), var(--accent-soft));
}
.mz-card__media-vide > span {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3.25rem);
  color: var(--brand);
  opacity: 0.5;
}

.mz-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: clamp(0.9rem, 0.6rem + 0.6vw, 1.35rem);
}

.mz-eyebrow {
  align-self: flex-start;
  padding: 0.24em 0.62em;
  border-radius: calc(var(--radius) / 2);
  background: var(--accent-soft);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-deep);
  text-decoration: none;
}
.mz-eyebrow:hover { background: var(--brand); color: var(--on-accent); }

.mz-card__title {
  margin: 0;
  font-family: var(--display);
  font-weight: var(--display-weight);
  font-size: 1.075rem;
  line-height: 1.24;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.mz-card__title a { color: var(--ink-strong); text-decoration: none; }
.mz-card__title a:hover { color: var(--accent-ink); }

.mz-card__excerpt {
  margin: 0;
  color: var(--ink-mid);
  font-size: 0.92rem;
  line-height: 1.58;
}

.mz-card__meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.1rem 0 0;
  font-family: var(--sans);
  font-size: 0.76rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* Variante grande : l'article de tête porte le titre le plus fort de la page
   après le H1, et un chapô plus long. */
.mz-card--hero .mz-card__media { aspect-ratio: 16 / 9; }
.mz-card--hero .mz-card__body { padding: clamp(1.1rem, 0.7rem + 1vw, 1.75rem); gap: 0.7rem; }
.mz-card--hero .mz-card__title { font-size: clamp(1.35rem, 1.05rem + 1.2vw, 2rem); line-height: 1.14; }
.mz-card--hero .mz-card__excerpt { font-size: 1rem; }

/* Variante compacte : image à gauche, pas de chapô — elle accompagne la une
   sans lui faire concurrence. */
.mz-card--compact { flex-direction: row; }
.mz-card--compact .mz-card__media { flex: 0 0 40%; aspect-ratio: 4 / 3; }
.mz-card--compact .mz-card__body { justify-content: center; }

@media (max-width: 480px) {
  .mz-card--compact { flex-direction: column; }
  .mz-card--compact .mz-card__media { flex: none; aspect-ratio: 16 / 10; }
}

/* --- Liste dense --------------------------------------------------------- */

.mz-latest { list-style: none; margin: 0; padding: 0; }
.mz-latest__item {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.mz-latest__item:last-child { border-bottom: 0; }
.mz-latest__date {
  flex: 0 0 6.5rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.mz-latest__link {
  flex: 1 1 18rem;
  font-family: var(--display);
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--ink-strong);
  text-decoration: none;
}
.mz-latest__link:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 0.15em; }
.mz-latest__cat {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}
.mz-latest__cat:hover { color: var(--accent-ink); }

/* --- Contenu éditorial de l'accueil ------------------------------------- */

.mz-editorial {
  padding: clamp(1.25rem, 0.8rem + 1.4vw, 2.25rem);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.mz-editorial > :first-child { margin-top: 0; }
.mz-editorial > :last-child { margin-bottom: 0; }
.mz-editorial img { max-width: 100%; height: auto; }
/* Le texte de fond se lit, il ne se parcourt pas : on borne la justification. */
.mz-editorial p { max-width: 72ch; }

/* --- Respect des préférences système ------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .mz-card,
  .mz-card__img,
  .mz-chip { transition: none; }
  .mz-card:hover { transform: none; }
  .mz-card:hover .mz-card__img { transform: none; }
}

/* ===========================================================================
   Corrections de maquette
   =========================================================================== */

/* Une grille auto-fill donnait 3 colonnes pour 4 cartes : la quatrième tombait
   seule à la ligne suivante, ce qui se lit comme un bug. On fixe le nombre de
   colonnes aux paliers où la largeur le permet vraiment. */
.mz-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) { .mz-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px)  { .mz-grid { grid-template-columns: 1fr; } }

/* La ligne de méta descend en bas de carte : les dates s'alignent d'une carte
   à l'autre même quand les chapôs n'ont pas la même longueur. */
.mz-card__meta { margin-top: auto; padding-top: 0.2rem; }

/* Titres et chapôs bornés : un titre de dix lignes déforme toute la rangée. */
.mz-card__title,
.mz-card__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mz-card__title { -webkit-line-clamp: 3; }
.mz-card__excerpt { -webkit-line-clamp: 3; }
.mz-card--hero .mz-card__title { -webkit-line-clamp: 2; }
.mz-card--hero .mz-card__excerpt { -webkit-line-clamp: 4; }
.mz-card--compact .mz-card__title { -webkit-line-clamp: 4; }

/* Le bandeau de tête occupait une colonne et laissait la moitié droite vide.
   Titre à gauche, chapô à droite : la largeur sert enfin à quelque chose. */
@media (min-width: 900px) {
  .mz-masthead {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    column-gap: clamp(2rem, 1rem + 3vw, 4rem);
    align-items: start;
  }
  .mz-masthead__kicker,
  .mz-chips { grid-column: 1 / -1; }
  .mz-masthead__title { grid-column: 1; margin-bottom: 0; max-width: none; }
  .mz-masthead__lede { grid-column: 2; padding-top: 0.35rem; }
}
.mz-masthead__lede > :last-child { margin-bottom: 0; }
