/* ================================================================ Bloc « Le magazine » (data-bloc="magazine")
   Des tuiles de rubriques (photo pleine, nom et nombre d'articles dessus), puis les articles : le premier affiché est le grand
   article (photo pleine, texte dessus), les autres en liste. Le script bloc-magazine.js ne fait que cacher les articles hors
   rubrique. Remplace les règles .magazine, .une, .article, .articles de la feuille commune, qui ne servent plus à ce bloc.
   Écrite téléphone d'abord, avec les jetons de la feuille commune. */
.mag { display: grid; gap: clamp(16px, 2.2vw, 26px); }
.mag > * { min-width: 0; }

/* ---------------------------------------------------------------- Rubriques : rangée qui défile au doigt, en quinconce */
.mag-rubriques__titre { margin: 0 0 6px; color: var(--gris); font-size: .86rem; font-weight: 650; }
.mag-rubriques ul { display: flex; align-items: flex-start; gap: 12px; margin: 0 calc(-1 * var(--gouttiere)); padding: 8px var(--gouttiere) 18px; list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: var(--gouttiere); scrollbar-width: none; }
.mag-rubriques ul::-webkit-scrollbar { display: none; }
.mag-rubriques li { flex: 0 0 148px; min-width: 0; scroll-snap-align: start; }
.mag-rubriques li:nth-child(even) { margin-top: 14px; }
.mag-tuile { position: relative; display: block; height: 178px; overflow: hidden; border-radius: 24px 24px 24px 8px; background: var(--nuit); color: #fff; text-decoration: none;
  box-shadow: var(--ombre-forte); isolation: isolate; transition: transform .35s var(--courbe), box-shadow .35s var(--courbe); }
.mag-rubriques li:nth-child(even) .mag-tuile { border-radius: 24px 8px 24px 24px; }
.mag-tuile:hover, .mag-tuile:focus-visible { color: #fff; }
.mag-tuile:focus-visible { transform: translateY(-4px); }
/* Au doigt, un survol reste collé après l'appui, et une rubrique touchée ne quitte pas la page : elle restait soulevée, photo agrandie.
   Le soulèvement et l'agrandissement ne viennent qu'à la souris ; la rubrique choisie garde son liseré (skills d'Emil Kowalski, 30/11). */
@media (hover: hover) and (pointer: fine) {
  .mag-tuile:hover { transform: translateY(-4px); }
  .mag-tuile:hover img { transform: scale(1.06); }
}
.mag-tuile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--courbe); }
/* Le voile fait partie du bloc de texte : un dégradé nuit sous le nom, la photo reste vive au-dessus ; un liseré clair */
.mag-tuile__texte { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 7px; padding: 14px; border-radius: inherit;
  background: linear-gradient(to top, rgba(9, 17, 42, .93) 0%, rgba(9, 17, 42, .72) 36%, rgba(9, 17, 42, .24) 60%, rgba(9, 17, 42, 0) 80%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), inset 0 1px 0 rgba(255, 255, 255, .3); }
.mag-tuile__nom { font: 750 1rem/1.18 var(--police); letter-spacing: -.012em; overflow-wrap: break-word; text-shadow: 0 1px 10px rgba(0, 0, 0, .4); }
.mag-tuile__nombre { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); color: #fff;
  font-size: .74rem; font-weight: 650; line-height: 1.5; white-space: nowrap; }
/* Tuile « Tous les articles » : pas de photo, une surface nuit avec deux lueurs et un liseré d'or */
.mag-tuile--tout { background: radial-gradient(90% 70% at 100% 0%, var(--lueur-1), transparent 62%), radial-gradient(80% 60% at 0% 100%, var(--lueur-2), transparent 66%),
  linear-gradient(150deg, #0A1533 0%, var(--nuit-2) 60%, #2B2257 100%); }
.mag-tuile--tout .mag-tuile__texte { background: none; box-shadow: inset 0 0 0 1px rgba(235, 209, 147, .34), inset 0 1px 0 rgba(255, 255, 255, .22); }
.mag-tuile__picto { position: absolute; top: 16px; left: 14px; width: 30px; height: 30px; color: var(--accent-clair-uni); }
/* Rubrique affichée : anneau d'or, compteur en or */
.mag-tuile[aria-current="true"] { box-shadow: 0 0 0 3px var(--fond-2), 0 0 0 5px var(--or), var(--ombre-forte); }
.mag-tuile[aria-current="true"] .mag-tuile__nombre { background: var(--accent); color: var(--accent-texte); box-shadow: inset 0 0 0 1px var(--accent-bord); }

.mag-etat { margin: 0; color: var(--titre); font-size: .95rem; font-weight: 650; scroll-margin-top: 8px; }   /* l'arrivée après un choix : juste sous le menu collé (la feuille commune donne déjà 90 px de marge de défilement) */
.mag-etat:empty { display: none; }

/* ---------------------------------------------------------------- Articles : en liste (vignette, rubrique, titre, date) */
.mag-articles { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; scroll-margin-top: 8px; }
.mag-art { display: flex; min-width: 0; }
.mag-art[hidden], .mag-suite[hidden] { display: none; }
.mag-carte { position: relative; flex: 1; min-width: 0; display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 14px; margin-inline: -8px; padding: 8px;
  border-radius: 22px 22px 22px 10px; transition: background-color .25s, box-shadow .25s; }
.mag-carte:hover { background: rgba(255, 255, 255, .62); box-shadow: var(--ombre); }
.mag-carte__image { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 16px 16px 16px 6px; background: var(--ligne); box-shadow: var(--ombre); }
.mag-carte__image img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--courbe); }
/* Image dont la gauche porte un titre incrusté : on n'en montre que les 40 % de droite, quelle que soit la forme du cadre */
.mag-art--droite .mag-carte__image img { position: absolute; top: 0; right: 0; width: 250%; max-width: none; transform-origin: 100% 50%; }
.mag-carte:hover .mag-carte__image img { transform: scale(1.05); }
.mag-carte__corps { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.mag-carte__rubrique { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--accent-lien); font-size: .76rem; font-weight: 650; line-height: 1.4; }
.mag-carte__rubrique::before { content: ""; width: 16px; height: 2px; border-radius: 2px; background: var(--accent); }
/* conseil D15 des vidéos du 28/11 : la rubrique (surtitre) colle au titre, la ligne suivante s'en écarte un peu plus (3 px puis 6 px) */
.mag-carte h3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 0 0 3px; color: var(--titre); font: 650 .98rem/1.32 var(--police); letter-spacing: -.008em; }
.mag-carte h3 a, .mag-carte h3 a:hover, .mag-carte h3 a:focus-visible { color: inherit; text-decoration: none; }
/* Toute la carte est le lien de son titre */
.mag-carte h3 a::after { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; }
.mag-carte:hover h3 a { text-decoration: underline; text-decoration-color: var(--or); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.mag-carte__chapo, .mag-carte__publie { display: none; }
.mag-carte__date { margin: 0; color: var(--gris); font-size: .8rem; }

/* ---------------------------------------------------------------- Le grand article : photo pleine, texte dessus */
.est-une .mag-carte { display: flex; align-items: flex-end; min-height: 430px; margin: 0 0 10px; padding: 0; overflow: hidden; border-radius: 30px 30px 30px 10px; background: var(--nuit);
  box-shadow: var(--ombre-forte); isolation: isolate; }
.est-une .mag-carte:hover { background: var(--nuit); box-shadow: var(--ombre-forte); }
.est-une .mag-carte::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(235, 209, 147, .4), inset 0 1px 0 rgba(255, 255, 255, .3); }
.est-une .mag-carte__image { position: absolute; inset: 0; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
.est-une .mag-carte__corps { position: relative; width: 100%; gap: 8px; padding: 110px 20px 22px; color: #fff;
  background: linear-gradient(to top, rgba(9, 17, 42, .96) 0%, rgba(9, 17, 42, .84) 40%, rgba(9, 17, 42, .4) 74%, rgba(9, 17, 42, 0) 100%); }
.est-une .mag-carte__rubrique { color: var(--accent-clair-uni); font-size: .8rem; }
.est-une .mag-carte h3 { -webkit-line-clamp: 3; margin-bottom: 4px; color: #fff; font: 750 clamp(1.3rem, 1rem + 1.2vw, 1.85rem)/1.16 var(--police); letter-spacing: -.022em; text-wrap: balance; text-shadow: 0 2px 18px rgba(0, 0, 0, .35); }   /* D15 : rubrique → titre 8 px, titre → chapô 12 px */
.est-une .mag-carte__chapo { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin: 0; max-width: 60ch; color: rgba(255, 255, 255, .92); font-size: .95rem; line-height: 1.5; }
.est-une .mag-carte__publie { display: inline; }
.est-une .mag-carte__date { color: rgba(255, 255, 255, .82); }

/* ---------------------------------------------------------------- Fin de rubrique (une rubrique d'un ou deux articles) */
.mag-suite__picto { width: 30px; height: 30px; margin-bottom: auto; color: var(--accent-clair-uni); }
.mag-suite { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 14px; min-height: 190px; margin-top: 8px; padding: 22px; border-radius: 10px 28px 28px 28px; color: #fff;
  background: radial-gradient(80% 90% at 100% 0%, var(--lueur-1), transparent 62%), radial-gradient(70% 80% at 0% 100%, var(--lueur-2), transparent 66%), linear-gradient(140deg, #0A1533 0%, var(--nuit-2) 62%, #2B2257 100%);
  box-shadow: inset 0 0 0 1px rgba(235, 209, 147, .34), inset 0 1px 0 rgba(255, 255, 255, .2), var(--ombre-forte); }
.mag-suite p { margin: 0; max-width: 30ch; color: #fff; font-size: 1.05rem; font-weight: 650; line-height: 1.4; text-wrap: balance; }
/* conseil A4 des vidéos du 28/11 : « Voir tous les articles » se réduit à 0,97 à l'appui */
.mag-suite .bouton { transition: background .2s, box-shadow .2s, color .2s, scale .12s var(--courbe); }

@media (prefers-reduced-motion: no-preference) {
  .mag-suite .bouton:active { scale: .97; }
  /* conseil A3 : les articles arrivent l'un après l'autre, 30 ms d'écart. --rang = place de l'article dans la liste ;
     après le choix d'une rubrique, bloc-magazine.js la remplace par sa place parmi les articles affichés. */
  .mag-art { animation: mag-entre .45s var(--courbe) calc(var(--rang, 0) * 30ms) both; }
  .mag-art:nth-child(2) { --rang: 1; } .mag-art:nth-child(3) { --rang: 2; } .mag-art:nth-child(4) { --rang: 3; }
  .mag-art:nth-child(5) { --rang: 4; } .mag-art:nth-child(6) { --rang: 5; } .mag-art:nth-child(7) { --rang: 6; } .mag-art:nth-child(n+8) { --rang: 7; }
  @keyframes mag-entre { from { opacity: 0; transform: translateY(10px); } }
}
@media (prefers-reduced-motion: reduce) {
  .mag-tuile, .mag-tuile img, .mag-carte, .mag-carte__image img { transition: none; }
  .mag-tuile:hover, .mag-tuile:focus-visible, .mag-tuile:hover img, .mag-carte:hover .mag-carte__image img { transform: none; }
}

/* ================================================================ Tablette */
@media (min-width: 720px) {
  .mag-rubriques li { flex-basis: 164px; }
  .mag-tuile { height: 190px; }
  .mag-carte { grid-template-columns: 104px minmax(0, 1fr); gap: 18px; }
  .est-une .mag-carte { min-height: 460px; }
  .est-une .mag-carte__corps { padding: 130px 28px 26px; }
}

/* ================================================================ Bureau : le grand article à gauche, la liste à droite */
@media (min-width: 900px) {
  /* Six lignes pour la liste, une septième qui prend la hauteur restante (c'est là que se pose la fin de rubrique) */
  .mag-articles { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); grid-template-rows: repeat(6, auto) minmax(0, 1fr); gap: 0 clamp(28px, 3.4vw, 52px); }
  .mag-art { grid-column: 2; padding-block: 2px; }
  .mag-art.est-une { padding-block: 0; }
  .mag-art.est-une { grid-column: 1; grid-row: 1 / -1; }
  .est-une .mag-carte { min-height: 520px; margin: 0; }
  .est-une .mag-carte__corps { padding: 150px 32px 30px; }
  .mag-suite { grid-column: 2; grid-row: 7; margin-top: 0; padding: 28px; }
  .mag-art:not(.est-une):not([hidden]) ~ .mag-suite { margin-top: 12px; }
}
@media (min-width: 1200px) {
  /* Les sept tuiles tiennent sur une ligne : plus de défilement */
  .mag-rubriques ul { gap: 14px; margin: 0; padding: 6px 0 4px; overflow: visible; }
  .mag-rubriques li { flex: 1 1 0; }
  .mag-rubriques li:nth-child(2) { flex-grow: 1.3; }
  .mag-rubriques li:nth-child(even) { margin-top: 18px; }
  .mag-tuile { height: 204px; }
  .mag-tuile__texte { padding: 16px; }
  .mag-tuile__nom { font-size: 1.06rem; }
}
