/* Speco public status page.
   No external fonts, no CDN, no third-party scripts — every external dependency
   is another way for the status page to break during an outage. */

/* Dark + blue is the fixed Speco brand theme (matches the main product
   dashboard) — not gated behind the visitor's system preference, so the
   status page looks consistent with every other Speco surface regardless of
   how a visitor's browser/OS is configured. Status colours (green/red/orange)
   are left untouched below since they carry meaning, not branding. */
:root {
  --bg: #05070d;
  --surface: #0f1420;
  --border: #1f2a44;
  --text: #eef1f5;
  --muted: #93a0b3;
  --accent: #1d6fe0;
  --accent-text: #ffffff;
  --op: #16a34a;
  --degraded: #eab308;
  --partial: #f97316;
  --major: #dc2626;
  --maint: #1d6fe0;
  --unknown: #9ca3af;
  --radius: 8px;
  --wrap: 880px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

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

/* ── header ── */

.site-header { padding: 28px 0 8px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { color: var(--accent); font-size: 24px; line-height: 1; }
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }

/* ── overall banner ── */

.banner {
  margin: 24px 0 28px;
  border-radius: var(--radius);
  /* Blue (brand) when everything is fine — outage states below override this
     with red/orange/yellow, since those still have to work as a real warning,
     not just branding. */
  background: var(--accent);
  color: #fff;
}
.banner[data-state="degraded"]      { background: var(--degraded); color: #3d2f00; }
.banner[data-state="partial_outage"]{ background: var(--partial); }
.banner[data-state="major_outage"]  { background: var(--major); }
.banner[data-state="maintenance"]   { background: var(--maint); }
.banner[data-state="unknown"]       { background: var(--unknown); }

.banner-inner { display: flex; align-items: center; gap: 12px; padding: 22px 24px; }
.banner-icon { font-size: 18px; line-height: 1; }
.banner-text { font-size: 19px; font-weight: 600; }

/* ── active incident ── */

.incident-live {
  border: 1px solid var(--border); border-left: 4px solid var(--partial);
  background: var(--surface); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 26px;
}
.incident-live[data-severity="major_outage"] { border-left-color: var(--major); }
.incident-live[data-severity="degraded"]     { border-left-color: var(--degraded); }

.incident-live h2 { margin: 0 0 4px; font-size: 17px; }
.incident-live .affected { font-size: 13px; color: var(--muted); margin: 0 0 16px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 16px 16px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -25px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted); border: 2px solid var(--surface);
}
.timeline li:first-child::before { background: var(--partial); }
.timeline .tl-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.timeline .tl-state { font-weight: 700; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.timeline .tl-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .tl-body { margin: 4px 0 0; font-size: 14px; }
.timeline .tl-next { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

/* ── uptime windows ── */

.windows {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px;
}
.window-tile {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.window-label { font-size: 12px; color: var(--muted); }
.window-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

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

/* ── services card ── */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.group-head {
  padding: 12px 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  background: color-mix(in srgb, var(--border) 30%, transparent);
  border-bottom: 1px solid var(--border);
}
.svc { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.svc:last-child { border-bottom: 0; }

.svc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.svc-name { font-size: 15px; font-weight: 500; }
.svc-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

.state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.state-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.state[data-state="operational"]    { color: var(--op); }
.state[data-state="degraded"]       { color: #a16207; }
.state[data-state="partial_outage"] { color: #c2410c; }
.state[data-state="major_outage"]   { color: var(--major); }
.state[data-state="maintenance"]    { color: var(--maint); }
.state[data-state="unknown"]        { color: var(--muted); }
.state[data-state="operational"]    .state-dot { background: var(--op); }
.state[data-state="degraded"]       .state-dot { background: var(--degraded); }
.state[data-state="partial_outage"] .state-dot { background: var(--partial); }
.state[data-state="major_outage"]   .state-dot { background: var(--major); }
.state[data-state="maintenance"]    .state-dot { background: var(--maint); }
.state[data-state="unknown"]        .state-dot { background: var(--unknown); }

/* 90-day bar. Cell height varies with severity as well as colour, so the bar is
   readable without relying on colour vision. */
.bars { display: flex; gap: 2px; align-items: flex-end; height: 34px; margin: 14px 0 6px; }
.bar {
  flex: 1 1 0; min-width: 0; border-radius: 2px;
  background: var(--op); height: 100%;
}
.bar[data-state="degraded"]       { background: var(--degraded); height: 76%; }
.bar[data-state="partial_outage"] { background: var(--partial);  height: 58%; }
.bar[data-state="major_outage"]   { background: var(--major);    height: 40%; }
.bar[data-state="maintenance"]    { background: var(--maint);    height: 70%; }
.bar:hover { outline: 1px solid var(--text); outline-offset: 1px; }
.bar-blank { background: transparent; pointer-events: none; }

.bars-axis {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.bars-axis .rule { flex: 1; height: 1px; background: var(--border); }

/* ── blocks ── */

.block { margin: 34px 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.block-title {
  margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.muted { color: var(--muted); font-size: 13px; }

.range-tabs { display: flex; gap: 4px; }
.range-tabs button {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font: inherit; font-size: 12px; padding: 5px 12px; border-radius: 5px; cursor: pointer;
}
.range-tabs button[aria-selected="true"] {
  color: var(--accent-text); background: var(--accent); border-color: var(--accent); font-weight: 600;
}

.maint-card, .inc-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px;
}
.maint-card h3, .inc-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.maint-when {
  font-size: 13px; color: var(--maint); font-weight: 600;
  font-variant-numeric: tabular-nums; margin: 0 0 6px;
}
.maint-card p, .inc-card p { margin: 0; font-size: 13px; color: var(--muted); }

.inc-card { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: baseline; }
.inc-date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.inc-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  background: color-mix(in srgb, var(--op) 15%, transparent); color: var(--op);
}
.inc-dur { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.inc-severity-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 8px 0; padding: 8px 12px; border-radius: 6px;
  background: color-mix(in srgb, var(--partial) 15%, transparent);
}
.inc-severity-row[data-severity="major_outage"] { background: color-mix(in srgb, var(--major) 15%, transparent); }
.inc-severity-row[data-severity="degraded"]      { background: color-mix(in srgb, var(--degraded) 15%, transparent); }
.inc-severity-label { font-size: 13px; font-weight: 600; color: var(--partial); }
.inc-severity-row[data-severity="major_outage"] .inc-severity-label { color: var(--major); }
.inc-severity-row[data-severity="degraded"]      .inc-severity-label { color: var(--degraded); }
.inc-severity-dur { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.inc-updates { list-style: none; margin: 10px 0 0; padding: 0; }
.inc-updates li { font-size: 13px; color: var(--muted); padding: 3px 0; }
.inc-updates .u-state { font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; }

.empty {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 14px 18px; font-size: 13px; color: var(--muted);
}

/* ── footer ── */

.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 18px 0 40px; }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap;
}
.footer-links { display: flex; gap: 14px; align-items: center; }
.footer-inner a { color: var(--muted); }
.linkish {
  background: none; border: 0; padding: 0; font: inherit; font-size: 12px;
  color: var(--muted); text-decoration: underline; cursor: pointer;
}

/* ── custom bar tooltip ── */

.bar-tip {
  display: none; position: absolute; z-index: 50;
  background: #ffffff; color: #1a1a1a; border: 1px solid #e2e5ea;
  border-radius: 10px; padding: 12px 14px; font-size: 12.5px;
  min-width: 220px; max-width: 300px; white-space: normal; pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}
.bar-tip-simple { font-weight: 500; white-space: nowrap; }
.bar-tip-date { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.bar-tip-plain { color: #4b5563; }
.bar-tip-severity {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; background: #fdf1e0; border-radius: 6px; padding: 8px 10px;
  margin-bottom: 6px;
}
.bar-tip-severity[data-severity="major_outage"] { background: #fde3e0; }
.bar-tip-severity[data-severity="degraded"]      { background: #fdf1e0; }
.bar-tip-severity-label { font-weight: 600; color: #b45309; white-space: nowrap; }
.bar-tip-severity[data-severity="major_outage"] .bar-tip-severity-label { color: #b91c1c; }
.bar-tip-severity-dur { font-weight: 600; color: #1a1a1a; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── responsive ── */

@media (max-width: 640px) {
  .windows { grid-template-columns: repeat(2, 1fr); }
  .banner-text { font-size: 17px; }
  .svc-top { flex-direction: column; align-items: flex-start; gap: 6px; }
  .inc-card { grid-template-columns: 1fr; gap: 6px; }
  .bars { gap: 1px; height: 28px; }
  .uptime-caption { text-align: left; }
}
