/* Vigil: a night watch. Quiet means fine; only trouble gets colour. */
:root {
  --night: #18212E;
  --deck: #212C3B;
  --rule: #2D3A4D;
  --ink: #E9E4D8;
  --dim: #8D97A6;
  --lamp: #F0B94A;
  --amber: #E39B3B;
  --red: #E5534B;
  --calm: #3A4A60;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--night); color: var(--ink); font: 15px/1.5 var(--sans); font-variant-numeric: tabular-nums; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration-color: var(--calm); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The bar */
.bar { display: flex; justify-content: space-between; align-items: center; padding: 14px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--rule); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .01em; text-decoration: none; margin: 0; }
.lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 10px 1px rgba(240, 185, 74, .45); }
.who { display: flex; align-items: center; gap: 14px; color: var(--dim); margin: 0; }

button { font: inherit; color: var(--night); background: var(--ink); border: 0; border-radius: 6px; padding: 9px 16px; font-weight: 600; cursor: pointer; }
button:hover { background: #fff; }
button.quiet { color: var(--dim); background: none; padding: 4px 6px; font-weight: 400; }
button.quiet:hover { color: var(--ink); }

main, .crumbs, .logs { padding: 0 clamp(16px, 4vw, 48px); max-width: 1180px; }
.crumbs { padding-top: 18px; color: var(--dim); }

/* The watch: one sentence, then every stack as a square */
.watch { padding: clamp(32px, 7vh, 72px) 0 28px; }
.headline { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.12; font-weight: 600; letter-spacing: -.015em; margin: 0; max-width: 24ch; }
.headline.attention { color: var(--amber); }
.headline.down { color: var(--red); }
.sub { color: var(--dim); margin: 10px 0 0; max-width: 72ch; }

.strip { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; padding: 0; margin: 26px 0 0; }
.cell { display: block; width: 16px; height: 16px; border-radius: 3px; background: var(--calm); }
.cell.legacy { background: none; box-shadow: inset 0 0 0 1.5px var(--calm); }
.cell.state-degraded { background: var(--amber); box-shadow: none; }
.cell.state-down { background: var(--red); box-shadow: none; }
.cell.state-stopped { background: none; box-shadow: inset 0 0 0 1.5px var(--dim); opacity: .55; }
.cell:hover { transform: scale(1.25); }
@media (prefers-reduced-motion: no-preference) { .cell { transition: transform .12s ease-out; } }

.vitals { display: flex; flex-wrap: wrap; gap: 8px 40px; margin: 30px 0 0; color: var(--dim); }
.vitals div { display: flex; align-items: baseline; gap: 10px; }
.vitals dt { color: var(--dim); }
.vitals dd { margin: 0; display: flex; align-items: center; gap: 6px; }
.vitals .spark { width: 90px; }
.num { color: var(--ink); font-weight: 600; }
.num.warn { color: var(--amber); }

/* Tables of stacks and containers */
section > h2 { font-size: 17px; font-weight: 600; margin: 34px 0 10px; }
.note { color: var(--dim); margin: -6px 0 10px; }
table.apps { width: 100%; border-collapse: collapse; }
.apps th, .apps td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.apps thead th { color: var(--dim); font-weight: 400; font-size: 13px; padding-bottom: 6px; }
.apps tbody th { font-weight: 600; width: 32%; }
.apps tbody th a { text-decoration: none; }
.apps tbody th a:hover { text-decoration: underline; }
.apps .n { text-align: right; padding-right: 0; padding-left: 12px; white-space: nowrap; }
.apps td.chart { display: table-cell; }
.apps td.chart .num { display: inline-block; min-width: 5.5em; }
.apps td.chart .spark { vertical-align: middle; margin-left: 8px; }
.problem, .cname { display: block; font-weight: 400; font-size: 13px; }
.problem { color: var(--amber); }
.state-down .problem { color: var(--red); }
.cname { color: var(--dim); }
.sha { color: var(--dim); }
.none { color: var(--dim); font-style: italic; }
tr.state-degraded th { box-shadow: inset 3px 0 0 var(--amber); padding-left: 12px; }
tr.state-down th { box-shadow: inset 3px 0 0 var(--red); padding-left: 12px; }
tr.state-stopped th { box-shadow: inset 3px 0 0 var(--calm); padding-left: 12px; }
.state-stopped .problem { color: var(--dim); }

.spark { width: 120px; height: 28px; display: inline-block; }
.spark polyline { fill: none; stroke: var(--dim); stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark line { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* Logs */
.logs { margin: 40px 0 60px; }
.logs-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 20px; }
.logs-head h2 { font-size: 17px; font-weight: 600; margin: 0; }
.controls { display: flex; gap: 18px; align-items: center; color: var(--dim); }
.controls select { font: inherit; color: var(--ink); background: var(--deck); border: 1px solid var(--rule); border-radius: 5px; padding: 2px 4px; margin-left: 6px; }
.controls input { accent-color: var(--lamp); }
pre.log { font: 12.5px/1.55 var(--mono); background: var(--deck); border-radius: 8px; padding: 14px 16px; margin: 12px 0 0; height: 60vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.log .t { color: var(--dim); margin-right: 12px; user-select: none; }
pre.log .err { color: #F3B1A8; }

/* Sign-in pages */
body.gate { display: grid; place-items: center; padding: 24px; }
.gate-box { width: min(100%, 400px); padding: 0; }
.gate-box .brand { margin-bottom: 36px; }
.gate-box h1 { font-size: 26px; font-weight: 600; margin: 0 0 22px; letter-spacing: -.01em; }
.gate-box form { display: grid; gap: 16px; }
.gate-box label { display: grid; gap: 6px; color: var(--dim); }
.gate-box input { font: inherit; color: var(--ink); background: var(--deck); border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; }
.gate-box input:focus { border-color: var(--lamp); outline: none; }
.gate-box button { margin-top: 6px; justify-self: start; }
.error { color: var(--red); background: rgba(229, 83, 75, .1); border-radius: 6px; padding: 10px 12px; margin: 0 0 18px; }
.steps { padding-left: 1.2em; display: grid; gap: 22px; }
.steps p { margin: 0 0 10px; }
.qr { background: #fff; padding: 10px; border-radius: 6px; image-rendering: pixelated; }
.small { font-size: 13px; color: var(--dim); }
code.secret { color: var(--ink); word-break: break-all; }

@media (max-width: 720px) {
  .apps thead { display: none; }
  .apps tr { display: grid; grid-template-columns: 1fr auto auto; gap: 0 14px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
  .apps th, .apps td { border: 0; padding: 2px 0; width: auto !important; }
  .apps td.sha, .apps td.n:not(.chart) { display: none; }
  .apps td.chart .spark { display: none; }
  .apps td.chart .num { min-width: 0; }
  .ctrs td:nth-child(2) { grid-column: 1 / -1; order: 9; color: var(--dim); font-size: 13px; }
}
