/* Animated diagram walkthroughs (docs/javascripts/walkthrough.js).
   Uses the theme's color variables, with fallbacks so the player also works on a plain page. */

:root {
  --wt-accent: #E14603;
  --wt-ink: #C23C02;
}
[data-md-color-scheme="slate"] {
  --wt-accent: #F26A2E;
  --wt-ink: #F26A2E;
}

.md-typeset figure.wt-ready > img { display: none; }

.wt-stage { max-width: 100%; }
.wt-stage svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }

/* Highlighting: the step's boxes and arrows in Sign orange, the rest muted. */
.wt-svg g[data-state] { transition: opacity .35s ease; }
.wt-svg g[data-state="muted"] { opacity: .28; }
.wt-svg g[data-node][data-state="active"] > :is(path, polygon, ellipse) {
  stroke: var(--wt-accent);
  stroke-width: 1.6;
}
.wt-svg g[data-edge][data-state="active"] > path { stroke: var(--wt-accent); stroke-width: 1.3; }
.wt-svg g[data-edge][data-state="active"] > polygon { stroke: var(--wt-accent); fill: var(--wt-accent); }

.wt-token {
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
  fill: var(--wt-accent);
  stroke: var(--md-default-bg-color, #fff);
  stroke-width: 1.5;
}

/* Player under the diagram. */
.wt-panel {
  width: 100%;
  max-width: 40rem;
  margin: .9rem auto 0;
  text-align: left;
}
.wt-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.wt-controls button {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  height: 1.8rem;
  padding: 0 .65rem;
  border: 1px solid var(--md-default-fg-color--lightest, rgba(0,0,0,.07));
  border-radius: .25rem;
  background: var(--md-default-bg-color, #fff);
  color: var(--md-default-fg-color, rgba(0,0,0,.87));
  font: inherit;
  font-size: .7rem;
  cursor: pointer;
}
.wt-controls button:hover:not(:disabled) { border-color: var(--wt-accent); color: var(--wt-ink); }
.wt-controls button:focus-visible { outline: 2px solid var(--wt-accent); outline-offset: 1px; }
.wt-controls button:disabled { opacity: .4; cursor: default; }
.wt-controls button svg { width: 1rem; height: 1rem; fill: currentColor; }
.wt-controls .wt-step { padding: 0 .35rem; }
.wt-controls .wt-play { border-color: var(--wt-accent); color: var(--wt-ink); font-weight: 600; }
.wt-pos { margin-left: auto; font-size: .65rem; color: var(--md-default-fg-color--light, rgba(0,0,0,.54)); }
.wt-story {
  min-height: 3.6em;
  margin-top: .6rem;
  padding: .45rem .75rem;
  border-left: 3px solid var(--wt-accent);
  background: var(--md-code-bg-color, #f5f5f5);
  font-size: .72rem;
  line-height: 1.55;
}
figure:not([data-walking]) .wt-story { border-left-color: var(--md-default-fg-color--lightest, rgba(0,0,0,.07)); }

@media (prefers-reduced-motion: reduce) {
  .wt-svg g[data-state], .wt-token { transition: none; }
}

/* Print the static figure, not the player. */
@media print {
  .md-typeset figure.wt-ready > img[src*="#only-light"] { display: block; }
  .wt-stage, .wt-panel { display: none; }
}
