/* --- Scroll-pinned process (accordion list + evolving 3D visual) ---
   Shared by the homepage's "How We Work" (4 stages) and every service
   detail page's own process section (8 stages) — moved out of home.css
   into its own file specifically so both pages can load it; a component
   trapped in a single page's CSS silently breaks everywhere else it's
   reused, which has bitten this site before.
   Without JS: a plain section, every step's description already expanded
   and readable, visual hidden (nothing to drive it). With JS: the panel
   pins while you scroll through however many stages this instance has, one
   step expands at a time, and a Three.js visual evolves in sync — same
   robust scroll-progress engine as the hero (see hero-story.js /
   crossfade-curve.js). */

.process-story {
  position: relative;
}

.no-js .process-story__track {
  display: none;
}

.no-js .process-story__visual {
  display: none;
}

.process-story.is-enhanced {
  display: grid;
}

.process-story.is-enhanced .process-story__sticky,
.process-story.is-enhanced .process-story__track {
  grid-area: 1 / 1;
}

.process-story.is-enhanced .process-story__sticky {
  position: relative;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* --process-stage-count defaults to 4 (home's "How We Work"); a page with a
   different number of steps (e.g. a service's 8-item process) sets it
   inline on this element so the scrollable track is exactly as tall as its
   own step count needs, not hardcoded to any one page's count. */
.process-story.is-enhanced .process-story__track {
  height: calc(var(--hero-phase-height, 100vh) * var(--process-stage-count, 4));
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.process-story.is-enhanced .process-story__marker {
  flex: 1 0 var(--hero-phase-height, 100vh);
}

/* Full-bleed variant: the 3D scene fills the entire pinned viewport edge to
   edge; the step list overlays on top in the corner, like the reference.
   Dark is this site's default theme (see tokens.css), so that's the base
   palette below; light is opt-in, following the exact same selector
   pattern tokens.css uses for the rest of the site. The Three.js scene
   itself reads the same data-theme/media-query rule and re-palettes its
   own colors to match. */
.process-story--full {
  --ps-bg-from: #0a0f16;
  --ps-bg-to: #10171f;
  --ps-scrim: 10, 15, 22;
  --ps-num-bg: #ffffff;
  --ps-num-color: #10161f;
  --ps-text-dim: #93a3b8;
  --ps-text-strong: #f4f7fb;
  --ps-text-desc: #b7c3d3;
  --ps-desc-border: rgba(255, 255, 255, 0.22);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .process-story--full {
    --ps-bg-from: #dde6f0;
    --ps-bg-to: #eef2f7;
    --ps-scrim: 238, 242, 247;
    --ps-num-bg: #ffffff;
    --ps-num-color: #1a2430;
    --ps-text-dim: #5a6b80;
    --ps-text-strong: #12181f;
    --ps-text-desc: #4a5a6d;
    --ps-desc-border: rgba(26, 36, 48, 0.18);
  }
}

:root[data-theme='light'] .process-story--full {
  --ps-bg-from: #dde6f0;
  --ps-bg-to: #eef2f7;
  --ps-scrim: 238, 242, 247;
  --ps-num-bg: #ffffff;
  --ps-num-color: #1a2430;
  --ps-text-dim: #5a6b80;
  --ps-text-strong: #12181f;
  --ps-text-desc: #4a5a6d;
  --ps-desc-border: rgba(26, 36, 48, 0.18);
}

.process-story--full.is-enhanced .process-story__sticky {
  position: sticky;
  background: linear-gradient(160deg, var(--ps-bg-from), var(--ps-bg-to));
}

/* The full-bleed absolute layout below only applies once JS has actually
   pinned the section (.is-enhanced) — on small viewports or when WebGL is
   unavailable, process-story.js deliberately skips adding that class, and
   everything here must fall back to normal static flow (see the base
   .process-story__visual/__overlay rules further down) rather than leaving
   absolutely-positioned elements with no positioned ancestor to anchor to. */
.process-story--full.is-enhanced .process-story__visual {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  margin: 0;
}

.process-story--full:not(.is-enhanced) .process-story__visual {
  display: none;
}

.process-story--full .process-story__canvas {
  object-fit: cover;
}

.process-story__scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(50rem 42rem at 0% 100%, rgba(var(--ps-scrim), 0.96) 0%, rgba(var(--ps-scrim), 0.7) 32%, rgba(var(--ps-scrim), 0.28) 58%, transparent 82%);
  pointer-events: none;
}

.process-story--full.is-enhanced .process-story__overlay {
  position: absolute;
  z-index: 1;
  left: 0;
  bottom: 0;
  width: 100%;
  max-width: 30rem;
  padding: var(--space-2xl) var(--container-pad);
  pointer-events: none;
}

.process-story__overlay > * {
  pointer-events: auto;
}

.process-story__item {
  padding-block: var(--space-sm);
}

.process-story__head {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  text-align: left;
  cursor: default;
}

.process-story.is-enhanced .process-story__head {
  cursor: pointer;
}

.process-story__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-xs);
  color: var(--ps-text-dim);
  background: transparent;
  box-shadow: none;
  transition: background var(--duration-base) var(--ease-out), color var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
}

.process-story__item.is-active .process-story__num {
  background: var(--ps-num-bg);
  color: var(--ps-num-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}

.process-story__title {
  font-family: var(--font-display);
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  color: var(--ps-text-dim);
  transition: font-size var(--duration-base) var(--ease-out), font-weight var(--duration-base) var(--ease-out), color var(--duration-base) var(--ease-out);
}

.process-story__item.is-active .process-story__title {
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
  color: var(--ps-text-strong);
}

/* Grid-rows 0fr/1fr trick: smoothly animates to/from auto height without
   JS measuring content, and — critically — defaults to expanded (1fr) so
   every description is already visible/readable without JS. */
.process-story__desc-wrap {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.4s var(--ease-out);
  margin-left: calc(2.25rem + var(--space-md));
  border-left: 2px solid var(--ps-desc-border);
}

.process-story.is-enhanced .process-story__desc-wrap {
  grid-template-rows: 0fr;
}

.process-story.is-enhanced .process-story__item.is-active .process-story__desc-wrap {
  grid-template-rows: 1fr;
}

.process-story__desc {
  overflow: hidden;
  color: var(--ps-text-desc);
  font-size: var(--fs-sm);
  padding-left: var(--space-md);
}

.process-story__visual {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 26rem;
  margin-inline: auto;
}

.process-story__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Base (non-enhanced) overlay: plain readable block-flow list — used when
   JS never adds .is-enhanced, i.e. no-JS, small viewports, or no WebGL. */
.process-story__overlay {
  padding: var(--space-xl) var(--container-pad);
}

