/* RBMG Groupe · charte
   Système de design « RBMG Groupe » : Paris côté rue. Zinc au sol, pierres de calcaire,
   vert wagon en grands blocs, aucune couleur d'accent. Une seule police, Bricolage Grotesque.
   Arêtes vives, joint de 4 px, ni filet ni coin arrondi.
   Choix de Marc : sur les images, le texte se pose directement, sans bloc de couleur, en
   calcaire sur une ombre diffuse de vert wagon qui le rend lisible.
   Les couleurs viennent de tokens.json du système ; ne pas en ajouter d'autres. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/BricolageGrotesque-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Thème jour */
  --fond: #c9d2d3;              /* zinc : le sol de la page, visible dans les joints */
  --pierre: #efe7d6;            /* calcaire : les blocs */
  --pierre-ombre: #e2d8c2;      /* survol d'un bloc cliquable */
  --bloc-fort: #0f2822;         /* vert wagon : le bloc qui domine, le pied de page */
  --bloc-fort-survol: #1b3e37;
  --sur-bloc-fort: #efe7d6;
  --sur-bloc-fort-doux: #c9d2d3;
  --encre: #0f2822;
  --encre-douce: #3c4d4e;
  --alerte: #8e2f1c;
  --vert-bronze: #1b3e37;       /* cadre vide, en attente de son image */
  --ombre-texte: 15, 40, 34;    /* vert wagon, en rgb, pour l'ombre diffuse sous le texte */

  --font-titre: "Bricolage Grotesque", Arial, sans-serif;
  --font-texte: "Bricolage Grotesque", Arial, sans-serif;

  --joint: 4px;
  --pas-2: 8px;
  --pas-3: 12px;
  --pas-4: 16px;
  --pas-6: 24px;
  --pas-8: 32px;
  --pas-12: 48px;
  --pas-16: 64px;
  --pas-24: 96px;
  --arete: 0;

  --transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--font-texte);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: var(--bloc-fort); color: var(--sur-bloc-fort); }

/* ---------- Styles de texte (jetons du système) ---------- */
.titre-hero {
  font-family: var(--font-titre);
  font-size: clamp(2.25rem, 5.6vw, 5rem);
  line-height: 0.98;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.titre-1 {
  font-family: var(--font-titre);
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.titre-2 {
  font-family: var(--font-titre);
  font-size: clamp(1.75rem, 2.6vw, 2.125rem);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.titre-3 {
  font-family: var(--font-titre);
  font-size: 1.4375rem;
  line-height: 1.22;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.chapo { font-size: 1.25rem; line-height: 1.5; max-width: 60ch; }
.corps { font-size: 1rem; line-height: 1.6; max-width: 68ch; }
.note { font-size: 0.875rem; line-height: 1.45; }
.doux { color: var(--encre-douce); }

.lien {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.lien:hover { text-decoration-thickness: 3px; }

/* Focus : contour plein de 2 px en encre, décalé de 3 px. */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--encre);
  outline-offset: 3px;
}

/* Le logo : le nom, « rbmg groupe », une seule encre, celle du texte du bloc. */
.logo { display: block; height: var(--logo-h, 28px); width: auto; aspect-ratio: 301.19 / 47.67; color: inherit; }

/* ---------- Film piloté au scroll : un cadre plein écran ---------- */
.film { position: relative; isolation: isolate; }

.film__stage {
  position: sticky;
  top: 0;
  z-index: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--fond);
}
/* Le cadre : la vidéo remplit l'écran, moins un joint de zinc tout autour. */
.film__media {
  position: absolute;
  inset: var(--joint);
  overflow: hidden;
  background: var(--vert-bronze);
}
.film__layer, .film__layer picture, .film__poster, .film__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.film__layer { margin: 0; opacity: 0; }
.film__layer.is-active { opacity: 1; }
.film__poster, .film__video { object-fit: cover; object-position: center; }
.film__video { z-index: 1; }
.film__layer[data-painted="true"] .film__poster { visibility: hidden; }

/* En haut du cadre : le logo et les chapitres, posés sur la vidéo. */
.film__top {
  position: absolute;
  z-index: 6;
  top: var(--joint);
  left: var(--joint);
  right: var(--joint);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pas-6);
  padding: var(--pas-6) var(--pas-8);
  color: var(--sur-bloc-fort);
  pointer-events: none;
  isolation: isolate;
}
/* Ombre douce depuis le haut, sans bord visible, pour lire le logo et le menu. */
.film__top::before {
  position: absolute;
  z-index: -1;
  inset: 0 0 -4rem 0;
  content: "";
  background: linear-gradient(180deg,
    rgba(var(--ombre-texte), 0.55) 0%,
    rgba(var(--ombre-texte), 0.28) 55%,
    rgba(var(--ombre-texte), 0) 100%);
  pointer-events: none;
}
.film__logo {
  display: block;
  color: inherit;
  pointer-events: auto;
}
.film__nav {
  display: flex;
  gap: var(--pas-4);
  pointer-events: auto;
}
.film__nav button {
  min-height: 2.75rem;
  padding: 0 var(--pas-2);
  border: 0;
  border-radius: var(--arete);
  background: transparent;
  color: inherit;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  text-underline-offset: 6px;
  cursor: pointer;
}
.film__nav button:hover,
.film__nav button[aria-current="step"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.film a:focus-visible, .film button:focus-visible { outline-color: currentColor; }

/* Le récit remonte d'un écran pour défiler par-dessus le cadre. */
.film__story {
  position: relative;
  z-index: 3;
  margin-top: -100vh;
  margin-top: -100dvh;
  pointer-events: none;
}
.chapter { position: relative; }
/* Le texte de chaque chapitre, en bas à gauche de l'image, sans bloc. */
.chapter__pin {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--pas-12) calc(var(--joint) + var(--pas-12)) calc(var(--joint) + var(--pas-12));
}
.chapter__stone {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: var(--pas-4);
  justify-items: start;
  width: min(100%, 40rem);
  color: var(--sur-bloc-fort);
  pointer-events: auto;
}
.chapter__stone--hero { width: min(100%, 60rem); gap: var(--pas-6); }
/* L'ombre : un halo de vert wagon qui s'efface jusqu'à la transparence, sans arête. */
.chapter__stone::before {
  position: absolute;
  z-index: -1;
  inset: -9rem -12rem -8rem -12rem;
  content: "";
  background: radial-gradient(closest-side,
    rgba(var(--ombre-texte), 0.8) 0%,
    rgba(var(--ombre-texte), 0.64) 45%,
    rgba(var(--ombre-texte), 0.26) 75%,
    rgba(var(--ombre-texte), 0) 100%);
  pointer-events: none;
}

/* ---------- Les sociétés du groupe : elles gravitent autour du groupe ---------- */
.societes {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: var(--pas-12);
  padding: var(--pas-24) var(--pas-12);
  background: var(--fond);
}
.societes__tete { display: grid; gap: var(--pas-4); max-width: 60ch; }

.galaxie {
  --tour: 90s;
  --k: 1;                        /* échelle des positions sur l'orbite */
  container-type: inline-size;
  position: relative;
  justify-self: center;
  width: min(100%, 680px);
  aspect-ratio: 1;
}
/* Ce qui tourne : l'orbite, les liens et les sociétés. */
.galaxie__ronde {
  position: absolute;
  inset: 0;
  animation: orbite var(--tour) linear infinite;
}
.galaxie__liens { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.galaxie__liens line,
.galaxie__orbite {
  fill: none;
  stroke: var(--encre-douce);
  stroke-width: 1.25px;
  vector-effect: non-scaling-stroke;
}
.galaxie__orbite { stroke-dasharray: 2 5; opacity: 0.7; }

.galaxie__societes { margin: 0; padding: 0; list-style: none; }
/* Chaque société : un disque de la couleur du fond, qui masque la fin des liens. Elle tourne
   en sens inverse de l'orbite pour rester droite. */
.galaxie__noeud {
  position: absolute;
  left: calc(50% + var(--x) * var(--k) * 1cqw);
  top: calc(50% + var(--y) * var(--k) * 1cqw);
  width: 25cqw;
  aspect-ratio: 1;
  translate: -50% -50%;
  animation: contre-orbite var(--tour) linear infinite;
}
.galaxie__noeud a {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.4cqw;
  width: 100%;
  height: 100%;
  padding: 2cqw;
  border-radius: 50%;
  background: var(--fond);
  color: var(--encre-douce);
  text-align: center;
  text-decoration: none;
  transition: box-shadow var(--transition);
}
.galaxie__noeud a:hover { box-shadow: inset 0 0 0 2px var(--encre); }
.galaxie__noeud a:focus-visible { outline-offset: 0; border-radius: 50%; }
.galaxie__noeud img { display: block; height: var(--marque-h, 5cqw); width: auto; max-width: 21cqw; }
.galaxie__metier { font-size: clamp(0.75rem, 1.9cqw, 0.875rem); line-height: 1.3; max-width: 19cqw; }

/* Au centre : le r du groupe. */
.galaxie__centre {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15cqw;
  height: 15cqw;
  translate: -50% -50%;
}
.galaxie__centre rect { fill: var(--bloc-fort); }
.galaxie__centre path { fill: var(--sur-bloc-fort); }

/* On s'arrête pour lire ou cliquer. */
.galaxie:hover .galaxie__ronde, .galaxie:hover .galaxie__noeud,
.galaxie:focus-within .galaxie__ronde, .galaxie:focus-within .galaxie__noeud {
  animation-play-state: paused;
}

@keyframes orbite { to { rotate: 360deg; } }
@keyframes contre-orbite { to { rotate: -360deg; } }

/* ---------- Pied de page : le bloc fort ---------- */
.pied {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--pas-6);
  margin: 0 var(--pas-12) var(--pas-12);
  padding: var(--pas-12);
  background: var(--bloc-fort);
  color: var(--sur-bloc-fort);
}
.pied .logo { --logo-h: 32px; }
.pied__mentions { display: grid; gap: var(--pas-2); color: var(--sur-bloc-fort-doux); }

/* ---------- Mobile ---------- */
@media (max-width: 1100px) {
  .societes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .film__top { padding: var(--pas-4); gap: var(--pas-4); }
  .film__logo { --logo-h: 20px; flex: none; }
  .film__nav {
    flex: 1 1 10rem;
    min-width: 0;
    gap: var(--pas-2);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .film__nav::-webkit-scrollbar { display: none; }
  .film__nav button { flex: 0 0 auto; font-size: 0.9375rem; }

  .chapter__pin {
    padding: var(--pas-8) calc(var(--joint) + var(--pas-6)) calc(var(--joint) + var(--pas-8) + env(safe-area-inset-bottom));
  }
  .chapter__stone, .chapter__stone--hero { width: 100%; gap: var(--pas-3); }
  /* Sur mobile, l'ombre monte du bas de l'écran sur toute la largeur. */
  .chapter__stone::before {
    inset: -6rem calc(-1 * (var(--joint) + var(--pas-6))) calc(-1 * (var(--joint) + var(--pas-8) + env(safe-area-inset-bottom)));
    background: linear-gradient(0deg,
      rgba(var(--ombre-texte), 0.85) 0%,
      rgba(var(--ombre-texte), 0.7) 55%,
      rgba(var(--ombre-texte), 0) 100%);
  }
  .chapo { font-size: 1.0625rem; }

  .societes { padding: var(--pas-16) var(--pas-6); }
  /* Sur petit écran : disques plus grands, logos agrandis, métiers lus par les lecteurs d'écran seulement. */
  .galaxie { --k: 0.95; }
  .galaxie__noeud { width: 31cqw; }
  .galaxie__noeud img { height: calc(var(--marque-h) * 1.35); max-width: 27cqw; }
  .galaxie__metier {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .pied { margin: 0 var(--pas-6) var(--pas-6); padding: var(--pas-8) var(--pas-6); }
}

/* ---------- Mouvement réduit : images fixes (le moteur ne charge aucune vidéo) ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .galaxie__ronde, .galaxie__noeud { animation: none; }
}
