/* ==========================================================================
   FLUX « Ce qui se passe à chaque appel »
   Quatre cartes reliées au cœur Automya par des courbes. Une impulsion
   lumineuse parcourt les courbes au rythme d'un scénario (js/flux.js) :
   l'appel arrive, Automya dit ce qu'il comprend, les résultats repartent.
   Les courbes sont recalculées par le JS à partir de la position réelle
   des cartes : elles suivent la mise en page, ordinateur comme téléphone.
   ========================================================================== */
.flux { padding: 72px 0 150px; }

.flux-legende {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 0 44px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--text-tertiary);
}
.flux-pastille {
    width: 7px; height: 7px; border-radius: 50%;
    background: #34D399;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
    animation: fluxPastille 2s ease-out infinite;
}
@keyframes fluxPastille { to { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); } }

.flux-carte {
    position: relative;
    max-width: 980px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px minmax(0, 1fr);
    align-items: center;
    gap: 0 72px;
}
.flux-traits {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    z-index: 0;
}
.flux-trait { fill: none; stroke: rgba(148, 163, 184, 0.16); stroke-width: 1.5; }
.flux-impulsion {
    fill: none;
    stroke: #CFE3FF;
    stroke-width: 2.6;
    stroke-linecap: round;
    filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.9));
    opacity: 0;
}

/* ---------- Cartes ---------- */
.flux-col { display: flex; flex-direction: column; gap: 22px; position: relative; z-index: 1; }
.flux-noeud {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    background: #101D31;
    border: 1px solid rgba(148, 163, 184, 0.12);
    transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.flux-icone {
    flex-shrink: 0;
    width: 42px; height: 42px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(96, 165, 250, 0.1);
    color: var(--accent);
    transition: background 0.4s ease, color 0.4s ease;
}
.flux-icone svg { width: 20px; height: 20px; }
.flux-textes { display: grid; min-width: 0; }
.flux-nom { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
/* Sous-titre au repos et message d'événement occupent la même case :
   l'un s'efface quand l'autre apparaît, sans faire bouger la carte. */
.flux-sous, .flux-evt {
    grid-row: 2; grid-column: 1;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.flux-sous { color: var(--text-tertiary); }
.flux-evt { color: #8FC0FF; font-weight: 500; opacity: 0; transform: translateY(6px); }

.flux-noeud.actif {
    border-color: rgba(96, 165, 250, 0.55);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.08), 0 14px 34px -12px rgba(47, 107, 255, 0.55);
    transform: translateY(-2px);
}
.flux-noeud.actif .flux-icone { background: #2F6BFF; color: #fff; }
.flux-noeud.actif .flux-sous { opacity: 0; transform: translateY(-6px); }
.flux-noeud.actif .flux-evt { opacity: 1; transform: none; }
.flux-sorties .flux-noeud.actif { border-color: rgba(52, 211, 153, 0.55); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.08), 0 14px 34px -12px rgba(16, 185, 129, 0.5); }
.flux-sorties .flux-noeud.actif .flux-icone { background: #10B981; }
.flux-sorties .flux-evt { color: #6EE7B7; }

/* ---------- Cœur ---------- */
.flux-coeur {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}
.flux-orbe {
    position: relative;
    width: 112px; height: 112px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 35% 30%, #2A2A2E 0%, #0A0A0B 60%, #000000 100%);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 20px 50px -12px rgba(0, 0, 0, 0.8);
    transition: box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.flux-orbe img { position: relative; z-index: 2; }
/* Deux anneaux en arc qui tournent en sens inverse : le « moteur » tourne. */
.flux-anneau {
    position: absolute; inset: -12px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(147, 197, 253, 0.85);
    border-right-color: rgba(147, 197, 253, 0.25);
    animation: fluxTourne 3.2s linear infinite;
}
.flux-anneau-2 {
    inset: -24px;
    border-width: 1.5px;
    border-top-color: transparent;
    border-bottom-color: rgba(147, 197, 253, 0.55);
    border-left-color: rgba(147, 197, 253, 0.15);
    animation-duration: 5.5s;
    animation-direction: reverse;
}
@keyframes fluxTourne { to { transform: rotate(360deg); } }
/* Onde qui part du cœur à chaque réception. */
.flux-onde {
    position: absolute; inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(147, 197, 253, 0.7);
    opacity: 0;
}
.flux-coeur.recoit .flux-onde { animation: fluxOnde 0.9s ease-out; }
.flux-coeur.recoit .flux-orbe { transform: scale(1.05); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3), 0 0 60px -6px rgba(96, 165, 250, 0.7); }
@keyframes fluxOnde { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.9); } }

/* Sur ordinateur, le nom et le statut pendent sous l'orbe sans compter
   dans sa hauteur : l'orbe reste pile entre les deux cartes, et les
   courbes arrivent symétriques. */
.flux-coeur-nom, .flux-statut {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
}
.flux-coeur-nom { top: calc(100% + 30px); font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.flux-statut {
    top: calc(100% + 54px);
    min-height: 2.8em;
    max-width: 240px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #8FC0FF;
    transition: opacity 0.3s ease;
}
.flux-statut.change { opacity: 0; }

/* ---------- Téléphone : tout en colonne, courbes verticales ---------- */
@media (max-width: 820px) {
    .flux { padding-bottom: 84px; }
    .flux-carte { grid-template-columns: 1fr; gap: 56px 0; max-width: 420px; }
    .flux-coeur-nom, .flux-statut { position: static; transform: none; }
    .flux-coeur-nom { margin-top: 22px; }
    .flux-col { gap: 14px; }
    .flux-noeud { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .flux-anneau, .flux-pastille { animation: none; }
    .flux-impulsion { display: none; }
}
