/* =============================================================================
   simulation-vc.css — Page-only styles for Simulation & Virtual Commissioning
   Foundation (style.css) provides all base tokens, components, and utilities.
   This file: hero variant, scrollytelling flagship, stat row, citations.
   Motion budget: transform/opacity only; all motion collapses under
   prefers-reduced-motion (handled globally in style.css + local overrides here).
   ============================================================================= */

/* =============================================================================
   1. HERO
   ============================================================================= */
/* Full-bleed photo-background hero — same pattern as the integrator/manufacturer
   main pages: image covers the section, a left→right dark wash keeps the
   left-anchored white text legible. */
.svc-hero .hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.svc-hero .hero__bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.svc-hero .hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg,
    rgba(7, 19, 35, 0.82) 0%,
    rgba(7, 19, 35, 0.52) 52%,
    rgba(7, 19, 35, 0.22) 100%);
  z-index: 1;
}
.svc-hero .hero__inner {
  position: relative;
  z-index: 2;
  /* Use the standard centered .container (max-width + margin-inline:auto) so the
     headline and body sit in the same limited, centered column as the home hero
     — instead of left-anchored and spanning wide on big displays. */
}
/* Constrain the text column within the left-anchored inner. */
.svc-hero .hero__sub { max-width: 54ch; }
/* White headline + accent eyebrow on the dark photo (the .hero--home rules that
   do this on the other pages live in index.css, which this page doesn't load). */
.svc-hero h1 { color: var(--c-on-dark); }
.svc-hero .hero__eyebrow { color: var(--c-accent); }

/* =============================================================================
   2. TOOL CARDS — minor tweaks on top of .card base
   ============================================================================= */
.card__eyebrow-sub {
  font-family: var(--f-mono);
  font-size: var(--t-eyebrow);
  font-weight: 400;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  /* --c-ink-3 fails AA at eyebrow size; use --c-ink-2 for sufficient contrast */
  color: var(--c-ink-2);
  margin-top: calc(var(--sp-1) * -0.5);
}

/* =============================================================================
   3. GESTURE-STEPPED FLAGSHIP — "Run an Experiment"
   Pinned two-column layout: sticky SVG schematic (left) + stepped cards (right).
   Engine: js/step-scroller.js · wiring: js/svc-experiment.js
   One scroll gesture advances exactly one step.
   ============================================================================= */

/* Outer section — section--dark provides background; padding-block:0 lets the
   section head + stage + track control all spacing. overflow:clip clips without
   creating a new scroll container, so position:sticky on the stage works. */
.svc-stepper {
  padding-block: 0;
  overflow: clip;
  position: relative;
}

/* ---- Section head — a normal heading above the stepper; scrolls away
   before the stage pins (it is NOT inside the pinned stage). ---- */
.svc-stepper__head {
  padding-block: var(--section-pad) var(--sp-6);
}

.svc-stepper__eyebrow {
  display: block;
  color: var(--c-accent);
  margin-bottom: var(--sp-2);
}

.svc-stepper__head h2 {
  color: var(--c-on-dark);
}

.svc-stepper__lead {
  color: var(--c-on-dark-2);
  margin-top: var(--sp-2);
}

/* --- Stepper scaffold --- */
.svc-stepper__stage {
  position: sticky;
  top: var(--nav-h);
  height: calc(100svh - var(--nav-h));
  overflow: clip;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The runway: one spacer block per step. The negative margin pulls the runway
   up over the sticky stage's own flow box (one viewport tall), so step 0 begins
   exactly where the stage pins. Without it there is ~1 viewport of dead scroll
   on entry and exit. */
.svc-stepper__track {
  margin-top: calc(-100svh + var(--nav-h));
  pointer-events: none;
}
.svc-stepper__block { height: 100svh; }

/* Two-column layout inside the stage */
.svc-stepper__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--sp-6);
  width: 100%;
}

/* ---- Left: schematic column ---- */
.svc-stepper__schematic-col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* Schematic wrapper — explicit aspect ratio, no layout shift */
.svc-scrolly__schematic-wrap {
  width: 100%;
  aspect-ratio: 720 / 460;
  position: relative;
}

/* Four swappable Claude-Design step graphics, all stacked in one grid cell;
   only the active step's layer is shown (toggled by [data-active-step], set by
   svc-experiment.js). */
.svc-schematic {
  width: 100%;
  height: 100%;
  display: grid;
}
.svc-schematic--sim .svc-sim-step {
  grid-area: 1 / 1;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.svc-schematic--sim .svc-sim-step svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.svc-schematic--sim .mono { font-family: "JetBrains Mono", var(--f-mono, monospace); }
.svc-schematic--sim[data-active-step="1"] .svc-sim-step[data-step="1"],
.svc-schematic--sim[data-active-step="2"] .svc-sim-step[data-step="2"],
.svc-schematic--sim[data-active-step="3"] .svc-sim-step[data-step="3"],
.svc-schematic--sim[data-active-step="4"] .svc-sim-step[data-step="4"] {
  opacity: 1;
}

/* ---- Right: stacked step cards ---- */
.svc-stepper__cards {
  display: grid;   /* all cards stack in one grid cell */
}

/* All step cards share one grid cell so they stack; the column sizes to the
   tallest. Only the active card is opaque. Transition is time-based so the
   card always flies in fully composed regardless of scroll speed. */
.svc-stepper__card {
  grid-area: 1 / 1;
  align-self: center;
  max-width: 460px;
  padding: var(--sp-4) var(--sp-5);
  background: rgba(46, 163, 242, 0.06);
  border: 1px solid var(--c-line-dark);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-lg);
  display: grid;
  gap: var(--sp-2);
  /* Incoming state: transparent, offset down */
  opacity: 0;
  transform: translateY(44px) scale(0.97);
  transition: opacity 0.5s ease,
              transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}

.svc-stepper__card.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.svc-stepper__card.is-passed {
  opacity: 0;
  transform: translateY(-44px) scale(0.97);
}

.svc-stepper__card h3 {
  color: var(--c-on-dark);
  font-size: var(--t-h3);
}

.svc-stepper__card p {
  color: var(--c-on-dark-2);
}

.svc-step-num {
  display: block;
  color: var(--c-accent);
  margin-bottom: 0.25rem;
}

/* --- Static fallback: reduced motion AND no-JS ---
   step-scroller.js is inert under prefers-reduced-motion, so the CSS must
   stand in: unpin the stage, drop the scroll runway, and unstack the cards
   so every step is visible and legible. Same treatment for no-JS. */
@media (prefers-reduced-motion: reduce) {
  .svc-stepper__stage {
    position: static;
    height: auto;
    overflow: visible;
  }
  .svc-stepper__track { display: none; }
  .svc-stepper__layout { align-items: start; }
  .svc-stepper__cards { gap: var(--sp-3); }
  .svc-stepper__card {
    grid-area: auto;
    opacity: 1 !important;
    transform: none !important;
    max-width: 100%;
  }
}
.no-js .svc-stepper__stage {
  position: static;
  height: auto;
  overflow: visible;
}
.no-js .svc-stepper__track { display: none; }
.no-js .svc-stepper__layout { align-items: start; }
.no-js .svc-stepper__cards { gap: var(--sp-3); }
.no-js .svc-stepper__card {
  grid-area: auto;
  opacity: 1;
  transform: none;
  max-width: 100%;
}

/* =============================================================================
   4. SVG SCHEMATIC — production line
   The schematic is composed of per-step STATE GROUPS (.sch-state--*). Exactly
   one set of state groups is shown at a time, toggled by [data-active-step] on
   .svc-schematic (set by svc-experiment.js). No two step-states ever overlap.
   ============================================================================= */

/* Base wire / conveyor — persistent in every step */
.sch-conveyor {
  stroke: var(--c-accent);
  opacity: 0.25;
  stroke-linecap: round;
}

/* Station boxes — persistent stations (1, 2, 4, 5) */
.sch-station {
  stroke: var(--c-accent);
  stroke-width: 1.5;
  fill: rgba(46, 163, 242, 0.06);
}

/* Bottleneck station — highlighted in red-orange (steps 1–2) */
.sch-station--bottleneck {
  stroke: #e85c3a;
  fill: rgba(232, 92, 58, 0.10);
}

/* New / cleared stations (3a + 3b, steps 3–4) */
.sch-station--new {
  stroke: #3dd68c;
  fill: rgba(61, 214, 140, 0.10);
}

/* Labels */
.sch-label {
  font-family: var(--f-mono);
  font-size: 11px;
  fill: rgba(245, 245, 247, 0.45);
  text-anchor: middle;
  letter-spacing: 0.06em;
}

.sch-label--bottleneck {
  fill: #e85c3a;
  font-size: 10px;
}

.sch-label--cleared {
  fill: #3dd68c;
  font-size: 10px;
}

/* ---- Per-step STATE GROUPS ----
   Every state group is hidden by default; the matching [data-active-step]
   rule below reveals exactly the groups that belong to that step. The opacity
   transition gives a clean cross-fade between states. */
.sch-state {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease-out);
}

/* Step 1 — model running: original STA 3 + WIP flowing normally */
.svc-schematic[data-active-step="1"] .sch-state--original,
.svc-schematic[data-active-step="1"] .sch-state--flow,
/* Step 2 — bottleneck found: original STA 3 + queued WIP + alert */
.svc-schematic[data-active-step="2"] .sch-state--original,
.svc-schematic[data-active-step="2"] .sch-state--queue,
/* Step 3 — testing the fix: STA 3 split into 3a/3b + WIP starting to clear */
.svc-schematic[data-active-step="3"] .sch-state--cleared,
.svc-schematic[data-active-step="3"] .sch-state--testing,
/* Step 4 — validated: STA 3a/3b + WIP flowing smoothly */
.svc-schematic[data-active-step="4"] .sch-state--cleared,
.svc-schematic[data-active-step="4"] .sch-state--validated {
  opacity: 1;
}

/* WIP tokens (work-in-progress units) */
.sch-wip {
  transition: opacity var(--dur-slow) var(--ease-out);
}
/* Queued / bottlenecked WIP — red-orange */
.sch-wip--queued  { fill: #e85c3a; }
.sch-wip--testing { fill: #e85c3a; }
/* Normal flowing WIP — accent blue */
.sch-wip--flow    { fill: var(--c-accent); }
/* Cleared WIP — green */
.sch-wip--cleared { fill: #3dd68c; }

/* Bottleneck alert ring + label */
.sch-alert-ring {
  stroke: #e85c3a;
}

.sch-alert-label {
  font-family: var(--f-mono);
  font-size: 9px;
  fill: #e85c3a;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

/* Progress track + fill */
.sch-progress-track {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-linecap: round;
}

.sch-progress-fill {
  stroke: var(--c-accent);
  stroke-linecap: round;
  transition: none; /* JS writes x2 directly for scroll-linked precision */
}

/* Progress dots + step numbers */
.sch-dot {
  fill: rgba(255, 255, 255, 0.25);
  transition: fill var(--dur-mid) var(--ease-out);
}

.sch-step-num {
  font-family: var(--f-mono);
  font-size: 9px;
  fill: rgba(245, 245, 247, 0.35);
  letter-spacing: 0.06em;
}

/* Active dot highlight — explicit class per dot avoids nth-of-type / nth-child
   ambiguity when other circle siblings exist in the SVG root. */
.svc-schematic[data-active-step="1"] .sch-dot--1,
.svc-schematic[data-active-step="2"] .sch-dot--2,
.svc-schematic[data-active-step="3"] .sch-dot--3,
.svc-schematic[data-active-step="4"] .sch-dot--4 {
  fill: var(--c-accent);
}

/* =============================================================================
   5. AUDIENCE CARDS
   ============================================================================= */
.svc-audience-card .link-arrow {
  margin-top: auto;
}

/* =============================================================================
   6. NUMBERS SECTION — stat row + citations
   ============================================================================= */
.svc-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}

.svc-stat {
  display: grid;
  gap: var(--sp-1);
}

.svc-stat .stat__num {
  /* foundation .stat__num handles size/weight/color */
}

.svc-stat__source {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--c-on-dark-2);
  letter-spacing: 0.02em;
  margin-top: var(--sp-1);
  padding-top: var(--sp-1);
  border-top: 1px solid var(--c-line-dark);
}

/* Case studies cite block */
.svc-case-studies {
  padding-top: var(--sp-5);
  border-top: 1px solid var(--c-line-dark);
}

.svc-case-studies .eyebrow {
  display: block;
  margin-bottom: var(--sp-2);
  color: var(--c-on-dark-2);
}

.svc-cite-list {
  display: grid;
  gap: var(--sp-2);
}

.svc-cite-list li {
  font-size: 0.95rem;
  color: var(--c-on-dark-2);
  padding-left: var(--sp-2);
  border-left: 2px solid var(--c-accent);
  line-height: 1.5;
}

.svc-cite-list strong {
  color: var(--c-on-dark);
}

.svc-cite-list em {
  /* --c-ink-3 fails on dark background at this size; use --c-on-dark-2 */
  color: var(--c-on-dark-2);
  font-style: normal;
  font-family: var(--f-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

/* =============================================================================
   7. REDUCED-MOTION — SVG schematic: force one static, clean final state.
   The stepper's own reduced-motion fallback (section 3 above) handles
   unpinning the stage and revealing all cards. This block locks the SVG to a
   single step-4 (validated) state — no transitions, no overlapping states.
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  /* No motion; lock the schematic to a single static step-4 (validated) graphic.
     !important is required: svc-experiment.js still runs applyFrame(0) once
     (the engine is inert under reduced motion), so the schematic may carry
     [data-active-step="1"] — and that selector out-specifies a plain rule. */
  .svc-schematic *,
  .svc-schematic { transition: none !important; }
  .svc-schematic--sim .svc-sim-step                { opacity: 0 !important; }
  .svc-schematic--sim .svc-sim-step[data-step="4"] { opacity: 1 !important; }
}

/* =============================================================================
   8. RESPONSIVE
   ============================================================================= */

/* 1024px — collapse 2-col stepper to single column */
@media (max-width: 1024px) {
  .svc-stepper__layout {
    grid-template-columns: 1fr;
  }

  .svc-stepper__head h2 {
    font-size: var(--t-h3);
  }

  .svc-stat-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* 768px — mobile */
@media (max-width: 768px) {
  /* Hide eyebrow inside stage on mobile to save space */
  .svc-stepper__eyebrow {
    display: none;
  }

  .svc-stepper__card {
    max-width: 100%;
    padding: var(--sp-4);
  }

  .svc-stat-row {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }
}

/* 480px — small phones */
@media (max-width: 480px) {
  .svc-stepper__head {
    margin-bottom: var(--sp-4);
  }

  .svc-case-studies {
    padding-top: var(--sp-3);
  }
}

/* =============================================================================
   TWO TOOLS — two white rounded cards on the gray section--alt, each with a
   cover image at the top (foundation .card provides the white bg + rounding via
   .section--alt .card). The grid sits outside .container, so it's capped and
   centered to the header's content width.
   ============================================================================= */
/* Headline forces a break after the colon (<br> in the markup); widen past the
   760px section-head cap so "decide on a model, not on the plant floor." stays
   on a single line. */
#tools .section-head { max-width: none; }

#tools .card-grid {
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  max-width: var(--w-max);      /* align with the header's .container */
  margin-inline: auto;
  padding-inline: var(--gutter);
}
#tools .card {
  min-width: 0;        /* let the 1fr tracks shrink below the image width */
  overflow: hidden;    /* clip the cover image to the card's rounded corners */
}
/* Cover image: break out of the card padding to span the full card width at the
   top; the card's border-radius + overflow:hidden round the top corners. */
#tools .svc-tool__media {
  display: block;
  width: calc(100% + 2 * var(--sp-4));
  max-width: none;     /* override the global img max-width:100% so it can break out */
  height: auto;        /* override the height attribute so aspect-ratio drives height */
  margin: calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)) var(--sp-2);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
@media (max-width: 768px) {
  #tools .card-grid { grid-template-columns: 1fr; }
}

/* =============================================================================
   GET STARTED — contact form. Ported verbatim from the homepage (index.css) so
   the HubSpot cta-form renders identically here; this page doesn't load
   index.css / mfr-subpage.css, where these rules otherwise live.
   ============================================================================= */
.cta-band.section--alt p { color: var(--c-ink-2); }

.cta-form {
  margin: var(--sp-5) auto 0;
  max-width: 540px;
  text-align: left;
}
.cta-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.cta-form__field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.cta-form__label {
  font-family: var(--f-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-ink-2);
}
.cta-form input:not([type="checkbox"]),
.cta-form select {
  width: 100%;
  padding: 0.72rem 0.9rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--c-ink);
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  -webkit-appearance: none;
  appearance: none;
}
.cta-form input::placeholder { color: var(--c-ink-3); }
.cta-form input:not([type="checkbox"]):focus,
.cta-form select:focus {
  outline: none;
  border-color: var(--c-accent-ink);
  box-shadow: 0 0 0 3px rgba(27, 118, 181, 0.16);
}
.cta-form__submit { width: 100%; }

.cta-form__group {
  border: 0;
  margin: 0 0 var(--sp-3);
  padding: 0;
}
.cta-form__group legend {
  margin-bottom: 9px;
  padding: 0;
}
.cta-form__check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--c-ink);
  cursor: pointer;
}
.cta-form__check input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--c-accent-ink);
  cursor: pointer;
}

.cta-form__status {
  margin: var(--sp-3) 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
}
.cta-form__status--ok {
  color: #1a7f37;
  font-weight: 600;
}
.cta-form__status--error { color: #b42318; }
.cta-form__status a { color: inherit; }

@media (max-width: 560px) {
  .cta-form__row { grid-template-columns: 1fr; }
}

/* Get Started headline: smaller than the global h2 so it stays within two lines
   in the centered CTA band. */
#contact .cta-band__inner h2 {
  font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem);
}
