/* ============================================================
   PAGE PROJETS : DA « Télémétrie »
   Le mur des stands lit les dossiers techniques du pilote #26.
   1. En-tête : lectures de télémétrie (pstats)
   2. Classement CTF (scène carbone) : timing tower, preuves
   3. Barre de filtres collante : molette de cartographie moteur
   4. Études de cas : dossiers techniques, secteurs de lecture,
      écran « onboard » de la démo
   5. Sans JS, mouvement réduit, impression
   Socle (variables, .hud-frame, .chip, .runhead...) : css/core.css
   ============================================================ */

/* ------------------------------------------------------------
   1. EN-TÊTE
   ------------------------------------------------------------ */

/* Repères du mur des stands, à gauche du chapeau (bureau) */
.hero-meta { display: none; }

@media (min-width: 1024px) {
  .hero-meta {
    grid-column: 1 / span 4;
    grid-row: 1;
    align-self: end;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .hero-meta .hud-tag { color: var(--fg); }

  .hero-meta-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
  }

  .hero-meta-line::before {
    content: "";
    width: 16px;
    height: 1px;
    background: var(--accent);
  }
}

/* Lectures de télémétrie : un canal par chiffre */
.pstats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gutter);
  margin-top: clamp(var(--s-8), 8vw, var(--s-10));
}

@media (min-width: 1024px) {
  .pstats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.pstat {
  --hud-c: var(--accent);
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px clamp(12px, 1.4vw, 18px) 16px;
  background-color: color-mix(in srgb, var(--carbon) 62%, transparent);
  box-shadow: inset 0 0 0 1px var(--rule);
}

.pstat--best { --hud-c: var(--purple); }

.pstat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: clamp(14px, 2vw, 24px);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.pstat-head span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.pstat-head span:first-child::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.pstat-head span:last-child { color: var(--accent-small); font-weight: 700; }
.pstat--best .pstat-head span:last-child { color: #cf8dff; }

.pstat-num {
  font-family: var(--font-display);
  font-size: clamp(3rem, 1.5rem + 4.2vw, 6.25rem);
  font-style: italic;
  font-variation-settings: "wdth" var(--fw, 74), "wght" var(--fwg, 850);
  line-height: 0.86;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Règle graduée sous la valeur */
.pstat-ruler {
  display: block;
  height: 8px;
  margin: 14px 0 10px;
  background:
    repeating-linear-gradient(90deg, var(--line-2) 0 1px, transparent 1px 32px) 0 100% / 100% 8px no-repeat,
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 8px) 0 100% / 100% 4px no-repeat;
  opacity: 0.9;
}

.pstat-label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}

/* Trois secteurs : verts, violets pour le meilleur résultat */
.pstat-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: auto;
  padding-top: 16px;
}

.pstat-bar i {
  height: 4px;
  background: var(--green);
  transform: skewX(var(--slant));
  transform-origin: 0 50%;
}

.pstat--best .pstat-bar i {
  background: var(--purple);
  box-shadow: 0 0 10px color-mix(in srgb, var(--purple) 60%, transparent);
}

.js .pstats .pstat-bar i {
  transform: skewX(var(--slant)) scaleX(0);
  transition: transform 0.55s var(--ease-out) calc(0.45s + var(--i, 0) * 90ms);
}

.js .pstats .pstat-bar i:nth-child(2) { transition-delay: calc(0.65s + var(--i, 0) * 90ms); }
.js .pstats .pstat-bar i:nth-child(3) { transition-delay: calc(0.85s + var(--i, 0) * 90ms); }
.js .pstats.is-in .pstat-bar i { transform: skewX(var(--slant)) scaleX(1); }

/* ------------------------------------------------------------
   2. CLASSEMENT CTF (scène carbone)
   ------------------------------------------------------------ */
.ranking {
  position: relative;
  isolation: isolate;
  padding-block: var(--section);
}

/* Tissage carbone, très discret, fondu en haut et en bas */
.ranking::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(27deg, rgba(255, 255, 255, 0.016) 5px, transparent 5px) 0 5px / 20px 20px,
    linear-gradient(207deg, rgba(255, 255, 255, 0.016) 5px, transparent 5px) 10px 0 / 20px 20px,
    linear-gradient(27deg, rgba(0, 0, 0, 0.32) 5px, transparent 5px) 0 10px / 20px 20px,
    linear-gradient(207deg, rgba(0, 0, 0, 0.32) 5px, transparent 5px) 10px 5px / 20px 20px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.01) 10px, transparent 10px) 0 0 / 20px 20px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}

.ranking-head {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--s-5);
  margin-bottom: clamp(var(--s-7), 6vw, var(--s-9));
}

.ranking-title {
  grid-column: 1 / -1;
  font-size: clamp(2.5rem, 0.9rem + 5.2vw, 6.75rem);
  font-stretch: 100%;
  line-height: 0.88;
  text-transform: uppercase;
}

.ranking-sub {
  grid-column: 1 / -1;
  max-width: 36ch;
  color: var(--muted);
}

.ranking-sub strong { font-weight: 600; color: var(--fg); }

.ranking-sub a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--dur-2) ease, text-decoration-color var(--dur-2) ease;
}

.ranking-sub a::after {
  content: " ↗";
  content: " ↗" / "";
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.ranking-sub a:hover,
.ranking-sub a:focus-visible { color: var(--accent-small); text-decoration-color: currentColor; }

@media (min-width: 1024px) {
  .ranking-title { grid-column: 1 / span 8; }
  .ranking-sub { grid-column: 9 / -1; align-self: end; }
}

.ranks {
  display: grid;
  gap: clamp(var(--s-8), 7vw, var(--s-10));
}

/* Un résultat : la tour à gauche, le chiffre et la preuve à droite */
.rank {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "num" "cap" "tower" "proof";
  gap: var(--s-5);
  margin: 0;
  padding-top: var(--s-6);
  border-top: 1px solid var(--rule);
}

.rank::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 64px;
  height: 1px;
  background: var(--accent);
}

.rank > .tower { grid-area: tower; }
.rank > .rank-num { grid-area: num; }
.rank > figcaption { grid-area: cap; }
.rank > .rank-proof-frame { grid-area: proof; }

@media (min-width: 760px) {
  .rank {
    grid-template-columns: minmax(270px, 5fr) minmax(0, 7fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "tower num" "tower cap" "tower proof";
    column-gap: clamp(var(--s-6), 4vw, var(--s-9));
    row-gap: var(--s-4);
  }
}

.rank-num {
  font-family: var(--font-display);
  font-size: clamp(6rem, 2rem + 11.5vw, 15rem);
  font-style: italic;
  font-weight: 850;
  line-height: 0.8;
  letter-spacing: -0.02em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rank-num [data-count] {
  font-variation-settings: "wdth" var(--fw, 74), "wght" var(--fwg, 850);
}

.rank-num sup {
  margin-left: 0.04em;
  font-family: var(--font-display);
  font-size: 0.3em;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  vertical-align: top;
  color: var(--accent-small);
}

.rank-label {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1rem + 1.4vw, 2.5rem);
  font-style: italic;
  font-weight: 800;
  font-stretch: 105%;
  line-height: 0.95;
  text-transform: uppercase;
}

.rank-desc {
  margin-top: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.6;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* La capture du classement, présentée comme une preuve */
.rank-proof-frame {
  --hud-c: var(--accent);
  align-self: end;
  width: 100%;
  max-width: 560px;
  padding: 30px 10px 10px;
}

.rank-proof-tag {
  position: absolute;
  top: 8px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.rank-proof-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--green);
  transform: skewX(var(--slant));
}

.rank-proof {
  width: 100%;
  height: auto;
  box-shadow: 0 0 0 1px var(--rule);
}

/* --- Timing tower (décor, aria-hidden) ----------------------- */
.tower {
  --row-h: 38px;
  --pos-w: 48px;
  position: relative;
  align-self: start;
  width: 100%;
  max-width: 440px;
  font-family: var(--font-mono);
  color: var(--text);
  background: linear-gradient(180deg, rgba(18, 23, 34, 0.94), rgba(9, 11, 16, 0.96));
  border: 1px solid var(--line-2);
  box-shadow: 0 40px 70px -40px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  user-select: none;
}

.tower--wide { --pos-w: 84px; }

.tw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px 0 12px;
  background: #000;
  border-bottom: 1px solid var(--line-2);
}

.tw-event {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tw-event::before {
  content: "";
  width: 14px;
  height: 10px;
  background: var(--livery);
  transform: skewX(var(--slant));
}

.tw-event b { color: var(--livery-glow); font-weight: 700; }
.tw-head .hud-tag { color: var(--text); }

.tw-cols {
  display: grid;
  grid-template-columns: var(--pos-w) minmax(0, 1fr) auto;
  gap: 12px;
  padding: 6px 12px 5px 0;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.tw-cols span:first-child { padding-right: 10px; text-align: right; }
.tw-cols span:nth-child(2) { padding-left: 12px; }

.tw-body {
  position: relative;
  height: calc(var(--row-h) * 7);
  overflow: hidden;
}

/* Colonne des positions : fixe, les pilotes glissent devant */
.tw-slots {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--pos-w);
  list-style: none;
}

.tw-slots li {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: var(--row-h);
  padding-right: 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.tw-slots li.is-me {
  color: var(--carbon);
  background: var(--white);
}

.tower.is-rolling .tw-slots li { color: var(--muted); }
.tower.is-rolling .tw-slots li.is-me { color: var(--carbon); }

.tw-rows {
  position: absolute;
  inset: 0 0 0 var(--pos-w);
}

.tw-row {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--row-h);
  padding-right: 12px;
  background: var(--carbon-2);
  border-bottom: 1px solid var(--line);
  transform: translate3d(0, calc(var(--slot, 0) * var(--row-h)), 0);
  transition: transform 0.46s var(--ease-out);
}

.tower.is-streaming .tw-row,
.tower.no-anim .tw-row,
.tower.no-anim .tw-slots li { transition: none; }

.tw-stripe {
  flex: none;
  width: 4px;
  height: 58%;
  background: var(--c, var(--faint));
}

/* Caviardage : aucun nom inventé, des barres noires */
.tw-redact {
  display: block;
  flex: 0 1 auto;
  width: calc(var(--w, 55%) - 40px);
  height: 13px;
  background: #000;
  box-shadow: 0 0 0 1px rgba(150, 175, 255, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: skewX(var(--slant));
}

.tw-redact--score {
  flex: none;
  width: 38px;
  height: 11px;
  margin-left: auto;
}

/* La ligne du pilote : barre bleu livrée */
.tw-row--me {
  z-index: 2;
  color: var(--white);
  background: var(--livery);
  border-bottom-color: transparent;
  box-shadow: 0 0 0 1px var(--livery-glow), 0 10px 30px -6px color-mix(in srgb, var(--livery) 80%, transparent);
}

.tw-row--me .tw-stripe { background: var(--white); }

.tw-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 850;
  font-stretch: 110%;
  letter-spacing: 0.04em;
  line-height: 1;
}

.tw-gain {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 18px;
  font-size: 0.625rem;
  line-height: 1;
  color: var(--green);
  background: rgba(0, 0, 0, 0.42);
}

.tw-row--me.is-gaining .tw-gain { animation: tw-gain 0.5s var(--ease-out); }

@keyframes tw-gain {
  from { transform: translateY(6px); opacity: 0.2; }
  to { transform: none; opacity: 1; }
}

.tw-score {
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Ligne doublée : bref éclat */
.tw-row.is-passed { animation: tw-passed 0.7s ease-out; }

@keyframes tw-passed {
  from { background-color: color-mix(in srgb, var(--red) 22%, var(--carbon-2)); }
  to { background-color: var(--carbon-2); }
}

.tw-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--line-2);
}

.tw-field { white-space: nowrap; }

.tw-grant {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 45%, transparent);
  background: color-mix(in srgb, var(--green) 8%, transparent);
}

.tw-grant .scr-fx { padding: 3px 8px; color: var(--green); }

/* Le tampon apparaît au terme de la remontée (projets.js) */
.js .tower.is-armed:not(.is-done) .tw-grant { display: none; }

.tower.is-done .tw-row--me {
  box-shadow: 0 0 0 1px var(--livery-glow), 0 0 34px -2px color-mix(in srgb, var(--livery) 75%, transparent);
}

@media (max-width: 639.98px) {
  .tower { --row-h: 34px; max-width: none; }
  .tower--wide { --pos-w: 76px; }
}

/* ------------------------------------------------------------
   3. ÉTUDES DE CAS (scène cockpit)
   ------------------------------------------------------------ */
.cases {
  --dock-h: 64px;
  padding-block: var(--section);
}

.projects-toolbar {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--s-5);
  margin-bottom: var(--s-7);
}

.cases-title {
  grid-column: 1 / -1;
  font-size: clamp(2.5rem, 0.9rem + 5.2vw, 6.75rem);
  font-stretch: 100%;
  line-height: 0.88;
  text-transform: uppercase;
}

.cases-intro {
  grid-column: 1 / -1;
  max-width: 38ch;
  color: var(--muted);
}

@media (min-width: 1024px) {
  .cases-title { grid-column: 1 / span 8; }
  .cases-intro { grid-column: 9 / -1; align-self: end; }
}

/* --- Barre collante : sélecteurs du volant ------------------- */
.filters-dock {
  position: sticky;
  top: calc(var(--nav-h) - 1px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--dock-h);
  margin: 0 calc(-1 * var(--margin)) clamp(var(--s-7), 6vw, var(--s-9));
  padding: 0 var(--margin);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-block: 1px solid var(--rule);
  transition: top 0.6s var(--ease-out);
}

.nav-hidden .filters-dock { top: 0; }

/* Filet de livrée sous la barre */
.filters-dock::after {
  content: "";
  position: absolute;
  left: var(--margin);
  bottom: -1px;
  width: 96px;
  height: 1px;
  background: var(--accent);
}

/* Molette de cartographie : le pointeur suit le filtre actif */
.filters-knob { display: none; }

@media (min-width: 1024px) {
  .filters-knob {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: none;
    padding-right: var(--s-4);
    border-right: 1px solid var(--rule);
  }
}

.knob {
  position: relative;
  width: 36px;
  height: 36px;
  margin: 8px;
  border-radius: 50%;
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.05) 0 6deg, transparent 6deg 12deg),
    radial-gradient(circle at 50% 35%, #1d2433, #07090d 72%);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 4px 14px rgba(0, 0, 0, 0.6);
}

/* Graduations : cinq positions, une par cartographie */
.knob::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(from -62deg,
    var(--muted) 0 4deg, transparent 4deg 30deg,
    var(--muted) 30deg 34deg, transparent 34deg 60deg,
    var(--muted) 60deg 64deg, transparent 64deg 90deg,
    var(--muted) 90deg 94deg, transparent 94deg 120deg,
    var(--muted) 120deg 124deg, transparent 124deg);
  -webkit-mask-image: radial-gradient(closest-side, transparent 80%, #000 82%);
  mask-image: radial-gradient(closest-side, transparent 80%, #000 82%);
}

.knob-ptr {
  position: absolute;
  inset: 0;
  transform: rotate(calc(-60deg + var(--knob, 0) * 30deg));
  transition: transform 0.55s var(--ease-snap);
}

.knob-ptr::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 3px;
  height: 11px;
  margin-left: -1.5px;
  background: var(--livery-glow);
  box-shadow: 0 0 8px var(--livery-glow);
}

.knob-label {
  display: grid;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.knob-label b {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--fg);
}

/* Les filtres : plaques penchées, numéro de cartographie, compteur */
.project-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  padding-block: 9px;
}

.filter-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 12px 0 7px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--carbon) 72%, transparent);
  border: 1px solid var(--line-2);
  transform: skewX(var(--slant));
  transition: color var(--dur-2) ease, background-color var(--dur-2) ease, border-color var(--dur-2) ease, box-shadow 0.4s ease;
}

.chip-map {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--rule);
  transition: inherit;
}

.filter-chip .count {
  min-width: 2ch;
  padding-left: 10px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  text-align: right;
  border-left: 1px solid var(--rule);
}

.filter-chip:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.filter-chip:hover .chip-map { color: var(--fg); border-color: var(--accent); }

.filter-chip:active { transform: skewX(var(--slant)) translateY(1px); }

.filter-chip.is-active {
  color: var(--white);
  background: var(--livery);
  border-color: var(--livery);
  box-shadow: 0 10px 26px -12px color-mix(in srgb, var(--livery) 90%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.filter-chip.is-active .chip-map {
  color: var(--livery);
  background: var(--white);
  border-color: var(--white);
}

.filter-chip.is-active .count { border-left-color: rgba(255, 255, 255, 0.45); }

/* Lecture en cours : le dossier lu et ses trois secteurs */
.filters-read { display: none; }

@media (min-width: 1320px) {
  .filters-read {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    padding-left: var(--s-4);
    border-left: 1px solid var(--rule);
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
  }
}

.fr-case b {
  display: inline-block;
  min-width: 2ch;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.fr-sectors {
  display: grid;
  grid-template-columns: repeat(3, 20px);
  gap: 3px;
}

.fr-sectors i,
.cs i {
  display: block;
  height: 4px;
  background: var(--carbon-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transform: skewX(var(--slant));
  transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

.fr-sectors i.is-green,
.cs.is-green i {
  background: var(--green);
  box-shadow: 0 0 10px color-mix(in srgb, var(--green) 55%, transparent);
}

.fr-sectors i.is-purple,
.cs.is-purple i {
  background: var(--purple);
  box-shadow: 0 0 12px color-mix(in srgb, var(--purple) 70%, transparent);
}

/* Voitures en piste : « 5/5 EN PISTE » */
.filters-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
}

.fs-cars {
  display: grid;
  grid-template-columns: repeat(8, 6px);
  gap: 3px;
}

.fs-cars i {
  height: 10px;
  background: var(--livery-glow);
  box-shadow: 0 0 8px color-mix(in srgb, var(--livery-2) 70%, transparent);
  transform: skewX(var(--slant));
  transition: background-color 0.35s ease, box-shadow 0.35s ease, opacity 0.35s ease;
}

.fs-cars i.is-off {
  background: var(--carbon-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.fs-num {
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.filters-dock.is-empty .fs-num { color: var(--red); }

/* Mobile : les filtres défilent horizontalement */
@media (max-width: 1023.98px) {
  .filters-dock { gap: var(--s-3); }

  .project-filters {
    overflow-x: auto;
    scrollbar-width: none;
    padding-inline: 6px;
    margin-inline: -6px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }

  .project-filters::-webkit-scrollbar { display: none; }
}

@media (max-width: 1179.98px) {
  .fs-cars,
  .fs-label { display: none; }
}

@media (max-width: 639.98px) {
  .cases { --dock-h: 60px; }
  .filter-chip { gap: 8px; padding-inline: 6px 10px; }
}

/* --- Une étude de cas : dossier technique -------------------- */
.case {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: var(--s-6);
  padding-block: var(--s-6) clamp(var(--s-8), 9vw, var(--s-10));
}

.case::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0 96px, var(--line-2) 96px);
}

.case.is-hidden { display: none; }

/* Sondes de lecture posées par projets.js (aucun rendu) */
.case-probe {
  position: absolute;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
  visibility: hidden;
}

/* Numéro de course : plaque bleu livrée */
.case-mark {
  position: relative;
  z-index: 0;
  grid-column: -3 / -1;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  margin-top: 22px;
  margin-right: 0.14em;
  padding: 0.08em 0.28em 0.02em 0.2em;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 1.3rem + 2.8vw, 4.4rem);
  font-style: italic;
  font-weight: 900;
  font-stretch: 112%;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}

.case-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--livery);
  transform: skewX(var(--slant));
  box-shadow: 0 16px 40px -20px var(--livery), inset 0 -3px 0 rgba(0, 0, 0, 0.22);
}

.case-mark::after {
  content: "Dossier";
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.case-head {
  grid-column: 1 / -3;
  grid-row: 1;
  min-width: 0;
}

.case-index {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  margin-bottom: var(--s-4);
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-small);
}

.case-index::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
}

.case-title {
  margin-bottom: var(--s-5);
  font-size: clamp(2.1rem, 0.8rem + 4.1vw, 5.25rem);
  font-stretch: 100%;
  line-height: 0.9;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.case-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Secteurs de lecture du dossier */
.case-sectors {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.cs {
  display: grid;
  gap: 5px;
  width: 54px;
}

.cs b { font-weight: 600; }
.cs.is-green b { color: var(--fg); }
.cs.is-purple b { color: #cf8dff; }

.case-lap {
  margin-left: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transition: color 0.4s ease;
}

.case-lap.is-set { color: var(--fg); }

/* Corps du dossier */
.case-body {
  grid-column: 1 / -1;
  min-width: 0;
  max-width: 62ch;
}

.case-desc {
  margin-bottom: var(--s-4);
  line-height: 1.65;
}

/* Intertitres (« Ce qu'il fait : ») en capitales mono */
.case-desc:has(> strong:only-child) {
  margin-top: var(--s-6);
  margin-bottom: var(--s-3);
}

.case-desc > strong:only-child {
  display: inline-flex;
  align-items: center;
  gap: 0.8em;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.case-desc > strong:only-child::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
  transform: skewX(var(--slant));
}

/* Listes : chaque point est un repère de visée */
.case-list {
  list-style: none;
  margin-bottom: var(--s-6);
}

.case-list li {
  position: relative;
  padding: 0.7em 0 0.7em 32px;
  line-height: 1.45;
  border-top: 1px solid var(--rule);
}

.case-list li:last-child { border-bottom: 1px solid var(--rule); }

.case-list li::before {
  --m: var(--accent);
  content: "";
  position: absolute;
  left: 4px;
  top: calc(0.7em + (1.45em - 12px) / 2);
  width: 12px;
  height: 12px;
  background:
    radial-gradient(circle, var(--accent-small) 0 1.5px, transparent 2px) center / 100% 100%,
    linear-gradient(var(--m), var(--m)) top left / 4px 1px,
    linear-gradient(var(--m), var(--m)) top left / 1px 4px,
    linear-gradient(var(--m), var(--m)) top right / 4px 1px,
    linear-gradient(var(--m), var(--m)) top right / 1px 4px,
    linear-gradient(var(--m), var(--m)) bottom left / 4px 1px,
    linear-gradient(var(--m), var(--m)) bottom left / 1px 4px,
    linear-gradient(var(--m), var(--m)) bottom right / 4px 1px,
    linear-gradient(var(--m), var(--m)) bottom right / 1px 4px;
  background-repeat: no-repeat;
  transition: transform 0.4s var(--ease-out);
}

.case-list li:hover::before { transform: rotate(45deg); }

/* Lien : soulignement en trois secteurs qui se remplissent */
.case-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding-bottom: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg);
  transition: color var(--dur-2) ease;
}

.case-link::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 3px;
  background:
    linear-gradient(90deg, var(--green) 0 66.6%, var(--purple) 66.6%) 0 0 / 0% 100% no-repeat,
    var(--line-2);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(33.33% - 2px), transparent 0 calc(33.33% + 2px), #000 0 calc(66.66% - 2px), transparent 0 calc(66.66% + 2px), #000 0);
  mask-image: linear-gradient(90deg, #000 calc(33.33% - 2px), transparent 0 calc(33.33% + 2px), #000 0 calc(66.66% - 2px), transparent 0 calc(66.66% + 2px), #000 0);
  transform: skewX(var(--slant));
  transition: background-size 0.6s var(--ease-out);
}

.case-link:hover,
.case-link:focus-visible { color: var(--accent-small); }

.case-link:hover::before,
.case-link:focus-visible::before { background-size: 100% 100%, auto; }

/* --- Médias : cadres HUD ------------------------------------- */
.case-media {
  --hud-c: var(--accent);
  grid-column: 1 / -1;
  position: relative;
  overflow: hidden;
  padding: 10px;
}

.case-media > img,
.case-media > picture,
.case-media > video {
  position: relative;
  z-index: 1;
}

.media-tag {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(6, 7, 10, 0.78);
  border: 1px solid var(--line-2);
}

.media-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
  transform: skewX(var(--slant));
}

.media-tag--rec::before {
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
  transform: none;
  animation: hud-blink 1.6s steps(2, jump-none) infinite;
}

.case-img {
  width: 100%;
  height: 100%;
}

/* Lien direct vers un dossier (#groupie-tracker…) : il apparaît sous la barre collante */
.case[id] { scroll-margin-top: calc(var(--dock-h, 64px) + var(--s-6, 48px)); }

/* Plaque : logo blanc sur fond technique */
.case-media--plate { aspect-ratio: 4 / 3; }

.case-media--plate::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 55% at 50% 50%, color-mix(in srgb, var(--livery) 16%, transparent), transparent 70%),
    linear-gradient(rgba(120, 150, 255, 0.07) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgba(120, 150, 255, 0.07) 1px, transparent 1px) 0 0 / 32px 100%,
    var(--carbon);
  box-shadow: inset 0 0 0 1px var(--line);
}

.case-media--plate .case-img {
  padding: 24%;
  object-fit: contain;
  filter: invert(1) drop-shadow(0 0 24px rgba(111, 160, 255, 0.35));
}

/* Illustration animée (js/illus.js) à la place d'un logo ; la marge
   haute laisse la place à l'étiquette CAM */
.case-media--plate .case-illus {
  --illus-safe: 26px;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}

html:not(.js) .case-illus::before {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Le réseau de neurones (atoms.js) passe sous le logo, détaché
   par un halo sombre */
.case-media--plate[data-neural] .case-img { padding: 29%; }

.case-media--plate[data-neural]::after {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(6, 7, 10, 0.92) 0 13%, transparent 27%);
}

/* Bannière : les atomes de NEUROPULSE vivent derrière l'image */
.case-media--banner { aspect-ratio: 4 / 3; }

.case-media--banner::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 0;
  background: #000;
}

.case-media--banner picture {
  display: block;
  height: 100%;
}

.case-media--banner .case-img {
  object-fit: contain;
  mix-blend-mode: screen;
}

.case-media--banner .atoms-hud { left: 22px; bottom: 20px; z-index: 3; }

/* Capture vidéo */
.case-media--shot { aspect-ratio: 16 / 9; }

.case-media--shot .case-img {
  object-fit: cover;
  background: var(--carbon-3);
}

/* --- Écran du mur des stands : la démo en direct ------------- */
.case-media--frame { padding: 10px; }

.screen-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  background: #05070b;
  border: 1px solid var(--line-2);
  border-bottom: 0;
}

.screen-bar .hud-tag { color: var(--text); border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.screen-bar .hud-tag--live::before { background: var(--red); box-shadow: 0 0 8px var(--red); }

.screen-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.screen-title::before {
  content: "· ";
  content: "· " / "";
  color: var(--muted);
}

.screen-sig {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
}

.screen-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.screen-bars i {
  width: 3px;
  background: var(--carbon-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background-color 0.3s ease;
}

.screen-bars i:nth-child(1) { height: 25%; }
.screen-bars i:nth-child(2) { height: 50%; }
.screen-bars i:nth-child(3) { height: 75%; }
.screen-bars i:nth-child(4) { height: 100%; }

.case-media--frame.is-live .screen-bars i { background: var(--green); box-shadow: none; }
.case-media--frame.is-live .screen-bars i:nth-child(2) { transition-delay: 0.08s; }
.case-media--frame.is-live .screen-bars i:nth-child(3) { transition-delay: 0.16s; }
.case-media--frame.is-live .screen-bars i:nth-child(4) { transition-delay: 0.24s; }

.screen-view {
  position: relative;
  background: #000;
  border: 1px solid var(--line-2);
}

.case-iframe {
  width: 100%;
  height: clamp(460px, 78vh, 860px);
  border: 0;
  background: #fff;
}

/* « Acquisition du signal » jusqu'au chargement de la démo */
.screen-acq {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  padding: var(--s-5);
  text-align: center;
  font-family: var(--font-mono);
  text-transform: uppercase;
  color: var(--text);
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 45%, #101624, #030406 75%);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s ease, visibility 0s linear 0.7s;
}

.case-media--frame.is-acquiring .screen-acq {
  opacity: 1;
  visibility: visible;
  transition: none;
}

.screen-acq-label {
  font-size: clamp(0.8125rem, 0.7rem + 0.4vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.18em;
}

.screen-acq-label::after {
  content: "...";
  display: inline-block;
  width: 3ch;
  overflow: hidden;
  vertical-align: bottom;
  text-align: left;
  animation: acq-dots 1.6s steps(4, jump-none) infinite;
}

@keyframes acq-dots {
  from { width: 0; }
  to { width: 3ch; }
}

.screen-acq-bar {
  position: relative;
  width: min(220px, 60vw);
  height: 3px;
  overflow: hidden;
  background: var(--carbon-3);
}

.screen-acq-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--livery-glow), transparent);
  animation: acq-sweep 1.4s var(--ease-in-out) infinite;
}

@keyframes acq-sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

.screen-acq-meta {
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* --- Placement --------------------------------------------- */

/* Sous 1024 px : secteurs sous le titre, média avant le texte (la
   démo de la mairie, annoncée « juste en dessous », reste après). */
@media (max-width: 1023.98px) {
  .case:not(.case--demo) .case-media { grid-row: 3; }
  .case:not(.case--demo) .case-body { grid-row: 4; }
  .case--demo .case-body { grid-row: 3; }
  .case--demo .case-media { grid-row: 4; }
}

@media (max-width: 639.98px) {
  .case-head { grid-column: 1 / -2; }
  .case-mark { grid-column: -2 / -1; margin-top: 20px; font-size: 1.9rem; }
  .case-media,
  .case-media--frame { padding: 6px; }
  .case-media--plate::before,
  .case-media--banner::before { inset: 6px; }
  .media-tag { top: 14px; left: 14px; }
  .screen-bar { gap: 8px; padding: 0 8px; }
  .screen-sig { font-size: 0; gap: 0; }
  .case-iframe { height: clamp(440px, 72vh, 640px); }
}

@media (min-width: 1024px) {
  .case-head { grid-column: 1 / -4; }
  .case-mark { grid-column: -4 / -1; }

  .case-sectors {
    grid-column: -5 / -1;
    grid-row: 1;
    justify-self: end;
    align-self: end;
    margin-bottom: 4px;
  }

  .case-body { grid-column: 8 / -1; grid-row: 2; }

  /* Le média reste à l'écran pendant la lecture, sous la barre */
  .case-media {
    grid-column: 1 / span 6;
    grid-row: 2;
    position: sticky;
    top: calc(var(--nav-h) + var(--dock-h) + var(--s-5));
    align-self: start;
  }

  .js .cases .case-media {
    transition: top 0.6s var(--ease-out), clip-path 1.3s var(--ease-in-out) var(--d, 0s);
  }

  .nav-hidden .case-media { top: calc(var(--dock-h) + var(--s-5)); }

  .case--flip .case-body { grid-column: 1 / span 5; }
  .case--flip .case-media { grid-column: 7 / -1; }

  /* La démo est annoncée « juste en dessous » : elle passe sous le texte */
  .case--demo .case-body {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: calc(var(--gutter) * 3);
    max-width: none;
  }

  .case--demo .case-col > :first-child { margin-top: 0; }

  .case--demo .case-media {
    grid-column: 1 / -1;
    grid-row: 3;
    position: relative;
    top: auto;
  }
}

/* --- État vide : la sortie des stands est fermée ------------ */
.projects-empty {
  display: none;
  padding: var(--s-9) 0;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  color: var(--muted);
}

.projects-empty.is-shown {
  display: grid;
  justify-items: center;
  gap: var(--s-5);
}

.pitlane {
  display: grid;
  justify-items: center;
  gap: var(--s-4);
}

.pitlane-lights {
  display: flex;
  gap: 10px;
  padding: 8px;
  background: #000;
  border: 1px solid var(--line-2);
}

.pitlane-lights i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 16px var(--red), inset 0 -3px 6px rgba(80, 0, 0, 0.5);
}

.pitlane-text {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1rem + 4vw, 4.5rem);
  font-style: italic;
  font-weight: 900;
  font-stretch: 115%;
  line-height: 0.9;
  letter-spacing: 0;
  color: var(--fg);
}

.pitlane-text::after {
  content: "";
  display: block;
  height: 6px;
  margin-top: 14px;
  background: repeating-linear-gradient(-60deg, var(--red) 0 12px, var(--white) 12px 24px);
}

/* ------------------------------------------------------------
   5. SANS JS, MOUVEMENT RÉDUIT, IMPRESSION
   ------------------------------------------------------------ */

/* Sans script, les filtres ne font rien : on les retire, et les
   secteurs de lecture n'ont pas de sens. Tout le contenu reste. */
html:not(.js) .filters-dock,
html:not(.js) .case-sectors { display: none; }

@media (prefers-reduced-motion: reduce) {
  .media-tag--rec::before,
  .screen-acq-label::after,
  .screen-acq-bar::before { animation: none !important; }

  .screen-acq-bar::before { transform: none; width: 100%; opacity: 0.5; }
  .case-list li:hover::before { transform: none; }
}

@media print {
  .ranking::before,
  .filters-dock,
  .case-sectors,
  .screen-bar,
  .screen-acq,
  .media-tag,
  .hero-meta,
  .tower .hud-tag { display: none !important; }

  .tower { box-shadow: none; }
  .case { break-inside: avoid; }
}
