/* ═══════════════════════════════════════════════════════════════════════════
   Runde 3: Prüf-Pipeline im Hero, Scan-Skizze, Zähler, Live-Fortschritt
   (Konzept: docs/ANIMATIONSKONZEPT.md, Abschnitt „Runde 3“)

   Regeln:
   - Endzustand = Normalzustand. Ausgeblendet wird nur per Klasse .is-wait, die das Skript setzt,
     und nur bei prefers-reduced-motion: no-preference.
   - Bewegt werden nur transform und opacity (Zahlen sind Text, den das Skript hochzählt).
   - Farben nur aus den Tokens von app.css; Kupfer (--accent) für Befunde und die Scan-Linie.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Typografie-Feinschliff der Startseite ───────────────────────────────── */
.page-home h1, .page-home h2, .status-card h1 { text-wrap: balance; }
.page-home .lead, .page-home .muted { text-wrap: pretty; }
.page-home .hero { border-bottom: 1px solid var(--line); }
.page-home .hero-kicker { display: flex; align-items: center; gap: 10px; }
.page-home .hero-kicker::before { content: ""; width: 8px; height: 8px; background: var(--accent); flex: none; }
.areas-name { display: grid; gap: 2px; align-content: start; }
.areas-count { font-size: var(--t-12); color: var(--text-3); letter-spacing: .02em; }
.areas-count span { display: inline-block; min-width: 2.2ch; text-align: right; color: var(--text-2); font-weight: 500; }
.areas-total { margin-top: var(--s-4); color: var(--text-2); font-size: var(--t-14); max-width: 72ch; }
.areas-total strong { color: var(--text); font-weight: 600; }
.areas-total strong span { display: inline-block; min-width: 3ch; text-align: right; color: var(--accent-hover); }

/* ── Hero-Pipeline ───────────────────────────────────────────────────────── */
.pipe { background: var(--surface); border: 1px solid var(--line-2); min-width: 0; }
.pipe-bar { background: var(--text); padding: 10px var(--s-5); }
.pipe-bar-label { color: var(--bg); margin: 0; opacity: .86; }
.pipe-body { padding: var(--s-4) var(--s-5) var(--s-5); display: grid; gap: var(--s-3); }
.pipe-title { font-size: var(--t-20); }
.pipe-scan { display: grid; gap: var(--s-2); }
.pipe-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: var(--t-12); color: var(--text-3); }
.pipe-legend-note { margin-left: auto; font-family: var(--f-mono); letter-spacing: .04em; }
.pp-key { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ok); margin-right: -8px; }
.pp-key-bad { border-color: var(--accent); }

.pipe-steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--text); }
.pp-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; column-gap: var(--s-3); align-items: center; min-height: 27px; padding: 2px 0; border-bottom: 1px solid var(--line); font-size: var(--t-14); }
.pp-area { grid-template-columns: 16px minmax(0, 1fr) 72px 40px; }
.pp-chk { width: 14px; height: 14px; color: var(--ok); }
.pp-name { color: var(--text); min-width: 0; }
.pp-val { text-align: right; color: var(--text-2); font-size: var(--t-13); white-space: nowrap; }
.pp-val-text { font-family: var(--f-mono); font-size: var(--t-12); color: var(--text-3); }
.pp-n { display: inline-block; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
.pp-bar { width: 72px; height: 4px; }
.pp-bar-bg { fill: var(--ring-track); }
.pp-bar-fg { fill: var(--text-2); }
.pp-total { border-bottom: 1px solid var(--text); }
.pp-total .pp-name { font-weight: 700; font-family: var(--f-display); }
.pp-total .pp-n { color: var(--accent-hover); font-size: var(--t-18); font-weight: 600; }
.pipe-foot { font-size: var(--t-13); color: var(--text-2); }
.pipe-foot a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; min-height: 32px; }
.pipe-foot svg { width: 16px; height: 16px; }

/* Skizze */
.pp-skizze { width: 100%; height: auto; aspect-ratio: 360 / 176; background: var(--bg); overflow: hidden; border: 0; }
.pp-fr { fill: var(--surface); stroke: var(--line-2); }
.pp-ln { fill: none; stroke: var(--line-2); stroke-width: 1; }
.pp-fein { stroke: var(--line); }
.pp-bl { fill: var(--ring-track); }
.pp-dk { fill: var(--text-2); }
.pp-cta { fill: var(--text); }
.pp-band { fill: var(--accent); opacity: .09; }
.pp-beam { fill: var(--accent); }
.pp-scan { opacity: 0; }
.pp-mk circle { fill: var(--surface); stroke-width: 2; }
.pp-mk path { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pp-mk-ok circle, .pp-mk-ok path { stroke: var(--ok); }
.pp-mk-bad circle, .pp-mk-bad path { stroke: var(--accent); }

@media (max-width: 599px) {
  .pipe-body { padding: var(--s-4); }
  .pipe-bar { padding-inline: var(--s-4); }
  .pp-area { grid-template-columns: 16px minmax(0, 1fr) 40px 36px; }
  .pp-bar { width: 40px; }
  .pp-val-text { font-size: 11px; }
}

/* ── Bewegung ────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .pp-row { transition: opacity .35s linear, transform .5s cubic-bezier(.16, 1, .3, 1); }
  .pp-row.is-wait { opacity: 0; transform: translateY(8px); }
  .pp-bar-fg { transform-box: fill-box; transform-origin: 0 50%; transition: transform .8s cubic-bezier(.16, 1, .3, 1); }
  .pp-row.is-wait .pp-bar-fg { transform: scaleX(0); }
  .pp-chk { transition: opacity .25s linear, transform .4s cubic-bezier(.16, 1, .3, 1); }
  .pp-row.is-active .pp-chk { opacity: 0; transform: scale(.5); }
  .pp-row.is-active .pp-name { color: var(--accent-hover); }

  .pp-mk { transform-box: fill-box; transform-origin: 50% 50%; transition: opacity .25s linear, transform .5s cubic-bezier(.16, 1, .3, 1); }
  .pp-mk.is-wait { opacity: 0; transform: scale(.4); }

  /* Scan-Linie: einmal von oben nach unten, Dauer = Dauer der Pipeline (pipeline.js: 200 + 12 · 170 ms) */
  .pipe.is-run .pp-scan { opacity: 1; transform: translateY(176px); transition: transform 2.3s linear, opacity .2s linear; }
  .pipe.is-fin .pp-scan { opacity: 0; transition: opacity .5s linear; }

  /* Live-Fortschritt: Skizze mit endlos laufender Scan-Linie, solange die Analyse läuft */
  .pp-loop .pp-scan { opacity: 1; animation: pp-scan 3.2s linear infinite; }
  @keyframes pp-scan { from { transform: translateY(0); } to { transform: translateY(176px); } }
}
@media print { .pp-row, .pp-mk { opacity: 1 !important; transform: none !important; } .pp-scan { display: none; } }

/* ═══ Live-Fortschritt (audits/progress.html) ═══════════════════════════════ */
.live { display: grid; gap: var(--s-7); align-items: start; }
@media (min-width: 960px) { .live { grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 72px; } }
.live-main { min-width: 0; max-width: 640px; }
.live-head { display: grid; gap: var(--s-2); }
.live-head h1 { font-size: var(--t-32); }
.live-meter { margin-top: var(--s-6); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px var(--s-4); align-items: end; }
.live-pct { font: 500 clamp(2.5rem, 2rem + 3vw, 3.75rem)/1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.04em; min-width: 4.6ch; }
.live-pct small { font-size: .4em; letter-spacing: 0; color: var(--text-3); margin-left: 2px; }
.live-stage { padding-bottom: 6px; font-weight: 600; font-size: var(--t-16); min-width: 0; }
.live-bar { display: none; grid-column: 1 / -1; position: relative; height: 4px; background: var(--ring-track); overflow: hidden; margin-top: var(--s-2); }
.live-js .live-bar { display: block; }
.live-js .live-fallback { display: none; }
.live-bar-fg { position: absolute; inset: 0; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); transition: transform .6s cubic-bezier(.16, 1, .3, 1); }

.stage-list.pp-pipeline { margin-top: var(--s-6); border-top: 1px solid var(--text); gap: 0; font-size: var(--t-14); }
.pp-pipeline li { position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; column-gap: var(--s-4); align-items: center; padding: 11px 0; min-height: 46px; border-bottom: 1px solid var(--line); color: var(--text-3); overflow: hidden; }
.pp-pipeline li::before { display: none; }
.pp-pipeline .st-dot { grid-column: 1; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); position: relative; justify-self: center; }
.pp-pipeline li .st-dot svg { position: absolute; inset: -1.5px; width: 14px; height: 14px; margin: 0; opacity: 0; color: var(--on-accent); transition: opacity .2s linear; }
.pp-pipeline .st-name { grid-column: 2; }
.pp-pipeline .st-detail { grid-column: 3; font-family: var(--f-mono); font-size: var(--t-12); color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; min-width: 6ch; }
.pp-pipeline li.is-done { color: var(--text-2); }
.pp-pipeline li.is-done .st-dot { background: var(--ok); border-color: var(--ok); }
.pp-pipeline li.is-done .st-dot svg { opacity: 1; color: var(--surface); }
.pp-pipeline li.is-active { color: var(--text); font-weight: 600; }
.pp-pipeline li.is-active .st-dot { border-color: var(--accent); background: var(--accent); }
.pp-pipeline li.is-active .st-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid var(--accent); opacity: 0; }
.pp-pipeline li.is-active .st-detail { color: var(--text-2); }
.pp-pipeline .st-sweep { position: absolute; left: 0; bottom: 0; height: 2px; width: 28%; background: var(--accent); opacity: 0; }
.pp-pipeline li.is-active .st-sweep { opacity: .9; }

@media (prefers-reduced-motion: no-preference) {
  .pp-pipeline li.is-active .st-dot::after { animation: st-puls 1.6s ease-out infinite; }
  .pp-pipeline li.is-active .st-sweep { animation: st-sweep 2.2s cubic-bezier(.45, 0, .25, 1) infinite; }
  .pp-pipeline li.is-done .st-dot { animation: st-pop .45s cubic-bezier(.16, 1, .3, 1); }
  @keyframes st-puls { from { transform: scale(.7); opacity: .55; } to { transform: scale(1.6); opacity: 0; } }
  @keyframes st-sweep { from { transform: translateX(-100%); } to { transform: translateX(360%); } }
  @keyframes st-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
}

.live-side { min-width: 0; display: grid; gap: var(--s-3); }
.live-side .pp-skizze { border: 1px solid var(--line-2); }
.live-side-note { font-size: var(--t-12); color: var(--text-3); font-family: var(--f-mono); letter-spacing: .04em; }
.live-side-total { font-size: var(--t-14); color: var(--text-2); }
.live-side-total strong { font-family: var(--f-mono); font-weight: 600; color: var(--text); }
@media (max-width: 959px) { .live-side { order: 2; } }
