/* Sphere case study, infographic test (internal). A flat, step-by-step
   diagram for case-sphere-wizard-of-oz-infographic.html. Without JavaScript,
   or with reduced motion, the finished diagram shows as a static figure above
   the paragraph; assets/js/sphere-infographic.js adds .is-live to pin it, move
   the paragraph in as its caption and build both up together. */

.ig {
  --ig-accent: #087a8f;
  --ig-tint: #e1f2f5;
  --ig-stroke: #2a3037;
  position: relative;
  margin: 8px 0 40px;
}
.ig__panel { margin: 0; padding: clamp(10px, 1.6vw, 24px); background: var(--paper); border-radius: 6px; }
.ig-svg { display: block; width: 100%; height: auto; }
.ig__caption { display: none; }

/* ---------- Diagram ---------- */
.ig-dot { fill: #d3dadf; }
.ig-svg text { font-family: var(--sans); font-size: 16px; fill: #1f242a; }
.ig-svg .t-title { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 0.01em; text-transform: uppercase; fill: var(--ink); }
.ig-svg .t-title--sm { font-size: 19px; }
.ig-svg .t-hero { font-family: var(--display); font-weight: 900; font-size: 30px; letter-spacing: 0.01em; text-transform: uppercase; fill: var(--ink); }
.ig-svg .t-small { font-size: 14.5px; fill: #3b4249; }
.ig-svg .t-mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; fill: var(--steel-dark); }
.ig-svg .t-chip { font-family: var(--mono); font-weight: 600; font-size: 14px; letter-spacing: 0.06em; text-anchor: middle; fill: var(--ink); }
.ig-line { fill: none; stroke: var(--ig-stroke); stroke-width: 1.6; }
.ig-arrow { marker-end: url(#ig-arrow); }
.ig-head { fill: var(--ig-stroke); }
.ig-flow { stroke-dasharray: 4 5; }
.ig-flow--wide { stroke-width: 3.2; }
.ig-packet { fill: var(--ig-accent); opacity: 0; }
.ig-zone { fill: rgba(126,135,147,0.08); stroke: var(--steel); stroke-width: 1.2; }
.ig-box, .ig-chip, .ig-cyl, .ig-ring, .ig-pill rect { fill: url(#ig-boxgrad); stroke: var(--ig-stroke); stroke-width: 1.6; }
.ig-box--edge { fill: none; }
.ig-box--fill { stroke: none; }
.ig-cyl-top { fill: #fff; stroke: var(--ig-stroke); stroke-width: 1.6; }
.ig-box--key, .ig-ring--key { fill: url(#ig-keygrad); }
.ig-screen { fill: #1c2026; stroke: var(--ig-stroke); stroke-width: 1.6; }
.ig-pins { stroke: var(--ig-stroke); stroke-width: 1.6; }
.ig-led { fill: #c5ccd2; }
.ig-chips.is-busy .ig-led { fill: #2fbf8f; animation: ig-blink 1.1s steps(2, end) infinite; }
.ig-chips.is-busy g:nth-child(2n) .ig-led { animation-delay: -0.4s; }
.ig-chips.is-busy g:nth-child(3n) .ig-led { animation-delay: -0.75s; }
@keyframes ig-blink { 50% { fill: #b7efd9; } }
.ig-film { fill: #1c2026; }
.ig-perf rect { fill: var(--paper); }
.ig-icon { fill: none; stroke: var(--ig-stroke); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.ig-icon circle { fill: #fff; }
.ig-sparkle { fill: var(--ig-accent); }
.ig-level { fill: url(#ig-levelgrad); transform-box: fill-box; transform-origin: 50% 100%; }
.ig-pill text { font-size: 15px; text-anchor: middle; }
.ig-badge circle { fill: var(--ink); }
.ig-svg .ig-badge text { font-family: var(--mono); font-weight: 600; font-size: 14px; text-anchor: middle; fill: #fff; }

/* The screen: drawn as an outline first, filled once the frame is extended. */
.ig-band-fill { fill: rgba(8,9,11,0.06); }
.ig-band-edge { fill: none; stroke: var(--ig-stroke); stroke-width: 1.6; stroke-dasharray: 7 6; }
.ig-band.is-filled .ig-band-edge { stroke-dasharray: none; }
.ig-win-frame { fill: none; stroke: #fff; stroke-width: 2; }
.ig-win-frame.is-scale { stroke-dasharray: 5 4; stroke-width: 1.6; }
.ig-dim { fill: none; stroke: var(--ig-accent); stroke-width: 1.6; }

/* The step being described gets the accent and a soft glow. */
.ig-svg [data-s] * { transition: stroke 0.4s ease, fill 0.4s ease; }
.ig-svg .is-active .ig-badge circle { fill: var(--ig-accent); }
.ig-svg .is-active .ig-box, .ig-svg .is-active .ig-chip, .ig-svg .is-active .ig-cyl, .ig-svg .is-active .ig-cyl-top,
.ig-svg .is-active .ig-ring, .ig-svg .is-active .ig-line, .ig-svg .is-active .ig-pins { stroke: var(--ig-accent); }
.ig-svg .is-active .ig-box--fill, .ig-svg .is-active .ig-box--key { filter: url(#ig-glow); }
.ig-pill.is-hot rect { fill: var(--ig-accent); stroke: var(--ig-accent); }
.ig-svg .ig-pill.is-hot text { fill: #fff; }
.ig.is-live .is-on .ig-flow { animation: ig-flow 0.9s linear infinite; }

/* The production loop, once the diagram is complete. */
.ig-film--queue { opacity: 0.5; }
#ig-queue { transition: opacity 0.6s ease; }
.ig-svg .ig-line.is-hot { stroke: var(--ig-accent); stroke-width: 2.6; }
.ig-svg #ig-pipe.is-busy { stroke: var(--ig-accent); filter: url(#ig-glow); }
.ig-mon-sel { fill: rgba(111,214,236,0.14); stroke: #fff; stroke-width: 1; stroke-dasharray: 3 2; }
.ig-mon-bar { fill: #6fd6ec; }
@keyframes ig-flow { to { stroke-dashoffset: -18; } }

/* ---------- Live: pinned, diagram and caption built up together ---------- */
.ig.is-live {
  --ig-bleed: calc(100vw - var(--sidebar));
  width: var(--ig-bleed);
  margin: 24px 0 56px calc((100% - var(--ig-bleed)) / 2);
}
.ig.is-live .ig__track { position: relative; height: 820vh; }
.ig.is-live .ig__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--ig-top, 56px) 28px 24px;
}
.ig.is-live .ig__panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: min(1320px, calc((100vh - 240px) * 1.66 + 48px));
  height: 100%;
}
.ig.is-live .ig-svg { flex: 1 1 0; min-height: 0; height: auto; }
.ig.is-live .ig__caption {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex: none;
  width: 100%;
  max-width: 1060px;
  min-height: 7.6em;
  margin: 8px auto 0;
  padding-top: 16px;
  border-top: 1px solid rgba(8,9,11,0.12);
  font-size: clamp(17px, 1.45vw, 21px);
}
.ig__steps { display: flex; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; flex: none; }
.post-body ol.ig__steps li {
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 1.5px solid rgba(8,9,11,0.25);
  border-radius: 50%;
  font: 600 12px/23px var(--mono);
  text-align: center;
  color: rgba(8,9,11,0.45);
  counter-increment: none;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.post-body ol.ig__steps li::before { content: none; }
.post-body ol.ig__steps li.is-done { background: var(--ink); border-color: var(--ink); color: #fff; }
.post-body ol.ig__steps li.is-cur { background: var(--ig-accent); border-color: var(--ig-accent); color: #fff; }
.ig__text { flex: 1; min-width: 0; }
.post-body .ig__text p { display: grid; margin: 0; font-size: inherit; line-height: 1.42; color: var(--ink); }
.ig__s { grid-area: 1 / 1; opacity: 0; transition: opacity 0.35s ease; }
.ig__s.is-cur { opacity: 1; }
.ig__w { transition: color 0.3s ease; }
.ig__w.is-key.is-lit { color: var(--ig-accent); }
/* Last step: the whole paragraph as the infographic's key, one numbered
   sentence per line. The step dots repeat the numbers, so they step aside. */
.ig.is-live .ig__caption.is-all { padding-top: 22px; padding-bottom: 6px; }
.ig__caption.is-all .ig__steps { display: none; }
.ig__text.is-all p { display: flex; flex-direction: column; gap: 0.55em; font-size: 0.78em; line-height: 1.6; }
.ig__text.is-all .ig__s { position: relative; display: block; padding-left: 2em; opacity: 1; counter-increment: ig; }
.ig__text.is-all p { counter-reset: ig; }
.ig__text.is-all .ig__s::before {
  content: counter(ig) / "";
  position: absolute;
  left: 0;
  top: 0.18em;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.8em;
  line-height: 1;
}
.ig__text.is-all .ig__w.is-key { color: inherit; font-weight: inherit; }

@media (max-width: 900px) {
  .ig.is-live { --ig-bleed: 100vw; }
  .ig.is-live .ig__panel { max-width: none; }
  .ig.is-live .ig__track { height: 720vh; }
  .ig.is-live .ig__stage {
    top: var(--bar-h, 60px);
    height: calc(100vh - var(--bar-h, 60px));
    height: calc(100svh - var(--bar-h, 60px));
    padding: var(--ig-top, 16px) 10px 10px;
  }
  .ig.is-live .ig__panel { padding: 8px 10px 12px; }
  .ig.is-live .ig__caption { gap: 10px; min-height: 0; flex-direction: column; font-size: 15.5px; }
  .post-body ol.ig__steps li { width: 22px; height: 22px; font-size: 11px; line-height: 19px; }
  .ig__text.is-all p { gap: 0.4em; font-size: 12.5px; line-height: 1.45; }
}
