.workflow-demo {
  --demo-surface: var(--panel);
  --demo-deep: var(--site-surface-deep);
  --demo-border: var(--line);
  --demo-muted: var(--site-secondary);
  --demo-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.demo-breadcrumb { padding-top: 27px; }

.inner-pages .demo-hero {
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2.5rem, 5vw, 4.5rem);
}

.inner-pages .demo-hero > .wrap {
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 4.5vw, 3.5rem);
}

.demo-intro { text-align: center; }

.demo-intro .standfirst { justify-content: center; }

.inner-pages .demo-hero h1 {
  max-width: 25ch;
  margin-inline: auto;
  font-size: clamp(2rem, 3.7vw, 3.125rem);
  line-height: 1.13;
}

.inner-pages .demo-hero h1 em { display: block; }

.inner-pages .demo-hero .sub { text-wrap: balance; }

.inner-pages .demo-hero .sub {
  margin-inline: auto;
  font-size: clamp(.95rem, 1.8vw, 1.08rem);
}

.demo-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .45rem;
  margin-top: 1.4rem;
}

.demo-badges span, .demo-status {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid var(--demo-border);
  border-radius: 100px;
  background: #10241c;
  color: #b4d0c2;
  padding: .35rem .7rem;
  font: .68rem/1.3 var(--demo-mono);
  white-space: nowrap;
}

.demo-badges i, .demo-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  color: var(--green);
}

.demo-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .7rem;
}

.demo-tile, .demo-scenarios button {
  background: var(--demo-surface);
  border: 1px solid var(--demo-border);
  border-radius: 12px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}

.demo-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  padding: .95rem;
}

.demo-tile:hover, .demo-tile[aria-pressed="true"],
.demo-scenarios button:hover, .demo-scenarios button[aria-pressed="true"] {
  background: #14271e;
  border-color: #569a76;
}

.demo-tile:focus-visible, .demo-scenarios button:focus-visible, .demo-log:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.demo-tile-icon, .demo-step-icon, .demo-preview-icon {
  display: grid;
  place-items: center;
  width: 38px;
  aspect-ratio: 1;
  border: 1px solid var(--demo-border);
  border-radius: 9px;
  background: #162b21;
  color: var(--green);
}

.demo-tile > .al-icon { color: var(--green); width: 15px; height: 15px; }
.demo-tile b, .demo-tile small { display: block; }
.demo-tile b { font-size: .92rem; font-weight: 600; }
.demo-tile small { margin-top: .2rem; font-size: .76rem; line-height: 1.4; color: var(--demo-muted); }

.demo-band { padding-block: 1rem clamp(3rem, 7vw, 6rem); }
.demo-section-title { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.demo-section-title h2 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.7rem); letter-spacing: -.045em; }
.demo-section-title h2:focus { outline: none; }
.demo-section-title > span { color: var(--demo-muted); font: .72rem/1.5 var(--demo-mono); }

.demo-workspace {
  display: grid;
  grid-template-columns: minmax(235px, .72fr) minmax(0, 1.65fr);
  overflow: hidden;
  border: 1px solid var(--demo-border);
  border-radius: 16px;
  background: var(--demo-deep);
}

.demo-sidebar {
  padding: clamp(1rem, 3vw, 1.5rem);
  border-right: 1px solid var(--demo-border);
  background: linear-gradient(145deg, #15281f, var(--demo-surface) 55%);
}

.demo-kicker {
  display: block;
  color: var(--green);
  font: .68rem/1.45 var(--demo-mono);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.demo-sidebar h3, .demo-console-head h3 { margin: .4rem 0 0; font-size: 1.15rem; letter-spacing: -.02em; }

.demo-scenarios { display: grid; gap: .55rem; margin-block: 1.15rem; }

.demo-scenarios button {
  position: relative;
  padding: .7rem .75rem .7rem 1.9rem;
}

.demo-scenarios button::before {
  content: '';
  position: absolute;
  inset: .98rem auto auto .72rem;
  width: 9px;
  height: 9px;
  border: 1px solid #77978a;
  border-radius: 50%;
}

.demo-scenarios button[aria-pressed="true"]::before {
  background: var(--green);
  border-color: var(--green);
}

.demo-scenarios strong, .demo-scenarios span { display: block; }
.demo-scenarios strong { font-size: .86rem; font-weight: 600; }
.demo-scenarios span, .demo-note { color: var(--demo-muted); font-size: .76rem; line-height: 1.45; }
.demo-scenarios span { margin-top: .23rem; }
.demo-note { margin: .65rem 0 0; }
#demo-run { width: 100%; justify-content: space-between; cursor: pointer; }
#demo-run:disabled { opacity: .56; cursor: default; }

.demo-console { display: flex; flex-direction: column; min-width: 0; }
.demo-console-head, .demo-console-foot { padding: .95rem clamp(1rem, 3vw, 1.5rem); }
.demo-console-head { display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.demo-status[data-state="review"], .demo-status[data-state="held"] { border-color: #775e39; background: #2b2419; color: #f0cf94; }
.demo-status[data-state="review"] i, .demo-status[data-state="held"] i { color: inherit; }
.demo-status[data-state="running"] i { animation: demo-pulse 1.5s ease-in-out infinite; }

.demo-progress { height: 2px; background: var(--demo-border); }
.demo-progress span { display: block; height: 100%; width: 0; background: var(--green); transition: width .25s ease; }

.demo-console-body { flex: 1; display: grid; min-height: 17rem; }
.demo-preview { display: flex; justify-content: center; align-items: center; gap: 1rem; padding: 1.5rem; background: radial-gradient(ellipse at center, #18312780, transparent 67%); }
.demo-preview-icon { width: 52px; flex-shrink: 0; }
.demo-preview h4 { margin: .2rem 0; font-size: 1.05rem; }
.demo-preview p { margin: 0; color: var(--demo-muted); font-size: .85rem; }

.demo-log {
  align-self: stretch;
  max-height: 20rem;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #4b745f var(--demo-deep);
  margin: 0;
  padding: .5rem clamp(1rem, 3vw, 1.5rem);
  list-style: none;
}

.demo-log li {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: .8rem;
  padding-block: .72rem;
  animation: demo-enter .22s ease-out both;
}

.demo-log li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 16px;
  top: calc(.72rem + 34px);
  bottom: -.72rem;
  width: 1px;
  background: var(--demo-border);
}

.demo-step-icon { width: 34px; }
.demo-step-icon .al-icon { width: 17px; height: 17px; }
.demo-log strong { display: block; font-size: .9rem; margin-block: .12rem; }
.demo-log p, .demo-console-foot p { margin: 0; color: var(--demo-muted); font-size: .82rem; line-height: 1.5; }
.demo-log [data-kind="event"] :is(.demo-kicker, .demo-step-icon) { color: #a9d6f2; }
.demo-log [data-kind="human"] :is(.demo-kicker, .demo-step-icon) { color: #d2c2fa; }
.demo-log [data-kind="review"] :is(.demo-kicker, .demo-step-icon) { color: #f0cf94; }
.demo-console-foot { border-top: 1px solid var(--demo-border); background: var(--demo-surface); }
.demo-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .7rem; }
.demo-actions .btn { cursor: pointer; }
.workflow-demo [hidden] { display: none !important; }

@keyframes demo-enter { from { opacity: .45; transform: translateY(4px); } }
@keyframes demo-pulse { 50% { opacity: .35; } }

@media (max-width: 850px) {
  .demo-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .demo-workspace { grid-template-columns: 1fr; }
  .demo-sidebar { border-right: 0; border-bottom: 1px solid var(--demo-border); }
  .demo-section-title > span { display: none; }
  .demo-preview { justify-content: flex-start; }
}
@media (max-width: 480px) {
  .demo-picker { grid-template-columns: 1fr; gap: .45rem; }
  .demo-tile { padding: .65rem .75rem; }
  .demo-console-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .workflow-demo :is(.demo-log li, .demo-status i) { animation: none; }
  .workflow-demo :is(.demo-tile, .demo-scenarios button, .demo-progress span) { transition: none; }
}
