/* tokens.css is linked before this file (console/index.html). */

/*
 * The console's shell: the menu down the left-hand edge and the pages beside
 * it. It is drawn in the studio's own trim (tokens.css), as Shipyard's is — hue-free
 * gray, with saturated colour kept for the marks of a chart and for the
 * status signals — so the shell around a chart never competes with it.
 * Nothing here names a colour of its own: every shade is a trim token at an
 * alpha.
 */
:root {
  color-scheme: dark;

  /* Surfaces, darkest at the page: the ground lifted by steps of the trim. */
  --shell-bg: var(--bg-dark);
  --shell-raised: rgba(var(--trim-rgb), 0.045);
  --shell-raised-2: rgba(var(--trim-rgb), 0.085);
  --shell-raised-3: rgba(var(--trim-rgb), 0.14);

  /* Hairlines. */
  --shell-line: rgba(var(--trim-rgb), 0.13);
  --shell-line-strong: rgba(var(--trim-rgb), 0.26);

  /* Text. */
  --shell-fg: var(--trim);
  --shell-fg-bright: var(--trim-bright);
  --shell-fg-dim: var(--trim-dim);
  --shell-fg-faint: rgba(var(--trim-rgb), 0.42);

  --r-1: 4px;
  --r-2: 6px;
  --r-3: 10px;
  --r-4: 14px;

  --fs-0: 11px;
  --fs-1: 12px;
  --fs-2: 13px;
  --fs-3: 14px;
  --fs-4: 16px;
  --fs-5: 20px;
  --fs-6: 26px;

  --topbar-h: 46px;
  --sidebar-w: 212px;
  --sidebar-w-collapsed: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-2);
  background: var(--shell-bg);
  color: var(--shell-fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app { height: 100%; }

.console-starting {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--shell-fg-dim);
  font-size: var(--fs-3);
}
.console-starting .console-button { margin-left: 14px; }

/* ── The shell: a menu that folds to its icons, and the page beside it ── */

.console {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100%;
  transition: grid-template-columns .16s ease;
}
.console.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.console-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--shell-raised);
  border-right: 1px solid var(--shell-line);
  position: relative;
  z-index: 2;
}

.console-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--shell-line);
  color: var(--shell-fg-bright);
  white-space: nowrap;
  overflow: hidden;
}
.console-mark { width: 24px; height: 24px; flex: none; display: grid; place-items: center; }
.console-mark svg { width: 24px; height: 24px; display: block; }
.console-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-2);
  letter-spacing: .16em;
  text-transform: uppercase;
}
.console-name small {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--fs-0);
  letter-spacing: .02em;
  text-transform: none;
  color: var(--shell-fg-faint);
  overflow: hidden;
  text-overflow: ellipsis;
}
.is-collapsed .console-brand { justify-content: center; padding: 0; }
.is-collapsed .console-name { display: none; }

.console-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }

.console-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  margin: 1px 0;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--r-2);
  background: transparent;
  color: var(--shell-fg-dim);
  font: inherit;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.console-item svg { width: 18px; height: 18px; flex: none; }
.console-item:hover, .console-item:focus-visible { background: var(--shell-raised-2); color: var(--shell-fg-bright); outline: none; }
.console-item:focus-visible { border-color: var(--shell-line-strong); }
.console-item.is-active { background: var(--shell-raised-2); color: var(--shell-fg-bright); border-color: var(--shell-line); }
.console-item.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--trim-bright);
}
.console-item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.is-collapsed .console-item { justify-content: center; padding: 0; }
.is-collapsed .console-item-text { display: none; }

/* How many things a page has to be looked at for: the one signal on the menu. */
.console-pill {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-orange);
  background: rgba(var(--color-orange-rgb), .14);
  border: 1px solid rgba(var(--color-orange-rgb), .42);
}
.is-collapsed .console-pill {
  position: absolute;
  top: 5px;
  right: 9px;
  min-width: 8px;
  width: 8px;
  height: 8px;
  padding: 0;
  font-size: 0;
  background: var(--color-orange);
  border: none;
}

.console-foot { padding: 10px 8px; border-top: 1px solid var(--shell-line); }
.console-foot .console-item { height: 30px; font-size: var(--fs-1); }
.console-who {
  padding: 2px 10px;
  font-size: var(--fs-0);
  color: var(--shell-fg-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.console-release { font-family: var(--font-mono); margin-bottom: 6px; }
.is-collapsed .console-who { display: none; }

.console-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.console-page { position: relative; display: block; flex: 1; min-height: 0; }


.console-scroll { height: 100%; overflow-y: auto; padding: 22px 28px 48px; }

/* ── Pages ── */

.console-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.console-page-head h1 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-5);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--shell-fg-bright);
}
.console-lede { margin: 6px 0 0; max-width: 68ch; color: var(--shell-fg-dim); line-height: 1.5; }

.console-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }

.console-card {
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--shell-raised);
  border: 1px solid var(--shell-line);
  border-radius: var(--r-3);
}
.console-grid .console-card { margin-bottom: 0; }
.console-card.is-down { border-color: rgba(var(--color-red-rgb), .45); }
.console-card.is-held { border-color: rgba(var(--color-orange-rgb), .38); }
.console-card-head { display: flex; align-items: center; gap: 10px; }
.console-card-head h2 {
  flex: 1;
  margin: 0;
  font-size: var(--fs-4);
  font-weight: 600;
  color: var(--shell-fg-bright);
}
.console-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--shell-line);
}

.console-note { margin: 8px 0 12px; color: var(--shell-fg-dim); line-height: 1.5; }
.console-note.is-down { color: var(--color-red); }
.console-note code, .console-facts code { font-family: var(--font-mono); color: var(--shell-fg); }
.console-faint { color: var(--shell-fg-faint); font-size: var(--fs-1); }
.console-empty {
  margin: 28px 0;
  padding: 28px;
  text-align: center;
  color: var(--shell-fg-dim);
  border: 1px dashed var(--shell-line-strong);
  border-radius: var(--r-3);
}
.console-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.console-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; }

/* A game is drawn in trim while all is well, and in a signal only when it is not. */
.console-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--trim-bright); }
.console-dot.is-held { background: var(--color-orange); }
.console-dot.is-down { background: var(--color-red); }
.console-standing {
  font-family: var(--font-mono);
  font-size: var(--fs-0);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--shell-fg-dim);
  white-space: nowrap;
}
.console-standing.is-held { color: var(--color-orange); }
.console-standing.is-down { color: var(--color-red); }

.console-facts { margin: 0; display: grid; gap: 9px; }
.console-facts > div { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 10px; }
.console-facts dt {
  font-family: var(--font-mono);
  font-size: var(--fs-0);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--shell-fg-faint);
}
.console-facts dd { margin: 0; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; color: var(--shell-fg); }

/* The usage gauge, as a bar: trim until the window is nearly used up. */
.console-meter { width: 72px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--shell-raised-3); }
.console-meter > span { display: block; height: 100%; background: var(--trim-bright); }
.console-meter > .is-warn { background: var(--color-yellow); }
.console-meter > .is-critical { background: var(--color-red); }
.console-meter > .is-unknown { background: transparent; }

.console-chip, .console-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: var(--fs-0);
  color: var(--shell-fg);
  background: var(--shell-raised-2);
  border: 1px solid var(--shell-line);
  text-decoration: none;
  white-space: nowrap;
}
.console-chip:hover, .console-chip:focus-visible { color: var(--shell-fg-bright); border-color: var(--shell-line-strong); outline: none; }
.console-tag { height: 18px; margin-left: 6px; color: var(--shell-fg-dim); }
.console-tag.is-down { color: var(--color-red); border-color: rgba(var(--color-red-rgb), .45); background: rgba(var(--color-red-rgb), .1); }

.console-link { color: var(--shell-fg-bright); text-decoration: underline; text-decoration-color: var(--shell-line-strong); text-underline-offset: 3px; }
.console-link:hover, .console-link:focus-visible { text-decoration-color: var(--trim-bright); outline: none; }

/* A small reading: what is measured, and what it reads. Trim unless it is the thing to look at. */
.console-reading {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: var(--fs-1);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  color: var(--shell-fg);
  white-space: nowrap;
}
.console-reading > span { font-size: 10px; letter-spacing: .1em; color: var(--shell-fg-faint); }
.console-reading.is-warn { color: var(--color-yellow); }
.console-reading.is-critical { color: var(--color-red); }

/* ── Controls ── */

.console-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--shell-line-strong);
  border-radius: var(--r-2);
  background: var(--shell-raised-2);
  color: var(--shell-fg-bright);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.console-button svg { width: 15px; height: 15px; }
.console-button:hover, .console-button:focus-visible { background: var(--shell-raised-3); border-color: var(--trim-dim); outline: none; }
.console-button:disabled { opacity: .5; cursor: default; }
.console-button.is-primary { background: var(--trim-bright); border-color: var(--trim-bright); color: var(--bg-dark); }
.console-button.is-primary:hover, .console-button.is-primary:focus-visible { background: var(--trim); border-color: var(--trim); }
.console-button.is-quiet { background: transparent; border-color: transparent; color: var(--shell-fg-dim); }
.console-button.is-quiet:hover, .console-button.is-quiet:focus-visible { background: var(--shell-raised-2); color: var(--shell-fg-bright); }
.console-button.is-danger { background: transparent; border-color: rgba(var(--color-red-rgb), .5); color: var(--color-red); }
.console-button.is-danger:hover, .console-button.is-danger:focus-visible { background: rgba(var(--color-red-rgb), .12); border-color: var(--color-red); }

.console-input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--shell-line-strong);
  border-radius: var(--r-2);
  background: var(--bg-dark);
  color: var(--shell-fg-bright);
  font: inherit;
  outline: none;
}
.console-input:focus { border-color: var(--trim-dim); box-shadow: 0 0 0 3px rgba(var(--trim-rgb), .16); }
.console-input.is-held { border-color: rgba(var(--color-orange-rgb), .6); }
.console-number { width: 68px; font-family: var(--font-mono); }
.console-field { display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-1); color: var(--shell-fg-dim); }
.console-field .console-input { min-width: 240px; }
form.console-row { align-items: flex-end; }

.console-code {
  margin: 0 0 12px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-1);
  line-height: 1.7;
  color: var(--shell-fg-bright);
  background: var(--bg-dark);
  border: 1px solid var(--shell-line);
  border-radius: var(--r-2);
  user-select: all;
}

.console-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  color: var(--shell-fg-bright);
  background: rgba(var(--color-red-rgb), .12);
  border: 1px solid rgba(var(--color-red-rgb), .45);
  border-radius: var(--r-2);
  line-height: 1.5;
}
.console-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 16px 0; }

/* ── Tables ── */

.console-table-tools { margin-bottom: 10px; }
.console-table-tools .console-input { width: 260px; }
.console-table { width: 100%; border-collapse: collapse; }
.console-table th {
  padding: 8px 10px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--fs-0);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--shell-fg-faint);
  border-bottom: 1px solid var(--shell-line-strong);
}
.console-table td { padding: 10px; vertical-align: middle; border-bottom: 1px solid var(--shell-line); }
.console-cell-action { text-align: right; white-space: nowrap; }

/* ── Something is being read ──
 *
 * Said three ways at once, so it cannot be missed and is never only a
 * picture: in words beside a spinner, by a bar that sweeps under the list's
 * headings, and — when there is no list yet to show — by rows standing in for
 * the ones on their way. All of it in trim: reading is not a signal.
 */

.console-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid var(--shell-line-strong);
  border-top-color: var(--trim-bright);
  border-radius: 50%;
  animation: consoleSpin .8s linear infinite;
}
.console-starting .console-spinner { margin-right: 10px; }
@keyframes consoleSpin { to { transform: rotate(360deg); } }

.console-activity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-height: 18px;
  font-family: var(--font-mono);
  font-size: var(--fs-0);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--shell-fg-bright);
  white-space: nowrap;
}

/* The bar is always there, two pixels of nothing, so the list does not move when a reading begins or ends. */
.console-table .console-table-activity td { padding: 0; border: none; background: none; }
.console-progress { position: relative; height: 2px; overflow: hidden; }
.console-progress.is-on { background: var(--shell-line); }
.console-progress.is-on::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 28%;
  border-radius: 2px;
  background: var(--trim-bright);
  animation: consoleSweep 1.25s cubic-bezier(.45, 0, .55, 1) infinite;
}
/* From wholly off the left-hand end to wholly off the right: the bar is 28% of its track. */
@keyframes consoleSweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(358%); }
}

.console-bone {
  display: block;
  width: 42%;
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--shell-raised-2) 0%, var(--shell-raised-3) 50%, var(--shell-raised-2) 100%);
  background-size: 200% 100%;
  animation: consoleShimmer 1.5s linear infinite;
}
.console-placeholder td { height: 55px; }
.console-placeholder td:nth-child(2) .console-bone { width: 96px; }
.console-placeholder td:nth-child(3) .console-bone { width: 88px; height: 26px; margin-left: auto; }
.console-placeholder:nth-child(3n) td:first-child .console-bone { width: 56%; }
.console-placeholder:nth-child(3n + 1) td:first-child .console-bone { width: 34%; }
@keyframes consoleShimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* Asked for less motion: the words still say it, and what moved holds still or only breathes. */
@media (prefers-reduced-motion: reduce) {
  .console-spinner { animation-duration: 2.4s; }
  .console-progress.is-on::after { width: 100%; animation: consoleBreathe 2s ease-in-out infinite; }
  .console-bone { animation: none; }
}
@keyframes consoleBreathe {
  0%, 100% { opacity: .35; }
  50% { opacity: .9; }
}

@media (max-width: 720px) {
  .console { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
  .console .console-brand { justify-content: center; padding: 0; }
  .console .console-name, .console .console-item-text, .console .console-who { display: none; }
  .console .console-item { justify-content: center; padding: 0; }
  .console-scroll { padding: 16px 14px 40px; }
  .console-page-head { flex-direction: column; }
}
