/* Static charts for the FlexDM post: System One flow, timeline, board distribution,
   failed tries. Colours come from the site tokens, so both themes work. */

.chart {
  position: relative;
  margin: 32px 0 36px;
}

.chart figcaption {
  margin-top: 12px;
  color: var(--faint);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* Tooltip (assets/viz/chart-tip.js). */
.chart-tip {
  position: absolute;
  z-index: 3;
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  color: var(--graphite);
  font-size: 0.76rem;
  line-height: 1.5;
  white-space: nowrap;
  pointer-events: none;
}

.chart-tip strong {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.chart-tip span {
  display: block;
}

/* Timeline. */
.post-body .tl-legend {
  display: flex;
  gap: 18px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  color: var(--graphite);
  font-size: 0.8rem;
}

.post-body .tl-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.tl-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--faint);
}

.tl-legend .ours i {
  background: var(--accent);
}

.post-body ol.tl {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-body ol.tl::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 6.5em;
  width: 1px;
  background: var(--hairline);
}

.post-body .tl li {
  position: relative;
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  column-gap: 2em;
  margin: 0;
  padding: 5px 0;
}

.post-body .tl li::before {
  content: "";
  position: absolute;
  top: calc(5px + 0.72em);
  left: 6.5em;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px var(--paper);
}

.post-body .tl li.ours::before {
  background: var(--accent);
}

.tl time {
  color: var(--faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.post-body .tl p {
  margin: 0;
  color: var(--graphite);
  font-size: 0.92rem;
  line-height: 1.5;
}

.post-body .tl li.ours p {
  color: var(--ink);
}

@media (max-width: 620px) {
  .post-body ol.tl::before,
  .post-body .tl li::before {
    left: 5.2em;
  }

  .post-body .tl li {
    grid-template-columns: 4.5em minmax(0, 1fr);
    column-gap: 1.4em;
  }
}

/* Board distribution (generated SVG). */
.chart-scroll {
  overflow-x: auto;
}

.chart-board svg {
  display: block;
  width: 100%;
  min-width: 540px;
  height: auto;
  overflow: visible;
  font-family: var(--sans);
}

.chart svg .pt {
  fill: var(--faint);
  fill-opacity: 0.5;
}

.chart svg .pt.ours {
  fill: var(--accent);
  fill-opacity: 1;
  stroke: var(--paper);
  stroke-width: 2px;
}

.chart svg .pt.is-hot {
  fill-opacity: 1;
  stroke: var(--ink);
  stroke-width: 1.5px;
}

.chart svg .grid,
.chart svg .sep {
  stroke: var(--hairline);
  stroke-width: 1px;
}

.chart svg .tick {
  fill: var(--faint);
  font-size: 11px;
}

.chart svg .rowlab {
  fill: var(--ink);
  font-size: 12.5px;
}

.chart svg .rowcount {
  fill: var(--faint);
  font-size: 11px;
}

.chart svg .ref {
  stroke: var(--ink);
  stroke-width: 1.5px;
}

.chart svg .refmark {
  fill: var(--ink);
}

.chart svg .reflab {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.chart svg .lab {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.chart svg .lead {
  fill: none;
  stroke: var(--graphite);
  stroke-width: 1px;
}

.chart svg :focus {
  outline: none;
}

.chart svg .pt:focus-visible,
.chart svg .ref:focus-visible {
  stroke: var(--ink);
  stroke-width: 2.5px;
}

details.chart-table {
  margin-bottom: 1.5em;
}

.chart-table summary {
  margin-top: 8px;
  color: var(--graphite);
  font-size: 0.82rem;
  cursor: pointer;
}

.chart-table table {
  margin-top: 10px;
}

/* Failed tries: a range per row against the noise band. Domain −1.0 … +0.6. */
.fx {
  display: grid;
  gap: 4px;
}

.fx-row,
.fx-head,
.fx-axis {
  display: grid;
  grid-template-columns: minmax(0, 13.5em) minmax(0, 1fr) 6.8em;
  gap: 16px;
  align-items: center;
}

.fx-name {
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.4;
}

.fx-val {
  color: var(--graphite);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.fx-track,
.fx-scale,
.fx-ticks {
  position: relative;
  height: 24px;
}

.fx-scale {
  height: 18px;
}

.fx-band {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(0.5 / 1.6 * 100%);
  width: calc(1 / 1.6 * 100%);
  background: var(--mask);
}

.fx-bandlab {
  position: absolute;
  bottom: 0;
  left: calc(1 / 1.6 * 100%);
  transform: translateX(-50%);
  color: var(--faint);
  font-size: 0.72rem;
  white-space: nowrap;
}

.fx-zero {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: calc(1 / 1.6 * 100%);
  width: 1px;
  background: var(--graphite);
}

.fx-mark {
  position: absolute;
  top: 50%;
  left: calc((var(--lo) + 1) / 1.6 * 100%);
  width: calc((var(--hi) - var(--lo)) / 1.6 * 100%);
  min-width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 4px;
  background: var(--accent);
}

.fx-mark.fx-dot {
  width: 10px;
  min-width: 0;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--paper);
}

.fx-mark.is-hot,
.fx-mark:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.fx-ticks span {
  position: absolute;
  top: 2px;
  left: calc((var(--v) + 1) / 1.6 * 100%);
  transform: translateX(-50%);
  color: var(--faint);
  font-size: 0.72rem;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .fx-row,
  .fx-head,
  .fx-axis {
    grid-template-columns: minmax(0, 1fr) 6.8em;
    gap: 4px 10px;
  }

  .fx-name {
    grid-column: 1 / -1;
    margin-top: 6px;
  }

  .fx-head > span:first-child,
  .fx-axis > span:first-child {
    display: none;
  }
}
