/* Client status pages (api/status.js). Light and dark follow the device.
   Text colours are 4.5:1 or better on their background, bars and borders 3:1
   or better; bar height carries the same meaning as bar colour. */
:root {
  --bg: #ffffff;
  --panel: #f4f6f8;
  --text: #16191f;
  --muted: #4b535c;
  --line: #c6ccd2;
  --accent: #0b5cad;
  --up: #1a7a0d;
  --minor: #9a6700;
  --down: #c3221d;
  --none: #7a8695;
  --up-bg: #edf7ea;
  --minor-bg: #fff6e0;
  --down-bg: #fdecec;
  --none-bg: #eef1f4;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1720;
    --panel: #182330;
    --text: #e9edf1;
    --muted: #adb7c2;
    --line: #4a5868;
    --accent: #78b4ff;
    --up: #62cf6c;
    --minor: #f0b43c;
    --down: #ff7b72;
    --none: #8592a1;
    --up-bg: #12301a;
    --minor-bg: #33280d;
    --down-bg: #3a1716;
    --none-bg: #1d2834;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
main:focus { outline: none; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .75rem; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
section {
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
  margin-top: 1.25rem;
}
.small { color: var(--muted); font-size: .9rem; font-weight: normal; }
.skip {
  position: absolute; left: .5rem; top: -3rem;
  background: var(--bg); color: var(--accent); padding: .5rem .75rem; border: 2px solid var(--accent);
}
.skip:focus { top: .5rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- current state --- */
.state {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem;
  margin: 0 0 .5rem; padding: .75rem 1rem;
  border: 1px solid var(--line); border-left-width: 6px; border-radius: 8px;
}
.state strong { font-size: 1.15rem; }
.state .dot { width: .85rem; height: .85rem; border-radius: 50%; background: currentColor; flex: none; }
.state.up { color: var(--up); background: var(--up-bg); border-left-color: var(--up); }
.state.degraded { color: var(--minor); background: var(--minor-bg); border-left-color: var(--minor); }
.state.down { color: var(--down); background: var(--down-bg); border-left-color: var(--down); }
.state.unknown { color: var(--muted); background: var(--none-bg); border-left-color: var(--none); }
.state span:last-child { color: var(--text); flex-basis: 100%; }
.state .dot + strong + span { flex-basis: 100%; }

/* --- figures --- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem;
  margin: 0;
}
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
.stats dt { color: var(--muted); font-size: .85rem; }
.stats dd { margin: .1rem 0 0; font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- 90-day strip --- */
.strip-wrap { margin: 1rem 0 .25rem; }
.strip { display: flex; align-items: flex-end; gap: 2px; height: 2.5rem; }
.strip .bar { flex: 1 1 0; min-width: 1px; }
.bar { display: inline-block; border-radius: 1px; }
.bar.full { background: var(--up); height: 100%; }
.bar.minor { background: var(--minor); height: 70%; }
.bar.major { background: var(--down); height: 40%; }
.bar.none { background: var(--none); height: 15%; }
figcaption { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; list-style: none; padding: 0; margin: .5rem 0; font-size: .85rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: flex-end; gap: .35rem; }
.legend .bar { width: .6rem; height: .9rem; }
.legend .bar.minor { height: .65rem; }
.legend .bar.major { height: .4rem; }
.legend .bar.none { height: .2rem; }

/* --- incidents --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .85rem; font-weight: 600; }

.foot { margin-top: 2rem; color: var(--muted); font-size: .9rem; }
.foot p { margin: .25rem 0; }

/* --- recovery form --- */
.recover { display: grid; gap: .5rem; max-width: 26rem; margin-top: 1rem; }
.recover label { font-weight: 600; }
.recover input {
  font: inherit; padding: .6rem .7rem; min-height: 44px;
  color: var(--text); background: var(--bg); border: 1px solid var(--muted); border-radius: 6px;
}
.recover button {
  font: inherit; font-weight: 600; min-height: 44px; padding: .6rem 1rem; cursor: pointer;
  color: #ffffff; background: #0b5cad; border: 0; border-radius: 6px; justify-self: start;
}
.notice { padding: .75rem 1rem; border-radius: 8px; border: 1px solid var(--line); }
.notice.ok { background: var(--up-bg); }
.notice.bad { background: var(--down-bg); }

@media (max-width: 30rem) {
  main { padding-top: 1rem; }
  h1 { font-size: 1.35rem; }
  .stats dd { font-size: 1.15rem; }
  .strip { gap: 1px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
