/* FibroMate — feuille de style unique. Fontes système, aucune ressource extérieure.

   Direction : page produit. Le vide sépare les sections, jamais un trait.
   Deux fonds qui alternent, deux niveaux de gris par fond, une seule teinte —
   le rouge du PLA. Contrastes calculés (WCAG 2.1, texte normal ≥ 4,5:1) :

     fond clair #f5f4f2 : encre #14141a 16,69:1 · gris #5f5f6b 5,73:1
                          rouge profond #b3301d 5,69:1
     fond noir  #0a0a0b : encre #f5f4f2 18,00:1 · gris #9b9ba6 7,19:1
                          rouge #e8482f 5,09:1
     blanc sur le bouton #b3301d 6,26:1 · survol #c23a22 5,35:1          */

:root {
  --blanc:        #f5f4f2;
  --noir:         #0a0a0b;
  --encre-clair:  #14141a;
  --gris-clair:   #5f5f6b;
  --encre-sombre: #f5f4f2;
  --gris-sombre:  #9b9ba6;
  --rouge:        #e8482f;   /* le rouge de l’objet : sur le noir, et en grand */
  --rouge-profond:#b3301d;   /* le même rouge assombri : texte sur clair, bouton */
  --rouge-vif:    #c23a22;   /* survol du bouton */

  /* rythme vertical : les sections respirent, rien ne les sépare d’autre */
  --respire:   clamp(4.5rem, 4rem + 5vw, 11.25rem);
  --gouttiere: clamp(1.5rem, 5vw, 4rem);
  --large:     68rem;
  --mesure:    36rem;

  /* échelle typographique */
  --t-petit:  0.9375rem;
  --t-corps:  clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  --t-lede:   clamp(1.2rem, 1.1rem + 0.42vw, 1.4rem);
  --t-h2:     clamp(2.1rem, 1.36rem + 2.9vw, 3.6rem);
  --t-h1:     clamp(2.9rem, 1.9rem + 3.9vw, 4.5rem);
  --t-geant:  clamp(3.2rem, 1.9rem + 5.1vw, 6rem);
  --t-note:   clamp(2.6rem, 1.9rem + 2.6vw, 4rem);

  /* largeurs d’affichage des photos : la moitié de leur définition de fichier,
     pour rester nettes sur un écran à densité double */
  --l-ouverture:  640px;
  --l-modules:    360px;
  --l-service:    369px;
  --l-endo:       200px;
  --l-creality:   300px;
  --l-snapmaker:  360px;
  --l-jean:       390px;

  --sans: ui-sans-serif, system-ui, -apple-system, "SF Pro Text", "Segoe UI",
          Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --courbe: cubic-bezier(0.16, 1, 0.3, 1);
  --duree: 600ms;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: #8a8a94 transparent;
}

body {
  margin: 0;
  background: var(--noir);
  color: var(--encre-sombre);
  font-family: var(--sans);
  font-size: var(--t-corps);
  line-height: 1.55;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, video { display: block; max-width: 100%; }

/* ---------- typographie ---------- */

h1, h2, h3 { margin: 0; text-wrap: balance; }

h1 {
  font-size: var(--t-h1);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

h2 {
  font-size: var(--t-h2);
  font-weight: 650;
  line-height: 1.06;
  letter-spacing: -0.032em;
}

h3 {
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.012em;
}

p { margin: 0; text-wrap: pretty; }
p + p { margin-top: 1.1em; }

/* les chiffres sont des données : chasse fixe partout */
.fait, .chiffre, .appui, .coordonnees, .fiche dd, .tel {
  font-variant-numeric: tabular-nums lining-nums;
}

/* ---------- les deux fonds ---------- */

.scene {
  padding: var(--respire) var(--gouttiere);
}
.scene--noir  { background: var(--noir);  color: var(--encre-sombre); }
.scene--blanc { background: var(--blanc); color: var(--encre-clair); }

::selection                { background: var(--rouge);         color: #fff; }
.scene--blanc::selection,
.scene--blanc ::selection  { background: var(--rouge-profond); color: #fff; }

/* chaque section fait une affirmation, centrée */
.bloc {
  max-width: var(--mesure);
  margin-inline: auto;
  text-align: center;
}
.bloc p { text-wrap: balance; }
.bloc h2 + p { margin-top: clamp(1.25rem, 2.4vw, 1.75rem); }
.scene--noir  .bloc p { color: var(--gris-sombre); }
.scene--blanc .bloc p { color: var(--gris-clair); }

/* le visuel suit son affirmation, petit et net au milieu du vide */
.visuel {
  margin: clamp(3rem, 7vw, 5.5rem) auto 0;
  text-align: center;
}
.visuel img { margin-inline: auto; }
.visuel--ouverture img { width: 100%; max-width: var(--l-ouverture); height: auto; }
.visuel--modules   img { width: 100%; max-width: var(--l-modules);   height: auto; }
.visuel--service   img { width: 100%; max-width: var(--l-service);   height: auto; }
.visuel--jean      img { width: 100%; max-width: var(--l-jean);      height: auto; }

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

.ouverture {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: clamp(3rem, 8vh, 6rem);
  padding-bottom: clamp(3rem, 8vh, 6rem);
}

.ouverture .bloc { max-width: 44rem; }

.ouverture .lede {
  max-width: 30ch;
  margin: clamp(1.4rem, 3vw, 2rem) auto 0;
  font-size: clamp(1.45rem, 1.15rem + 1.3vw, 2.1rem);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.022em;
  color: var(--encre-sombre) !important;
}

.ouverture .bloc .fait {
  max-width: 40ch;
  margin: clamp(1.1rem, 2.2vw, 1.6rem) auto 0;
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  font-weight: 500;
  color: var(--rouge) !important;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem 2rem;
  margin-top: clamp(1.75rem, 3.4vw, 2.5rem);
}

/* ---------- le seul bouton de la page ---------- */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  background: var(--rouge-profond);
  color: #fff;
  font-size: 1rem;
  font-weight: 550;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: background-color 180ms var(--courbe),
              transform 140ms var(--courbe);
}
.bouton:active { transform: scale(0.97); }

/* un lien prend le rouge de l’objet, jamais une autre teinte */
.lien,
.coordonnees a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--rouge);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: rgba(232, 72, 47, 0.38);
  transition: text-decoration-color 180ms var(--courbe);
}
.scene--blanc .lien { color: var(--rouge-profond); }

@media (hover: hover) and (pointer: fine) {
  .bouton:hover { background-color: var(--rouge-vif); }
  .lien:hover,
  .coordonnees a:hover { text-decoration-color: currentcolor; }
}

a:focus-visible,
video:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--rouge);
  outline-offset: 4px;
  border-radius: 2px;
}
.scene--blanc a:focus-visible { outline-color: var(--rouge-profond); }
main:focus { outline: none; }

.evitement {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  padding: 0.9rem 1.4rem;
  background: var(--rouge-profond);
  color: #fff;
  text-decoration: none;
}
.evitement:focus { left: 0; }

/* ---------- la bande de vues endoluminales ---------- */

.pellicule {
  display: flex;
  gap: clamp(0.75rem, 1.6vw, 1.25rem);
  margin-top: clamp(3rem, 7vw, 5.5rem);
  margin-inline: calc(var(--gouttiere) * -1);
  padding-inline: var(--gouttiere);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.pellicule img {
  flex: 0 0 min(52vw, var(--l-endo));
  width: min(52vw, var(--l-endo));
  height: auto;
  scroll-snap-align: center;
}
/* dès que les cinq vignettes tiennent, la bande se pose au centre */
@media (min-width: 75rem) {
  .pellicule {
    justify-content: center;
    margin-inline: auto;
    overflow: visible;
  }
}

/* ---------- les chiffres sont des évènements ---------- */

.chiffres {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(3rem, 9vw, 7rem);
  margin-top: clamp(3.5rem, 8vw, 6rem);
  text-align: center;
}
.chiffres .chiffre { margin: 0; }
.chiffres strong {
  display: block;
  font-size: var(--t-geant);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--rouge);
}
.chiffres span {
  display: block;
  margin-top: 0.9rem;
  font-size: var(--t-petit);
  color: var(--gris-sombre);
}

/* ---------- les deux séquences ---------- */

.films {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(1.75rem, 4vw, 3rem);
  margin-top: clamp(3.5rem, 8vw, 6rem);
}
.films video {
  width: 100%;
  height: auto;
  background: #141417;
}
.films video:first-child { max-width: var(--l-snapmaker); }
.films video:last-child  { max-width: var(--l-creality); }

/* ---------- les notes, en jauges ---------- */

.notes {
  display: grid;
  gap: clamp(2rem, 5vw, 3rem);
  max-width: 40rem;
  margin: clamp(3.5rem, 8vw, 6rem) auto 0;
}
.notes > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem 1.25rem;
  align-items: baseline;
}
.notes dt {
  grid-column: 1;
  grid-row: 1;
  font-size: var(--t-corps);
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--encre-clair);
}
.notes .chiffre {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--rouge-profond);
}
.notes .chiffre small {
  font-size: 0.875rem;
  font-weight: 450;
  letter-spacing: 0;
  color: var(--gris-clair);
}
.notes .jauge {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 0.6rem;
  margin: 0;
  border-radius: 999px;
  background: rgba(20, 20, 26, 0.1);
  overflow: hidden;
}
.notes .jauge span {
  display: block;
  width: var(--v);
  height: 100%;
  border-radius: 999px;
  background: var(--rouge-profond);
  transform-origin: left center;
}
.js .notes.vu .jauge span { animation: jauge 900ms var(--courbe) both; }
@keyframes jauge { from { transform: scaleX(0); } to { transform: none; } }

/* ---------- fiche technique ---------- */

.fiche {
  max-width: 46rem;
  margin: clamp(3rem, 7vw, 5rem) auto 0;
}
.fiche > div {
  display: grid;
  gap: 0.3rem 2.5rem;
  padding-block: 0.95rem;
}
.fiche dt {
  font-size: var(--t-petit);
  font-weight: 550;
  letter-spacing: -0.006em;
  color: var(--encre-clair);
}
.fiche dd {
  margin: 0;
  font-size: var(--t-petit);
  line-height: 1.5;
  color: var(--gris-clair);
}
@media (min-width: 46rem) {
  .fiche > div { grid-template-columns: 13rem minmax(0, 1fr); }
}

/* ---------- contact ---------- */

.contact { padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.contact .visuel { margin-top: 0; }
.contact .bloc { margin-top: clamp(3rem, 7vw, 5rem); }

.coordonnees {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.5rem 2.5rem;
  margin-top: clamp(1.75rem, 3.4vw, 2.5rem);
  font-style: normal;
}
.coordonnees .tel {
  font-size: clamp(1.9rem, 1.2rem + 2.3vw, 2.9rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  text-underline-offset: 0.14em;
}

.mention {
  max-width: 46ch;
  margin: clamp(2.5rem, 5vw, 3.25rem) auto 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--gris-sombre);
}

/* ---------- pied ---------- */

.pied {
  padding: clamp(2.5rem, 5vw, 4rem) var(--gouttiere) clamp(3rem, 6vw, 4.5rem);
  background: var(--noir);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--gris-sombre);
  text-align: center;
}
.pied .bloc { max-width: var(--mesure); }
.pied .lien { font-size: 0.875rem; }

/* ---------- mentions légales (page secondaire, non réécrite) ---------- */

.bandeau {
  padding: var(--gouttiere) var(--gouttiere) 0;
}
.bandeau .page,
.pied .page,
.texte-legal.page {
  max-width: var(--large);
  margin-inline: auto;
}
.bandeau .page {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
}
.bandeau .marque { font-weight: 650; letter-spacing: -0.02em; }
.bandeau .marque a { color: var(--encre-sombre); text-decoration: none; }
.bandeau-contact { font-size: var(--t-petit); color: var(--gris-sombre); }
.bandeau-contact a { color: var(--rouge); }

.texte-legal {
  max-width: 44rem;
  margin-inline: auto;
  padding: clamp(3rem, 7vw, 5rem) var(--gouttiere);
}
.texte-legal h1 { font-size: var(--t-h2); margin-bottom: 2rem; }
.texte-legal h2 {
  font-size: 1.1875rem;
  letter-spacing: -0.015em;
  margin: 2.75rem 0 0.75rem;
}
.texte-legal p,
.texte-legal address { color: var(--gris-sombre); }
.texte-legal a { color: var(--rouge); }
.texte-legal .retour { display: inline-flex; align-items: center; min-height: 44px; font-weight: 550; }
.a-completer { color: var(--rouge); font-style: italic; }

/* ---------- mouvement ----------

   Un seul geste, partout le même : la section monte de 24 px en fondu quand
   elle entre dans le champ. Même durée, même courbe. L’ouverture le joue une
   fois au chargement, en CSS pur, sans attendre le script.
   Sans JavaScript la classe .js n’existe pas : rien n’est jamais masqué.     */

.ouverture .bloc > *,
.ouverture .visuel {
  animation: monte var(--duree) var(--courbe) both;
}
.ouverture .lede    { animation-delay:  60ms; }
.ouverture .fait    { animation-delay: 120ms; }
.ouverture .actions { animation-delay: 180ms; }
.ouverture .visuel  { animation-delay: 240ms; }

@keyframes monte {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duree) var(--courbe),
              transform var(--duree) var(--courbe);
}
.js [data-reveal].vu { opacity: 1; transform: none; }

/* Apparition échelonnée : dans un bloc de texte, chaque élément arrive à son tour. */
.js .bloc[data-reveal] { opacity: 1; transform: none; transition: none; }
.js .bloc[data-reveal] > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duree) var(--courbe), transform var(--duree) var(--courbe);
}
.js .bloc[data-reveal] > :nth-child(2) { transition-delay: 110ms; }
.js .bloc[data-reveal] > :nth-child(3) { transition-delay: 220ms; }
.js .bloc[data-reveal] > :nth-child(4) { transition-delay: 330ms; }
.js .bloc[data-reveal] > :nth-child(n+5) { transition-delay: 440ms; }
.js .bloc[data-reveal].vu > * { opacity: 1; transform: none; }
.js .visuel[data-reveal], .js .films[data-reveal], .js .notes[data-reveal] { transition-delay: 160ms; }

/* Barre de progression de lecture */
.progression {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  background: var(--rouge); transform: scaleX(0); transform-origin: left center;
  pointer-events: none;
}

/* Boutons : lévitation au survol, pulsation unique du bouton flottant */
@media (hover: hover) {
  .bouton:hover, .contact-flottant:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(232, 72, 47, 0.38);
  }
}
.contact-flottant { animation: pulsation 1.4s ease-out 5s 1 both; }
@keyframes pulsation {
  0%   { box-shadow: 0 6px 24px rgba(0,0,0,.35), 0 0 0 0 rgba(232,72,47,.7); }
  70%  { box-shadow: 0 6px 24px rgba(0,0,0,.35), 0 0 0 18px rgba(232,72,47,0); }
  100% { box-shadow: 0 6px 24px rgba(0,0,0,.35), 0 0 0 0 rgba(232,72,47,0); }
}

/* Mouvement réduit : le déplacement disparaît, le retour visuel des commandes
   reste. Un bouton qui ne répond plus à la pression n’aide personne. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js [data-reveal], .js .bloc[data-reveal] > * { opacity: 1; transform: none; }
  .bouton:hover, .contact-flottant:hover { transform: none; }
  .bouton, .lien, .coordonnees a {
    transition-property: background-color, color, text-decoration-color !important;
    transition-duration: 180ms !important;
  }
  .bouton:active { transform: none; }
}

/* Bouton flottant « Contacter le concepteur » */
.contact-flottant {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 50;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  background: var(--rouge-profond);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 550;
  text-decoration: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  transition: opacity 0.25s, transform 0.25s, background-color 0.2s;
}
.contact-flottant:hover { background: var(--rouge-vif); }
.contact-flottant:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.contact-flottant.masque { opacity: 0; pointer-events: none; transform: translateY(12px); }
@media (max-width: 480px) { .contact-flottant { padding: 0.75rem 1.1rem; font-size: 0.9rem; } }

/* ======================================================================
   OUVERTURE — proposition 3 : « L’objet »

   Le simulateur lui-même, détouré de son plan de travail et posé dans le
   noir de la page : la trachée, les deux arbres, le socle imprimé, les
   bandes noires qui tiennent les modules ensemble. Rien d’ajouté, rien de
   lissé. Sur grand écran il occupe la moitié droite, à côté du titre ;
   sur téléphone il émerge du bas de l’écran, sous le bouton.

   L’image est un JPEG sur fond noir, composé en `screen` : ses noirs
   disparaissent dans le fond quel que soit l’arrière-plan, sans canal alpha
   et donc sans le poids d’un PNG.
   ====================================================================== */

.ouverture--objet {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--noir);
}

.ouverture--objet .decor {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ouverture--objet .bloc {
  position: relative;
  z-index: 1;
}

/* le halo : l’objet ne doit pas avoir l’air découpé et collé sur du noir */
.ouverture--objet .decor-halo {
  position: absolute;
  inset: 0;
  display: block;
  background: radial-gradient(30% 26% at 50% 96%,
    rgba(179, 48, 29, 0.22) 0%,
    rgba(179, 48, 29, 0.08) 52%,
    rgba(179, 48, 29, 0) 100%);
}

.ouverture--objet .decor-objet {
  position: absolute;
  width: auto;
  height: auto;
  max-width: none;
}

/* ---- téléphone : l’objet émerge du bas, le texte remonte pour lui laisser
        la place. La hauteur du héros ne change pas, seul son centre bouge.

   L’objet est dimensionné par sa HAUTEUR, jamais par sa largeur : la place
   qu’on lui réserve est une hauteur, et un écran large et court (un portable
   couché, un vieux portable 980 × 760) le ferait sinon déborder sur le texte.
   Constaté en capture à 980 × 760, corrigé, revérifié. ---- */

.ouverture--objet { padding-bottom: clamp(12rem, 32vh, 21rem); }

.ouverture--objet .decor-objet {
  left: 50%;
  bottom: -1.25rem;
  width: auto;
  height: clamp(10rem, 28vh, 18rem);
  translate: -50% 0;
}

.ouverture--objet .decor-halo {
  background: radial-gradient(52% 15% at 50% 97%,
    rgba(179, 48, 29, 0.26) 0%,
    rgba(179, 48, 29, 0.10) 52%,
    rgba(179, 48, 29, 0) 100%);
}

/* ---- grand écran : l’objet prend la moitié droite, le texte la gauche ---- */

@media (min-width: 62rem) {
  .ouverture--objet {
    padding-bottom: clamp(3rem, 8vh, 6rem);
    padding-right: 46%;
  }
  /* même principe : l’objet est dimensionné par sa hauteur. Le troisième
     terme (30vw) garantit qu’il reste à droite de la colonne de texte,
     quelle que soit la largeur de la fenêtre. */
  .ouverture--objet .decor-objet {
    left: auto;
    right: -9%;
    bottom: auto;
    top: 47%;
    width: auto;
    height: min(56vh, 32rem, 30vw);
    translate: 0 -50%;
  }
  .ouverture--objet .decor-halo {
    background: radial-gradient(26% 22% at 76% 73%,
      rgba(179, 48, 29, 0.26) 0%,
      rgba(179, 48, 29, 0.09) 52%,
      rgba(179, 48, 29, 0) 100%);
  }
}

/* ---- la dérive : dix-huit secondes pour s’approcher de 3 %, autant pour
        repartir. Transform seul, donc sur le compositeur. ---- */

@media (prefers-reduced-motion: no-preference) {
  .ouverture--objet .decor-objet {
    will-change: transform;
    animation: derive-objet 18s ease-in-out infinite alternate;
  }
}
@keyframes derive-objet {
  from { transform: none; }
  to   { transform: translate3d(0, -1.6%, 0) scale(1.03); }
}

.ouverture--objet.fige .decor-objet { animation-play-state: paused; }
