/* dash-hallucination.css — extends dash.css mission-control palette
 * with a matrix table + per-model sparkline grid.
 */

.halluc-page .mc-stage { padding-bottom: 100px; }
.halluc-stage { max-width: 1200px; }

.halluc-intro {
  margin: 12px 0 22px;
  padding: 18px 22px;
  background: var(--bg-card);
  border: 1px solid var(--line-mid);
  border-radius: 4px;
}
.halluc-intro h1 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--cyan-soft);
  margin: 0 0 8px;
}
.halluc-lede {
  font-family: var(--font-sans);
  font-size: 13.5px; line-height: 1.55;
  color: var(--ink-1);
  margin: 0;
}
.halluc-lede code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-card-2, var(--bg-strip));
  padding: 1px 5px; border-radius: 2px;
  color: var(--amber-0);
}

/* ── matrix ──────────────────────────────────────────────────── */
.halluc-matrix {
  margin-bottom: 28px;
  background: var(--bg-card);
  border: 1px solid var(--line-mid);
  border-radius: 4px;
  overflow: hidden;
}
.halluc-loading {
  padding: 30px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.halluc-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.halluc-table th, .halluc-table td {
  padding: 11px 14px;
  text-align: right;
  border-bottom: 1px solid var(--line-mid);
  font-variant-numeric: tabular-nums;
}
.halluc-table th {
  background: var(--bg-strip);
  color: var(--cyan-deep);
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.halluc-table th:first-child,
.halluc-table td:first-child {
  text-align: left;
  color: var(--ink-0);
}
.halluc-table tbody tr:hover {
  background: var(--bg-card-hot);
}
.halluc-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Cell color-coding — overall grounding */
.cell-bar {
  display: inline-block;
  position: relative;
  min-width: 72px;
}
.cell-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 2px;
  opacity: 0.18;
  animation: halluc-bar-grow 1200ms ease-out forwards;
  transform-origin: left;
}
.cell-bar-text {
  position: relative;
  display: inline-block;
  padding: 0 8px;
  z-index: 1;
}
.cell-bar[data-tone="ok"]   .cell-bar-fill { background: var(--green-ok); }
.cell-bar[data-tone="warn"] .cell-bar-fill { background: var(--amber-0); }
.cell-bar[data-tone="bad"]  .cell-bar-fill { background: var(--rose-warn); }
.cell-bar[data-tone="positive"] .cell-bar-fill { background: var(--cyan-0); }

@keyframes halluc-bar-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ── in-table mini sparkline (per model row) ──────────────────── */
.halluc-table .th-spark {
  text-align: left;
}

.halluc-table .cell-spark {
  padding: 4px 12px;
  min-width: 130px;
  text-align: left;
}

.spark-svg {
  display: block;
  width: 100%;
  max-width: 160px;
  min-width: 80px;
  height: 28px;
  overflow: visible;
}

.spark-axis {
  stroke: var(--line-mid);
  stroke-width: 1;
}

.spark-line {
  fill: none;
  stroke: var(--amber-0);   /* warm yellow — hallucination flavor */
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: spark-draw 1100ms ease-out forwards;
}

.spark-dot-last {
  fill: var(--amber-0);
  filter: drop-shadow(0 0 3px rgba(255, 196, 96, 0.55));
}

.spark-empty {
  fill: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

/* row-tone tints: cool down good rows, warm up bad ones; sparkline
   colour follows so a model's trend reads at-a-glance. */
.halluc-table .row-tone-ok .spark-line       { stroke: var(--green-ok); }
.halluc-table .row-tone-ok .spark-dot-last   { fill: var(--green-ok);
                                               filter: drop-shadow(0 0 3px rgba(120, 220, 140, 0.45)); }
.halluc-table .row-tone-warn .spark-line     { stroke: var(--amber-0); }
.halluc-table .row-tone-warn .spark-dot-last { fill: var(--amber-0); }
.halluc-table .row-tone-bad .spark-line      { stroke: var(--rose-warn); }
.halluc-table .row-tone-bad .spark-dot-last  { fill: var(--rose-warn);
                                               filter: drop-shadow(0 0 3px rgba(220, 120, 100, 0.45)); }

@keyframes spark-draw {
  to { stroke-dashoffset: 0; }
}

@media (max-width: 720px) {
  .halluc-table .cell-spark { min-width: 90px; padding: 4px 6px; }
  .spark-svg { max-width: 110px; min-width: 80px; height: 24px; }
}

/* ── progress sparklines ──────────────────────────────────────── */
.halluc-progress {
  margin-bottom: 28px;
}
.halluc-h2 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan-deep);
  margin: 0 0 12px;
}
.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.progress-card {
  background: var(--bg-card);
  border: 1px solid var(--line-mid);
  border-radius: 4px;
  padding: 12px 14px 10px;
}
.progress-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono); font-size: 11.5px;
  margin-bottom: 6px;
}
.progress-card-model {
  color: var(--ink-0); letter-spacing: 0.04em;
}
.progress-card-current {
  color: var(--cyan-soft);
  font-variant-numeric: tabular-nums;
}
.progress-svg {
  width: 100%;
  height: 56px;
  display: block;
}
.progress-svg .axis {
  stroke: var(--line-mid); stroke-width: 1;
}
.progress-svg .line {
  fill: none; stroke: var(--cyan-0); stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: halluc-draw 1400ms ease-out forwards;
}
.progress-svg .dot {
  fill: var(--cyan-soft);
}
.progress-svg .dot-last {
  fill: var(--amber-0);
  filter: drop-shadow(0 0 4px var(--amber-0));
}

@keyframes halluc-draw {
  to { stroke-dashoffset: 0; }
}

/* ── legend ───────────────────────────────────────────────────── */
.halluc-legend {
  background: var(--bg-card);
  border: 1px solid var(--line-mid);
  border-radius: 4px;
  padding: 16px 22px;
}
.halluc-dl {
  display: grid;
  grid-template-columns: 80px 1fr;
  row-gap: 6px; column-gap: 14px;
  margin: 0;
  font-size: 12.5px;
}
.halluc-dl dt {
  font-family: var(--font-mono);
  color: var(--cyan-deep);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10.5px;
  align-self: baseline;
  padding-top: 2px;
}
.halluc-dl dd {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-1);
  line-height: 1.5;
}
.halluc-dl code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--amber-0);
  background: var(--bg-strip);
  padding: 1px 5px; border-radius: 2px;
}

@media (max-width: 720px) {
  .halluc-stage { padding: 12px; }
  .halluc-table th, .halluc-table td { padding: 8px 8px; font-size: 11px; }
  .halluc-dl { grid-template-columns: 60px 1fr; column-gap: 10px; }
}
