/* diagnostics.css --- v3 runtime diagnostics panel styling.
 *
 * W2 facet, wave 2. Styled inset that sits inside the Piano Keys body
 * (which is itself a fixed overlay, already monospace via its own rules).
 * Integration: concatenated into logan-os/v3/v3.css by W5 (append-only).
 *
 * Vocabulary:
 *   .diagnostics-panel      top-level inset
 *   .diagnostics-header     summary row (counts + ISO timestamp + re-run)
 *   .diagnostics-summary    "<pass> pass / <fail> fail" label
 *   .diagnostics-live       live state grid
 *   .diagnostics-list       pass/fail assertion rows
 *   .diagnostics-row.pass   subtle green checkmark row
 *   .diagnostics-row.fail   soft red cross row with mono error detail
 */

.diagnostics-panel {
  margin-top: 10px;
  padding: 10px;
  background: #F6F6F2;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 2px;
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--ink, #111);
  line-height: 1.5;
}

.diagnostics-header {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(17, 17, 17, 0.12);
}

.diagnostics-glyph {
  font-size: 12px;
}

.diagnostics-title {
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--ink, #111);
}

.diagnostics-summary {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-64, rgba(17, 17, 17, 0.64));
}

.diagnostics-time {
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--ink-42, rgba(17, 17, 17, 0.42));
  white-space: nowrap;
}

.diagnostics-rerun {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(17, 17, 17, 0.18);
  border-radius: 2px;
  padding: 2px 8px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--ink, #111);
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.diagnostics-rerun:hover,
.diagnostics-rerun:focus-visible {
  border-color: var(--red, #D0342C);
  color: var(--red, #D0342C);
  background: rgba(208, 52, 44, 0.04);
  outline: none;
}

.diagnostics-rerun:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── live state grid ──────────────────────────────────────────────── */

.diagnostics-live {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  padding: 6px 0 8px;
  margin-bottom: 8px;
  border-bottom: 1px dashed rgba(17, 17, 17, 0.12);
}

.diagnostics-live-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
}

.diagnostics-live-key {
  color: var(--ink-64, rgba(17, 17, 17, 0.64));
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.diagnostics-live-val {
  color: var(--ink, #111);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}

/* ── assertion rows ───────────────────────────────────────────────── */

.diagnostics-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.diagnostics-row {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  padding: 4px 6px;
  border-radius: 2px;
  border: 1px solid transparent;
}

.diagnostics-row-glyph {
  grid-row: 1 / 3;
  grid-column: 1;
  align-self: start;
  font-size: 12px;
  line-height: 1;
  padding-top: 1px;
}

.diagnostics-row-name {
  grid-row: 1;
  grid-column: 2;
  font-size: 11px;
  color: var(--ink, #111);
}

.diagnostics-row-detail {
  grid-row: 2;
  grid-column: 2;
  font-size: 10px;
  color: var(--ink-64, rgba(17, 17, 17, 0.64));
  word-break: break-word;
}

.diagnostics-row.pass {
  background: rgba(63, 140, 74, 0.05);
  border-color: rgba(63, 140, 74, 0.18);
}

.diagnostics-row.pass .diagnostics-row-glyph {
  color: #3F8C4A;
}

.diagnostics-row.fail {
  background: rgba(208, 52, 44, 0.06);
  border-color: rgba(208, 52, 44, 0.22);
}

.diagnostics-row.fail .diagnostics-row-glyph {
  color: var(--red, #D0342C);
}

.diagnostics-row.fail .diagnostics-row-detail {
  color: var(--red, #D0342C);
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── live overlay (soc-501 round 7) ──────────────────────────────── */
/* Dev-only pinned panel. Fixed top-right. Reuses the inset tokens of
 * .diagnostics-panel but opts out of the 2-col grid — key/val rows lay
 * out via flex for narrower content. Mounted only when ?debug=1 or
 * window.__debug__; never rendered in prod default. */

.diagnostics-overlay {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 240px;
  z-index: 60;
  padding: 8px 10px;
  background: #F6F6F2;
  border: 1px solid rgba(17, 17, 17, 0.16);
  border-radius: 2px;
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  line-height: 1.45;
  color: var(--ink, #111);
  pointer-events: none;
}

.diagnostics-overlay[hidden] { display: none; }

.diagnostics-overlay .overlay-title {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--ink-42, rgba(17, 17, 17, 0.42));
  margin-bottom: 4px;
}

.diagnostics-overlay .overlay-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.diagnostics-overlay .overlay-key {
  color: var(--ink-64, rgba(17, 17, 17, 0.64));
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.diagnostics-overlay .overlay-val {
  color: var(--ink, #111);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.diagnostics-overlay .overlay-val.alert {
  color: var(--red, #D0342C);
}

/* ── print: suppress with the rest of the v3 panels ───────────────── */

@media print {
  .diagnostics-panel,
  .diagnostics-overlay {
    display: none !important;
  }
}
