/* ==========================================================================
   MOTION : un langage de mouvement discret, guidé par le fil ONCOPOLE.
   Le moteur GSAP / ScrollTrigger / SplitText est chargé par WordPress ; les attributs,
   réglages, modes de repli et procédures de rollback sont documentés dans MOTION.md.
   Les marqueurs data-reveal, data-stagger et data-parallax restent compatibles.

   Cette feuille conserve les dessins, les masques typographiques et les interactions
   natives. Le moteur possède seul les états d’entrée et les transformations au scroll.
   Aucun contenu essentiel n’est prémasqué en CSS : sans JavaScript, tout reste lisible.
   html.motion-active active uniquement les détails de navigation lorsque le moteur est prêt.
   ========================================================================== */

:root {
  --ribbon-span: 112px;
  --ribbon-green-width: 13px;
  --shape-wave-green: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 220' fill='none'%3E%3Cpath d='M12 168C118 42 228 24 334 112C438 198 524 154 628 46' stroke='%233E9960' stroke-width='18' stroke-linecap='round'/%3E%3C/svg%3E");
  --shape-wave-blue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 760 140' fill='none'%3E%3Cpath d='M6 96C120 18 250 12 390 74C520 132 640 108 754 34' stroke='%234F73B8' stroke-opacity='.55' stroke-width='8' stroke-linecap='round'/%3E%3C/svg%3E");
  --drift-scale: 1.04;
}

.home-section {
  overflow-x: clip;
}

.section-shapes {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

.section-shapes .shape {
  position: absolute;
  display: block;
  pointer-events: none;
  z-index: 1;
}

.section-shapes .shape--blue { z-index: 0; }

.hero > .hero-container,
.specialties-section > .specialties-container,
.journey-section > .journey-container,
.technologies-section > .technologies-container,
.extension-section > .extension-container,
.news-section > .news-container,
.contact-section > .contact-layout {
  position: relative;
  z-index: 10;
}

.specialties-grid > .specialty-card,
.news-grid > .news-card,
.technology-values > li,
.extension-benefits > li,
.reassurance-grid > .reassurance {
  position: relative;
  z-index: 5;
}

.section-shapes .shape--circle {
  width: clamp(92px, 12vw, 230px);
  aspect-ratio: 1;
  border-radius: 50%;
}

.section-shapes .shape--yellow.shape--circle {
  background: radial-gradient(circle at 38% 34%, var(--shape-circle-highlight, #fff6c4), var(--shape-circle, #fbdd3b) 66%, var(--shape-circle-shade, #f0cc3a));
}

.section-shapes .shape--yellow.shape--outline {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--shape-circle-line, rgb(251 221 59 / 92%));
}

.section-shapes .shape--arc {
  width: clamp(150px, 20vw, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: transparent;
}

.section-shapes .shape--green.shape--arc {
  border: 11px solid var(--shape-arc, rgb(62 153 96 / 72%));
  border-left-color: transparent;
  border-bottom-color: transparent;
}

.section-shapes .shape--blue.shape--arc {
  border: 0;
  background: radial-gradient(circle, var(--shape-halo, rgb(79 115 184 / 15%)), var(--shape-halo-edge, rgb(37 63 145 / 0)) 70%);
}

.section-shapes .shape--wave {
  width: clamp(210px, 32vw, 520px);
  height: clamp(78px, 10vw, 160px);
  background: var(--shape-wave-green) center / 100% 100% no-repeat;
}

.section-shapes .shape--blue.shape--wave {
  width: min(78%, 920px);
  height: clamp(56px, 7vw, 110px);
  background-image: var(--shape-wave-blue);
}

.section-shapes .shape--bridge-top { top: -36px; }
.section-shapes .shape--bridge-bottom { bottom: -28px; }

.home-section--hero .shape--green {
  left: auto;
  right: -6%;
  bottom: 6%;
  width: clamp(160px, 16vw, 240px);
  opacity: .85;
}

.home-section--hero .shape--blue {
  left: -90px;
  bottom: 8%;
  width: clamp(180px, 22vw, 320px);
}

/* Spécialités : reprend le vert, puis un petit jaune en bas à droite. */
.home-section--specialties .shape--green {
  top: -42px;
  left: 36%;
  width: clamp(200px, 26vw, 420px);
  height: clamp(72px, 8vw, 120px);
}

.home-section--specialties .shape--yellow {
  right: 2.5%;
  bottom: 3%;
  width: clamp(52px, 4.5vw, 76px);
}

.home-section--specialties .shape--blue {
  top: 18%;
  right: -70px;
  width: clamp(160px, 18vw, 280px);
}

.home-section--journey .section-shapes { z-index: 0; }

/* Parcours : l’arc reste dans la marge basse, hors du titre. */
.home-section--journey .shape--green {
  top: auto;
  bottom: 14%;
  left: -150px;
  width: 170px;
  border-width: 8px;
  opacity: .35;
}

.home-section--journey .shape--blue {
  left: 8%;
  bottom: 16%;
}

.home-section--journey .shape--yellow {
  left: 6%;
  bottom: 31%;
  width: 46px;
}

/* Technologies : petit jaune en marge, l’arc vert de jointure est le ruban. */
.home-section--technologies .shape--yellow {
  top: 22%;
  left: -36px;
  width: clamp(52px, 4.5vw, 78px);
}

.home-section--technologies .shape--green {
  left: 32%;
  bottom: -24px;
  width: clamp(220px, 34vw, 560px);
}

.home-section--technologies .shape--blue {
  left: -120px;
  top: 22%;
  width: clamp(200px, 24vw, 360px);
}

.home-section--extension .section-shapes { z-index: -1; }

/* Extension : formes plus larges, en partie hors champ. */
.home-section--extension .shape--yellow {
  top: -100px;
  left: -70px;
  width: clamp(180px, 22vw, 340px);
}

.home-section--extension .shape--green { display: none; }

.home-section--extension .shape--blue {
  left: 8%;
  top: 12%;
  width: clamp(220px, 28vw, 420px);
}

/* Actualités : présence légère, les cartes restent lisibles. */
.home-section--news .section-shapes { opacity: .72; }

.home-section--news .shape--green {
  top: 10%;
  left: auto;
  right: -48px;
  width: clamp(120px, 13vw, 190px);
  border-width: 6px;
  opacity: .4;
}

.home-section--news .shape--yellow {
  left: 18%;
  top: 8%;
  width: 42px;
}

.home-section--news .shape--blue {
  right: 30%;
  bottom: 6%;
  width: clamp(120px, 14vw, 200px);
}

/* Contact : le vert du haut raccorde les actualités ; le halo reste très pâle. */
.home-section--contact .shape--green {
  top: -24px;
  left: 6%;
  width: clamp(180px, 24vw, 380px);
}

.home-section--contact .shape--blue {
  left: -140px;
  top: 16%;
  width: clamp(200px, 22vw, 320px);
  background: radial-gradient(circle, var(--shape-halo-soft, rgb(79 115 184 / 10%)), var(--shape-halo-edge, rgb(37 63 145 / 0)) 70%);
}

/* Pied de page : mêmes formes, plus pâles sur le bleu. */
.site-footer .section-shapes { z-index: 0; }

.site-footer .shape--yellow {
  top: 4%;
  right: 4%;
  width: clamp(64px, 7vw, 120px);
  opacity: .4;
}

.site-footer .shape--green { display: none; }
.ribbon-seam--flow-g .ribbon-green { stroke-width: 11px; }

.site-footer .shape--blue {
  left: -90px;
  top: 22%;
  width: clamp(150px, 16vw, 260px);
  opacity: .55;
}

/* Ruban de jointure. Chaque variante est dessinée deux fois, centrée sur le bord commun.
   Déplacer une courbe : le tracé SVG dans oncopole_ribbon_seam().
   Épaisseur : --ribbon-green-width. Hauteur visible : --ribbon-span. */
.ribbon-seam {
  position: absolute;
  left: 0;
  width: 100%;
  height: 0;
  z-index: 3;
  pointer-events: none;
}

.ribbon-seam--out { bottom: 0; }
.ribbon-seam--in { top: 0; }

.ribbon-seam svg {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--ribbon-span);
  top: calc(var(--ribbon-span) / -2);
  overflow: visible;
}

.ribbon-green { stroke: var(--ribbon-stroke, #3E9960); stroke-width: var(--ribbon-green-width); }
.ribbon-blue { stroke: var(--ribbon-stroke-soft, #4F73B8); stroke-width: 7px; stroke-opacity: .32; }
.ribbon-seam--flow-c .ribbon-blue { stroke: var(--ribbon-stroke-fine, #99BAFF); stroke-width: 2.4px; stroke-opacity: .9; }
.ribbon-seam--flow-e .ribbon-green,
.ribbon-seam--flow-f .ribbon-green,
.ribbon-seam--flow-h .ribbon-green { stroke-width: 8px; stroke-opacity: .45; }
.ribbon-seam--flow-a .ribbon-green { stroke-width: 15px; }

.ribbon-dot {
  position: absolute;
  left: 82%;
  top: 0;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, var(--shape-circle-highlight, #fff6c4), var(--shape-circle, #FBDD3B) 68%);
}

.ribbon-dot--small {
  left: 8%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
}

.ribbon-dot--ring {
  left: 72%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--shape-circle, #FBDD3B);
}

.footer-lip {
  position: absolute;
  z-index: 2;
  top: -1px;
  left: 0;
  width: 100%;
  height: 52px;
  pointer-events: none;
}

.footer-art__layer {
  transform-box: fill-box;
  transform-origin: center;
}

.footer-art__sun { transform-origin: 100% 0%; }
.footer-art__facet { transform-origin: 70% 0%; }
.footer-art__ribbon { transform-origin: 100% 40%; }
.footer-art__green { transform-origin: 80% 100%; }
.footer-art__navy { transform-origin: center bottom; }

/* ==========================================================================
   COUCHE 0 : ambiance (liée au défilement par ScrollTrigger)
   ========================================================================== */

/* Le fil est complet par défaut. Le moteur ne prépare que les tracés qu’il anime. */
.ribbon-seam { --draw: 1; }

/* Les pastilles jaunes s’allument quand le tracé les rejoint (de 55 % à 85 % du fil). */
.ribbon-dot {
  --dot-in: clamp(0, (var(--draw) - .55) * 3.4, 1);
  opacity: var(--dot-in);
  scale: calc(.55 + .45 * var(--dot-in));
}

/* La section Partenaires ne coupait pas son débordement : sans cela, sa moitié du fil se
   superposerait à celle de la section voisine (traits translucides plus foncés à l’endroit du recouvrement). */
.home-section--partners { overflow: clip; }
.partners-section > .partners-container { position: relative; z-index: 10; }

/* Les cadres contiennent la dérive interne. L’échelle est calculée par le moteur. */
.hero-visual[data-drift="image"],
.technologies-visual[data-drift="image"],
.extension-visual[data-drift="image"],
.article-cover[data-drift="image"],
.article-cover__frame[data-drift="image"],
.act-hero__visual[data-drift="image"],
.specialty-cover__frame[data-drift="image"],
.clinic-frame[data-drift="image"],
.clinic-visual[data-drift="image"],
.team-frame[data-drift="image"] {
  overflow: hidden;
}

/* ==========================================================================
   COUCHE 1 : texte et accès clavier
   ========================================================================== */

/* SplitText utilise des div pour conserver les span éditoriaux des titres.
   Le débordement de quelques pixels préserve accents et jambages sans changer la hauteur. */
.motion-line { display: block; }
.motion-word { display: inline-block; }
.motion-line-mask {
  overflow: clip !important;
  overflow-clip-margin: .16em;
}

/* Un lien atteint au clavier ne doit jamais attendre une animation d’entrée. */
:is([data-motion], [data-reveal], [data-stagger] > *):focus-within,
:is([data-motion], [data-reveal], [data-stagger] > *):focus-within :is(.motion-line, .motion-word) {
  opacity: 1 !important;
  visibility: visible !important;
  clip-path: none !important;
}
:is([data-motion], [data-reveal], [data-stagger] > *):focus-within .motion-line-mask {
  overflow: visible !important;
}

/* ==========================================================================
   COUCHE 2 : composants (une recette par famille)
   ========================================================================== */

/* Appui : répond avant même que le doigt se lève. */
.button:active { transform: translateY(0) scale(.985); transition-duration: var(--dur-instant); }

@media (hover: hover) and (pointer: fine) {
  /* Cartes : on se soulève de 5 px, la photo respire. Même geste partout. */
  .news-card--editorial { transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
  .news-card--editorial:is(:hover, :focus-within) { transform: translateY(-5px); box-shadow: 0 18px 42px rgb(19 32 70 / 10%); }
  .news-card--editorial .news-media img,
  .act-card__media img { transition: scale var(--dur-slow) var(--ease-out); }
  .news-card--editorial:is(:hover, :focus-within) .news-media img,
  .act-card:is(:hover, :focus-within) .act-card__media img { scale: 1.04; }

  /* Pastilles d’icônes : un léger souffle au survol de leur bloc. */
  .icon-circle, .technology-icon, .extension-icon, .journey-icon { transition: scale var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
  .reassurance:is(:hover, :focus-within) .icon-circle,
  .specialties-section .specialty-card:is(:hover, :focus-within) .icon-circle,
  .technology-values li:is(:hover, :focus-within) .technology-icon,
  .extension-benefit:is(:hover, :focus-within) .extension-icon,
  .journey-step:is(:hover, :focus-within) .journey-icon {
    scale: 1.04;
    box-shadow: 0 0 0 8px rgb(79 115 184 / 9%);
  }
}

/* Repère de la carte. */
.contact-map-pin svg {
  transform-origin: center 78%;
  animation: pinIn var(--dur-slow) var(--ease-out) both;
}

.contact-map-pin__halo {
  animation: pinPulse 3.5s var(--ease-in-out) infinite;
}

@keyframes pinIn {
  from { scale: .85; }
  to { scale: 1; }
}

@keyframes pinPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: .72; }
}

/* Menu mobile : les entrées se posent l’une après l’autre quand le panneau s’ouvre. */
@media (max-width: 1339px) {
  html.motion-active .primary-navigation .menu > .menu-item {
    opacity: 0;
    translate: var(--rise-sm) 0;
    transition: opacity var(--dur-base) var(--ease-out), translate var(--dur-base) var(--ease-out);
  }
  html.motion-active .primary-navigation.is-open .menu > .menu-item {
    opacity: 1;
    translate: 0 0;
    transition-delay: calc(var(--dur-fast) + var(--i, 0) * 45ms);
  }
  html.motion-active .primary-navigation .menu > .menu-item:focus-within {
    opacity: 1;
    translate: 0 0;
    transition: none;
  }
  .primary-navigation .menu > .menu-item:nth-child(2) { --i: 1; }
  .primary-navigation .menu > .menu-item:nth-child(3) { --i: 2; }
  .primary-navigation .menu > .menu-item:nth-child(4) { --i: 3; }
  .primary-navigation .menu > .menu-item:nth-child(5) { --i: 4; }
  .primary-navigation .menu > .menu-item:nth-child(6) { --i: 5; }
  .primary-navigation .menu > .menu-item:nth-child(7) { --i: 6; }
  .primary-navigation .menu > .menu-item:nth-child(8) { --i: 7; }
}

/* ==========================================================================
   COUCHE 3 : pages (transition de vue entre documents)
   Aucune coupure sèche entre deux pages : l’en-tête, seul élément permanent, ne bouge pas ; le reste
   se fond doucement pendant que la nouvelle page se compose (motion.js) ; la photo d’une carte cliquée
   devient la photo de la page d’arrivée. Les navigateurs sans cette fonction naviguent normalement.
   Les deux pages doivent porter la même règle @view-transition ; le nom « media » est posé par le
   script d’en-tête (functions.php) uniquement sur la photo concernée.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  .site-header { view-transition-name: site-header; }
  ::view-transition-group(site-header) { animation-duration: 0s; }
  ::view-transition-old(site-header),
  ::view-transition-new(site-header) { animation-duration: var(--dur-base); animation-timing-function: var(--ease-out); }

  ::view-transition-old(root) { animation: vt-out var(--dur-fast) var(--ease-in) both; }
  ::view-transition-new(root) { animation: vt-in var(--dur-base) var(--ease-out) both; }

  /* La page n’est pas utilisable pendant une transition : on reste sous la seconde. */
  ::view-transition-group(media) { animation-duration: var(--dur-slow); animation-timing-function: var(--ease-in-out); }
  ::view-transition-old(media),
  ::view-transition-new(media) { width: 100%; height: 100%; object-fit: cover; overflow: clip; }
}

@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

/* ==========================================================================
   Mobile : formes plus discrètes, distances plus courtes, pas de dérive.
   ========================================================================== */
@media (max-width: 767px) {
  :root { --ribbon-span: 72px; --ribbon-green-width: 8px; --rise: 16px; --rise-sm: 8px; }

  .ribbon-seam .ribbon-blue,
  .ribbon-dot--ring,
  .ribbon-dot--small { display: none; }
  .ribbon-dot { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  .footer-lip { height: 28px; }
  .home-section--hero .shape--green { left: auto; right: -8%; bottom: 12%; width: 46vw; height: 64px; }
  .home-section--hero .shape--blue { width: 42vw; bottom: 2%; opacity: .7; }
  .home-section--specialties .shape--yellow { width: 48px; }
  .home-section--journey .shape--green { display: none; }
  .home-section--journey .shape--blue { left: 12%; width: 76%; bottom: 8%; }
  .home-section--journey .shape--yellow { display: none; }
  .home-section--technologies .shape--yellow { left: -18px; top: 18%; width: 56px; }
  .home-section--extension .shape--yellow { width: 34vw; top: -48px; left: -28px; }
  .home-section--extension .shape--green { display: none; }
  .home-section--news .shape--green,
  .home-section--news .shape--blue { display: none; }
  .site-footer .shape--yellow { width: 48px; top: 2%; right: -8px; opacity: .4; }
  .site-footer .shape--green { left: -8%; top: auto; bottom: 22%; width: 58vw; opacity: .32; }
  .site-footer .shape--blue { width: 42vw; top: auto; bottom: 28%; opacity: .4; }
}

/* ==========================================================================
   Mouvement réduit : le moteur nettoie ses animations ; le CSS garantit un état
   lisible immédiatement, y compris pendant un changement de préférence système.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  :is([data-motion], [data-reveal], [data-parallax], .motion-line, .motion-word, .footer-art__layer, .footer-lip),
  [data-stagger] > *,
  [data-drift="image"] img {
    transform: none !important;
    translate: none !important;
    scale: none !important;
    rotate: none !important;
    clip-path: none !important;
  }
  :is([data-motion], [data-reveal], .motion-line, .motion-word, .footer-art__layer),
  [data-stagger] > * {
    opacity: 1 !important;
    visibility: visible !important;
  }
  .motion-line-mask { overflow: visible !important; }
  .ribbon-seam { --draw: 1 !important; }
  .ribbon-seam path { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; }
  html.motion-active .primary-navigation .menu > .menu-item {
    opacity: 1;
    translate: none;
    transition: none;
  }
  .news-card--editorial:is(:hover, :focus-within) { transform: none; }
  :is(.news-media, .act-card__media) img,
  .icon-circle, .technology-icon, .extension-icon, .journey-icon { scale: none !important; }
}
