/* ============================================================
   SEMICO.AI — workflows.html page styles
   Namespace: .wfx-   (adds only; tokens from semico.css)
   ============================================================ */

/* ---------- 1. Hero ---------- */
.wfx-hero {
  position: relative;
  padding: clamp(84px, 11vw, 130px) 0 clamp(26px, 4vw, 44px);
  overflow: hidden;
}
.wfx-hero .container { position: relative; z-index: 1; }
.wfx-hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: clamp(28px, 4vw, 54px); align-items: center;
}
.wfx-hero h1 { max-width: 18ch; margin-top: 18px; }
.wfx-hero .lede { max-width: 560px; }
.wfx-hero-art {
  display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0;
  /* Lift the workflow ring toward the top of the hero grid (raised, matching the architecture hero art). */
  align-self: start; margin-top: clamp(-22px, -1.5vw, -10px);
}
.wfx-ring-svg { width: min(100%, 520px); height: auto; display: block; }
.wfx-ring-cap { margin: 0; text-align: center; }

/* ----- Workflow ring (ink on sand, copper/gold accents) -----
   Base styles are the STATIC state: all nodes lit, the combined
   before→after pair shown. Motion (comet, sequenced lighting, value
   flips) applies only under prefers-reduced-motion: no-preference. */
.wfr-ring { fill: none; stroke: var(--glass-border); stroke-width: 1.5; }
.wfr-comet {
  fill: none; stroke: var(--copper); stroke-width: 2.5; stroke-linecap: round;
  opacity: 0; /* static: hidden */
}
.wfr-spoke { stroke: var(--copper); stroke-opacity: 0.4; stroke-width: 1.2; stroke-dasharray: 3 5; }
.wfr-hex { fill: rgba(168, 126, 31, 0.10); stroke: var(--copper); stroke-width: 2; }
.wfr-eye { fill: var(--ink); }
.wfr-emit { fill: none; stroke: var(--copper); stroke-width: 1; opacity: 0; }

a.wfr-node { cursor: pointer; }
.wfr-box { fill: rgba(168, 126, 31, 0.10); stroke: var(--copper); stroke-width: 1.5; }
.wfr-glyph { color: var(--copper); }
.wfr-name {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  fill: var(--ink-3); font-weight: 500;
}
.wfr-val { font-family: var(--font-mono); font-size: 13px; }
.wfr-vb { fill: var(--ink-3); opacity: 0; }
.wfr-va { fill: var(--sand-equipment); font-weight: 700; opacity: 0; }
.wfr-vr { fill: var(--ink-3); opacity: 1; }
.wfr-vr tspan { fill: var(--sand-equipment); font-weight: 700; }
a.wfr-node:hover .wfr-box, a.wfr-node:focus-visible .wfr-box {
  stroke: var(--ink); fill: rgba(168, 126, 31, 0.20);
}
a.wfr-node:hover .wfr-name, a.wfr-node:focus-visible .wfr-name { fill: var(--ink); }

/* Motion: a pulse orbits the ring; each node lights as it passes and its
   micro number flips before → after. 16s cycle, 2s per node (--i = index). */
@media (prefers-reduced-motion: no-preference) {
  .wfr-node, .wfr-spoke { --d: calc(var(--i) * 2s); }
  .wfx-ring-svg:hover .wfr-comet,
  .wfx-ring-svg:hover .wfr-box,
  .wfx-ring-svg:hover .wfr-glyph,
  .wfx-ring-svg:hover .wfr-spoke,
  .wfx-ring-svg:hover .wfr-vb,
  .wfx-ring-svg:hover .wfr-va { animation-play-state: paused; }

  .wfr-comet {
    opacity: 0.9;
    stroke-dasharray: 46 896.5;
    stroke-dashoffset: 46;
    animation: wfrOrbit 16s linear infinite;
  }
  .wfr-emit {
    opacity: 0;
    transform-box: fill-box; transform-origin: center;
    animation: wfrEmit 2s var(--ease-out) infinite;
  }
  .wfr-eye {
    transform-box: fill-box; transform-origin: center;
    animation: wfrBlink 7s linear infinite;
  }
  .wfr-spoke { stroke: var(--glass-border); stroke-opacity: 1; animation: wfrSpoke 16s linear var(--d) infinite; }
  .wfr-box { fill: var(--glass); stroke: var(--glass-border); animation: wfrBox 16s linear var(--d) infinite; }
  .wfr-glyph { color: var(--ink-2); animation: wfrGlyph 16s linear var(--d) infinite; }
  .wfr-vb, .wfr-va { transform-box: fill-box; transform-origin: center; }
  .wfr-vb { opacity: 1; animation: wfrValB 16s linear var(--d) infinite; }
  .wfr-va { opacity: 0; animation: wfrValA 16s linear var(--d) infinite; }
  .wfr-vr { opacity: 0; }
}
@keyframes wfrOrbit { to { stroke-dashoffset: -896.5; } }
@keyframes wfrEmit {
  0% { opacity: 0.45; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.45); }
}
@keyframes wfrBlink {
  0%, 96.4%, 100% { transform: none; }
  97.4%, 98.4% { transform: scaleY(0.12); }
}
@keyframes wfrSpoke {
  0% { stroke: var(--glass-border); }
  1.5%, 11% { stroke: var(--copper); }
  19%, 100% { stroke: var(--glass-border); }
}
@keyframes wfrBox {
  0% { stroke: var(--glass-border); fill: var(--glass); }
  1.5%, 11% { stroke: var(--copper); fill: rgba(168, 126, 31, 0.14); }
  19%, 100% { stroke: var(--glass-border); fill: var(--glass); }
}
@keyframes wfrGlyph {
  0% { color: var(--ink-2); }
  1.5%, 11% { color: var(--copper); }
  19%, 100% { color: var(--ink-2); }
}
@keyframes wfrValB {
  0%, 1.5% { opacity: 1; transform: none; }
  3.5%, 92% { opacity: 0; transform: scaleY(0.1); }
  97%, 100% { opacity: 1; transform: none; }
}
@keyframes wfrValA {
  0%, 2.2% { opacity: 0; transform: scaleY(0.1); }
  4.5%, 90% { opacity: 1; transform: none; }
  95%, 100% { opacity: 0; transform: scaleY(0.1); }
}

/* Legend — a small dark die on the sand (class="di" in HTML) */
.wfx-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  margin-top: 26px;
  width: fit-content; max-width: 100%;
  padding: 12px 18px;
  border: 1px solid var(--glass-border); border-radius: var(--radius-m);
  box-shadow: var(--shadow-1);
}
.wfx-legend-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3);
}

/* Actor + legend badges */
.wfx-actor {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: var(--radius-pill);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
}
.wfx-actor svg { width: 13px; height: 13px; flex: none; }
.wfx-actor--ai {
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.32);
}
.wfx-actor--gate {
  color: var(--violet-soft);
  background: rgba(139, 92, 246, 0.1);
  border: 1px dashed rgba(167, 139, 250, 0.6);
}
.wfx-legend .wfx-chip { font-size: 0.78rem; }

/* ---------- 2. Body layout (deliberately NOT .section: keeps
   offsetTop document-accurate for the shared scrollspy) ---------- */
.wfx-body { padding: clamp(30px, 4vw, 54px) 0 clamp(46px, 6vw, 84px); }

.wfx-nav a { display: flex; align-items: center; gap: 9px; }
.wfx-nav .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.wfx-nav .wfx-nav-x { color: var(--ink-3); font-size: 0.82rem; }

/* ---------- 3. Workflow sections ---------- */
.wfx-sec { margin-bottom: clamp(56px, 8vw, 96px); scroll-margin-top: calc(var(--nav-h) + 22px); }
.wfx-sec:last-of-type { margin-bottom: 0; }
.wfx-sec-head { margin-bottom: 20px; max-width: 780px; }
.wfx-sec-head .kicker .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.wfx-sec-head h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
.wfx-tag { color: var(--ink-2); font-size: 1.02rem; margin: 0; }

/* ---------- 4. Workflow player add-ons ---------- */
.wfx-player .wf-stage { min-height: clamp(330px, 30vw, 400px); }
.wfx-step .wfx-what { margin: 10px 0 4px; max-width: 68ch; }
.wfx-step--gate {
  border-left: 3px solid var(--violet);
  background: rgba(139, 92, 246, 0.06);
  padding: 14px 16px 16px;
  border-radius: 0 var(--radius-m) var(--radius-m) 0;
}

/* Rail: mark human-gate steps */
.wfx-player .wf-step.wfx-rail-gate { color: var(--violet-soft); }
.wfx-player .wf-step.wfx-rail-gate .wf-step-num { color: var(--violet-soft); }
.wfx-player .wf-step.wfx-rail-gate .wf-step-num::before { content: "◆ "; }
.wfx-player .wf-step.wfx-rail-gate.is-active { color: var(--ink); border-bottom-color: var(--violet); }

/* Meta chips: artifact + elapsed time */
.wfx-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.wfx-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--radius-pill);
  background: var(--surface-3); border: 1px solid var(--hairline);
  font-size: 0.76rem; color: var(--ink-2);
}
.wfx-chip svg { width: 12px; height: 12px; color: var(--ink-3); flex: none; }
.wfx-chip b { color: var(--ink); font-weight: 600; }
.wfx-chip--time { font-variant-numeric: tabular-nums; }

/* KPI chips inside steps */
.wfx-kchips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 2px; }
.wfx-kchip {
  padding: 6px 12px; border-radius: var(--radius-m);
  background: var(--glass); border: 1px solid var(--glass-border);
  font-size: 0.78rem; color: var(--ink-3);
}
.wfx-kchip b { color: var(--ink); font-weight: 700; font-size: 0.92rem; margin-right: 5px; }

/* Mono data rows (spec extraction, spares package, citations) */
.wfx-rows { margin: 12px 0 4px; max-width: 560px; font-family: var(--font-mono); font-size: 0.78rem; }
.wfx-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 7px 12px; margin-bottom: 6px;
  border: 1px solid var(--hairline); border-radius: 8px; background: var(--surface-1);
  color: var(--ink-2);
  opacity: 0; transform: translateY(6px);
  animation: wfxIn 0.5s var(--ease-out) forwards;
}
.wfx-row .wfx-row-val { color: var(--cyan); white-space: nowrap; }
@keyframes wfxIn { to { opacity: 1; transform: none; } }

/* Node chain (process / genealogy / blast radius) */
.wfx-chain { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.wfx-node {
  padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--glass-border); background: var(--glass);
  color: var(--ink-2); font-size: 0.74rem; font-family: var(--font-mono);
  opacity: 0; animation: wfxIn 0.45s var(--ease-out) forwards;
}
.wfx-node--hot { border-color: rgba(56, 189, 248, 0.5); color: var(--ink); background: rgba(56, 189, 248, 0.08); }
.wfx-chain .wfx-arrow {
  width: 14px; height: 14px; color: var(--ink-3); flex: none;
  opacity: 0; animation: wfxIn 0.45s var(--ease-out) forwards;
}

/* Inline SVG visuals */
.wfx-viz { margin: 14px 0 4px; }
.wfx-viz svg { display: block; max-width: 100%; height: auto; }

/* Process glyph: one pictogram + silkscreen note per step */
.wfx-glyph { display: flex; align-items: center; gap: 13px; }
.wfx-glyph-ic {
  flex: none; width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  color: var(--cyan);
}
.wfx-glyph-ic svg { width: 27px; height: 27px; }
.wfx-glyph-note {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3); line-height: 1.6; max-width: 44ch;
}
.wfx-step--gate .wfx-glyph-ic {
  color: var(--violet-soft);
  border-color: rgba(167, 139, 250, 0.45);
  background: rgba(139, 92, 246, 0.12);
}
.wfx-draw {
  stroke-dasharray: 360; stroke-dashoffset: 360;
  animation: wfxDraw 1.4s var(--ease-out) 0.2s forwards;
}
@keyframes wfxDraw { to { stroke-dashoffset: 0; } }
.wfx-die { opacity: 0; animation: wfxIn 0.4s var(--ease-out) forwards; }

/* Outcome banner (state: success — status green is intentional) */
.wfx-outcome {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 16px; padding: 12px 16px;
  border-radius: 10px;
  background: rgba(12, 163, 12, 0.09);
  border: 1px solid rgba(53, 201, 106, 0.25);
  color: var(--ink-2); font-size: 0.9rem;
  max-width: 72ch;
}
.wfx-outcome svg { width: 16px; height: 16px; color: var(--good-text); flex: none; margin-top: 3px; }
.wfx-outcome b { color: var(--ink); }

/* ---------- 5. Before / after strips ---------- */
.wfx-ba { margin-top: 18px; padding: 24px 26px; }
.wfx-ba-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
}
.wfx-ba-head h3 { font-size: 1.02rem; margin: 0; }
.wfx-ba-note { font-size: 0.76rem; color: var(--ink-3); }
.wfx-ba-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 22px; align-items: start; }
.wfx-ba-stats { display: grid; gap: 12px; }
.wfx-ba-stats .stat-tile { background: var(--surface-1); }
.wfx-ba-stats .stat-value { font-size: clamp(1.5rem, 2.2vw, 1.9rem); }

/* Text panes (data-ba variant): state colors mark pain vs outcome */
.wfx-ba-panes { min-width: 0; }
.wfx-pane { padding: 4px 0 2px 16px; border-left: 3px solid var(--serious); max-width: 76ch; }
.wfx-pane--after { border-left-color: var(--good); }
.wfx-pane p { margin: 0 0 10px; }

/* Wafer-stage photograph (yield section) — pinned on the sand */
.wfx-photo { margin: 0 0 20px; max-width: 620px; }
.wfx-fig-cap {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; border-top: 1px solid var(--hairline);
}
.wfx-fig-cap .etch { font-size: 0.62rem; }

/* ---------- 6. Powered-by product chips ---------- */
.wfx-products { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.wfx-products-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3);
}
a.wfx-pchip { transition: border-color var(--dur-1), color var(--dur-1), transform var(--dur-1); }
a.wfx-pchip:hover { border-color: rgba(56, 189, 248, 0.45); color: var(--ink); transform: translateY(-2px); }
.wfx-pchip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* ---------- 7. Trust spine band — five flip cards ---------- */
.wfx-trust { margin-top: clamp(48px, 6vw, 72px); padding: clamp(24px, 3vw, 34px); }
.wfx-trust h2 { font-size: clamp(1.25rem, 2vw, 1.6rem); }
.wfx-trust-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 10px; margin: 18px 0 20px;
}
.wfx-flip {
  position: relative; min-height: 128px;
  perspective: 800px;
  background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; text-align: left;
  font: inherit; color: inherit;
  border-radius: var(--radius-m);
}
.wfx-flip-inner {
  position: absolute; inset: 0; display: block;
  transform-style: preserve-3d;
  transition: transform 0.55s var(--ease-out);
}
.wfx-flip.is-flipped .wfx-flip-inner { transform: rotateY(180deg); }
.wfx-flip-front, .wfx-flip-back {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius-m); border: 1px solid var(--hairline);
  padding: 14px 12px;
  display: flex; flex-direction: column; justify-content: center; gap: 9px;
}
.wfx-flip-front { background: var(--surface-3); }
.wfx-flip-front svg { width: 19px; height: 19px; color: var(--cyan); flex: none; }
.wfx-flip-front b { font-size: 0.84rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.wfx-flip-back {
  background: rgba(56, 189, 248, 0.07); border-color: rgba(56, 189, 248, 0.3);
  transform: rotateY(180deg);
  font-size: 0.76rem; line-height: 1.45; color: var(--ink-2);
}
.wfx-flip-hint {
  position: absolute; top: 8px; right: 11px;
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-3); line-height: 1;
}
.wfx-flip:hover .wfx-flip-front { border-color: rgba(56, 189, 248, 0.35); }
@media (prefers-reduced-motion: reduce) {
  .wfx-flip-inner { transition: none; }
}

/* ---------- 8. Responsive ---------- */
@media (max-width: 1020px) {
  .wfx-trust-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 940px) {
  .wfx-hero-grid { grid-template-columns: 1fr; }
  .wfx-hero-art { margin-top: 6px; align-self: auto; }
  .wfx-ring-svg { width: min(100%, 460px); }
  .wfx-ba-grid { grid-template-columns: 1fr; }
  .wfx-player .wf-stage { min-height: 0; }
  .wfx-nav a { flex: none; }
}
@media (max-width: 560px) {
  .wfx-ba { padding: 18px; }
  .wfx-step--gate { padding: 12px 12px 14px; }
  .wfx-trust-grid { grid-template-columns: repeat(2, 1fr); }
  .wfx-flip { min-height: 138px; }
}
