/* /demos/kafka-lab page chrome.
 *
 * Loaded only by this page, through Tags.PageCSS. Not a shell asset, so sw.js's
 * CACHE_VERSION has nothing to say about it — the ?v= in PageCSSHref is the
 * whole cache-busting story, and it is served with a 30-day max-age.
 *
 * COLORS COME FROM THE SHARED SHEET'S CUSTOM PROPERTIES. css.css declares
 * --ink, --ink-muted, --hairline, --surface-alt and --accent, and redeclares
 * every one of them under the dark theme. Reading them here is what makes this
 * page survive both without a second palette to keep in step — a hard-coded
 * gray that reads correctly on white is invisible on black, and nothing on the
 * page would say so.
 *
 * The three series colors are the exception and are declared here, because they
 * are this page's own vocabulary rather than the site's: produced, consumed and
 * backlog have to stay distinguishable from each other, and the shared sheet has
 * no opinion about that. They are set on :root and overridden for dark, so they
 * follow the same discipline as everything else.
 */

.kl-stage {
  --kl-produced: #0a66c2;
  --kl-consumed: #1a7f37;
  --kl-backlog: #bc4c00;
}

@media (prefers-color-scheme: dark) {
  .kl-stage {
    --kl-produced: #58a6ff;
    --kl-consumed: #3fb950;
    --kl-backlog: #f0883e;
  }
}

/* An explicit choice wins over the system preference, matching the shell's own
 * theme toggle. Without this the series colors would follow the OS while the
 * rest of the page followed the toggle. */
[data-theme="dark"] .kl-stage {
  --kl-produced: #58a6ff;
  --kl-consumed: #3fb950;
  --kl-backlog: #f0883e;
}

[data-theme="light"] .kl-stage {
  --kl-produced: #0a66c2;
  --kl-consumed: #1a7f37;
  --kl-backlog: #bc4c00;
}

.kl-panel {
  margin: 1.5rem 0;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 1.25rem;
  background: var(--surface-alt);
}

/* THE SIMULATION LABEL IS NOT DECORATION. It is the one sentence that stops a
 * reader taking these figures for measurements, so it is given the weight of a
 * caption rather than the weight of a footnote. */
.kl-panel__label {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.kl-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kl-figure {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.kl-figure__value {
  font-size: 1.9rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kl-figure__unit {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

#kl-produced .kl-figure__value { color: var(--kl-produced); }
#kl-consumed .kl-figure__value { color: var(--kl-consumed); }
#kl-queue .kl-figure__value { color: var(--kl-backlog); }

/* The ceiling is a DERIVED figure rather than a series on the chart, so it takes
 * the body color rather than one of the three series colors. Giving it one would
 * imply a fourth line that is not drawn. */
#kl-ceiling .kl-figure__value {
  color: var(--ink);
}

.kl-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
}

.kl-status {
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
  min-height: 1.4em;
}

.kl-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.5rem;
  margin-top: 1.25rem;
}

.kl-control label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.kl-control output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.kl-control input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* The note is where the page says "three of your five consumers have no
 * partition". It is empty most of the time, so it reserves its line rather than
 * shifting the panel every time the message appears and disappears. */
.kl-note {
  margin: 1rem 0 0;
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--kl-backlog);
}

.kl-clone {
  background: var(--surface-alt);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}

.kl-clone code {
  color: var(--ink);
  white-space: pre;
}
