.step-demo {
  display: grid;
  gap: 1rem;
}

.step-demo__header,
.step-demo__step-button,
.step-demo__step-label,
.step-demo__panel-step,
.step-demo__detail-label {
  font-family: "IBM Plex Sans", sans-serif;
}

.step-demo__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: start;
  gap: 0.9rem;
}

.step-demo__eyebrow {
  margin: 0 0 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}

.step-demo__title {
  margin: 0;
  font-size: 1.36rem;
  font-family: "Fraunces", "Source Serif 4", serif;
  font-weight: 700;
  line-height: 1.15;
}

.step-demo__step-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(31, 38, 48, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(31, 38, 48, 0.06);
}

.step-demo__step-label {
  min-width: 7.5rem;
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.step-demo__step-button {
  min-width: 4.5rem;
  padding: 0.65rem 0.95rem;
  border: 1px solid rgba(13, 107, 99, 0.18);
  border-radius: 999px;
  background: rgba(13, 107, 99, 0.08);
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease,
    box-shadow 140ms ease;
}

.step-demo__step-button:hover,
.step-demo__step-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(13, 107, 99, 0.36);
  background: rgba(13, 107, 99, 0.15);
  box-shadow: 0 10px 22px rgba(13, 107, 99, 0.12);
  outline: none;
}

.step-demo__step-button:disabled {
  cursor: default;
  opacity: 0.42;
  transform: none;
  box-shadow: none;
}

.step-demo__status {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-small);
  border: 1px solid rgba(13, 107, 99, 0.16);
  background: rgba(13, 107, 99, 0.06);
  color: var(--ink);
  line-height: 1.55;
}

.step-demo__layout {
  display: grid;
  gap: 1rem;
}

.step-demo__pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.85rem;
}

.step-demo__panel,
.step-demo__detail-card {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-small);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease,
    opacity 180ms ease, transform 180ms ease;
}

.step-demo__panel {
  opacity: 0.3;
}

.step-demo__panel.is-complete {
  opacity: 0.72;
  background: rgba(13, 107, 99, 0.05);
  border-color: rgba(13, 107, 99, 0.18);
}

.step-demo__panel.is-active {
  opacity: 1;
  background: rgba(13, 107, 99, 0.1);
  border-color: rgba(13, 107, 99, 0.3);
  box-shadow: 0 10px 24px rgba(13, 107, 99, 0.08);
  transform: translateY(-2px);
}

.step-demo__panel-step,
.step-demo__detail-label {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.step-demo__panel h4,
.step-demo__detail-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.step-demo__panel p,
.step-demo__detail-body,
.step-demo__detail-result {
  margin: 0.55rem 0 0;
  color: var(--ink);
  line-height: 1.55;
}

.step-demo__chip-row,
.step-demo__formula {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.step-demo__chip,
.step-demo__formula code {
  display: inline-flex;
  align-items: center;
  min-height: auto;
  padding: 0.14rem 0.42rem;
  border-radius: 0.45rem;
  border: 0;
  background: rgba(17, 24, 39, 0.06);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: none;
}

.step-demo__formula {
  align-items: center;
  gap: 0.35rem 0.25rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(13, 107, 99, 0.12);
  border-radius: var(--radius-small);
  background: rgba(13, 107, 99, 0.035);
}

.step-demo__formula.is-typesetting {
  visibility: hidden;
}

.step-demo__formula-math {
  display: inline-flex;
  align-items: center;
  min-height: auto;
  padding: 0.18rem 0.45rem;
  border-radius: 0.45rem;
  background: rgba(17, 24, 39, 0.04);
  color: var(--ink);
  line-height: 1.35;
}

.step-demo__formula mjx-container {
  margin: 0;
  font-size: 1rem;
}

.step-demo__formula-math code {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.92em;
  box-shadow: none;
}

.step-demo__math-var {
  font-family: "IBM Plex Serif", "Source Serif 4", serif;
  font-style: italic;
  font-weight: 600;
}

.step-demo__math-inline {
  font-family: "IBM Plex Serif", "Source Serif 4", serif;
  font-style: italic;
  font-weight: 600;
}

.step-demo__fraction {
  display: inline-grid;
  justify-items: center;
  margin: 0 0.1rem;
  line-height: 1.1;
  vertical-align: middle;
}

.step-demo__fraction > span:first-child {
  padding: 0 0.18rem 0.08rem;
  border-bottom: 1px solid currentColor;
}

.step-demo__fraction > span:last-child {
  padding-top: 0.05rem;
  font-size: 0.92em;
}

.step-demo__formula-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: auto;
  padding: 0 0.05rem;
  color: var(--ink-muted);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1;
}

.step-demo__detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem;
}
