/* ═══════════════════════════════════════════════════════════════
   STUDIA SUP — SECTION FILIÈRES « NEURAL PATHWAYS »
   Trois voies SVG qui se ramifient depuis un point unique vers chaque
   carte. Cartes à border-beam + spotlight + tilt 3D.
   Animations en transform/opacity/stroke (GPU). prefers-reduced-motion
   fige les voies et désactive tilt, spotlight et beam.
   ═══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Space Grotesk';
  src: url('../fonts/SpaceGrotesk-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

/* Angle animable du border-beam (fallback géré plus bas si non supporté) */
@property --beam {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.filieres {
  --fil-bg: #080d0a;
  position: relative;
  isolation: isolate;
  background: var(--fil-bg);
  overflow: hidden;
  padding-block: clamp(80px, 12vh, 140px);
}

/* Halo d'origine : le point commun d'où partent les trois voies */
.filieres::before {
  content: '';
  position: absolute;
  top: -10%;
  left: 50%;
  width: min(900px, 120vw);
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(46,158,79,.14), transparent 62%);
  pointer-events: none;
  z-index: -2;
}

/* ── Les trois voies : lignes SVG ramifiées depuis un point unique ──
   Les tracés sont générés en JS depuis la position réelle des cartes,
   donc exacts en desktop (3 colonnes) comme en mobile (empilé). */
.fil-paths {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: visible;
  pointer-events: none;
  will-change: transform;
}

/* Ligne de fond, discrète */
.fil-path {
  fill: none;
  stroke: var(--voie, rgba(255,255,255,.2));
  stroke-width: 1.1;
  stroke-linecap: round;
  opacity: .22;
  /* Tracé progressif à l'entrée dans le viewport */
  stroke-dasharray: var(--len, 1000);
  stroke-dashoffset: var(--len, 1000);
  transition: opacity .5s ease, stroke-width .5s ease;
}
.filieres.is-drawn .fil-path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.5s cubic-bezier(.16,1,.3,1) var(--draw-delay, 0ms),
              opacity .5s ease, stroke-width .5s ease;
}

/* Signal lumineux qui parcourt la voie (impulsion neuronale) */
.fil-pulse {
  fill: none;
  stroke: var(--voie, #fff);
  stroke-width: 2;
  stroke-linecap: round;
  filter: url(#pathGlow);
  opacity: 0;
  stroke-dasharray: 3 var(--len, 1000);
}
.filieres.is-drawn .fil-pulse {
  opacity: .9;
  animation: fil-signal 5.2s cubic-bezier(.55,0,.45,1) infinite;
  animation-delay: var(--pulse-delay, 0s);
}
@keyframes fil-signal {
  0%       { stroke-dashoffset: var(--len, 1000); opacity: 0; }
  8%       { opacity: .95; }
  60%, 100%{ stroke-dashoffset: 0; opacity: 0; }
}

/* Nœud de ramification / d'arrivée */
.fil-node {
  fill: var(--voie, #fff);
  opacity: 0;
  transition: opacity .6s ease var(--draw-delay, 0ms), r .4s ease;
}
.filieres.is-drawn .fil-node { opacity: .55; }
.fil-node--origin { opacity: 0; }
.filieres.is-drawn .fil-node--origin { opacity: .9; }

/* La voie de la carte survolée s'illumine, les autres s'effacent */
.fil-voie.is-lit .fil-path { opacity: .85; stroke-width: 1.7; }
.fil-voie.is-lit .fil-node { opacity: 1; }
.fil-paths.has-lit .fil-voie:not(.is-lit) .fil-path { opacity: .1; }
.fil-paths.has-lit .fil-voie:not(.is-lit) .fil-node { opacity: .25; }
.fil-paths.has-lit .fil-voie:not(.is-lit) .fil-pulse { opacity: 0; }

/* ── En-tête de section ───────────────────────────────────────── */
.fil-head {
  max-width: 780px;
  /* Marge basse généreuse : c'est l'espace où les trois voies se ramifient. */
  margin: 0 auto clamp(104px, 16vh, 170px);
  text-align: center;
  padding-inline: 24px;
}

.fil-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', var(--display);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 22px;
}
.fil-eyebrow__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(46,158,79,.7);
  animation: fil-pulse 2.4s ease-out infinite;
}
@keyframes fil-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(46,158,79,.7); }
  70%  { box-shadow: 0 0 0 9px rgba(46,158,79,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,158,79,0); }
}

.fil-title {
  font-family: 'Space Grotesk', var(--display);
  font-weight: 700;
  font-size: clamp(2.1rem, 5.6vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -.03em;
  margin-bottom: 20px;
}
/* Cascade : chaque mot dans un masque, translaté vers le haut */
.fil-title .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: .08em;
  margin-bottom: -.08em;
}
.fil-title .w > span {
  display: inline-block;
  transform: translateY(105%);
  transition: transform .9s cubic-bezier(.16,1,.3,1);
  transition-delay: var(--d, 0ms);
}
.fil-head.is-in .fil-title .w > span { transform: translateY(0); }

/* « demain » : dégradé lumineux animé vert → or */
.fil-title .accent > span {
  background: linear-gradient(100deg, var(--green) 0%, #7ede9c 26%, var(--yellow) 52%, #7ede9c 78%, var(--green) 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fil-shimmer 7s ease-in-out infinite;
}
@keyframes fil-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.fil-sub {
  font-size: 1rem;
  color: rgba(247,249,248,.62);
  max-width: 56ch;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .8s ease .55s, transform .8s ease .55s;
}
.fil-head.is-in .fil-sub { opacity: 1; transform: none; }

/* ── Grille ───────────────────────────────────────────────────── */
.fil-grid {
  display: grid;
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  padding-inline: 20px;
}

/* Grand mobile : la carte cesse de s'étirer en bandeau */
@media (min-width: 560px) and (max-width: 719px) {
  .fil-grid { max-width: 520px; }
}

/* Tablette : 2 colonnes, la troisième centrée dessous à la même largeur.
   (En une seule colonne, les cartes atteignaient 738 px de large pour
   312 px de haut — des bandeaux vides.) */
@media (min-width: 720px) and (max-width: 1039px) {
  .fil-grid { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  .fil-card:last-child {
    grid-column: 1 / -1;
    width: calc(50% - 11px);
    justify-self: center;
  }
}

/* Desktop : trois colonnes égales */
@media (min-width: 1040px) {
  .fil-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; padding-inline: 24px; }
}

/* ── Carte ────────────────────────────────────────────────────── */
.fil-card {
  --accent: var(--green);
  --accent-soft: rgba(46,158,79,.08);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px 26px 26px;
  border-radius: 20px;
  background: rgba(255,255,255,.028);
  border: 1px solid rgba(255,255,255,.08);
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform .5s cubic-bezier(.16,1,.3,1),
              border-color .4s ease,
              background-color .4s ease;
  /* Apparition staggered au scroll */
  opacity: 0;
  translate: 0 40px;
}
.fil-card.is-in {
  opacity: 1;
  translate: 0 0;
  transition: opacity .8s cubic-bezier(.16,1,.3,1) var(--delay, 0ms),
              translate .8s cubic-bezier(.16,1,.3,1) var(--delay, 0ms),
              transform .5s cubic-bezier(.16,1,.3,1),
              border-color .4s ease,
              background-color .4s ease;
}

/* Palette : on reste dans le thème de la marque.
   IA Créative → blanc / vert clair · Agrotech → vert émeraude · Business → or */
.fil-card--clair    { --accent: #d8f7e6; --accent-soft: rgba(216,247,230,.07); }
.fil-card--emeraude { --accent: #2ee08a; --accent-soft: rgba(46,224,138,.09); }
.fil-card--or       { --accent: #f2c230; --accent-soft: rgba(242,194,48,.09); }

/* Hairline supérieure : la carte « s'active » au survol.
   (Elle remplace le border-beam conique qui tournait en permanence —
   le repos doit être une bordure blanche à 8 %, pas une animation.) */
.fil-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .4s cubic-bezier(.16,1,.3,1);
  pointer-events: none;
}

/* Spotlight : le fond s'accentue autour du curseur */
.fil-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(350px circle at var(--mx, 50%) var(--my, 50%),
              var(--accent-soft), transparent 68%);
  opacity: 0;
  transition: opacity .45s ease;
  pointer-events: none;
}

@media (hover: hover) {
  .fil-card:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    background: rgba(255,255,255,.045);
  }
  .fil-card:hover::before { transform: scaleX(1); }
  .fil-card:hover::after  { opacity: 1; }
  .fil-card:hover .fil-motif { opacity: .06; }
  .fil-card:hover .fil-medallion { animation: fil-pulse-med .3s ease-out; }
  .fil-card:hover .fil-medallion::after { opacity: .2; }
}
@keyframes fil-pulse-med {
  50% { transform: scale(1.06); }
}
.fil-card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Contenu au-dessus des couches décoratives */
.fil-card > * { position: relative; z-index: 1; }

/* ── En-tête de carte ─────────────────────────────────────────── */
.fil-card__top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.fil-medallion {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(255,255,255,.045);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  color: var(--accent);
  box-shadow: inset 0 0 22px color-mix(in srgb, var(--accent) 14%, transparent);
}
.fil-medallion svg { width: 26px; height: 26px; display: block; }

.fil-badge {
  font-family: 'Space Grotesk', var(--display);
  font-size: .625rem;
  font-weight: 500;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--yellow);
  border: 1px solid rgba(242,194,48,.38);
  border-radius: 99px;
  padding: 6px 13px;
  white-space: nowrap;
}

/* Micro-signature labo, en haut à droite */
.fil-sig {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  font-family: ui-monospace, 'SFMono-Regular', 'Menlo', monospace;
  font-size: .62rem;
  letter-spacing: .12em;
  color: rgba(247,249,248,.26);
  transition: color .4s ease;
  pointer-events: none;
}
.fil-card:hover .fil-sig { color: color-mix(in srgb, var(--accent) 70%, transparent); }

/* ── Corps ────────────────────────────────────────────────────── */
.fil-card__title {
  font-family: 'Space Grotesk', var(--display);
  font-weight: 700;
  font-size: 1.32rem;
  line-height: 1.18;
  letter-spacing: -.02em;
  margin: 0;
}
.fil-card__desc {
  font-size: .92rem;
  line-height: 1.62;
  color: rgba(247,249,248,.6);
  margin: 0;
}

.fil-jobs {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
}
.fil-jobs li {
  font-size: .74rem;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 99px;
  color: rgba(247,249,248,.78);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  transition: color .3s ease, border-color .3s ease, box-shadow .3s ease, transform .3s ease;
}
@media (hover: hover) {
  .fil-jobs li:hover {
    color: #fff;
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 22%, transparent);
  }
}

/* ── Pied : deux actions ──────────────────────────────────────── */
.fil-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}
@media (min-width: 480px) {
  .fil-actions { grid-template-columns: 1fr auto; align-items: center; }
}

.fil-btn {
  --fill: 0%;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 13px 20px;
  border-radius: 12px;
  font-family: 'Space Grotesk', var(--display);
  font-weight: 700;
  font-size: .88rem;
  letter-spacing: -.01em;
  text-decoration: none;
  transition: box-shadow .35s ease, border-color .35s ease, color .35s ease;
}

/* Primaire : plein accent + remplissage animé au survol */
.fil-btn--primary {
  color: #07100b;
  background: var(--accent);
}
.fil-btn--primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #fff, color-mix(in srgb, var(--accent) 60%, #fff));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s cubic-bezier(.16,1,.3,1);
}
.fil-btn--primary > * { position: relative; z-index: 1; }
.fil-btn__arrow { transition: transform .35s cubic-bezier(.16,1,.3,1); }
@media (hover: hover) {
  .fil-btn--primary:hover::before { transform: scaleX(1); }
  .fil-btn--primary:hover { box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 34%, transparent); }
  .fil-btn--primary:hover .fil-btn__arrow { transform: translateX(5px); }
}

/* Secondaire : ghost */
.fil-btn--ghost {
  color: #fff;
  background: rgba(255,255,255,0);
  border: 1px solid rgba(255,255,255,.2);
}
@media (hover: hover) {
  .fil-btn--ghost:hover {
    background: rgba(255,255,255,.1);
    border-color: rgba(255,255,255,.55);
    box-shadow: 0 0 20px rgba(255,255,255,.1);
  }
}

.fil-btn:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

/* Transition de sortie vers la page filière */
.fil-card.is-leaving {
  transform: scale(1.014) !important;
  border-color: var(--accent);
  box-shadow: 0 0 60px color-mix(in srgb, var(--accent) 30%, transparent);
}
.fil-card.is-leaving::after { opacity: 1; }
.fil-fade {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--black);
  opacity: 0;
  pointer-events: none;
  transition: opacity .38s ease;
}
.fil-fade.is-on { opacity: 1; }

/* ═══ Intérieur de carte ═════════════════════════════════════════
   Ces règles ne concernent que les cartes de l'accueil : les pages
   détail n'utilisent pas .fil-card. Celles qui touchent des classes
   partagées (.fil-jobs, .fil-btn--primary) sont donc portées par
   .fil-card, jamais globalement.
   ═══════════════════════════════════════════════════════════════ */

/* Halo derrière le médaillon, éveillé au survol */
.fil-card .fil-medallion { position: relative; }
.fil-card .fil-medallion::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 20px;
  background: radial-gradient(circle, var(--accent), transparent 68%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
  z-index: -1;
}

/* Souligné éditorial sous le titre */
.fil-rule {
  display: block;
  width: 32px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  margin-top: -8px;
}

/* Jauge de places : le badge statique devient une donnée */
.fil-jauge { display: grid; gap: 7px; margin-top: -4px; }
.fil-jauge__piste {
  display: block;
  height: 3px;
  border-radius: 3px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.fil-jauge__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .8s cubic-bezier(.16,1,.3,1) calc(var(--delay, 0ms) + 260ms);
}
.fil-card.is-in .fil-jauge__fill { transform: scaleX(1); }
.fil-jauge__label {
  font-family: ui-monospace, 'SFMono-Regular', 'Menlo', monospace;
  font-size: 10px;
  letter-spacing: .1em;
  color: rgba(247,249,248,.45);
}

/* Tags : pills compactes, deux par ligne, point d'accent */
.fil-card .fil-jobs { gap: 8px; }
.fil-card .fil-jobs li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 12px;
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.12);
  /* Cascade à l'entrée, après la carte */
  opacity: 0;
  translate: 0 8px;
}
.fil-card.is-in .fil-jobs li {
  opacity: 1;
  translate: 0 0;
  transition: opacity .45s ease var(--d, 0ms), translate .45s cubic-bezier(.16,1,.3,1) var(--d, 0ms),
              color .3s ease, border-color .3s ease, background-color .3s ease, box-shadow .3s ease, transform .3s ease;
}
/* Cascade des tags : 50 ms entre chacun, après l'entrée de la carte.
   Quatre tags par carte, nth-child suffit — pas de JS pour ça. */
.fil-card .fil-jobs li:nth-child(1) { --d: calc(var(--delay, 0ms) + 220ms); }
.fil-card .fil-jobs li:nth-child(2) { --d: calc(var(--delay, 0ms) + 270ms); }
.fil-card .fil-jobs li:nth-child(3) { --d: calc(var(--delay, 0ms) + 320ms); }
.fil-card .fil-jobs li:nth-child(4) { --d: calc(var(--delay, 0ms) + 370ms); }

.fil-pt {
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}
@media (hover: hover) {
  .fil-card .fil-jobs li:hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
    box-shadow: none;
    transform: none;
  }
}

/* Filet avant le pied de carte */
.fil-sep {
  display: block;
  height: 1px;
  background: rgba(255,255,255,.08);
  margin-top: auto;
}

/* Motif de fond propre à la filière, rogné par le coin bas-droit */
.fil-motif {
  position: absolute;
  right: -14%;
  bottom: -16%;
  width: 52%;
  height: auto;
  aspect-ratio: 1;
  color: var(--white);
  opacity: .035;
  pointer-events: none;
  transition: opacity .4s ease;
  z-index: 0;
}

/* Bouton primaire : plein accent, texte noir verdâtre */
.fil-card .fil-btn--primary { color: var(--black); }
.fil-card .fil-btn--ghost { border-color: rgba(255,255,255,.25); }
@media (hover: hover) {
  .fil-card .fil-btn--ghost:hover {
    background: rgba(255,255,255,.05);
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    box-shadow: none;
  }
}

@media (max-width: 767px) {
  /* Pas de spotlight au toucher, motif plus discret */
  .fil-card::after { display: none; }
  .fil-motif { opacity: .03; width: 58%; }
}

@media (prefers-reduced-motion: reduce) {
  .fil-card::before { transition: none; }
  .fil-jauge__fill { transform: scaleX(1); transition: none; }
  .fil-card .fil-jobs li { opacity: 1; translate: none; transition: none; }
  .fil-card:hover .fil-medallion { animation: none; }
  .fil-motif { transition: none; }
}

/* ── Mobile (une colonne) : pas de spotlight, boutons pleine largeur.
   La borne 719 px s'aligne sur le passage à deux colonnes ci-dessus. ── */
@media (max-width: 719px) {
  .fil-card { padding: 24px 20px; }
  .fil-card::after { display: none; }
  .fil-actions { grid-template-columns: 1fr; }
  .fil-btn { width: 100%; }
  .fil-sig { top: 14px; right: 14px; }
}

/* Cartes plus étroites (tablette 2 col. / desktop 3 col.) : on repasse les
   deux actions l'une sous l'autre plutôt que de comprimer les libellés. */
@media (min-width: 720px) and (max-width: 899px) {
  .fil-actions { grid-template-columns: 1fr; }
  .fil-btn { width: 100%; }
}
@media (min-width: 1040px) and (max-width: 1179px) {
  .fil-actions { grid-template-columns: 1fr; }
  .fil-btn { width: 100%; }
}

/* ── Accessibilité : mouvement réduit ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .fil-paths { opacity: .5; }
  .fil-pulse { display: none; }
  .fil-path { stroke-dashoffset: 0 !important; transition: none; }
  .fil-node, .fil-node--origin { opacity: .5 !important; transition: none; }
  .fil-eyebrow__dot { animation: none; }
  .fil-title .w > span { transform: none; transition: none; }
  .fil-title .accent > span { animation: none; }
  .fil-sub { opacity: 1; transform: none; transition: none; }
  .fil-card {
    opacity: 1;
    translate: none;
    transform: none !important;
    transition: border-color .2s ease, background-color .2s ease;
  }
  .fil-card::before { animation: none; opacity: .5; }
  .fil-card::after { display: none; }
  .fil-btn--primary::before { transition: none; }
  .fil-fade { transition: none; }
}
