:root {
  color-scheme: dark;
  --bg: #0e131e;
  --surface: #10233f;
  --surface-2: #162c4a;
  --ink: #f4f6f8;
  --muted: #a2a8b0;
  --line: #243656;
  --blue: #72a0dd;
  --ok: #3ddc97;
  --warn: #e6b84d;
  --bad: #fa5f66;
  --absent: #8b95a8;
  --shadow: 0 18px 50px rgb(0 0 0 / 28%);
  --sans: "Segoe UI", "PT Root UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
}

:root.light {
  color-scheme: light;
  --bg: #fbfcfe;
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --ink: #081133;
  --muted: #5c6578;
  --line: #d5dde8;
  --blue: #3e6a96;
  --ok: #0e7a4b;
  --warn: #8a5a00;
  --bad: #c84c51;
  --absent: #6d7688;
  --shadow: 0 16px 40px rgb(8 17 51 / 6%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(680px 460px at 100% -12%, rgb(114 160 221 / 22%), transparent 58%),
    radial-gradient(920px 560px at 82% 8%, rgb(18 42 88 / 55%), transparent 64%),
    var(--bg);
}

:root.light body {
  background:
    radial-gradient(680px 460px at 100% -12%, rgb(114 160 221 / 22%), transparent 58%),
    radial-gradient(920px 560px at 82% 8%, rgb(220 232 246 / 70%), transparent 64%),
    var(--bg);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

a { color: inherit; }

.skip {
  position: absolute;
  left: 16px;
  top: 8px;
  transform: translateY(-140%);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 650;
}

.skip:focus { transform: none; }

.wrap {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
}

.top-row {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 72px;
}

.brand { display: flex; }

.logo { height: 36px; width: auto; color: var(--ink); }

.mark-navy { fill: currentColor; }

:root.light .mark-navy { fill: #001a47; }

.brand-label {
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.site-link {
  margin-left: auto;
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}

.site-link:hover { color: var(--blue); }

.theme {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.theme:hover { background: var(--surface-2); }

.theme svg { width: 20px; height: 20px; }

.icon-sun { display: none; }

:root.light .icon-sun { display: block; }

:root.light .icon-moon { display: none; }

main { padding: 28px 0 48px; }

.banner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.banner h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.checked,
.banner-detail,
.stale {
  margin: 8px 0 0;
  color: var(--muted);
}

.banner-detail { color: var(--ink); }

.stale { color: var(--warn); }

.orb {
  width: 16px;
  height: 16px;
  margin-top: 12px;
  border-radius: 99px;
  flex: none;
  background: var(--ok);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 18%, transparent);
}

.banner[data-state="degraded"] .orb {
  background: var(--warn);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--warn) 18%, transparent);
}

.banner[data-state="partial"] .orb,
.banner[data-state="outage"] .orb {
  background: var(--bad);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 18%, transparent);
}

.banner[data-state="checking"] .orb {
  background: var(--blue);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--blue) 18%, transparent);
  animation: pulse 1.4s ease-in-out infinite;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 18px 4px;
  color: var(--muted);
  font-size: 13px;
}

.key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: none;
  background: var(--line);
}

.swatch.up { background: var(--ok); }
.swatch.degraded { background: var(--warn); }
.swatch.down { background: var(--bad); }
.swatch.empty { background: color-mix(in srgb, var(--line) 85%, var(--muted)); }

.legend-note { margin-left: auto; }

.group,
.incidents {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}

.group-head,
.incidents h2 {
  margin: 0;
  padding: 18px 22px 8px;
  font-size: 15px;
}

.svc {
  display: grid;
  grid-template-columns: minmax(210px, 1.05fr) minmax(180px, 1.4fr) auto;
  gap: 12px 22px;
  align-items: center;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}

.svc-id {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.svc h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.svc h3 a { text-decoration: none; }

.svc h3 a:hover { color: var(--blue); }

.svc-sub,
.svc-detail {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.svc-detail { color: var(--warn); }

.svc[data-state="down"] .svc-detail { color: var(--bad); }

.host { text-decoration: none; }

.host:hover { color: var(--blue); }

.dot,
.pill i {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 99px;
  background: var(--absent);
  flex: none;
}

.pill i { margin-top: 0; }

.svc[data-state="up"] .dot,
.svc[data-state="up"] .pill { color: var(--ok); }
.svc[data-state="up"] .dot,
.svc[data-state="up"] .pill i { background: var(--ok); }

.svc[data-state="degraded"] .dot,
.svc[data-state="degraded"] .pill { color: var(--warn); }
.svc[data-state="degraded"] .dot,
.svc[data-state="degraded"] .pill i { background: var(--warn); }

.svc[data-state="down"] .dot,
.svc[data-state="down"] .pill { color: var(--bad); }
.svc[data-state="down"] .dot,
.svc[data-state="down"] .pill i { background: var(--bad); }

.svc[data-state="absent"] .pill,
.svc[data-state="unknown"] .pill { color: var(--absent); }

.svc[data-state="unknown"] .dot { animation: pulse 1.4s ease-in-out infinite; }

.history-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.bars {
  display: flex;
  gap: 2px;
  height: 28px;
  align-items: stretch;
}

.bar {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px;
  background: var(--line);
}

.bar.up { background: var(--ok); }
.bar.degraded { background: var(--warn); }
.bar.down { background: var(--bad); }
.bar.empty { background: color-mix(in srgb, var(--line) 85%, var(--muted)); }

.aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 8.5rem;
}

.latency {
  min-height: 1em;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.incidents { padding-bottom: 8px; }

.incidents .empty {
  margin: 0;
  padding: 4px 22px 18px;
  color: var(--muted);
}

.incidents ul {
  list-style: none;
  margin: 0;
  padding: 0 8px 8px;
}

.incidents li {
  display: grid;
  grid-template-columns: 10.5rem 8rem 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.incidents .pill[data-state="down"] { color: var(--bad); }
.incidents .pill[data-state="down"] i { background: var(--bad); }
.incidents .pill[data-state="degraded"] { color: var(--warn); }
.incidents .pill[data-state="degraded"] i { background: var(--warn); }

.when { color: var(--muted); font-size: 14px; }

.foot {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.foot-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 32px;
}

.foot a { color: var(--blue); }

@media (max-width: 760px) {
  .svc,
  .incidents li { grid-template-columns: 1fr; }
  .aside {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
  .legend-note { margin-left: 0; }
  .foot-row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@keyframes pulse {
  50% { opacity: 0.45; }
}
