/* sb-status-page — self-contained styles. No external fonts or assets.
   Theme-aware via prefers-color-scheme (light + navy-tinted dark).
   v2 brand pass (SMASH-1662) — palette grounded in the smashballoon.com theme
   tokens: peach #FE544F (brand accent) · navy #141B38 (ink). */

:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --border: #e3e6ee;
  --text: #141b38;
  --text-muted: #5d6478;
  --shadow: 0 1px 3px rgba(20, 27, 56, 0.07);
  --accent: #fe544f;

  --green: #1f9d55;
  --green-soft: #e2f4e9;
  --yellow: #d98a04;
  --yellow-soft: #fdf1d7;
  --red: #d6333f;
  --red-soft: #fae0e2;
  --grey: #c3c9d8;
  --grey-soft: #eaedf4;

  --radius: 12px;
  --cell-radius: 2px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1322;
    --card: #171d33;
    --border: #272f4d;
    --text: #e8eaf2;
    --text-muted: #8e96b0;
    --shadow: none;
    --accent: #fe6f6a;

    --green: #3fb950;
    --green-soft: #14301f;
    --yellow: #d29922;
    --yellow-soft: #392e12;
    --red: #f85149;
    --red-soft: #3d181b;
    --grey: #454e6b;
    --grey-soft: #202741;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.25rem 1rem 3rem;
}

/* --- masthead: official SB lockup + "Status" --- */
.masthead {
  margin: 0 0 1.5rem;
}

.masthead__title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text); /* wordmark paths use currentColor: navy in light, white in dark */
}

.masthead__logo {
  flex: 0 0 auto;
  display: block;
}

.masthead__status {
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 0.65rem;
  line-height: 1.2;
}

/* --- overall banner --- */
.overall {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.05rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1.6rem;
  font-size: 1.08rem;
  font-weight: 650;
}

.overall__dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--grey);
}

.overall__asof {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.overall--operational {
  background: var(--green-soft);
  border-color: var(--green);
}
.overall--operational .overall__dot {
  background: var(--green);
}
.overall--degraded {
  background: var(--yellow-soft);
  border-color: var(--yellow);
}
.overall--degraded .overall__dot {
  background: var(--yellow);
}
.overall--down {
  background: var(--red-soft);
  border-color: var(--red);
}
.overall--down .overall__dot {
  background: var(--red);
}
.overall--stale,
.overall--loading,
.overall--error {
  background: var(--grey-soft);
  border-color: var(--grey);
}

/* --- service rows --- */
.service-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.service {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.05rem 1.2rem 0.9rem;
}

.service--stale {
  opacity: 0.72;
}

.service__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.service__id {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.service__name {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service__right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 0 0 auto;
}

.service__latency {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.08rem 0.55rem;
}

.service__state {
  font-size: 0.82rem;
  font-weight: 550;
}
.state--operational {
  color: var(--green);
}
.state--degraded {
  color: var(--yellow);
}
.state--down {
  color: var(--red);
}
.state--unknown {
  color: var(--text-muted);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.dot--operational {
  background: var(--green);
}
.dot--degraded {
  background: var(--yellow);
}
.dot--down {
  background: var(--red);
}
.dot--unknown {
  background: var(--grey);
}

/* --- 96-cell history bar ---
   Rendered as SVG (not CSS grid): 96 fractional-width grid tracks snap to
   whole device pixels, making cells/gaps visibly uneven at most viewport
   widths. SVG with preserveAspectRatio="none" scales continuously, so every
   cell and gap stays identical. */
.history {
  height: 34px;
  margin-bottom: 0.5rem;
}
.history svg {
  display: block;
  width: 100%;
  height: 100%;
}

.cell {
  cursor: default;
  transition: opacity 80ms ease;
}
.history .cell:hover {
  opacity: 0.7;
}
@media (prefers-reduced-motion: reduce) {
  .cell {
    transition: none;
  }
}
/* `fill` paints the SVG history cells; `background` keeps the legend swatches. */
.cell--operational {
  fill: var(--green);
  background: var(--green);
}
.cell--degraded {
  fill: var(--yellow);
  background: var(--yellow);
}
.cell--down {
  fill: var(--red);
  background: var(--red);
}
.cell--unknown {
  fill: var(--grey-soft);
  background: var(--grey-soft);
}

/* --- per-row meta: time axis + uptime --- */
.service__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.service__meta .axis {
  opacity: 0.8;
}

/* --- footer --- */
.footer {
  margin-top: 2.1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.last-checked {
  margin: 0 0 0.75rem;
  font-weight: 550;
  color: var(--text);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 0 0 0.6rem;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend .cell {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: var(--cell-radius);
}

.footer__note {
  margin: 0 0 0.35rem;
  opacity: 0.85;
}

.footer__brand {
  margin: 0.8rem 0 0;
}
.footer__brand a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 550;
}
.footer__brand a:hover {
  text-decoration: underline;
}
.footer__brand a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- tooltip --- */
.tooltip {
  position: absolute;
  z-index: 20;
  background: var(--text);
  color: var(--card);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  font-size: 0.74rem;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(20, 27, 56, 0.28);
  font-variant-numeric: tabular-nums;
}
.tooltip[hidden] {
  display: none;
}

@media (max-width: 480px) {
  .history {
    height: 28px;
  }
  .page {
    padding: 1.6rem 0.85rem 2.5rem;
  }
  .service__latency {
    display: none;
  }
}
