/* Pipeline animé de l'accueil (style CI/CD) */
.pipeline { position: relative; overflow: hidden; }
.pipeline::before { position: absolute; inset: 0; z-index: 0; pointer-events: none; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 32px 32px; opacity: .35; mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%); content: ""; }
.pipeline > * { position: relative; z-index: 1; }

.pipeline .flow-head { align-items: center; }
.pipeline-run { margin-left: 10px; padding: 2px 8px; color: var(--soft); font-style: normal; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.pipeline-state { display: inline-flex; align-items: center; gap: 8px; }
.pipeline-state::before { width: 8px; height: 8px; background: currentColor; border-radius: 50%; content: ""; }
.pipeline.is-running .pipeline-state { color: #f5b74a; }
.pipeline.is-running .pipeline-state::before { animation: pipe-pulse 1s ease-in-out infinite; }
.pipeline.is-success .pipeline-state { color: var(--success); }

.pipeline-method { padding: clamp(20px, 3vw, 28px); }
.pipeline-method .flow-steps strong { font-size: 21px; }

/* Rail de progression */
.pipeline-rail { position: relative; height: 4px; margin: 0 4px 16px; overflow: hidden; background: var(--surface-2); border-radius: 999px; }
.pipeline-rail::before { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(122, 162, 255, .35) 14px 18px); opacity: 0; content: ""; }
.pipeline.is-running .pipeline-rail::before { opacity: 1; animation: pipe-flow .8s linear infinite; }
.pipeline-fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: linear-gradient(90deg, var(--accent-strong), #00b0f0); border-radius: inherit; box-shadow: 0 0 12px rgba(37, 88, 240, .7); transition: width .7s cubic-bezier(.2, .7, .2, 1); }
.pipeline-fill::after { position: absolute; top: 50%; right: -2px; width: 10px; height: 10px; background: #fff; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0, 176, 240, .35), 0 0 16px #00b0f0; transform: translateY(-50%); content: ""; }
.pipeline.is-success .pipeline-fill { background: linear-gradient(90deg, var(--accent-strong), var(--success)); }

/* Étapes */
.pipeline .flow-steps li { overflow: hidden; transition: border-color .3s ease, box-shadow .3s ease, transform .3s ease, opacity .3s ease; }
.pipeline .flow-steps li.is-ai { border-color: var(--line); }
.pipeline .flow-steps li.is-ai span { color: var(--muted); }
.pipeline .flow-steps li .step-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pipeline.is-animated .flow-steps li { opacity: .55; }
.pipeline.is-animated .flow-steps li.is-running, .pipeline.is-animated .flow-steps li.is-done { opacity: 1; }
.pipeline .flow-steps li.is-running { border-color: var(--accent-strong); box-shadow: 0 0 0 1px var(--accent-strong), 0 12px 40px -18px rgba(37, 88, 240, .9); transform: translateY(-2px); }
.pipeline .flow-steps li.is-running::after { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(122, 162, 255, .14) 50%, transparent 70%); animation: pipe-scan 1.1s linear infinite; content: ""; }
.pipeline .flow-steps li.is-done { border-color: rgba(111, 211, 160, .45); }
.pipeline .flow-steps li.is-running span:first-child { color: var(--accent); }

.step-status { position: relative; display: inline-block; width: 16px; height: 16px; flex: none; border: 2px solid var(--line-2); border-radius: 50%; }
li.is-running .step-status { border-color: rgba(122, 162, 255, .25); border-top-color: var(--accent); animation: pipe-spin .7s linear infinite; }
li.is-done .step-status { background: var(--success); border-color: var(--success); }
li.is-done .step-status::after { position: absolute; top: 1px; left: 4px; width: 4px; height: 8px; border: solid #0a0d14; border-width: 0 2px 2px 0; transform: rotate(45deg); content: ""; }
.pipeline:not(.is-animated) .step-status { background: var(--success); border-color: var(--success); }
.pipeline:not(.is-animated) .step-status::after { position: absolute; top: 1px; left: 4px; width: 4px; height: 8px; border: solid #0a0d14; border-width: 0 2px 2px 0; transform: rotate(45deg); content: ""; }

.step-time { display: block; min-height: 18px; margin-top: 12px; color: var(--muted); font: 500 12px var(--mono); }
.pipeline .flow-steps li .step-time { color: var(--muted); }
.pipeline .flow-steps li.is-done .step-time { color: var(--success); }

/* Journal d'exécution */
.pipeline-log { display: flex; flex-direction: column; justify-content: flex-end; height: 84px; margin-top: 16px; padding: 12px 16px; overflow: hidden; background: #070b13; border: 1px solid #232b3a; border-radius: 12px; font: 500 12.5px/1.65 var(--mono); }
.pipeline-log p { margin: 0; color: #b4bdcc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: pipe-line .35s ease both; }
.pipeline-log .log-time { margin-right: 10px; color: #5f6b80; }
.pipeline-log .log-ok { color: #6fd3a0; }
.pipeline-log .log-run { color: #7aa2ff; }
.pipeline-log .log-cursor { display: inline-block; width: 7px; height: 13px; margin-left: 4px; vertical-align: -2px; background: #7aa2ff; animation: terminal-blink 1.1s steps(2, start) infinite; }

@keyframes pipe-spin { to { transform: rotate(360deg); } }
@keyframes pipe-scan { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes pipe-flow { from { background-position: 0 0; } to { background-position: 18px 0; } }
@keyframes pipe-pulse { 50% { opacity: .35; } }
@keyframes pipe-line { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 700px) {
  .pipeline-log { height: 92px; font-size: 11.5px; }
  .pipeline-run { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pipeline-rail::before, .pipeline .flow-steps li.is-running::after { animation: none; }
}
