:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #646a73;
  --border: #e3e3e0;
  --brand: #d71920;
  --ok: #2b8a3e;
  --ok-bar: #40a858;
  --degraded: #9a6700;
  --degraded-bar: #e3b008;
  --partial: #c2410c;
  --partial-bar: #f08c00;
  --major: #c92a2a;
  --major-bar: #e03131;
  --nodata-bar: #d5d7da;
  --unknown: #646a73;
  --banner-text: #ffffff;
  --tooltip-bg: #1f2328;
  --tooltip-text: #ffffff;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #111315;
    --surface: #181b1f;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --border: #2c3036;
    --ok: #51cf66;
    --ok-bar: #37b24d;
    --degraded: #fcc419;
    --degraded-bar: #f2b705;
    --partial: #ff922b;
    --partial-bar: #f08c00;
    --major: #ff6b6b;
    --major-bar: #f03e3e;
    --nodata-bar: #3a3f46;
    --unknown: #9aa0a6;
    --tooltip-bg: #e8eaed;
    --tooltip-text: #111315;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.page {
  max-width: 850px;
  margin: 0 auto;
  padding: 48px 16px 64px;
}

/* ── header ─────────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #ffffff;
  padding: 4px;
  box-shadow: 0 0 0 1px var(--border);
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.lang-toggle {
  flex: none;
  border: 1px solid var(--text);
  background: var(--text);
  color: var(--bg);
  border-radius: 4px;
  padding: 9px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.lang-toggle:focus-visible,
.bars:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* ── banner + notices ───────────────────────── */

.banner {
  border-radius: 4px;
  padding: 20px 20px;
  font-size: 20px;
  font-weight: 500;
  color: var(--banner-text);
  background: var(--unknown);
  margin-bottom: 16px;
}

.banner[data-state='operational'] { background: var(--ok); }
.banner[data-state='degraded'] { background: var(--degraded-bar); color: #1f2328; }
.banner[data-state='partial_outage'] { background: var(--partial-bar); color: #1f2328; }
.banner[data-state='major_outage'] { background: var(--major-bar); }

.notice {
  border: 1px solid var(--border);
  border-left: 4px solid var(--degraded-bar);
  background: var(--surface);
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ── active incidents ───────────────────────── */

.active {
  margin: 32px 0 0;
}

.active-incident {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  margin-bottom: 16px;
  overflow: hidden;
}

.active-incident h3 {
  margin: 0;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
  background: var(--major-bar);
}

.active-incident[data-impact='minor'] h3 {
  background: var(--partial-bar);
  color: #1f2328;
}

.active-incident .updates {
  padding: 4px 20px 8px;
}

/* ── components ─────────────────────────────── */

.uptime-caption {
  margin: 64px 0 8px;
  text-align: right;
  font-size: 14px;
  color: var(--muted);
}

.components {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.component {
  padding: 20px 20px 16px;
}

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

.component-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.component-name {
  font-weight: 500;
}

.component-state {
  flex: none;
  font-size: 14px;
}

.component-state[data-state='operational'] { color: var(--ok); }
.component-state[data-state='degraded'] { color: var(--degraded); }
.component-state[data-state='down'] { color: var(--major); }
.component-state[data-state='unknown'] { color: var(--unknown); }

.bars {
  display: flex;
  gap: 2px;
  height: 34px;
  border-radius: 2px;
}

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

.bar[data-state='ok'] { background: var(--ok-bar); }
.bar[data-state='degraded'] { background: var(--degraded-bar); }
.bar[data-state='partial'] { background: var(--partial-bar); }
.bar[data-state='major'] { background: var(--major-bar); }

.bar:hover,
.bar[data-active] {
  opacity: 0.7;
}

.component-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

.component-foot .rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.short-window {
  display: none;
}

/* Phones show the last 30 days, as Statuspage does. */
@media (max-width: 640px) {
  .bar:nth-child(-n + 60) {
    display: none;
  }
  .long-window {
    display: none;
  }
  .short-window {
    display: inline;
  }
  .header {
    margin-bottom: 32px;
  }
  .brand h1 {
    font-size: 20px;
  }
  .lang-toggle {
    padding: 8px 12px;
  }
  .component-foot {
    gap: 8px;
    font-size: 13px;
  }
}

/* ── tooltip ────────────────────────────────── */

.tooltip {
  position: absolute;
  z-index: 10;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-size: 13px;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.18);
}

.tooltip strong {
  display: block;
  margin-bottom: 2px;
}

.tooltip ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

/* ── incidents ──────────────────────────────── */

.past {
  margin-top: 72px;
}

.past h2 {
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 16px;
}

.day h4 {
  margin: 28px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 19px;
  font-weight: 500;
}

.day .empty {
  margin: 8px 0 0;
  color: var(--muted);
}

.incident-title {
  margin: 12px 0 8px;
  font-size: 19px;
  font-weight: 500;
  color: var(--major);
}

.incident-title[data-impact='minor'] {
  color: var(--partial);
}

.update {
  margin: 0 0 14px;
}

.update p {
  margin: 0;
  white-space: pre-line;
}

.update time {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

/* ── footer ─────────────────────────────────── */

.footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
