/*
 * ADC Lab - figures.css
 *
 * Interactive figure frame, control panel, readout table and every SVG
 * class used by js/lib/plot.js and the figures. Colours live here only.
 */

/* ------------------------------------------------------------------ */
/* Frame                                                               */
/* ------------------------------------------------------------------ */

figure.lab {
  max-width: var(--figure-max);
  margin: 3rem auto 3.5rem;
  padding: 0;
  background: var(--sheet);
  outline: 0.5px solid rgba(0, 0, 0, 0.35);
  border-radius: 2px;
  text-align: left;
  scroll-margin-top: 64px;
}

.lab-head {
  display: flex;
  align-items: baseline;
  gap: 1em;
  padding: 0.7rem 1rem 0.55rem;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.35);
}

.lab-id {
  font-size: 11px;
  color: var(--color-primary);
}

.lab-title {
  font-size: 11px;
  color: var(--foreground);
}

.lab-cn {
  font-size: 13px;
  color: var(--ink-50);
}

.lab-reset { margin-left: auto; }

.lab-body {
  display: grid;
  grid-template-columns: minmax(0, 62fr) minmax(220px, 38fr);
  gap: 0;
}

.lab-body-stack { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .lab-body { grid-template-columns: 1fr; }
}

.lab-plot {
  padding: 0.9rem 0.6rem 0.6rem 0.9rem;
  min-width: 0;
}

.lab-plot .lab-svg {
  display: block;
  width: 100%;
  height: auto;
}

.lab-panel {
  border-left: 0.5px solid rgba(0, 0, 0, 0.25);
  padding: 0.8rem 1rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.lab-body-stack .lab-panel {
  border-left: 0;
  border-top: 0.5px solid rgba(0, 0, 0, 0.25);
  flex-direction: row;
  flex-wrap: wrap;
}

.lab-body-stack .lab-controls { flex: 1 1 320px; }
.lab-body-stack .lab-readouts { flex: 1 1 260px; }

@media (max-width: 900px) {
  .lab-panel { border-left: 0; border-top: 0.5px solid rgba(0, 0, 0, 0.25); }
}

.lab-caption {
  padding: 0.7rem 1rem 0.2rem;
  border-top: 0.5px solid rgba(0, 0, 0, 0.35);
  text-align: left;
  font-family: var(--font-serif);
  font-size: 12.5px;
  color: var(--ink-80);
  line-height: 1.6;
}

.lab-caption::before {
  content: "CAPTION";
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-35);
  margin-right: 0.8em;
}

.lab-tries {
  list-style: none;
  margin: 0;
  padding: 0.4rem 1rem 0.8rem;
  font-family: var(--font-serif);
  font-size: 12.5px;
  line-height: 1.6;
}

.lab-tries li {
  display: flex;
  gap: 0.8em;
  margin: 0.25em 0;
  text-align: left;
}

.try-id {
  flex: 0 0 auto;
  font-size: 9px;
  color: var(--color-primary);
  line-height: 2.2;
}

.lab-error {
  padding: 2rem 1rem;
  font: 400 11px/1.6 var(--font-mono);
  text-transform: uppercase;
  color: var(--color-error);
}

.lab-error small {
  display: block;
  text-transform: none;
  color: var(--ink-50);
  margin-top: 0.5em;
}

/* ------------------------------------------------------------------ */
/* Controls                                                            */
/* ------------------------------------------------------------------ */

.lab-controls {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ctl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.6rem;
  align-items: baseline;
}

.ctl-label {
  font-size: 9.5px;
  color: var(--ink-50);
}

.ctl-label em {
  font-size: 11px;
  color: var(--ink-50);
  margin-left: 0.5em;
}

.ctl-value {
  font-size: 10.5px;
  color: var(--color-primary);
  text-align: right;
  text-transform: none;
  white-space: nowrap;
}

.ctl-slider input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  height: 14px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.ctl-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--ink-35);
}

.ctl-slider input[type="range"]::-moz-range-track {
  height: 1px;
  background: var(--ink-35);
}

.ctl-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -4.5px;
  border-radius: 1px;
  background: #fff;
  border: 1px solid #000;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
  transition: background 150ms;
}

.ctl-slider input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  background: #fff;
  border: 1px solid #000;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
}

.ctl-slider input[type="range"]:hover::-webkit-slider-thumb { background: #f4f4f4; }
.ctl-slider input[type="range"]:focus { outline: none; }
.ctl-slider input[type="range"]:focus-visible::-webkit-slider-thumb { border-color: var(--color-primary); }

.ctl-seg { grid-template-columns: 1fr; }

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  border: 1px solid #000;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
  background: #fff;
  align-self: start;
}

.seg-opt {
  font-size: 10px;
  padding: 0.35em 0.75em;
  border: 0;
  border-right: 1px solid #000;
  background: #fff;
  color: var(--foreground);
  cursor: pointer;
  transition: var(--transition);
}

.seg-opt:last-child { border-right: 0; }
.seg-opt:hover { background: #f4f4f4; }
.seg-opt.active { background: var(--color-primary); color: #fff; }

.ctl-row { grid-template-columns: 1fr; }

.ctl-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.ctl-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 9.5px;
  color: var(--ink-50);
  text-transform: none;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* Readouts                                                            */
/* ------------------------------------------------------------------ */

.lab-readouts {
  margin: 0;
  padding: 0.6rem 0 0;
  border-top: 0.5px solid rgba(0, 0, 0, 0.25);
  font-size: 10px;
  display: grid;
  gap: 0.25rem;
}

.lab-readouts div {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  align-items: baseline;
}

.lab-readouts dt { color: var(--ink-50); }
.lab-readouts dt em { font-size: 11px; margin-left: 0.4em; }

.lab-readouts dd {
  margin: 0;
  color: var(--foreground);
  text-transform: none;
  text-align: right;
  white-space: nowrap;
}

.lab-readouts div.warn dd { color: var(--color-error); }
.lab-readouts div.ok dd { color: var(--color-primary); }

/* ------------------------------------------------------------------ */
/* SVG                                                                 */
/* ------------------------------------------------------------------ */

.lab-svg {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.lab-svg text { fill: var(--foreground); }
.lab-svg .tick-label { fill: var(--ink-50); font-size: 9px; }
.lab-svg .axis-label { fill: var(--ink-50); font-size: 9px; }
.lab-svg .axis-line { stroke: #000; stroke-width: 1; }
.lab-svg .tick { stroke: #000; stroke-width: 1; }
.lab-svg .tick.minor { stroke: var(--ink-25); }
.lab-svg .grid { stroke: var(--ink-6); stroke-width: 1; }

.lab-svg path, .lab-svg line, .lab-svg polyline, .lab-svg circle { fill: none; }

.lab-svg .analog { stroke: var(--ink-35); stroke-width: 1.25; }
.lab-svg .digital { stroke: #000; stroke-width: 1.25; }
.lab-svg .accent { stroke: var(--color-primary); stroke-width: 1.25; }
.lab-svg .accent-fill { fill: var(--color-primary); }
.lab-svg .warn { stroke: var(--color-error); stroke-width: 1.25; }
.lab-svg .warn-fill { fill: var(--color-error); }
.lab-svg .ideal { stroke: var(--ink-35); stroke-width: 1; stroke-dasharray: 3 3; }
.lab-svg .dashed { stroke-dasharray: 4 3; }
.lab-svg .thin { stroke-width: 0.75; }
.lab-svg .hair { stroke: var(--ink-25); stroke-width: 0.75; }
.lab-svg .ref-line { stroke: var(--ink-50); stroke-width: 0.75; stroke-dasharray: 2 3; }

.lab-svg .sample { fill: var(--color-primary); stroke: none; }
.lab-svg .sample-ring { fill: #fff; stroke: var(--color-primary); stroke-width: 1; }

.lab-svg .band { fill: rgba(48, 110, 255, 0.10); stroke: none; }
.lab-svg .band-warn { fill: rgba(255, 102, 59, 0.14); stroke: none; }
.lab-svg .band-gray { fill: rgba(0, 0, 0, 0.05); stroke: none; }

.lab-svg .bar { fill: rgba(0, 0, 0, 0.55); stroke: none; }
.lab-svg .bar.warn { fill: var(--color-error); stroke: none; }
.lab-svg .bar.accent { fill: var(--color-primary); stroke: none; }
.lab-svg .bar.muted { fill: rgba(0, 0, 0, 0.18); stroke: none; }

.lab-svg .label { fill: var(--foreground); }
.lab-svg .label-muted { fill: var(--ink-50); }
.lab-svg .label-accent { fill: var(--color-primary); }
.lab-svg .label-warn { fill: var(--color-error); }
.lab-svg .label-big { font-size: 13px; }
.lab-svg .label-cn { font-family: var(--font-serif); text-transform: none; letter-spacing: 0; font-size: 11px; fill: var(--ink-50); }

.lab-svg .box { fill: #fff; stroke: #000; stroke-width: 1; }
.lab-svg .box-yellow { fill: #ffe14d; stroke: #000; stroke-width: 1; }
.lab-svg .box-mint { fill: #63e6a4; stroke: #000; stroke-width: 1; }
.lab-svg .box-lavender { fill: #cfa9f0; stroke: #000; stroke-width: 1; }
.lab-svg .box-salmon { fill: #ff9d94; stroke: #000; stroke-width: 1; }
.lab-svg .box-gray { fill: #e9e9e9; stroke: #000; stroke-width: 1; }
.lab-svg .box-active { fill: #d7f5e3; stroke: #000; stroke-width: 1.5; }
.lab-svg .box-dashed { fill: none; stroke: #000; stroke-width: 1; stroke-dasharray: 4 3; }
.lab-svg .inactive { opacity: 0.3; }

.lab-svg .region-flash { fill: rgba(255, 225, 77, 0.45); stroke: #000; stroke-width: 1; }
.lab-svg .region-pipeline { fill: rgba(255, 157, 148, 0.45); stroke: #000; stroke-width: 1; }
.lab-svg .region-sar { fill: rgba(99, 230, 164, 0.45); stroke: #000; stroke-width: 1; }
.lab-svg .region-sd { fill: rgba(207, 169, 240, 0.5); stroke: #000; stroke-width: 1; }
.lab-svg .region-hover { stroke-width: 1.5; }
.lab-svg .region-dim { opacity: 0.35; }

.lab-svg .hit { fill: transparent; stroke: none; cursor: pointer; }
.lab-svg .region text, .lab-svg .refs { pointer-events: none; }
.lab-svg .region rect { cursor: help; }

.lab-svg .arrow line, .lab-svg .arrow path { stroke: #000; stroke-width: 1; }
.lab-svg .arrow.accent line, .lab-svg .arrow.accent path { stroke: var(--color-primary); }

/* ------------------------------------------------------------------ */
/* FIG_01 hover card and parameter dictionary                          */
/* ------------------------------------------------------------------ */

.chain-note {
  min-height: 3.2em;
  margin: 0.4rem 1rem 0.6rem;
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-80);
}

.chain-note .kicker { display: inline; font-size: 10px; margin-right: 0.8em; color: var(--color-primary); }

.dict {
  max-width: var(--figure-max);
  margin: 2rem auto 0;
}

.dict-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2em 0;
  font-size: 10.5px;
  color: var(--ink-50);
  margin-bottom: 1.5rem;
  justify-content: center;
}

.dict-tabs button {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  background: none;
  border: 0;
  color: var(--ink-50);
  cursor: pointer;
  padding: 0.2em 0.6em;
  transition: color 150ms;
}

.dict-tabs button:hover { color: var(--foreground); }
.dict-tabs button.active { color: var(--color-primary); }
.dict-tabs .dot { color: var(--ink-25); }

.dict-count {
  text-align: center;
  font: 400 10px var(--font-mono);
  text-transform: uppercase;
  color: var(--ink-50);
  margin: -1rem 0 1.5rem;
}

.dict-group { margin-bottom: 3rem; }

.dict-group-head {
  display: flex;
  align-items: baseline;
  gap: 1em;
  margin: 0 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--foreground);
}

.dict-group-head .mono { font-size: 10.5px; color: var(--foreground); }
.dict-group-head span:last-child { font-size: 13px; color: var(--ink-50); }

.dict-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 0.75rem;
}

.dict-card {
  outline: 0.5px solid rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  padding: 0.75rem 0.85rem 0.7rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: outline-color 150ms;
}

.dict-card:hover { outline-color: #000; }

.dict-card .dict-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5em;
}

.dict-card .dict-cn {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
}

.dict-en {
  font-size: 9px;
  color: var(--ink-50);
  text-align: right;
}

.dict-tag {
  font-size: 8.5px;
  color: var(--color-error);
  border: 0.5px solid var(--color-error);
  padding: 0.1em 0.4em;
  border-radius: 2px;
  align-self: flex-start;
}

.dict-card p {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: left;
}

.dict-card p.dict-why { color: var(--ink-80); }

.dict-vals {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-50);
  line-height: 1.6;
  word-break: break-all;
}

.dict-vals::before {
  content: "LCSC";
  color: var(--color-primary);
  margin-right: 0.6em;
}

.dict-vals.partial::after {
  content: " (节选)";
  font-family: var(--font-serif);
  font-size: 11px;
}

.dict-link {
  margin-top: auto;
  padding-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dict-link a {
  color: var(--color-primary);
  text-decoration: none;
}

.dict-link a:hover { text-decoration: underline; }
