/* Colors are the dataviz reference palette: chrome and ink per mode, the
   blue series for latency, and the reserved status colors, which always
   come with an icon and a label, never alone. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.1);
  --series: #2a78d6;
  --track: #cde2fb;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.1);
    --series: #3987e5;
    --track: #184f95;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --hairline: #2c2c2a;
  --border: rgba(255, 255, 255, 0.1);
  --series: #3987e5;
  --track: #184f95;
}

[data-state="up"] { --state: var(--good); }
[data-state="failing"],
[data-state="recovering"] { --state: var(--warning); }
[data-state="down"] { --state: var(--critical); }
[data-state="pending"] { --state: var(--muted); }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 16px 48px;
}

/* Masthead */
.title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.headline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
}

.headline .icon { width: 24px; height: 24px; }

.updated {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}

/* Checks */
.checks {
  display: grid;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.check {
  padding: 16px 20px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.check.empty { color: var(--ink-2); }

.check-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.check-name {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.check-type {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 3px 10px 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--state) 14%, transparent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.check-meta {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}

.nowrap { white-space: nowrap; }

/* Icons: the shape carries the status color; the glyph inside stays
   legible on it. */
.icon { flex: none; width: 15px; height: 15px; color: var(--state); }
.icon-shape { fill: currentColor; }
.icon-ring { fill: none; stroke: currentColor; stroke-width: 2; }
.icon-glyph { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-state="failing"] .icon-glyph,
[data-state="recovering"] .icon-glyph { stroke: #0b0b0b; }

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 16px;
}

@media (max-width: 600px) {
  .page { padding-top: 28px; }
  .headline { font-size: 24px; }
  .check { padding: 14px 16px 16px; }
  .metrics { grid-template-columns: 1fr; gap: 20px; }
}

.metric { min-width: 0; }

.metric-label {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.metric-value {
  margin: 2px 0 10px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

.metric-none { font-size: 15px; font-weight: 500; color: var(--ink-2); }

.metric-aside {
  margin-left: 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-2);
}

.metric-caption {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-2);
}

.caption-icon { display: inline-flex; }

/* Latency sparkline. Overflow stays visible so the end dot is not clipped
   at the right edge. */
.spark { display: block; overflow: visible; }
.spark-base { stroke: var(--hairline); stroke-width: 1; }
.spark-line { stroke: var(--series); stroke-width: 2; stroke-linecap: round; }
/* Failed probes: a light wash over their slots, anchored by a solid mark on
   the baseline, rather than solid bars that turn an outage into a block. */
.spark-fail { fill: var(--critical); opacity: 0.14; }
.spark-fail-mark { fill: var(--critical); }
.spark-end { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.spark-hit { fill: transparent; }
.spark-hit:hover { fill: color-mix(in srgb, var(--ink) 7%, transparent); }

/* Error budget meter */
.meter { display: block; }
.meter-track { fill: var(--track); }
.meter-fill { fill: var(--series); }
.meter[data-level="low"] .meter-fill { fill: var(--warning); }
.meter[data-level="exhausted"] .meter-fill { fill: var(--critical); }

/* Recent probes table: the same values as the chart, readable without
   hovering. */
.probes {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}

.probes summary {
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}

.probes table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.probes th {
  font-weight: 500;
  color: var(--ink-2);
}

.probes th,
.probes td {
  padding: 5px 12px 5px 0;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
}

/* A fixed share for the time, so the result column starts at the same place
   in every card, whatever the results say and whether there is a latency. */
.probes th:first-child { width: 40%; }
.probes .num { padding-right: 0; text-align: right; }
.probes tr.failed td { font-weight: 600; }

.footer {
  margin-top: 32px;
  font-size: 12px;
  color: var(--ink-2);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .spark-fail { opacity: 0.24; }
}
:root[data-theme="dark"] .spark-fail { opacity: 0.24; }
