/* ==========================================================================
   Pages intérieures parcourues à l’horizontale.
   Molette, flèches, rail de repères ou glissé : le contenu défile de gauche
   à droite, panneau par panneau. Aucun défilement vertical de page.
   ========================================================================== */

.page-planche {
  --rail-h: 72px;
  height: 100dvh;
  overflow: hidden;
}

.track {
  position: fixed;
  inset: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  padding: var(--chrome-h) 0 var(--rail-h);
  /* Pas d’aimantation CSS sur grand écran : planche.js aimante en douceur. */
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }
.track:focus-visible { outline: none; }

.panel {
  position: relative;
  flex: none;
  height: 100%;
  display: grid;
  align-content: center;
  /* Trop haut pour l’écran, un panneau se cale en haut : rien ne déborde hors d’atteinte. */
  align-content: safe center;
  gap: clamp(20px, 3.4vh, 40px);
  padding: clamp(16px, 4vh, 56px) clamp(28px, 5vw, 96px);
  scroll-snap-align: start;
  overflow-y: auto;
  scrollbar-width: thin;
  border-left: var(--rule);
}
.panel:first-child { border-left: 0; padding-left: var(--gutter); }
.panel:last-child { padding-right: max(var(--gutter), 8vw); }
.panel:focus-visible { outline: none; }

.panel > * { animation: sl-rise 1000ms var(--ease) both; }
.panel > :nth-child(2) { animation-delay: 120ms; }
.panel > :nth-child(3) { animation-delay: 200ms; }
.panel > :nth-child(4) { animation-delay: 260ms; }

.panel__head { display: grid; gap: 14px; max-width: 34rem; }

/* ---------- ouverture ---------- */

.panel--ouverture {
  width: 100vw;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  column-gap: clamp(32px, 6vw, 120px);
}
.ouverture__texte { display: grid; gap: 22px; max-width: 42rem; }
.ouverture__texte h1 { max-width: 14ch; }

.faits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  justify-content: start;
  gap: 14px clamp(28px, 4vw, 64px);
  margin-top: 12px;
  padding-top: 26px;
  border-top: var(--rule);
}
.faits dt { color: var(--faint); }
.faits dd { margin-top: 4px; color: var(--ink); font-size: 0.9375rem; }

.fig {
  justify-self: center;
  display: grid;
  gap: 18px;
  justify-items: center;
  color: var(--accent);
}
.fig svg {
  height: min(52dvh, 520px);
  width: auto;
  fill: currentColor;
}
.fig figcaption { color: var(--faint); }

/* Figure du service (figure.js) : l’ananas à points, la partie du service allumée,
   et la liste de ce qui est créé. */
.fig--ananas {
  width: 100%;
  max-width: 600px;
  grid-template-columns: auto minmax(13.5rem, 1fr);
  align-items: center;
  justify-items: stretch;
  gap: clamp(20px, 3vw, 52px);
  color: var(--ink);
}
.fig .ananas__carte {
  height: min(50dvh, 440px, 26vw);
  width: auto;
  aspect-ratio: 600 / 900;
  overflow: visible;
}
.fig--ananas .a-pt {
  fill: var(--fruit);
  opacity: 0.16;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 500ms ease, scale 500ms var(--ease);
}
.fig--ananas .g-reseaux { fill: var(--couronne); }
.fig--ananas .a-pt.is-vif { opacity: 1; }
.fig--ananas.is-pulse .a-pt.is-vif { scale: 1.25; }
.fig--ananas.is-allume .a-pt { animation: sl-allume-p 800ms var(--ease) both; animation-delay: calc(var(--d) * 0.5 + 200ms); }
@keyframes sl-allume-p { from { opacity: 0; scale: 0.2; } }

.ananas__legende { display: grid; gap: 14px; align-content: center; text-align: left; }
.ananas__liste { border-top: var(--rule); }
.ananas__liste li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: clamp(9px, 1.6vh, 13px) 6px clamp(9px, 1.6vh, 13px) 0;
  border-bottom: var(--rule);
  font-size: 1.0625rem;
  transition: background-color 300ms ease, padding-left 500ms var(--ease);
}
.ananas__liste li::before { content: ""; flex: none; width: 7px; height: 7px; rotate: 45deg; background: var(--accent); }
.ananas__liste li:hover { background: var(--hover); padding-left: 8px; }

/* Profondeur : la figure et les grands numéros glissent un peu moins vite que la page.
   --profondeur vaut 0 quand le panneau est calé à gauche (posé par planche.js). */
.fig,
.frise__num { translate: calc(var(--profondeur, 0) * var(--amplitude, 0px) * -1) 0; }
.fig { --amplitude: 56px; }
.frise__num { --amplitude: 20px; }
/* Couches dédiées : le déplacement se fait sans redessiner la figure à chaque image. */
.fig,
.frise__num { will-change: transform, translate; }

.scroll-cue {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(16px, 3vh, 32px);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--faint);
}
.scroll-cue::after {
  content: "";
  width: 56px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  animation: cue 2400ms var(--ease) infinite;
  transform-origin: left center;
}
@keyframes cue { 0% { transform: scaleX(0); } 60%, 100% { transform: scaleX(1); opacity: 0; } }

/* ---------- liste « ce qui est inclus » ---------- */

.panel--liste { width: min(100vw, 1080px); }

.lignes { border-top: var(--rule); }
.lignes li {
  display: grid;
  grid-template-columns: 56px minmax(0, 15rem) minmax(0, 1fr);
  gap: 8px 32px;
  align-items: baseline;
  padding: clamp(12px, 2.2vh, 22px) 0;
  border-bottom: var(--rule);
  transition: background-color 300ms ease, padding 400ms var(--ease);
}
.lignes li:hover { background: var(--hover); padding-left: 12px; }
.lignes .num { color: var(--accent); }
.lignes h3 { font-size: 1.25rem; }
.lignes p { color: var(--muted); font-size: 0.9375rem; line-height: 1.7; }

/* ---------- déroulé en frise ---------- */

.panel--frise { width: auto; }

.frise {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(220px, 22vw, 300px);
  gap: 0 clamp(24px, 3vw, 48px);
  position: relative;
  padding-top: 44px;
}
.frise::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--line-strong) 40%, var(--line));
}
.frise li { position: relative; display: grid; gap: 10px; align-content: start; }
.frise li::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--accent);
}
.frise__num { font-family: var(--fh); font-size: 2.75rem; font-weight: 300; line-height: 1; color: var(--accent); }
.frise h3 { font-size: 1.25rem; }
.frise p { color: var(--muted); font-size: 0.9375rem; line-height: 1.75; }
.frise .meta { color: var(--faint); }

/* ---------- suite ---------- */

.panel--suite {
  width: min(100vw, 900px);
  align-content: center;
  align-content: safe center;
}

.appel {
  display: grid;
  gap: 18px;
  justify-items: start;
  padding: clamp(28px, 5vh, 56px);
  background: color-mix(in oklab, var(--accent) 6%, var(--panel));
  border-radius: var(--radius);
}
.appel p { color: var(--muted); max-width: 30rem; }
.appel__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

.suivant {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px 24px;
  padding: 26px 0 8px;
  border-bottom: var(--rule);
}
.suivant .meta { grid-column: 1 / -1; color: var(--faint); }
.suivant__titre { font-family: var(--fh); font-size: var(--fs-h2); line-height: 1.1; transition: color 300ms ease; }
.suivant:hover .suivant__titre { color: var(--accent); }
.suivant .arrow { font-size: 1.5rem; color: var(--accent); }

/* ---------- texte courant en colonnes (mentions, artisans) ---------- */

.panel--colonnes {
  width: auto;
  align-content: stretch;
}
.colonnes {
  height: 100%;
  columns: 21rem auto;
  column-gap: clamp(40px, 5vw, 80px);
  column-rule: var(--rule);
  column-fill: auto;
}
.colonnes section { break-inside: avoid; padding-bottom: 32px; }
.colonnes h2 { font-size: 1.5rem; margin-bottom: 10px; }
.colonnes p { color: var(--muted); font-size: 0.9375rem; line-height: 1.8; }
.colonnes p + p { margin-top: 10px; }
.colonnes .kicker { display: block; margin-bottom: 6px; }
.a-completer { color: var(--accent); font-style: normal; }

/* ---------- texte court (artisans) ---------- */

.colonnes-simple { display: grid; gap: 18px; max-width: 36rem; }
.colonnes-simple em { font-style: normal; color: var(--accent); }

/* ---------- principes (artisans) ---------- */

.principes {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, auto);
  grid-auto-columns: clamp(240px, 24vw, 320px);
  gap: clamp(24px, 4vh, 48px) clamp(28px, 3vw, 56px);
}
.principes li { display: grid; gap: 8px; padding-top: 18px; border-top: var(--rule); }
.principes .num { color: var(--accent); }
.principes h3 { font-size: 1.25rem; }
.principes p { color: var(--muted); font-size: 0.9375rem; line-height: 1.75; }

/* ---------- rail de repères ---------- */

.rail {
  position: fixed;
  inset: auto 0 0;
  z-index: 50;
  height: var(--rail-h);
  display: grid;
  /* Précédent et suivant à leur largeur naturelle, les repères occupent le centre. */
  grid-template-columns: minmax(max-content, 1fr) minmax(min-content, 1180px) minmax(max-content, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
  /* Fond plein : un flou d’arrière-plan serait recalculé à chaque image du défilement. */
  background: var(--paper);
}
/* ---------- traces de graines (traces.js) ----------
   La progression est marquée par de petits losanges qui s’impriment un à un,
   puis pâlissent ; les deux derniers restent nets. */

.traces {
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: calc(var(--gutter) + 32px);
  height: 22px;
  pointer-events: none;
}

.graine {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  color: var(--accent);
  translate: var(--x) var(--y);
  rotate: var(--r);
  /* Effacement de la trace : pleine tant qu’elle est en tête, puis pâlit lentement.
     Au retrait, on attend que le dessin se soit effacé avant de revenir à 1. */
  opacity: 1;
  transition: opacity 0s linear 260ms;
}
.graine.is-posee {
  opacity: 0.22;
  transition: opacity 2600ms ease 700ms;
}
.graine.is-posee.is-tete {
  opacity: 0.95;
  transition: opacity 300ms ease;
}

/* L’encre prend : le dessin se précise dès que la graine est posée, quoi qu’il arrive
   ensuite. Séparé de l’effacement ci-dessus pour qu’aucun pas n’apparaisse en retard. */
.graine svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
  scale: 0.55;
  filter: blur(1.6px);
  transition: opacity 250ms ease, scale 250ms ease, filter 250ms ease;
}
.graine.is-posee svg {
  opacity: 1;
  scale: 1;
  filter: blur(0);
  transition: opacity 380ms ease, scale 520ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 520ms ease;
}
.traces.is-instant .graine,
.traces.is-instant .graine svg { transition: none; }

/* Repères : un sautillement au passage ; une fois foulés, leur numéro prend l’encre. */
.rail .reperes .num { transition: color 700ms ease; }
.rail .reperes a.is-foule:not([aria-current="true"]) .num { color: var(--accent-2); }

@keyframes repere-saut {
  0%, 100% { translate: 0 0; }
  40% { translate: 0 -3px; }
}
.reperes a.is-saut { animation: repere-saut 560ms cubic-bezier(0.3, 0.7, 0.3, 1); }

/* Boîte aux lettres : au bout de la piste, elle reçoit une enveloppe et lève son drapeau. */
.boite {
  position: absolute;
  top: -5px;
  right: var(--gutter);
  width: 22px;
  height: 22px;
  color: var(--faint);
  transition: color 600ms ease;
}
.boite:hover,
.boite.is-arrivee { color: var(--accent); }
.boite svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.boite__drapeau {
  transform-box: view-box;
  transform-origin: 15.5px 10px;
  transition: rotate 700ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.boite.is-arrivee .boite__drapeau { rotate: -90deg; transition-delay: 550ms; }

.boite__lettre { opacity: 0; }
.boite.is-arrivee .boite__lettre { animation: boite-lettre 1100ms cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes boite-lettre {
  0% { opacity: 0; translate: -9px -1px; }
  30% { opacity: 1; translate: -9px -1px; }
  85% { opacity: 1; translate: 1px 0; }
  100% { opacity: 0; translate: 1px 0; }
}

.rail__prev,
.rail__next { display: inline-flex; align-items: center; gap: 10px; color: var(--accent-2); }
.rail__next { justify-self: end; }
.rail__prev:hover,
.rail__next:hover { color: var(--accent); }
.rail__prev:hover .arrow { transform: translateX(-4px); }

/* Les repères eux-mêmes (.reperes) sont définis dans base.css. Dans le rail, ils s’écartent
   plus largement que dans l’en-tête, pour occuper la largeur de la page. */
.rail .reperes {
  width: 100%;
  justify-content: space-evenly;
  gap: 16px;
}

.rail__compteur { color: var(--faint); }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .panel--ouverture { grid-template-columns: 1fr; }
  .fig { display: none; }
  .lignes li { grid-template-columns: 44px 1fr; }
  .lignes li p { grid-column: 2; }
}

@media (max-width: 760px) {
  .page-planche { --rail-h: 60px; }
  .track { scroll-snap-type: x mandatory; }
  .panel,
  .panel--liste,
  .panel--suite { width: 100vw; padding-inline: var(--gutter); border-left: 0; }
  .panel--frise,
  .panel--colonnes { width: auto; }
  .faits { grid-template-columns: 1fr 1fr; }
  .rail .reperes span:not(.num) { display: none; }
  .rail__prev span:not(.arrow),
  .rail__next span:not(.arrow) { display: none; }
  .scroll-cue { display: none; }
  .colonnes { columns: calc(100vw - 2 * var(--gutter)) auto; column-rule: none; }
}

@media (max-height: 620px) {
  .panel { align-content: start; }
  .fig svg { height: 40dvh; }
}

/* La figure reste visible sous 1100 px, sous le texte, en plus petit. */
@media (max-width: 1100px) {
  .panel--ouverture:has(.fig--ananas) { align-content: start; }
  .fig.fig--ananas { display: grid; justify-self: start; max-width: 560px; }
  .fig .ananas__carte { height: min(26dvh, 210px); }
}
@media (max-width: 760px) {
  .fig.fig--ananas { grid-template-columns: auto minmax(0, 1fr); gap: 16px; margin-top: 6px; }
  .fig .ananas__carte { height: 150px; }
  .ananas__liste li { font-size: 0.9375rem; }
}

/* ---------- formules (réseaux sociaux) ---------- */

.panel--formules { width: min(100vw, 1100px); }
.formules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); }
.formule {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: clamp(22px, 3vh, 36px);
  border: var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 400ms ease, translate 600ms var(--ease);
}
.formule:hover { border-color: var(--accent); translate: 0 -4px; }
.formule--mise { background: color-mix(in oklab, var(--accent) 7%, var(--panel)); border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }
.formule h3 { font-size: 1.375rem; }
.formule__pour { color: var(--muted); font-size: 0.9375rem; }
.formule ul { display: grid; gap: 8px; padding-top: 14px; border-top: var(--rule); }
.formule li { display: flex; gap: 12px; align-items: baseline; color: var(--ink); font-size: 0.9375rem; line-height: 1.55; }
.formule li::before { content: ""; flex: none; width: 6px; height: 6px; rotate: 45deg; background: var(--accent-2); translate: 0 -2px; }
@media (max-width: 760px) {
  .panel--formules { width: 100vw; }
  .formules { grid-template-columns: 1fr; }
}
