:root {
  --bg: #F5F0EB;
  --surface: #FFFFFF;
  --recessed: #E8E2DA;
  --ink: #1C1917;
  --ink-2: #57534E;
  --ink-3: #78716C;
  --dark: #1C1917;
  --dark-elevated: #292524;
  --on-dark: #F5F0EB;
  --on-dark-muted: #A8A29E;
  --border: #D6D3D1;
  --border-strong: #A8A29E;
  --accent: #D97706;
  --up: #15803D;
  --down: #DC2626;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: #FEF3C7; color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.shell {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 48px);
}

/* ── Header band ─────────────────────────────────────────── */

.band {
  background: var(--dark);
  color: var(--on-dark);
  position: relative;
}

.band::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

.band__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 28px;
}

.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.band .wordmark { color: var(--on-dark); }

.wordmark span { color: var(--accent); }
.wordmark--footer span { color: var(--accent); }

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.verdict__dot {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: var(--border-strong);
  flex: none;
}

.verdict__dot[data-state="up"] {
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.verdict__dot[data-state="down"] {
  background: var(--down);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.verdict__dot[data-state="maintenance"] {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

/* ── Service register ────────────────────────────────────── */

.services { padding-block: 40px 24px; }

.services__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.services__title {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.services__meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.rows { display: block; }

.service {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px 32px;
  padding-block: 20px;
  border-bottom: 1px solid var(--border);
}

.service:last-child { border-bottom: 0; }

.service__name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.service__dot {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  background: var(--border-strong);
  flex: none;
}

.service__dot[data-state="up"] { background: var(--up); }
.service__dot[data-state="down"] { background: var(--down); }
.service__dot[data-state="maintenance"] { background: var(--accent); }

.service__name {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.service__stats {
  display: flex;
  align-items: baseline;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.service__uptime { color: var(--ink-2); white-space: nowrap; }
.service__ping { color: var(--ink-3); white-space: nowrap; }

.beats {
  grid-column: 1 / -1;
  display: flex;
  gap: 3px;
  height: 22px;
  align-items: stretch;
}

.beat {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px;
  background: var(--recessed);
}

.beat--up { background: #86EFAC; }
.beat--down { background: var(--down); }
.beat--maintenance { background: #FCD34D; }
/* ── Loading, error, incident ────────────────────────────── */

.loading {
  display: grid;
  gap: 18px;
  padding-block: 32px;
}

.loading__bar {
  height: 22px;
  width: 100%;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--recessed), #F0EBE4, var(--recessed));
  background-size: 200% 100%;
  animation: sweep 1.4s ease-in-out infinite;
}

.loading__bar--short { max-width: 55%; }

@keyframes sweep {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .loading__bar { animation: none; }
}

.error {
  padding-block: 28px;
  color: var(--down);
  font-weight: 500;
}

.error__retry {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.incident {
  margin-block: 28px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
}

.incident__title {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.incident__content { margin: 0; color: var(--ink-2); font-size: 15px; }

.incident[data-style="danger"] { border-color: #FECACA; background: #FEF2F2; }
.incident[data-style="warning"] { border-color: #FDE68A; background: #FFFBEB; }

/* ── Notes ───────────────────────────────────────────────── */

.notes { padding-block: 32px 72px; max-width: 65ch; }

.notes__divider {
  width: 120px;
  border-top: 1px solid var(--border-strong);
  margin-bottom: 28px;
}

.notes__title {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.notes__text { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }

.notes a {
  color: var(--ink);
  font-weight: 500;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.notes a:hover { text-decoration-color: var(--accent); }

.legend { white-space: nowrap; }

.legend__swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
}

.legend__swatch--up { background: #86EFAC; }
.legend__swatch--down { background: var(--down); }
.legend__swatch--none { background: var(--recessed); }

/* ── Footer ──────────────────────────────────────────────── */

.footer {
  background: var(--dark);
  color: var(--on-dark-muted);
}

.footer .wordmark--footer { color: var(--on-dark); }

.footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 32px;
}

.footer__links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer__links a {
  color: var(--on-dark-muted);
  text-decoration: none;
  font-size: 14px;
}

.footer__links a:hover { color: var(--on-dark); }

.footer__links a:focus-visible { outline-color: var(--accent); }

/* ── Narrow screens ──────────────────────────────────────── */

@media (max-width: 640px) {
  .service {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .service__stats { gap: 16px; font-size: 12px; }

  .beats { height: 18px; gap: 2px; }

  .band__row { padding-block: 20px; }

  .services { padding-block: 28px 16px; }
}
