/*
 * Self-contained styles. The status page deliberately does not consume the
 * design system: a shared dependency would mean a design-system regression could
 * take down the page that reports outages.
 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d21;
  --text-muted: #5b6472;
  --healthy: #178a5a;
  --degraded: #b8860b;
  --unhealthy: #c0392b;
  --unknown: #8a919e;
  --nodata: #dfe3e8;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --surface: #1e2126;
    --border: #2e333b;
    --text: #e8eaed;
    --text-muted: #9aa3b0;
    --healthy: #35c184;
    --degraded: #e0aa3e;
    --unhealthy: #ef6459;
    --unknown: #7d8592;
    --nodata: #2b3038;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem 1.25rem 3rem;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.page__header,
.page__main,
.page__footer {
  max-width: 1100px;
  margin: 0 auto;
}

.page__header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
}

.page__subtitle {
  margin: 0 0 2rem;
  color: var(--text-muted);
}

.page__footer {
  margin-top: 2.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Notices ---------------------------------------------------------------- */

.notice {
  padding: 0.85rem 1rem;
  margin: 0 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.notice--warning {
  border-left: 4px solid var(--degraded);
}

.notice--error {
  border-left: 4px solid var(--unhealthy);
}

/* Environment ------------------------------------------------------------ */

.env {
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.env__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.env__name {
  margin: 0;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.env__summary {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.env__empty {
  margin: 0;
  padding: 1rem 1.1rem;
  color: var(--text-muted);
}

/* Service row ------------------------------------------------------------ */

.service + .service {
  border-top: 1px solid var(--border);
}

.service__summary {
  display: grid;
  grid-template-columns: minmax(11rem, 1.4fr) 9rem auto minmax(8rem, 1fr);
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.1rem;
  cursor: pointer;
  list-style: none;
}

.service__summary::-webkit-details-marker {
  display: none;
}

.service__summary:hover,
.service__details[open] .service__summary {
  background: color-mix(in srgb, var(--surface) 88%, var(--text) 12%);
}

.service__summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

.service__name {
  display: flex;
  flex-direction: column;
}

.service__nameText {
  font-weight: 600;
}

.service__kind {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.service__metrics {
  display: flex;
  gap: 1rem;
}

.metric {
  display: flex;
  flex-direction: column;
  min-width: 3.6rem;
}

.metric__label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric__value {
  font-variant-numeric: tabular-nums;
}

/* Status pill ------------------------------------------------------------ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.pill__dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex: none;
  background: var(--unknown);
}

.pill--healthy .pill__dot {
  background: var(--healthy);
}
.pill--degraded .pill__dot {
  background: var(--degraded);
}
.pill--unhealthy .pill__dot,
.pill--unreachable .pill__dot {
  background: var(--unhealthy);
}

.pill--healthy .pill__text {
  color: var(--healthy);
}
.pill--degraded .pill__text {
  color: var(--degraded);
}
.pill--unhealthy .pill__text,
.pill--unreachable .pill__text {
  color: var(--unhealthy);
}
.pill--unknown .pill__text {
  color: var(--unknown);
}

/* 90-day strip ----------------------------------------------------------- */

.strip {
  display: flex;
  gap: 1px;
  height: 1.9rem;
  align-items: stretch;
}

.strip__bar {
  flex: 1 1 0;
  min-width: 1px;
  border-radius: 1px;
  background: var(--nodata);
}

.strip__bar--healthy {
  background: var(--healthy);
}
.strip__bar--degraded {
  background: var(--degraded);
}
.strip__bar--unhealthy {
  background: var(--unhealthy);
}

/* Dependency detail ------------------------------------------------------ */

.deps {
  padding: 0.5rem 1.1rem 1.1rem;
  border-top: 1px dashed var(--border);
}

.deps__list {
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
}

.deps__item {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) 7rem 6rem 5rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.deps__name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}

.deps__meta,
.deps__latency {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.deps__state {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: right;
}

.deps__item--ok .deps__state {
  color: var(--healthy);
}

.deps__item--error .deps__state {
  color: var(--unhealthy);
}

.deps__empty,
.deps__note {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.updated {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Narrow screens: the grid columns collapse to stacked blocks. */
@media (max-width: 820px) {
  .service__summary {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .deps__item {
    grid-template-columns: 1fr 1fr;
  }

  .deps__state {
    text-align: left;
  }
}
