/* Status page. Brand colours from roundupece/brand.ts and swiftstartece/brand.ts (AA-darkened primaries). */

:root {
  --bg: #fbf7f2;
  --card: #ffffff;
  --ink: #2a1633;
  --muted: #6b5d72;
  --line: #ebe3e8;
  --brand: #c54a5c;
  --brand-2: #ffc857;

  --ok: #1f8f4e;
  --degraded: #b07d00;
  --partial: #d4600a;
  --major: #c8302a;
  --maint: #2f67cf;
  --none: #ddd6e0;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(42, 22, 51, 0.06), 0 4px 16px rgba(42, 22, 51, 0.05);
  color-scheme: light;
}

body[data-brand="swiftstart"] {
  --bg: #f6f7fc;
  --ink: #213472;
  --muted: #5b6488;
  --line: #e1e5f2;
  --brand: #c43d52;
  --brand-2: #f49cb4;
  --shadow: 0 1px 2px rgba(33, 52, 114, 0.06), 0 4px 16px rgba(33, 52, 114, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1220;
    --card: #261b2d;
    --ink: #f5eef7;
    --muted: #b8a9bf;
    --line: #3a2d42;
    --brand: #e8586d;
    --ok: #3fbf74;
    --degraded: #e0b030;
    --partial: #f08a3c;
    --major: #f0605a;
    --maint: #6f9cf0;
    --none: #43364b;
    --shadow: none;
    color-scheme: dark;
  }
  body[data-brand="swiftstart"] {
    --bg: #161a2b;
    --card: #20253a;
    --ink: #eef0fa;
    --muted: #a9b0cf;
    --line: #333a57;
    --brand: #f07c93;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--brand); }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 10; }

/* ── Header ─────────────────────────────────────────────────────────────── */

.top { border-bottom: 1px solid var(--line); background: var(--card); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand) 55%, var(--brand-2) 55%);
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: 18px; }
.support {
  font-weight: 600; font-size: 14px; text-decoration: none;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap;
}
.support:hover { border-color: var(--brand); }

/* ── Overall ────────────────────────────────────────────────────────────── */

main { padding-top: 28px; padding-bottom: 8px; }

.overall {
  --c: var(--none);
  display: flex; align-items: center; gap: 16px;
  padding: 22px 24px; border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow);
  border: 1px solid var(--line); border-left: 6px solid var(--c);
}
.overall h1 { margin: 0; font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; }
.updated { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
/* The icon's glyph carries the status too, not only its colour. */
.overall-icon {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 800; font-size: 22px; line-height: 1;
}
.overall-icon::after { content: "?"; }
.overall[data-status="operational"] { --c: var(--ok); }
.overall[data-status="operational"] .overall-icon::after { content: "\2713"; }
.overall[data-status="degraded"] { --c: var(--degraded); }
.overall[data-status="partial_outage"] { --c: var(--partial); }
.overall[data-status="major_outage"] { --c: var(--major); }
.overall[data-status="degraded"] .overall-icon::after,
.overall[data-status="partial_outage"] .overall-icon::after,
.overall[data-status="major_outage"] .overall-icon::after { content: "!"; }
.overall[data-status="maintenance"] { --c: var(--maint); }
.overall[data-status="maintenance"] .overall-icon::after { content: "\2026"; transform: translateY(-4px); }

.stale {
  margin: 14px 0 0; padding: 12px 16px; border-radius: 10px;
  background: color-mix(in srgb, var(--degraded) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--degraded) 40%, transparent);
  font-size: 15px;
}

/* ── Sections ───────────────────────────────────────────────────────────── */

section { margin-top: 32px; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -0.005em; }
.muted { color: var(--muted); margin: 0; }

.components-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.legend { margin: 0; color: var(--muted); font-size: 13px; }

.group {
  margin: 0 0 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.group-name {
  margin: 0; padding: 12px 20px; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.components { list-style: none; margin: 0; padding: 0; }
.component { padding: 14px 20px 12px; border-top: 1px solid var(--line); }
.component:first-child { border-top: 0; }
.component-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.component-name { font-weight: 600; }
.component-status { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--none); flex: none; }

.component[data-status="operational"] .dot { background: var(--ok); }
.component[data-status="degraded"] .dot { background: var(--degraded); }
.component[data-status="partial_outage"] .dot { background: var(--partial); border-radius: 2px; }
.component[data-status="major_outage"] .dot { background: var(--major); border-radius: 2px; }
.component[data-status="maintenance"] .dot { background: var(--maint); }
.component[data-status="degraded"] .component-status,
.component[data-status="partial_outage"] .component-status,
.component[data-status="major_outage"] .component-status,
.component[data-status="maintenance"] .component-status { color: var(--ink); font-weight: 600; }

/* ── Uptime bars ────────────────────────────────────────────────────────── */

.bars { display: flex; gap: 2px; height: 30px; margin-top: 10px; }
.bar { flex: 1 1 0; min-width: 2px; border-radius: 2px; background: var(--none); }
.bar:hover { opacity: 0.7; }
.bar[data-status="operational"] { background: var(--ok); }
.bar[data-status="degraded"] { background: var(--degraded); }
.bar[data-status="partial_outage"] { background: var(--partial); }
.bar[data-status="major_outage"] { background: var(--major); }
.bars-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.bars-uptime { font-variant-numeric: tabular-nums; }

/* Phones: the last 30 days, so each bar stays wide enough to see. */
.d30 { display: none; }
@media (max-width: 600px) {
  .bars .bar:nth-child(-n+60) { display: none; }
  .d90 { display: none; }
  .d30 { display: inline; }
  .component, .group-name { padding-left: 16px; padding-right: 16px; }
  .overall { padding: 18px; gap: 14px; }
  .overall h1 { font-size: 19px; }
  .brand-sub { display: none; }
}

/* ── Incidents ──────────────────────────────────────────────────────────── */

.incident {
  --c: var(--none);
  margin: 0 0 14px; padding: 16px 20px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c);
  box-shadow: var(--shadow);
}
.incident[data-impact="degraded"] { --c: var(--degraded); }
.incident[data-impact="partial_outage"] { --c: var(--partial); }
.incident[data-impact="major_outage"] { --c: var(--major); }
.incident[data-impact="maintenance"] { --c: var(--maint); }
#recent .incident { --c: var(--line); box-shadow: none; }
.incident-title { margin: 0; font-size: 17px; line-height: 1.3; }
.incident-meta { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.incident-updates { list-style: none; margin: 12px 0 0; padding: 0; }
.incident-updates li { padding: 10px 0 0; border-top: 1px dashed var(--line); margin-top: 10px; }
.incident-updates li:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.update-head { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 14px; }
.update-head time { color: var(--muted); }
.update-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.foot { padding-top: 24px; padding-bottom: 40px; color: var(--muted); font-size: 13px; }
.foot p { margin: 4px 0; }

@media (prefers-reduced-motion: no-preference) {
  .bar { transition: opacity 0.12s; }
}
