/* Sembr public status page.
 *
 * Mobile first. This is the page somebody opens on a phone, standing up,
 * because something is not working.
 *
 * NO AMBER AND NO ORANGE, a standing Sembr constraint, and here it also happens
 * to be the accessible choice. The usual status triad of green, amber and red
 * is close to the worst possible palette for the most common colour blindness,
 * where red and green already collide. Degraded borrows the existing --calm
 * blue from feed.css rather than inventing a colour, so the four states are
 * green, blue, red and grey, and every one of them also carries a word. Colour
 * alone is never the status.
 *
 * Manrope is the Sembr typeface and is NOT loaded, deliberately. A page whose
 * job is to work when other things are broken should not depend on a font
 * origin it does not control.
 */

:root {
  --accent: #0aadbc;
  --accent-strong: #067885;
  --ink: #10161a;
  --ink-soft: #55636b;
  --ink-faint: #8b979e;
  --paper: #f6f8f9;
  --card: #ffffff;
  --line: #dde4e7;

  --ok: #12a06a;
  --degraded: #4c6ef5;
  --down: #d3395f;
  --nodata: #c2ccd2;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef3f5;
    --ink-soft: #a6b3ba;
    --ink-faint: #71808a;
    --paper: #0e1417;
    --card: #161e23;
    --line: #263238;
    --nodata: #37444c;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.status {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Banner ------------------------------------------------------------------ */

.status-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 18px;
  margin-bottom: 28px;
}

.status-banner h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.status-banner p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* The dot is the status signal, never a coloured left border on the card.
 * Standing Sembr constraint. */
.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--nodata);
}

.status-banner--operational .status-dot { background: var(--ok); }
.status-banner--degraded .status-dot { background: var(--degraded); }
.status-banner--outage .status-dot { background: var(--down); }

/* Components -------------------------------------------------------------- */

.components {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 12px;
}

.component {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.component-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.component-name h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.component-name p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 4px 11px 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill .status-dot {
  width: 8px;
  height: 8px;
  margin-top: 0;
}

.pill--operational .status-dot { background: var(--ok); }
.pill--degraded .status-dot { background: var(--degraded); }
.pill--outage .status-dot { background: var(--down); }
.pill--unknown .status-dot { background: var(--nodata); }

/* The 90-day bar ---------------------------------------------------------- */

.bar {
  display: flex;
  gap: 2px;
  align-items: stretch;
  height: 34px;
}

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

.day--operational { background: var(--ok); }
.day--degraded { background: var(--degraded); }
.day--outage { background: var(--down); }
.day--nodata { background: var(--nodata); }

/* On a narrow screen 90 bars are two pixels each and read as mush, so the
 * oldest 45 are dropped rather than squeezed. The DOM keeps all ninety, so
 * nothing is hidden from a reader who wants it or from a screen reader. */
@media (max-width: 560px) {
  .bar .day:nth-child(-n + 45) {
    display: none;
  }

  .bar-scale span:first-child::after {
    content: " (45 shown)";
  }
}

.bar-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--ink-faint);
  font-size: 0.75rem;
}

.bar-empty {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.875rem;
}

/* Legend ------------------------------------------------------------------ */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  margin-bottom: 30px;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend .day {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
}

.legend-note {
  flex: 1 0 100%;
  margin: 0;
  color: var(--ink-faint);
}

/* Incidents --------------------------------------------------------------- */

.incidents h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.incidents ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.incident {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.incident h3 {
  margin: 0 0 4px;
  font-size: 0.975rem;
}

.incident-meta {
  margin: 0 0 8px;
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

.incident-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.incidents-empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* Footer ------------------------------------------------------------------ */

.status-foot {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

.status-foot p {
  margin: 0 0 4px;
}

.status-foot a {
  color: var(--accent-strong);
}

@media (prefers-color-scheme: dark) {
  .status-foot a {
    color: var(--accent);
  }
}

@media (min-width: 640px) {
  .status {
    padding: 40px 24px 64px;
  }

  .status-banner h1 {
    font-size: 1.6rem;
  }
}
