/* Anona Compute status. The console's world (dashboard/app/globals.css):
   Space Grotesk, hairline plates with square shoulders, the brand red only
   for an outage, cyan for structure and charts. Dark by default for dark
   systems, light for light ones. */

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --ground: #e7e9e4;
  --plate: #f4f5f1;
  --rule: #d3d6ce;
  --rule-2: #b9bfb5;
  --ink: #12171a;
  --ink-2: #4a5550;
  --reseau: #237f8c;
  --ok: #2f8f63;
  --warn: #a8761a;
  --bad: #c43d33;
  --nodata: #c4c8c0;
  --tail: #b8577f;
  --tip-bg: #12171a;
  --tip-ink: #e4e7e5;

  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0d1113;
    --plate: #141a1c;
    --rule: #232b2e;
    --rule-2: #313b3f;
    --ink: #e4e7e5;
    --ink-2: #a7b2af;
    --reseau: #4fb6c4;
    --ok: #4fbf8b;
    --warn: #d9a441;
    --bad: #e9514c;
    --nodata: #2c3538;
    --tail: #d4739c;
    --tip-bg: #e4e7e5;
    --tip-ink: #0d1113;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

.shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 16px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
}
.wordmark {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark span { color: var(--ink-2); font-weight: 400; }
.masthead-label { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }

/* Status colours, shared by pips, bars, legend swatches and pills. */
[data-k="operational"] { --k: var(--ok); }
[data-k="degraded"], [data-k="maintenance"] { --k: var(--warn); }
[data-k="outage"] { --k: var(--bad); }
[data-k="nodata"], [data-k="unknown"], [data-k="resolved"] { --k: var(--nodata); }
[data-k="avg"] { --k: var(--reseau); }
[data-k="tail"] { --k: var(--tail); }

.banner {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--plate);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--k, var(--nodata));
  padding: 18px 20px;
}
.banner[data-status="operational"] { --k: var(--ok); }
.banner[data-status="degraded"] { --k: var(--warn); }
.banner[data-status="outage"] { --k: var(--bad); }
.banner h1 { font-size: 20px; font-weight: 600; }
.pip {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--k, var(--nodata));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--k, var(--nodata)) 22%, transparent);
}

.board {
  background: var(--plate);
  border: 1px solid var(--rule);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.board-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  justify-content: space-between;
}
.board-head h2 { font-size: 16px; font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; background: var(--k); display: inline-block; }

.group { display: grid; gap: 0; }
.group + .group { margin-top: 10px; }
.group-name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

.comp { padding: 14px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 8px; }
.comp:last-child { border-bottom: 0; }
.comp-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.comp-name h3 { font-size: 15px; font-weight: 600; }
.comp-name p { max-width: 60ch; }
.state {
  flex: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--k);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--k); }
.state[data-k="unknown"] { color: var(--ink-2); }

.bars { display: flex; gap: 2px; height: 30px; }
.bar { flex: 1 1 0; min-width: 0; background: var(--k); border-radius: 1px; cursor: default; }
.bar:hover { opacity: 0.7; }
.bars-foot { display: flex; justify-content: space-between; gap: 8px; }
.bars-foot span:nth-child(2) { font-family: var(--mono); }

/* 30 days on a phone: 90 bars would be under 3 px each. */
@media (max-width: 640px) {
  .board, .banner { padding: 14px; }
  .bar:nth-child(-n + 60) { display: none; }
  .ago { font-size: 0; }
  .ago::after { content: "30 days ago"; font-size: 13px; }
  .comp-head { flex-direction: column; gap: 4px; }
}

.metrics { display: grid; gap: 22px; }
.metric { display: grid; gap: 8px; }
.metric-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; align-items: flex-start; }
.metric h3 { font-size: 15px; font-weight: 600; }
.chart {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "y plot" ". x";
  column-gap: 8px;
}
.yaxis { grid-area: y; display: flex; flex-direction: column; justify-content: space-between; text-align: right; font-family: var(--mono); font-size: 11px; min-width: 52px; }
.plot-wrap { grid-area: plot; position: relative; height: 120px; min-width: 0; }
.plot { width: 100%; height: 100%; display: block; overflow: visible; }
.plot .grid { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.plot .avg { fill: none; stroke: var(--reseau); stroke-width: 2; }
.plot .tail { fill: none; stroke: var(--tail); stroke-width: 1.5; }
.plot .dot { stroke: none; }
.plot .avg.dot { fill: var(--reseau); }
.plot .tail.dot { fill: var(--tail); }
.hits { position: absolute; inset: 0; display: flex; }
.hits span { flex: 1 1 0; }
.hits span:hover { background: color-mix(in srgb, var(--reseau) 10%, transparent); }
.xaxis { grid-area: x; display: flex; justify-content: space-between; padding-top: 4px; }

.active { display: grid; gap: 12px; }
.active:empty { display: none; }
.incident {
  border-left: 3px solid var(--k);
  padding: 4px 0 4px 14px;
  display: grid;
  gap: 6px;
}
.active .incident { background: var(--plate); border: 1px solid var(--rule); border-left: 4px solid var(--k); padding: 16px 20px; }
#incidents { display: grid; gap: 18px; }
.incident h3 { font-size: 15px; font-weight: 600; }
.updates { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.update-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.updates p { max-width: 70ch; }

.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding-top: 4px; }
.footer nav { display: flex; gap: 16px; font-size: 13px; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }

.tip {
  position: absolute;
  z-index: 10;
  max-width: 280px;
  background: var(--tip-bg);
  color: var(--tip-ink);
  font-size: 12px;
  line-height: 1.45;
  padding: 7px 10px;
  pointer-events: none;
  box-shadow: 0 6px 24px -8px rgb(0 0 0 / 0.45);
}
.tip strong { display: block; font-weight: 600; margin-bottom: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .bar, .hits span { transition: opacity 120ms, background-color 120ms; }
}
