/* ------------------------------------------------------------------
   schema-layout.css — les six faisceaux du schéma et ses trois mises en page :
   empilée (téléphone), en rangées (768-1 359 px), de gauche à droite (1 360 px et plus).
   Un faisceau est un trait de 1,5 px, dégradé, qui s'éclaircit en approchant du panneau,
   terminé par un chevron fin. Il est décoratif (aria-hidden).
   --axis (x ou y) dit à schema-scene.js dans quel sens le tracer : il se dessine par
   transform (scaleX ou scaleY) depuis son origine, jamais autrement.
   ------------------------------------------------------------------ */

.beam {
  --axis: x;
  --dim: rgb(var(--muted-rgb) / 0.2);
  --lit: rgb(var(--soft-rgb) / 0.85);
  --from: var(--dim);
  --to: var(--lit);
  --angle: 90deg;
  position: absolute;
  display: block;
  background: linear-gradient(var(--angle), var(--from), var(--to));
  transform-origin: 0 50%;
  pointer-events: none;
}

/* Une sortie part du panneau : claire à sa source, elle s'éteint vers la carte */
.out .beam,
.link-out {
  --from: var(--lit);
  --to: var(--dim);
}

/* Le chevron, horizontal par défaut */
.beam::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1px;
  width: 7px;
  height: 7px;
  border: solid var(--soft);
  border-width: 1.5px 1.5px 0 0;
  transform: translateY(-50%) rotate(45deg);
}

/* La troisième entrée : pointillés discrets (un masque cacherait aussi le chevron) */
.src-later .beam {
  background: repeating-linear-gradient(var(--angle), rgb(var(--soft-rgb) / 0.5) 0 3px, transparent 3px 8px);
}

/* La branche sérieuse : or */
.out-gold .beam {
  --lit: var(--gold-bright);
  --dim: rgb(var(--gold-rgb) / 0.55);
}

.out-gold .beam::after {
  border-color: var(--gold);
  border-width: 2px 2px 0 0;
}

/* --- Téléphone : tout s'empile ; deux liaisons verticales encadrent le panneau,
       qui ne descend jamais sous 280 px de large --- */
.node .beam {
  display: none;
}

.link {
  --axis: y;
  --angle: 180deg;
  position: relative;
  justify-self: center;
  width: 1.5px;
  height: 32px;
  margin-block: 6px;
  transform-origin: 50% 0;
}

.link::after {
  top: auto;
  right: auto;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%) rotate(135deg);
}

.heart-wrap {
  justify-self: center;
  width: 100%;
  min-width: 280px;
  max-width: 400px;
}

/* --- 768 px et plus : les passages sont nommés sous le panneau --- */
@media (min-width: 768px) {
  .link {
    display: none;
  }

  .heart-wrap {
    max-width: none;
  }
}

/* --- De 768 à 1 359 px : entrées en rangée au-dessus du panneau, sorties en dessous.
       Le tout plafonné à 800 px : les six faisceaux tombent sur le panneau. --- */
@media (min-width: 768px) and (max-width: 1359px) {
  .flow-grid {
    --row-gap: 48px;
    row-gap: var(--row-gap);
    max-width: 800px;
    margin-inline: auto;
  }

  .lane {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .node .beam {
    --axis: y;
    --angle: 180deg;
    display: block;
    left: 50%;
    width: 1.5px;
    height: var(--row-gap);
    margin-left: -0.75px;
    transform-origin: 50% 0;
  }

  .src .beam {
    top: 100%;
  }

  .out .beam {
    bottom: 100%;
  }

  .out-gold .beam {
    width: 2.5px;
    margin-left: -1.25px;
  }

  .node .beam::after {
    top: auto;
    right: auto;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%) rotate(135deg);
  }
}

/* --- 1 360 px et plus : de gauche à droite, comme on lit --- */
@media (min-width: 1360px) {
  .flow-grid {
    --lane-gap: 56px;
    grid-template-columns: 224px minmax(0, 1fr) 240px;
    column-gap: var(--lane-gap);
  }

  /* Les cartes se répartissent sur la hauteur du panneau, pas sur celle des mots en dessous */
  .lane {
    align-content: space-around;
    padding-bottom: 48px;
  }

  .node .beam {
    display: block;
    top: 50%;
    width: var(--lane-gap);
    height: 1.5px;
    margin-top: -0.75px;
  }

  .src .beam {
    left: 100%;
  }

  .out .beam {
    right: 100%;
  }

  .out-gold .beam {
    height: 2.5px;
    margin-top: -1.25px;
  }

  /* La sortie arrive sur la carte : sa pointe touche le bord, pas l'intérieur */
  .out .beam::after {
    right: 2px;
  }
}
