/* AgentGate — status page (/status). Builds on site.css.

   Colour follows the verdicts: operational → allow, degraded → redact,
   down → block. Anything the feed did not report stays neutral. */

/* ── Overall banner ────────────────────────────────────────────────────────── */

.sys-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  transition: border-color 0.2s;
}

.sys-banner > .dot {
  width: 11px;
  height: 11px;
}

.sys-banner[data-state="operational"] { border-color: var(--allow-line); }
.sys-banner[data-state="degraded"] { border-color: var(--redact-line); }
.sys-banner[data-state="down"] { border-color: var(--block-line); }

.sys-banner-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sys-banner-text strong {
  font-size: 1.125rem;
  font-weight: 560;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.sys-banner-text span {
  font-size: 0.875rem;
  color: var(--ink-2);
}

.sys-banner-figure {
  display: grid;
  gap: 2px;
  flex: none;
  margin-left: auto;
  text-align: right;
}

.sys-banner-figure strong {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.sys-banner-figure span {
  font-size: 0.75rem;
  color: var(--ink-3);
}

.is-loading {
  animation: st-pulse 1.5s ease-in-out infinite;
}

@keyframes st-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* ── Page body ─────────────────────────────────────────────────────────────── */

.st-body {
  padding-block: 4px calc(var(--section) * 0.62);
}

.st-stack {
  display: grid;
  gap: clamp(40px, 6vw, 64px);
}

.st-stack > section {
  min-width: 0;
}

.st-head {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.st-head p {
  max-width: 64ch;
}

/* ── Services ──────────────────────────────────────────────────────────────── */

.svc-list {
  overflow: hidden;
}

.svc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px 22px;
  padding: 16px clamp(16px, 2.4vw, 24px);
  border-top: 1px solid var(--line);
}

.svc-row:first-child {
  border-top: 0;
}

.svc-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-weight: 560;
  letter-spacing: -0.01em;
}

.svc-desc {
  margin-top: 2px;
  font-size: 0.84375rem;
  color: var(--ink-3);
}

.svc-lat {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
}

.svc-lat b {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* the dot inside a state tag takes the tag's colour */
.svc-row .tag .dot,
.incident .tag .dot {
  width: 6px;
  height: 6px;
  background: currentColor;
  box-shadow: none;
}

/* ── Uptime bars ───────────────────────────────────────────────────────────── */

.uptime-row + .uptime-row {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.uptime-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 16px;
  margin-bottom: 10px;
}

.uptime-name {
  font-size: 0.9375rem;
  font-weight: 550;
  letter-spacing: -0.01em;
}

.uptime-figure {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-3);
}

.uptime-figure b {
  font-weight: 500;
  color: var(--ink);
}

.uptime-bar {
  display: flex;
  gap: 2px;
  height: 30px;
}

.uptime-bar i,
.uptime-legend i {
  background: var(--line-2);
}

.uptime-bar i {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px;
}

.uptime-bar i[data-s="operational"],
.uptime-legend i[data-s="operational"] { background: var(--allow); }

.uptime-bar i[data-s="degraded"],
.uptime-legend i[data-s="degraded"] { background: var(--redact); }

.uptime-bar i[data-s="down"],
.uptime-legend i[data-s="down"] { background: var(--block); }

.uptime-axis {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--ink-3);
}

/* `ul.` so the padding beats the base `ul[class]` reset */
ul.uptime-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.78125rem;
  color: var(--ink-3);
}

.uptime-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.uptime-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ── Response time ─────────────────────────────────────────────────────────── */

.lat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 16px;
}

.lat-chart {
  display: block;
  width: 100%;
  height: 190px;
}

/* ── Incidents ─────────────────────────────────────────────────────────────── */

.incident {
  display: grid;
  gap: 8px;
  padding-block: 18px;
  border-top: 1px solid var(--line);
}

.incident:first-child {
  padding-top: 0;
  border-top: 0;
}

.incident:last-child {
  padding-bottom: 0;
}

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

.incident-head strong {
  font-weight: 560;
  letter-spacing: -0.01em;
}

/* ── Subscribe ─────────────────────────────────────────────────────────────── */

.sub-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 620px) {
  .sys-banner {
    flex-wrap: wrap;
  }

  .sys-banner-text {
    flex: 1;
  }

  .sys-banner-figure {
    flex: 1 1 100%;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 10px;
    margin-left: 27px;
    text-align: left;
  }

  .sys-banner-figure strong {
    font-size: 1.125rem;
  }

  .svc-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .svc-lat {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: baseline;
    gap: 6px;
    text-align: left;
  }

  .svc-lat b {
    display: inline;
    font-size: 0.75rem;
  }

  .uptime-bar {
    gap: 1px;
    height: 26px;
  }

  .uptime-bar i {
    border-radius: 1px;
  }

  .lat-chart {
    height: 160px;
  }

  .sub-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
