/* ============================================================
   css/process.css — Scrollytelling: diagram SVG (desktop) + Sticky HUD (mobile)
   Stan steruje js/process.js (klasy is-active / is-done, data-active-step).
   Uwaga: NIGDY overflow:hidden na przodkach — psuje position: sticky.
   ============================================================ */
.process-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; align-items: start; }

/* ---------- Mobile (< 960px): kompaktowy HUD ---------- */
.process-visual { display: none; }
.process-hud {
  position: sticky; inset-block-start: var(--nav-h); z-index: 40;
  display: flex; align-items: center; gap: .65rem; block-size: var(--hud-h);
  margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter);
  background: var(--bg-glass); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-block-end: 1px solid var(--border-subtle);
}
.mini-stack { inline-size: 2.25rem; block-size: 2.25rem; flex: none; }
.mini-layer { fill: var(--surface); stroke: var(--border-strong); stroke-width: .8; transition: transform .45s var(--ease), fill .3s, stroke .3s; }
.mini-layer.is-done { stroke: var(--accent); }
.mini-layer.is-active { fill: var(--accent-soft); stroke: var(--accent); transform: translateY(-2px); }
.hud-text { display: grid; min-inline-size: 0; flex: 1; line-height: 1.25; }
.hud-count { font-size: .72rem; letter-spacing: .1em; color: var(--accent); }
.hud-title { font-size: .875rem; font-weight: 500; white-space: nowrap; }
.hud-segments { display: flex; gap: .15rem; flex: none; }
.hud-segments a { display: grid; place-items: center; inline-size: 1.25rem; block-size: 2.75rem; text-decoration: none; }
.hud-segments a::before { content: ""; inline-size: .95rem; block-size: 4px; border-radius: 2px; background: var(--border-strong); opacity: .55; transition: background-color .3s, opacity .3s; }
.hud-segments a[aria-current="step"]::before { background: var(--accent); opacity: 1; }

/* ---------- Etapy ---------- */
.process-steps { position: relative; padding-inline-start: 1.75rem; }
.process-steps::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 1px; background: var(--border-subtle); }
.step { padding-block: clamp(2rem, 5vw, 3.5rem); scroll-margin-top: calc(var(--nav-h) + var(--hud-h) + 1rem); }
.step + .step { border-block-start: 1px solid var(--border-subtle); }
.step-num { font: 500 .8rem/1 var(--font-mono); letter-spacing: .12em; color: var(--accent); }
.step h3 { margin-block: .9rem .6rem; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem); letter-spacing: -.03em; }
.step-tag { margin-block-end: 1.1rem; font-weight: 500; color: var(--accent); }
.step-body { max-inline-size: 52ch; color: var(--text-secondary); }

/* Pasek postępu w CSS (progresywne ulepszenie — tylko przeglądarki ze scroll-driven animations) */
@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
  .process-steps::after {
    content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 1px; background: var(--accent);
    transform-origin: top; animation: rail linear both; animation-timeline: view(); animation-range: cover 15% cover 85%;
  }
  @keyframes rail { from { transform: scaleY(0); } to { transform: scaleY(1); } }
}
@media (prefers-reduced-motion: reduce) { .process-steps::after { display: none; } }

/* ---------- Desktop (≥ 960px): 42% / 58%, sticky diagram po lewej ---------- */
@media (min-width: 960px) {
  .process-grid { grid-template-columns: minmax(0, 42fr) minmax(0, 58fr); gap: clamp(2.5rem, 6vw, 6rem); }
  .process-hud { display: none; }
  .process-visual { display: block; position: sticky; inset-block-start: calc(var(--nav-h) + 2rem); }
  .process-steps { padding-inline-start: 2rem; }
  .step { min-block-size: 64vh; display: flex; flex-direction: column; justify-content: center; scroll-margin-top: calc(var(--nav-h) + 1rem); }
  html.js .step { opacity: .62; transition: opacity .5s; }
  html.js .step.is-active { opacity: 1; }
}
@media (min-width: 960px) and (prefers-reduced-motion: reduce) { html.js .step { opacity: 1; transition: none; } }

.visual-frame { padding: 1.25rem 1.25rem 1rem; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 20px; }
.stack { inline-size: 100%; block-size: auto; max-block-size: calc(100dvh - var(--nav-h) - 12rem); margin-inline: auto; }
.visual-caption { display: flex; align-items: baseline; gap: 1rem; margin-block-start: .75rem; padding-block-start: .75rem; border-block-start: 1px solid var(--border-subtle); font-size: .78rem; letter-spacing: .06em; color: var(--text-muted); }
.visual-caption [data-step-count] { color: var(--accent); }

/* ---------- Warstwy diagramu ---------- */
.layer { transition: transform .6s var(--ease); }
.layer .top { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; transition: fill .4s, stroke .4s; }
.layer .side { fill: var(--border-subtle); stroke: var(--border-strong); stroke-width: 1; transition: fill .4s, stroke .4s; }
.layer .motif { fill: none; stroke: var(--text-muted); stroke-width: 1; opacity: .6; transition: stroke .4s, opacity .4s; }
.layer .lead-line { fill: none; stroke: var(--border-strong); stroke-width: 1; }
.layer text { font: 500 11px var(--font-mono); letter-spacing: .06em; fill: var(--text-muted); transition: fill .4s; }

.layer.is-done .top { fill: var(--surface-alt); stroke: var(--accent); stroke-dasharray: none; }
.layer.is-done .side { stroke: var(--accent); }
.layer.is-active { transform: translateY(-14px); }
.layer.is-active .top { fill: var(--accent-soft); stroke: var(--accent); stroke-dasharray: none; }
.layer.is-active .side { fill: var(--accent); fill-opacity: .3; stroke: var(--accent); }
.layer.is-active .motif { stroke: var(--accent); opacity: 1; }
.layer.is-active text, .layer.is-done text { fill: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .layer, .mini-layer { transition: none; }
  .layer.is-active, .mini-layer.is-active { transform: none; }
}
@media (forced-colors: active) {
  .layer .top, .layer .side { stroke: CanvasText; }
  .layer.is-active .top { fill: Highlight; }
}
