/* robbiesucks.lol status page
 * Palette: the validated dataviz reference instance.
 *  - status tokens (good/warning/serious/critical) are FIXED across modes and
 *    never reused for a series; every one of them ships with an icon + label.
 *  - the response-time chart uses categorical slots 1 and 2 only, re-stepped
 *    for the dark surface. Validated: worst adjacent CVD dE 24.7 light /
 *    26.8 dark, normal-vision 33.6 / 31.8, contrast >= 3:1 in both modes.
 */

/* MUST COME FIRST, AND MUST KEEP THE !important.
 *
 * The `hidden` attribute is enforced only by the UA stylesheet's
 * `[hidden] { display: none }`, which ANY author rule setting `display` on a
 * class or id defeats. Several elements here are class-styled `display: flex`
 * AND toggled via `el.hidden` from app.js -- so without this rule the attribute
 * silently does nothing.
 *
 * This shipped to production on 2026-08-06: `.demo-banner { display: flex }`
 * beat `[hidden]`, so the live status page carried the banner reading "Demo --
 * every number on this page is fake" over real measured data, and also exposed
 * the demo-only Preview control that lets any visitor force the page into a
 * fake "Major outage". Both are demo-only elements that app.js explicitly sets
 * `.hidden = true` on when `demo` is false; the assignment worked, the CSS
 * ignored it. `.tip` and `.table-slot` toggle the same way and were one
 * `display` declaration away from the same fault.
 */
[hidden] {
  display: none !important;
}

:root {
  color-scheme: light;

  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --hair: rgba(11, 11, 11, 0.1);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px -16px rgba(11, 11, 11, 0.18);

  /* status — fixed, never themed */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --nodata: #d9d8d1;

  /* categorical series */
  --s1: #2a78d6;
  --s2: #eb6834;

  --stripe: rgba(252, 252, 251, 0.72);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --hair: rgba(255, 255, 255, 0.1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px -16px rgba(0, 0, 0, 0.9);
    --nodata: #33332f;
    --s1: #3987e5;
    --s2: #d95926;
    --stripe: rgba(26, 26, 25, 0.78);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --hair: rgba(255, 255, 255, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px -16px rgba(0, 0, 0, 0.9);
  --nodata: #33332f;
  --s1: #3987e5;
  --s2: #d95926;
  --stripe: rgba(26, 26, 25, 0.78);
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.011em;
}
p {
  margin: 0;
}
button {
  font: inherit;
  color: inherit;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

/* ── demo banner ─────────────────────────────────────────────────────────── */
.demo-banner {
  background: color-mix(in oklab, var(--warning) 16%, var(--page));
  border-bottom: 1px solid color-mix(in oklab, var(--warning) 40%, var(--page));
  color: var(--ink);
  padding: 10px 20px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
}
.demo-banner span {
  color: var(--ink-2);
}
.demo-banner code {
  font-size: 12px;
}

/* ── masthead ────────────────────────────────────────────────────────────── */
.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand h1 {
  font-size: 22px;
}
.sub {
  color: var(--muted);
  font-size: 13px;
}
.pulse {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--muted) 22%, transparent);
  flex: none;
}
.pulse[data-state="up"] {
  background: var(--good);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--good) 22%, transparent);
}
.pulse[data-state="degraded"] {
  background: var(--warning);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--warning) 26%, transparent);
}
.pulse[data-state="partial"] {
  background: var(--serious);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--serious) 26%, transparent);
}
.pulse[data-state="down"] {
  background: var(--critical);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--critical) 26%, transparent);
}
.masthead-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.freshness {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.ghost-btn {
  background: none;
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.ghost-btn:hover {
  background: color-mix(in oklab, var(--ink) 5%, transparent);
}

/* ── overall banner ──────────────────────────────────────────────────────── */
.banner {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--hair);
  background: var(--surface);
  margin-bottom: 26px;
}
.banner[data-state="up"] {
  background: color-mix(in oklab, var(--good) 9%, var(--surface));
  border-color: color-mix(in oklab, var(--good) 34%, var(--surface));
}
.banner[data-state="degraded"] {
  background: color-mix(in oklab, var(--warning) 13%, var(--surface));
  border-color: color-mix(in oklab, var(--warning) 42%, var(--surface));
}
.banner[data-state="partial"] {
  background: color-mix(in oklab, var(--serious) 13%, var(--surface));
  border-color: color-mix(in oklab, var(--serious) 42%, var(--surface));
}
.banner[data-state="down"] {
  background: color-mix(in oklab, var(--critical) 11%, var(--surface));
  border-color: color-mix(in oklab, var(--critical) 40%, var(--surface));
}
.banner-icon {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
}
.banner-icon svg {
  width: 26px;
  height: 26px;
}
.banner-title {
  font-size: 18px;
  font-weight: 600;
}
.banner-sub {
  color: var(--ink-2);
  font-size: 13px;
  margin-top: 2px;
}

/* ── service cards + the 90-day bar ──────────────────────────────────────── */
.services {
  display: grid;
  gap: 14px;
}
.svc {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 18px 20px 14px;
  box-shadow: var(--shadow);
}
.svc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.svc-name {
  font-size: 16px;
  font-weight: 600;
}
.svc-host {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 1px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill svg {
  width: 13px;
  height: 13px;
  flex: none;
}
.pill[data-state="up"] {
  color: color-mix(in oklab, var(--good) 76%, var(--ink));
  background: color-mix(in oklab, var(--good) 14%, var(--surface));
}
.pill[data-state="degraded"] {
  color: color-mix(in oklab, var(--warning) 55%, var(--ink));
  background: color-mix(in oklab, var(--warning) 20%, var(--surface));
}
.pill[data-state="partial"] {
  color: color-mix(in oklab, var(--serious) 62%, var(--ink));
  background: color-mix(in oklab, var(--serious) 20%, var(--surface));
}
.pill[data-state="down"] {
  color: color-mix(in oklab, var(--critical) 74%, var(--ink));
  background: color-mix(in oklab, var(--critical) 15%, var(--surface));
}
.pill[data-state="unknown"] {
  color: var(--ink-2);
  background: color-mix(in oklab, var(--muted) 16%, var(--surface));
}

.bars {
  display: flex;
  gap: 3px;
  align-items: stretch;
  height: 30px;
  outline: none;
  border-radius: 4px;
}
.bars:focus-visible {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--s1);
}
.bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 3px;
  background: var(--nodata);
  transition: opacity 0.1s;
}
.bar[data-k="up"] {
  background: var(--good);
}
.bar[data-k="degraded"] {
  background: var(--warning);
}
.bar[data-k="serious"] {
  background: var(--serious);
}
.bar[data-k="down"] {
  background: var(--critical);
}
.bar[data-imported="1"] {
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 2px,
    var(--stripe) 2px 3.5px
  );
}
.bars:hover .bar {
  opacity: 0.55;
}
.bars .bar:hover,
.bar[data-cursor="1"] {
  opacity: 1;
}
/* provenance rail: a hairline under any day that is not purely measured */
.rail {
  display: flex;
  gap: 3px;
  height: 3px;
  margin-top: 4px;
}
.rail i {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 2px;
  background: transparent;
}
.rail i[data-imported="1"] {
  background: var(--muted);
}
.svc-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.svc-foot .mid {
  color: var(--ink-2);
  font-weight: 600;
}

.rail-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 14px 4px 26px;
  font-size: 12px;
  color: var(--ink-2);
}
.key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sw {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--nodata);
  flex: none;
}
.sw[data-k="up"] {
  background: var(--good);
}
.sw[data-k="degraded"] {
  background: var(--warning);
}
.sw[data-k="serious"] {
  background: var(--serious);
}
.sw[data-k="down"] {
  background: var(--critical);
}
.sw-imported {
  background: var(--good);
  background-image: repeating-linear-gradient(45deg, transparent 0 2px, var(--stripe) 2px 3.5px);
  box-shadow: 0 4px 0 -1.5px var(--muted);
}

/* ── controls ────────────────────────────────────────────────────────────── */
.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.chips {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.chips button {
  border: 0;
  background: none;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.chips button:hover {
  background: color-mix(in oklab, var(--ink) 6%, transparent);
}
.chips button.on {
  background: color-mix(in oklab, var(--ink) 88%, var(--surface));
  color: var(--surface);
  font-weight: 600;
}
.chips.small button {
  padding: 5px 10px;
  font-size: 12px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.preview-label {
  font-size: 12px;
  color: var(--muted);
}

/* ── stat tiles ──────────────────────────────────────────────────────────── */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.tile-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-value {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 4px;
  line-height: 1.15;
}
.tile-note {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 3px;
}
.tile svg.spark {
  display: block;
  margin-top: 8px;
  width: 100%;
  height: 22px;
  overflow: visible;
}

/* ── cards / chart ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.card h2 {
  font-size: 16px;
}
.card-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-2);
}
.legend i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.chart-host {
  position: relative;
}
.chart-host svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.grid-line {
  stroke: var(--grid);
  stroke-width: 1;
}
.axis-line {
  stroke: var(--axis);
  stroke-width: 1;
}
.tick {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.dlabel {
  fill: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.crosshair {
  stroke: var(--axis);
  stroke-width: 1;
}
.downband {
  fill: color-mix(in oklab, var(--critical) 16%, transparent);
}
.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 26px 0;
  text-align: center;
}

/* ── incidents ───────────────────────────────────────────────────────────── */
.inc-month {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hair);
}
.inc-month:first-child {
  margin-top: 0;
}
.inc {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--hair);
  align-items: start;
}
.inc:last-child {
  border-bottom: 0;
}
.inc-ic {
  margin-top: 2px;
}
.inc-ic svg {
  width: 16px;
  height: 16px;
  display: block;
}
.inc-title {
  font-size: 14px;
  font-weight: 600;
}
.inc-meta {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 2px;
}
.inc-detail {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}
.inc-dur {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}
.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--hair);
  color: var(--muted);
  margin-left: 6px;
  vertical-align: 1px;
}
.tag[data-t="imported"] {
  border-color: color-mix(in oklab, var(--muted) 60%, transparent);
}
.tag[data-t="ongoing"] {
  color: color-mix(in oklab, var(--critical) 74%, var(--ink));
  border-color: color-mix(in oklab, var(--critical) 45%, var(--surface));
  background: color-mix(in oklab, var(--critical) 10%, var(--surface));
}

/* ── tables (the WCAG-clean twin of every chart) ─────────────────────────── */
.table-slot {
  margin-top: 16px;
  border-top: 1px solid var(--hair);
  padding-top: 12px;
  overflow-x: auto;
}
/* 90 rows per service would bury the page; scroll them in place instead. */
.table-slot.scroll {
  max-height: 340px;
  overflow-y: auto;
}
.table-slot.scroll thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
caption {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 6px;
}
th,
td {
  text-align: right;
  padding: 5px 10px;
  border-bottom: 1px solid var(--hair);
  white-space: nowrap;
}
th:first-child,
td:first-child {
  text-align: left;
}
thead th {
  color: var(--muted);
  font-weight: 600;
}

/* ── footer ──────────────────────────────────────────────────────────────── */
.foot {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--hair);
}
.foot h2 {
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.foot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 28px;
}
.foot h3 {
  font-size: 12.5px;
  color: var(--ink);
  margin-bottom: 4px;
}
.foot p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}

/* ── tooltip ─────────────────────────────────────────────────────────────── */
.tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: color-mix(in oklab, var(--ink) 92%, var(--surface));
  color: var(--surface);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  max-width: 260px;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.45);
}
.tip b {
  font-weight: 600;
}
.tip .tip-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}
.tip .tip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}

.refetching {
  opacity: 0.55;
}

@media (max-width: 720px) {
  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }
  .foot-grid {
    grid-template-columns: 1fr;
  }
  .preview {
    margin-left: 0;
    width: 100%;
  }
}
@media (max-width: 420px) {
  .tiles {
    grid-template-columns: 1fr;
  }
  .wrap {
    padding: 20px 14px 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
