/*
 * macOS Terminal.app.
 *
 * Two real Terminal profiles: "Pro" (black) in dark mode, "Basic" (white) in
 * light mode. The chrome is the point -- traffic lights left, centred title,
 * and nothing else. Everything inside the window is text.
 */

:root {
  color-scheme: light dark;

  /* Basic profile */
  --desktop-a: #d7d3cc;
  --desktop-b: #b9b4ab;
  --bar-a: #e8e6e3;
  --bar-b: #d6d3cf;
  --bar-line: #b7b3ad;
  --bar-text: #4b4b4b;

  --bg: #ffffff;
  --fg: #22252a;
  --dim: #8a8f98;
  --green: #007d38;
  --red: #c02a3c;
  --yellow: #8a6100;
  --cyan: #006c93;
  --magenta: #8a2d8a;
  --sel: #b4d5fe;
  --rule: #e2e2e0;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Mono", monospace;
  --size: 13px;
  --line: 1.5;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Pro profile */
    --desktop-a: #1b1d22;
    --desktop-b: #0a0b0d;
    --bar-a: #3a3a3c;
    --bar-b: #2c2c2e;
    --bar-line: #191919;
    --bar-text: #c3c3c6;

    --bg: #0c0c0e;
    --fg: #e4e4e6;
    --dim: #6e737c;
    --green: #28c840;
    --red: #ff5f57;
    --yellow: #febc2e;
    --cyan: #5ac8fa;
    --magenta: #d18bff;
    --sel: #2f4f7a;
    --rule: #22242a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 26px 20px;
  background: linear-gradient(150deg, var(--desktop-a), var(--desktop-b));
  display: flex;
  justify-content: center;
  align-items: flex-start;
  font-family: var(--mono);
}

.window {
  width: 100%;
  max-width: 900px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 0 0 0.5px rgb(0 0 0 / 0.35),
    0 24px 60px rgb(0 0 0 / 0.42),
    0 3px 10px rgb(0 0 0 / 0.22);
}

/* titlebar ------------------------------------------------------------- */

.titlebar {
  position: relative;
  display: flex;
  align-items: center;
  height: 30px;
  padding-inline: 11px;
  background: linear-gradient(var(--bar-a), var(--bar-b));
  border-bottom: 1px solid var(--bar-line);
  user-select: none;
}

.lights { display: flex; gap: 8px; }
.light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.22);
}
.light.close { background: #ff5f57; }
.light.min { background: #febc2e; }
.light.max { background: #28c840; }

.title {
  position: absolute;
  inset-inline: 0;
  text-align: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--bar-text);
  pointer-events: none;
  padding-inline: 78px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* screen --------------------------------------------------------------- */

.screen {
  background: var(--bg);
  color: var(--fg);
  font-size: var(--size);
  line-height: var(--line);
  padding: 10px 12px 14px;
  height: min(74vh, 660px);
  overflow-y: auto;
  cursor: text;
  outline: none;
  -webkit-font-smoothing: antialiased;
}

.screen ::selection, .screen::selection { background: var(--sel); }

#scrollback > * { white-space: pre-wrap; word-break: break-word; }

/* Must out-specify the rule above, which an id selector would otherwise win.
   Plots and tables lose their alignment the instant a line is allowed to wrap. */
#scrollback > .fixed { white-space: pre; word-break: normal; overflow-x: auto; }

.blank { height: calc(var(--size) * var(--line)); }

.dim { color: var(--dim); }
.green { color: var(--green); }
.red { color: var(--red); }
.yellow { color: var(--yellow); }
.cyan { color: var(--cyan); }
.magenta { color: var(--magenta); }
.b { font-weight: 700; }
.inv { background: var(--fg); color: var(--bg); padding: 0 4px; font-weight: 700; }
.inv.green { background: var(--green); color: var(--bg); }
.inv.yellow { background: var(--yellow); color: var(--bg); }
.inv.red { background: var(--red); color: var(--bg); }

/* prompt --------------------------------------------------------------- */

.prompt-row { display: flex; align-items: baseline; }
.ps1 { white-space: pre; flex: none; }
.entry { position: relative; flex: 1; display: flex; align-items: baseline; }

#input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  line-height: inherit;
  outline: none;
  caret-color: var(--fg);
}
#input:disabled { opacity: 1; }

/* Shown only while the line is empty, where a block at position 0 is exactly
   where the caret is. Anything cleverer drifts out of sync mid-edit. */
.block-cursor {
  position: absolute;
  left: 0;
  width: 0.62em;
  height: calc(var(--size) * var(--line) * 0.82);
  align-self: center;
  background: var(--fg);
  animation: blink 1.06s step-end infinite;
  pointer-events: none;
}
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .block-cursor { animation: none; }
}

@media (max-width: 560px) {
  body { padding: 10px; }
  :root { --size: 11.5px; }
  .title { padding-inline: 70px; font-size: 11px; }
  .screen { height: 78vh; }
}

/* tab bar -------------------------------------------------------------- */
/* Terminal.app has tabs, so the dashboard lives in one rather than in some
   other chrome bolted onto a terminal window. */

.tabbar {
  display: flex;
  background: linear-gradient(var(--bar-b), var(--bar-a));
  border-bottom: 1px solid var(--bar-line);
  user-select: none;
}

.tab {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--bar-line);
  background: transparent;
  color: var(--bar-text);
  font: 12px var(--mono);
  padding: 7px 20px;
  cursor: pointer;
  opacity: 0.62;
}
.tab:hover { opacity: 0.85; }
.tab[aria-selected='true'] {
  opacity: 1;
  background: var(--bg);
  color: var(--fg);
  box-shadow: inset 0 2px 0 var(--cyan);
}
.tab-fill { flex: 1; border-bottom: 0; }

/* dashboard ------------------------------------------------------------ */

.dash {
  background: var(--bg);
  color: var(--fg);
  font-size: var(--size);
  line-height: var(--line);
  height: min(74vh, 660px);
  overflow-y: auto;
  padding: 18px 18px 26px;
}

.dash h2 {
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 26px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}
.dash h2:first-child { margin-top: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 14px; }
.tile .k { display: block; font-size: 11px; color: var(--dim); letter-spacing: 0.06em; }
.tile .v { display: block; font: 700 24px/1.2 var(--mono); margin-top: 4px; }
.tile .n { display: block; font-size: 11.5px; color: var(--dim); margin-top: 2px; }

.split { display: grid; grid-template-columns: minmax(0, 250px) 1fr; gap: 22px; align-items: center; }
.split svg { width: 100%; max-width: 250px; height: auto; display: block; }
.split p { margin: 0; font-size: 12.5px; color: var(--dim); }

/* horizontal bar rows, used for verdicts and gate failures */
.rows { display: grid; gap: 7px; }
.rowbar { display: grid; grid-template-columns: 104px 1fr 44px; gap: 10px; align-items: center; font-size: 12.5px; }
.rowbar .track { display: block; height: 10px; background: var(--rule); overflow: hidden; }
.rowbar .fill { display: block; height: 100%; background: var(--cyan); }
.rowbar .fill.green { background: var(--green); }
.rowbar .fill.yellow { background: var(--yellow); }
.rowbar .fill.red { background: var(--red); }
.rowbar .n { text-align: right; color: var(--dim); font-size: 12px; }

.claim {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  gap: 5px;
}
.claim .top { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; }
.claim .prop { font-size: 13.5px; }
.claim .meta { font-size: 11.5px; color: var(--dim); }
.claim .acts { display: flex; gap: 6px; align-items: center; margin-top: 3px; }
.claim .acts .meta { margin-right: 2px; }

.btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--dim);
  font: 11.5px var(--mono);
  padding: 3px 10px;
  cursor: pointer;
}
.btn:hover { color: var(--fg); border-color: var(--dim); }
.btn:disabled { opacity: 0.45; cursor: default; }

.badge { font: 700 10.5px var(--mono); letter-spacing: 0.06em; padding: 2px 7px; white-space: nowrap; }
.badge.green { color: var(--bg); background: var(--green); }
.badge.yellow { color: var(--bg); background: var(--yellow); }
.badge.red { color: var(--bg); background: var(--red); }

.dash .empty { color: var(--dim); padding: 30px 0; text-align: center; }

@media (max-width: 620px) {
  .split { grid-template-columns: 1fr; }
  .rowbar { grid-template-columns: 88px 1fr 40px; }
}

/* links ---------------------------------------------------------------- */

.screen a, .dash a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.screen a:hover, .dash a:hover { color: var(--fg); }

.dash-foot {
  margin: 26px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--dim);
}
