/* Editorial charts for blog posts (basal-2.0 post). Bars are static markup; charts.js adds sorting, details and motion. */
.bchart {
  --c20: var(--accent, #b94329);
  --c15: var(--ink, #232824);
  --c15d: #a3a89c;
  --comni: var(--accent, #b94329);
  --comni-light: #f2d3c7;
  --cother: #c9ccc3;
  --grid: #ecece6;
  --base: var(--ink, #232824);
  --sub: #6b7166;
  --omni-fill: repeating-linear-gradient(135deg, var(--comni) 0 2px, var(--comni-light) 2px 5px);
  position: relative;
  margin: 40px 0;
  padding: 28px 26px 22px;
  border: 1px solid var(--line, #dedfd8);
  border-radius: 6px;
  background: #fff;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink, #232824);
}
.bchart .is-20 { --fill: var(--c20); }
.bchart .is-15 { --fill: var(--c15); }
.bchart .is-15d { --fill: var(--c15d); }
.bchart .is-omni { --fill: var(--omni-fill); }

/* Heading block */
.bchart-head { text-align: center; }
.bchart-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 2px;
  background: #5c6258;
  color: #fff;
  font: 10px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.blog-prose .bchart-title {
  max-width: 600px;
  margin: 14px auto 8px;
  font-size: 29px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.7px;
  color: #3a3f37;
}
.blog-prose .bchart-sub {
  max-width: 600px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.6;
  color: var(--sub);
}
.bchart-sub strong { color: var(--ink, #232824); font-weight: 600; }
.bchart code { font: 0.86em var(--mono); }

/* Tools: switch buttons on the left, legend on the right */
.bchart-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 24px;
}
.bchart-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bchart-switch > span,
.blog-prose .bchart-axisname {
  margin: 0 4px 0 0;
  font: 11px/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sub);
}
.bchart-switch button {
  padding: 5px 11px;
  border: 1px solid #d6d8d0;
  border-radius: 2px;
  background: #fff;
  color: var(--ink, #232824);
  font: 500 13px/1.4 var(--sans, sans-serif);
  cursor: pointer;
}
.bchart-switch button[aria-pressed="true"] { border-color: var(--ink, #232824); background: var(--ink, #232824); color: #fff; }
.bchart-switch button:focus-visible { outline: 2px solid var(--accent, #b94329); outline-offset: 2px; }
.blog-prose .bchart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}
.blog-prose .bchart-legend li { margin: 0; font-size: 13px; line-height: 1.5; color: #4c5348; }
.bchart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
  background: var(--fill);
}
.bchart-legend i.is-omni { box-shadow: inset 0 0 0 1px var(--comni); }
.bchart-legend i.is-mark { width: 2px; height: 12px; margin-inline: 4px 8px; background: var(--ink, #232824); }
.bchart-legend i.is-dot { width: 9px; height: 9px; border-radius: 50%; }
.bchart-legend i.is-dot.is-omni { background: #fff; box-shadow: inset 0 0 0 2px var(--comni); }
.bchart-legend i.is-other { background: var(--cother); }

/* Shared bar pieces */
.bc-label b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.bc-label small,
.bc-head small,
.bc-xlabel small {
  display: block;
  font: 10.5px/1.4 var(--mono);
  color: var(--sub);
  text-transform: none;
  letter-spacing: 0;
}
.bc-track {
  position: relative;
  height: 100%;
  min-height: 26px;
  border-left: 1px solid var(--base);
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px);
  background-size: var(--step, 25%) 100%;
  box-shadow: inset -1px 0 0 var(--edge, var(--grid));
}
.bc-log { --step: 43.46%; --edge: transparent; }
.bc-bar {
  position: absolute;
  top: 50%;
  left: 0;
  width: var(--v);
  height: 14px;
  margin-top: -7px;
}
.bc-bar i,
.bc-vbar i {
  position: absolute;
  inset: 0;
  background: var(--fill);
  transform-origin: left center;
}
.bc-row.is-omni .bc-bar i,
.bc-hbar.is-omni .bc-bar i { box-shadow: inset 0 0 0 1px var(--comni); }
.bc-na {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  font: 10.5px var(--mono);
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sub);
}
.bc-axis { position: relative; height: 24px; font: 10.5px var(--mono); color: var(--sub); }
.bc-axis span { position: absolute; top: 6px; transform: translateX(-50%); white-space: nowrap; }
.bc-axis span:first-child { transform: none; }
.bc-axis span:last-child:not(:first-child) { transform: translateX(-100%); }
.bc-axis[data-panel="dps"] span:last-child { transform: translateX(-50%); }
.bc-hit { cursor: pointer; }

/* Chart 1: rows with three panels */
.bc-panels { margin-top: 20px; }
.bc-row {
  display: grid;
  grid-template-columns: 160px repeat(3, minmax(0, 1fr));
  column-gap: 20px;
  align-items: stretch;
}
.bc-rows .bc-row { min-height: 50px; border-top: 1px solid var(--grid); }
.bc-rows .bc-row:last-child { border-bottom: 1px solid var(--grid); }
.bc-rows .bc-label { align-self: center; padding: 6px 0; }
.bc-head {
  padding-bottom: 10px;
  font: 11px/1.4 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #3a3f37;
}
.bc-head > div { align-self: end; }
.bc-row.bc-hit:hover,
.bc-row.bc-hit.is-active { background: #f8f7f3; }
.bc-row.bc-hit.is-active .bc-label b { text-decoration: underline; text-underline-offset: 3px; }

/* Chart 2: vertical paired bars on a log axis */
.bc-cols {
  --h: 260px;
  display: grid;
  grid-template-columns: 44px repeat(3, minmax(0, 1fr));
  grid-template-rows: var(--h) auto;
  margin-top: 22px;
}
.bc-yaxis { position: relative; font: 10.5px var(--mono); color: var(--sub); }
.bc-yaxis span { position: absolute; right: 8px; transform: translateY(50%); }
.bc-col {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  border-bottom: 1px solid var(--base);
  background-image: linear-gradient(to top, var(--grid) 1px, transparent 1px);
  background-position: 0 100%;
  background-size: 100% 43.46%;
}
.bc-col:hover,
.bc-col.is-active { background-color: #f8f7f3; }
.bc-vbar { position: relative; width: 36px; height: var(--v); }
.bc-vbar i { transform-origin: center bottom; }
.bc-vbar b {
  position: absolute;
  bottom: 100%;
  left: 50%;
  padding-bottom: 4px;
  transform: translateX(-50%);
  font: 600 12px var(--mono);
  white-space: nowrap;
}
.bc-xpad { grid-column: 1; }
.bc-xlabel { padding: 10px 4px 0; text-align: center; }
.bc-xlabel b { display: block; font-size: 14px; font-weight: 600; }

/* Charts 3 and 5: grouped horizontal bars with a value column */
.bc-hchart { margin-top: 20px; }
.bc-hgroup {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  column-gap: 20px;
  padding: 10px 0;
  border-top: 1px solid var(--grid);
}
.bc-hgroup.bc-axisrow { padding: 0; }
.bc-hgroup .bc-label { align-self: center; }
.bc-hgroup.bc-hit:hover,
.bc-hgroup.bc-hit.is-active { background: #f8f7f3; }
.bc-hbar { display: grid; grid-template-columns: minmax(0, 1fr) 52px; column-gap: 8px; align-items: center; }
.bc-hbar + .bc-hbar { margin-top: 3px; }
.bc-hbar .bc-track { min-height: 20px; }
.bc-hbar .bc-bar { height: 13px; margin-top: -6.5px; }
.bc-val { font: 600 12px var(--mono); font-style: normal; }
.bc-mark {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: var(--v);
  width: 2px;
  margin-left: -1px;
  background: var(--ink, #232824);
}
.bchart[data-model="mini"] [data-m="max"],
.bchart[data-model="max"] [data-m="mini"] { display: none; }

/* Chart 4: board strip, drawn by charts.js */
.bc-strip { display: none; margin-top: 20px; }
.bchart.is-ready .bc-strip { display: block; }
.bc-srow { display: grid; grid-template-columns: 110px minmax(0, 1fr); column-gap: 16px; border-top: 1px solid var(--grid); }
.bc-srow .bc-label { align-self: center; }
.bc-splot { position: relative; height: 100px; }
.bc-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grid); }
.bc-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--cother);
}
.bc-dot.is-15 { background: var(--c15); }
.bc-dot.is-20 { z-index: 2; background: var(--c20); box-shadow: 0 0 0 2px #fff; }
.bc-dot.is-omni { z-index: 2; background: #fff; box-shadow: inset 0 0 0 2.5px var(--comni), 0 0 0 2px #fff; }
.bc-dot:hover,
.bc-dot.is-active { z-index: 3; outline: 2px solid var(--ink, #232824); outline-offset: 1px; }
.bc-dlabel {
  position: absolute;
  font: 11px/1.3 var(--mono);
  white-space: nowrap;
  color: var(--ink, #232824);
}
.bc-dlabel b { font-weight: 600; }
.bc-dlabel.is-20 { color: var(--c20); }
.bc-lead { position: absolute; width: 1px; background: currentColor; opacity: 0.55; }
.bc-lead.is-20 { color: var(--c20); }
.bc-lead.is-omni { color: var(--comni); }
.bc-strip .bc-axisrow { display: grid; grid-template-columns: 110px minmax(0, 1fr); column-gap: 16px; border-top: 1px solid var(--grid); }

/* Readout, caption and notes */
.blog-prose .bchart-readout {
  min-height: 1.6em;
  margin: 14px 0 0;
  font: 12px/1.6 var(--mono);
  color: #3a3f37;
}
.blog-prose .bchart-caption {
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.7;
  color: #4c5348;
}
.bchart-caption b { font: 600 0.92em var(--mono); color: var(--ink, #232824); }
.bchart-notes { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line, #dedfd8); }
.blog-prose .bchart-notes p { margin: 0; font-size: 13px; line-height: 1.65; color: #5c6358; }
.blog-prose .bchart-notes p + p { margin-top: 6px; }
.bchart-notes strong { color: var(--ink, #232824); }

/* First view: bars grow in (charts.js adds .is-anim only without reduced motion) */
.bchart.is-anim .bc-bar i { transform: scaleX(0); }
.bchart.is-anim .bc-vbar i { transform: scaleY(0); }
.bchart.is-anim .bc-dot { opacity: 0; }
.bchart.is-anim.is-in .bc-bar i,
.bchart.is-anim.is-in .bc-vbar i { transform: none; transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1); }
.bchart.is-anim.is-in .bc-dot { opacity: 1; transition: opacity 0.6s ease; }
@media (prefers-reduced-motion: reduce) {
  .bchart .bc-bar i,
  .bchart .bc-vbar i,
  .bchart .bc-dot { transform: none !important; opacity: 1 !important; transition: none !important; }
}

/* Compact layout */
@media (max-width: 680px) {
  .bchart { margin: 32px 0; padding: 22px 14px 18px; }
  .blog-prose .bchart-title { font-size: 23px; letter-spacing: -0.4px; }
  .blog-prose .bchart-sub { font-size: 14px; }
  .blog-prose .bchart-legend { margin-left: 0; }
  .bc-row { grid-template-columns: minmax(0, 1fr); }
  .bc-head .bc-label,
  .bc-axisrow .bc-label { display: none; }
  .bchart[data-metric="acc"] [data-panel]:not([data-panel="acc"]),
  .bchart[data-metric="dps"] [data-panel]:not([data-panel="dps"]),
  .bchart[data-metric="ece"] [data-panel]:not([data-panel="ece"]) { display: none; }
  .bc-rows .bc-row { padding: 6px 0 8px; }
  .bc-rows .bc-label { padding: 0 0 4px; }
  .bc-rows .bc-label b, .bc-rows .bc-label small { display: inline; margin-right: 8px; }
  .bc-rows .bc-track { min-height: 20px; }
  .bc-cols { --h: 220px; grid-template-columns: 30px repeat(3, minmax(0, 1fr)); }
  .bc-yaxis span { right: 5px; }
  .bc-col { gap: 5px; }
  .bc-vbar { width: 24px; }
  .bc-vbar b { font-size: 10.5px; }
  .bc-xlabel b { font-size: 13px; }
  .bc-hgroup,
  .bc-srow,
  .bc-strip .bc-axisrow { grid-template-columns: minmax(0, 1fr); }
  .bc-hgroup .bc-label { padding-bottom: 6px; }
  .bc-hbar { grid-template-columns: minmax(0, 1fr) 44px; }
  .bc-srow .bc-label { padding-top: 8px; }
  .bc-srow .bc-label b, .bc-srow .bc-label small { display: inline; margin-right: 8px; }
}
