/* Compiled from cheatsheet/src/styles/figure.css + MathJax */
/* SVG figure vocabulary, mirroring the TikZ styles of the PDF sheets.
   box = neutral, good = safe/result, warn = rule/condition, bad = failure, flow = blue arrow, msg = ink. */
.fig-wrap { margin: 2px 0 6px; }
.fig { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-body); }
.modal-fig .fig, .modal-fig .d3fig { max-width: 760px; max-height: 56vh; margin: 0 auto; }

.fig .n { stroke-width: 1.1; }
.fig .n-box { fill: var(--surface); stroke: var(--line-strong); }
.fig .n-good { fill: color-mix(in srgb, var(--book-green) 10%, var(--surface)); stroke: var(--book-green); }
.fig .n-warn { fill: color-mix(in srgb, var(--book-gold) 13%, var(--surface)); stroke: var(--book-sienna); }
.fig .n-bad { fill: color-mix(in srgb, var(--book-red) 9%, var(--surface)); stroke: var(--book-red); }
.fig .n-accent { fill: color-mix(in srgb, var(--book-blue) 10%, var(--surface)); stroke: var(--book-blue); }
.fig .n-muted { fill: color-mix(in srgb, var(--lightgray) 45%, var(--surface)); stroke: var(--line); stroke-dasharray: 3 2; }

.fig text, .fig .math { fill: var(--book-ink); color: var(--book-ink); }
.fig text { font-family: var(--font-body); }
.fig .t-bold { font-weight: 700; }
.fig .t-it { font-style: italic; }
.fig .t-good { fill: var(--book-green); color: var(--book-green); }
.fig .t-bad { fill: var(--book-red); color: var(--book-red); }
.fig .t-warn { fill: var(--book-sienna); color: var(--book-sienna); }
.fig .t-accent, .fig .t-flow { fill: var(--book-blue); color: var(--book-blue); }
.fig .t-muted, .fig .t-dash { fill: var(--gray); color: var(--gray); }
.fig .t-msg { fill: var(--book-ink); color: var(--book-ink); }
/* label background: a halo in the surface colour so labels stay readable over lines */
.fig text.halo { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }

.fig .e { fill: none; stroke-width: 1.3; }
.fig .e-flow { stroke: var(--book-blue); }
.fig .e-msg { stroke: var(--book-ink); }
.fig .e-good { stroke: var(--book-green); }
.fig .e-warn { stroke: var(--book-sienna); }
.fig .e-bad { stroke: var(--book-red); stroke-dasharray: 4 3; }
.fig .e-dash, .fig .e-muted { stroke: var(--gray); stroke-dasharray: 3 3; }
.fig .e-accent { stroke: var(--book-blue); stroke-width: 1.8; }
.ah-flow, .ah-accent { fill: var(--book-blue); }
.ah-msg { fill: var(--book-ink); }
.ah-good { fill: var(--book-green); }
.ah-warn { fill: var(--book-sienna); }
.ah-bad { fill: var(--book-red); }
.ah-dash, .ah-muted { fill: var(--gray); }

.fig .life { stroke: var(--line-strong); stroke-dasharray: 2 3; }
.fig .brace { fill: none; stroke: var(--line-strong); stroke-width: 1.1; }
.fig .fr { fill: none; stroke-width: 1.2; }
.fig .fr-dash { stroke: var(--gray); stroke-dasharray: 4 3; }
.fig .fr-good { stroke: var(--book-green); fill: color-mix(in srgb, var(--book-green) 5%, transparent); }
.fig .fr-warn { stroke: var(--book-sienna); fill: color-mix(in srgb, var(--book-gold) 7%, transparent); }
.fig .fr-bad { stroke: var(--book-red); fill: color-mix(in srgb, var(--book-red) 5%, transparent); stroke-dasharray: 4 3; }
.fig .fr-accent { stroke: var(--book-blue); fill: color-mix(in srgb, var(--book-blue) 5%, transparent); }

/* Stepper: future steps are dimmed (static SVG) or hidden; the current step is emphasised. */
.fig [data-step], .fig [data-until] { transition: opacity 0.3s; }
.fig .is-future { opacity: 0.08; }
.fig [data-past] { opacity: 0; pointer-events: none; }
.fig .is-current .n, .fig .is-current.e, .fig .is-current .e { stroke-width: 2; }

.stepper { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.stepper .round { width: 30px; height: 30px; font-size: 0.95rem; }
.step-count { font-family: var(--font-sans); font-size: 0.8rem; color: var(--gray); min-width: 3.5em; }
.step-caption { flex: 1 1 260px; font-size: 0.98rem; }
.step-dots { display: flex; gap: 4px; }
.step-dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; }
.step-dots button[aria-current="true"] { background: var(--secondary); border-color: var(--secondary); }
.fig-toggles { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }

/* D3 figures share the vocabulary above; these are their extras. */
.d3fig svg { display: block; width: 100%; height: auto; overflow: visible; }
.d3fig .server-ring { stroke-width: 2.4; stroke-dasharray: none; }

/* MathJax */

mjx-container[jax="SVG"] {
  direction: ltr;
}

mjx-container[jax="SVG"] > svg {
  overflow: visible;
  min-height: 1px;
  min-width: 1px;
}

mjx-container[jax="SVG"] > svg a {
  fill: blue;
  stroke: blue;
}

mjx-container[jax="SVG"][display="true"] {
  display: block;
  text-align: center;
  margin: 1em 0;
}

mjx-container[jax="SVG"][display="true"][width="full"] {
  display: flex;
}

mjx-container[jax="SVG"][justify="left"] {
  text-align: left;
}

mjx-container[jax="SVG"][justify="right"] {
  text-align: right;
}

g[data-mml-node="merror"] > g {
  fill: red;
  stroke: red;
}

g[data-mml-node="merror"] > rect[data-background] {
  fill: yellow;
  stroke: none;
}

g[data-mml-node="mtable"] > line[data-line], svg[data-table] > g > line[data-line] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > rect[data-frame], svg[data-table] > g > rect[data-frame] {
  stroke-width: 70px;
  fill: none;
}

g[data-mml-node="mtable"] > .mjx-dashed, svg[data-table] > g > .mjx-dashed {
  stroke-dasharray: 140;
}

g[data-mml-node="mtable"] > .mjx-dotted, svg[data-table] > g > .mjx-dotted {
  stroke-linecap: round;
  stroke-dasharray: 0,140;
}

g[data-mml-node="mtable"] > g > svg {
  overflow: visible;
}

[jax="SVG"] mjx-tool {
  display: inline-block;
  position: relative;
  width: 0;
  height: 0;
}

[jax="SVG"] mjx-tool > mjx-tip {
  position: absolute;
  top: 0;
  left: 0;
}

mjx-tool > mjx-tip {
  display: inline-block;
  padding: .2em;
  border: 1px solid #888;
  font-size: 70%;
  background-color: #F8F8F8;
  color: black;
  box-shadow: 2px 2px 5px #AAAAAA;
}

g[data-mml-node="maction"][data-toggle] {
  cursor: pointer;
}

mjx-status {
  display: block;
  position: fixed;
  left: 1em;
  bottom: 1em;
  min-width: 25%;
  padding: .2em .4em;
  border: 1px solid #888;
  font-size: 90%;
  background-color: #F8F8F8;
  color: black;
}

foreignObject[data-mjx-xml] {
  font-family: initial;
  line-height: normal;
  overflow: visible;
}

mjx-container[jax="SVG"] path[data-c], mjx-container[jax="SVG"] use[data-c] {
  stroke-width: 3;
}

