/* CT reconstruction demo: the artifact's console layout, scoped under .ctlab, recolored with the site palette.
   This page loads only /css/site.css + this file (not demo.css), so the resets below undo site.css's
   global label/input/heading/.btn/.grid rules inside the console. */
.ctlab {
  --bg: #1f2b1f;
  --panel: #263526;
  --raised: #2f402f;
  --line: rgba(170, 204, 170, 0.22);
  --fg: #dfe8df;
  --muted: #a9b8a9;
  --accent: #aca;
  --accent-ink: #1f2b1f;
  --unet: #3c3;
  --fbp: #6cb4e4;
  --truth: #c9d6c9;
  --ok: #3c3;
  --warn: #e6c35c;
  --bad: #f19a8a;
  --image: #000;
  --font-display: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Courier New", monospace;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Courier New", monospace;
  --r: 6px;
  color-scheme: dark;

  max-width: 1320px; margin: 0 auto; padding: 18px 16px 40px;
  display: grid; gap: 16px;
  background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45;
}
.ctlab * { box-sizing: border-box; }

/* resets against site.css globals */
.ctlab label { display: inline; margin: 0; font-size: inherit; color: inherit; }
.ctlab input { display: inline-block; width: auto; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; }
.ctlab input:focus { outline: none; }
.ctlab details { margin: 0; font-size: inherit; color: inherit; }

.ctlab h1, .ctlab h2, .ctlab h3 { font-family: var(--font-display); font-weight: 700; margin: 0; text-wrap: balance; }
.ctlab h1 { font-size: clamp(24px, 4vw, 34px); color: var(--accent); line-height: 1.2; }
.ctlab h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.ctlab h3 { color: var(--fg); }
.ctlab p { margin: 0; }
.ctlab .mono, .ctlab .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ctlab .muted { color: var(--muted); }
.ctlab button, .ctlab select, .ctlab input { font: inherit; color: inherit; }
.ctlab :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ctlab header.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
.ctlab header.top .lede { max-width: 70ch; color: var(--muted); margin-top: 4px; }

.ctlab .status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ctlab .chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); font-family: var(--font-mono); font-size: 12px; white-space: nowrap;
}
.ctlab .chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.ctlab .chip.ok .dot { background: var(--ok); }
.ctlab .chip.warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.ctlab .chip.warn .dot { background: var(--warn); }
.ctlab .chip.bad .dot { background: var(--bad); }
.ctlab .chip.busy .dot { background: var(--accent); animation: ctpulse 1s ease-in-out infinite; }
@keyframes ctpulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .ctlab .chip.busy .dot { animation: none; } }

.ctlab .grid { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1020px) { .ctlab .grid { grid-template-columns: minmax(0, 1fr); } }

.ctlab .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 12px; min-width: 0; margin: 0; }
.ctlab .panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* phantom editor */
.ctlab .editor { position: relative; width: 100%; aspect-ratio: 1; max-width: 100%; background: var(--image); border-radius: 4px; overflow: hidden; touch-action: none; }
.ctlab .editor canvas { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; }
.ctlab #phantom { image-rendering: pixelated; }
.ctlab #overlay { cursor: crosshair; }

.ctlab .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ctlab .field { display: grid; gap: 4px; min-width: 0; }
.ctlab .field > label, .ctlab .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.ctlab .seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; flex-wrap: wrap; }
.ctlab .seg button { border: 0; background: transparent; padding: 6px 10px; cursor: pointer; border-right: 1px solid var(--line); }
.ctlab .seg button:last-child { border-right: 0; }
.ctlab .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.ctlab .btn {
  display: inline-block; font-family: var(--font-body); font-size: 14px; color: var(--fg); text-decoration: none;
  border: 1px solid var(--line); background: var(--raised); padding: 6px 11px; border-radius: var(--r); cursor: pointer;
}
.ctlab .btn:hover { border-color: var(--muted); }
.ctlab .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ctlab .btn:disabled { opacity: 0.5; cursor: default; }
.ctlab select { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 8px; max-width: 100%; }
.ctlab input[type="range"] { accent-color: var(--accent); width: 100%; }
.ctlab .slider { display: grid; grid-template-columns: minmax(0, 1fr) 4.5em; gap: 8px; align-items: center; }
.ctlab .slider output { font-family: var(--font-mono); font-size: 13px; text-align: right; }
.ctlab .presets { display: flex; flex-wrap: wrap; gap: 6px; }
.ctlab .presets button { border: 1px solid var(--line); background: var(--raised); border-radius: 999px; padding: 3px 9px; font-size: 12px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.ctlab .presets button .sw { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--line); }
.ctlab .hint { font-size: 12px; color: var(--muted); }
.ctlab .note { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); color: var(--muted); }
.ctlab .note b { color: var(--fg); font-weight: 600; }

/* acquisition */
.ctlab .acq { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
@media (max-width: 760px) { .ctlab .acq { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ctlab .switch { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; padding: 6px 0; }
.ctlab .switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.ctlab .trained { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }

/* reconstruction tiles */
.ctlab .tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .ctlab .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ctlab .tile { display: grid; gap: 6px; min-width: 0; }
.ctlab .tile-head { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.ctlab .tile-head h3 { font-size: 14px; }
.ctlab .tile-head .num { font-size: 12px; color: var(--muted); }
.ctlab .view { position: relative; aspect-ratio: 1; max-width: 100%; background: var(--image); border-radius: 4px; overflow: hidden; }
.ctlab .view canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ctlab .view .rowline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--accent); pointer-events: none; opacity: 0.9; }
.ctlab .view .busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.55); color: #e8edf2; font-family: var(--font-mono); font-size: 12px; text-align: center; padding: 8px; }
.ctlab .tile .sub { font-size: 12px; color: var(--muted); font-family: var(--font-mono); min-height: 1.4em; }

.ctlab .toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }

/* metrics + profile */
.ctlab .lower { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 760px) { .ctlab .lower { grid-template-columns: minmax(0, 1fr); } }
.ctlab table.metrics { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.ctlab .metrics th, .ctlab .metrics td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.ctlab .metrics th:first-child, .ctlab .metrics td:first-child { text-align: left; }
.ctlab .metrics th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 500; }
.ctlab .metrics td { font-family: var(--font-mono); }
.ctlab .metrics tr.gain td { color: var(--ok); border-bottom: 0; }
.ctlab .profile-wrap { display: grid; gap: 6px; min-width: 0; }
.ctlab #profile { width: 100%; height: 170px; display: block; }
.ctlab .legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.ctlab .legend span::before { content: ""; display: inline-block; width: 14px; height: 2px; margin-right: 6px; vertical-align: middle; background: var(--c); }

.ctlab .progress { height: 4px; background: var(--raised); border-radius: 2px; overflow: hidden; }
.ctlab .progress > div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.ctlab details.about summary { cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--accent); }
.ctlab details.about .body { display: grid; gap: 8px; margin-top: 10px; color: var(--muted); }
.ctlab details.about b { color: var(--fg); font-weight: 600; }
.ctlab kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; }

/* site pieces used on this page (normally in demo.css) */
[hidden] { display: none !important; }
.cta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 0; }
.credits { font-size: 14px; color: var(--muted); }
