@font-face {
  font-family: "TWK Everett";
  src:
    url("fonts/TWKEverett-Regular.woff2") format("woff2"),
    url("fonts/TWKEverett-Regular.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* ---------- Theme ----------
   Five variables flip between light (default) and dark.
   Status colours are fixed (GitHub-style "calm" palette). */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #1f2328;
  --text-dim: #3d444d;
  --border: #d1d9e0;

  --operational: #1a7f37;
  --degraded: #9a6700;
  --outage: #cf222e;
  --maintenance: #0969da;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #141414;
    --text: #f0f6fc;
    --text-dim: #c2cad4;
    --border: #2a2f37;
  }
}

* { box-sizing: border-box; }
body { margin: 0; }

body {
  font-family: "TWK Everett", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding: 1.5rem 1rem 4rem;
}

.container { max-width: 880px; margin: 0 auto; }

.loading, .error { text-align: center; color: var(--text-dim); padding: 3rem 0; }
.error { color: var(--outage); }

/* ---------- Header bar ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand h1 { margin: 0; line-height: 1; }
.brand-logo { display: block; height: 1.5rem; width: auto; filter: brightness(0); }
@media (prefers-color-scheme: dark) {
  .brand-logo { filter: none; }
}
.brand-tag { font-size: 1.2rem; color: var(--text); }
.brand-tag::before {
  content: '|';
  margin-right: 0.6rem;
  color: var(--border);
}

.header-actions { display: flex; align-items: center; gap: 0.6rem; }
.last-updated { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; }
.refresh {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  padding: 0.3rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.refresh:hover:not(:disabled) { color: var(--text); border-color: var(--text-dim); }
.refresh:disabled { cursor: default; opacity: 0.5; }
.refresh svg { width: 0.95rem; height: 0.95rem; display: block; }
.refresh.loading svg { animation: refresh-spin 0.7s linear infinite; }

@keyframes refresh-spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

/* ---------- Hero banner ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  border-radius: 10px;
  margin-bottom: 2.25rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.hero-icon { flex-shrink: 0; width: 2.75rem; height: 2.75rem; }
.hero-text h2 { margin: 0; font-size: 1.35rem; }
.hero-text p { margin: 0.2rem 0 0; font-size: 0.95rem; color: var(--text-dim); }

.hero.operational { border-color: color-mix(in srgb, var(--operational) 35%, var(--border)); background: color-mix(in srgb, var(--operational) 6%, var(--surface)); }
.hero.operational .hero-icon { color: var(--operational); }
.hero.degraded { border-color: color-mix(in srgb, var(--degraded) 35%, var(--border)); background: color-mix(in srgb, var(--degraded) 6%, var(--surface)); }
.hero.degraded .hero-icon { color: var(--degraded); }
.hero.outage { border-color: color-mix(in srgb, var(--outage) 40%, var(--border)); background: color-mix(in srgb, var(--outage) 6%, var(--surface)); }
.hero.outage .hero-icon { color: var(--outage); }
.hero.maintenance { border-color: color-mix(in srgb, var(--maintenance) 35%, var(--border)); background: color-mix(in srgb, var(--maintenance) 6%, var(--surface)); }
.hero.maintenance .hero-icon { color: var(--maintenance); }

/* ---------- Sections ---------- */
section { margin-bottom: 2rem; }
section h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 0 0 0.65rem; }

.empty { color: var(--text-dim); font-size: 0.9rem; padding: 0.5rem 0; margin: 0; }

/* ---------- Components list ---------- */
.components {
  list-style: none; padding: 0; margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.components li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.components li:last-child { border-bottom: none; }
.components li.degraded { background: color-mix(in srgb, var(--degraded) 6%, var(--surface)); }
.components li.outage { background: color-mix(in srgb, var(--outage) 6%, var(--surface)); }
.components li.maintenance { background: color-mix(in srgb, var(--maintenance) 6%, var(--surface)); }

.component-name { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; background: var(--operational);
}
.dot.degraded { background: var(--degraded); }
.dot.outage { background: var(--outage); }
.dot.maintenance { background: var(--maintenance); }

/* ---------- Pills ---------- */
.pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap; flex-shrink: 0;
  background: color-mix(in srgb, var(--text-dim) 15%, transparent);
  color: var(--text-dim);
}
.pill.operational, .pill.resolved { background: color-mix(in srgb, var(--operational) 15%, transparent); color: var(--operational); }
.pill.degraded, .pill.investigating, .pill.identified, .pill.high, .pill.medium, .pill.low { background: color-mix(in srgb, var(--degraded) 15%, transparent); color: var(--degraded); }
.pill.outage, .pill.critical { background: color-mix(in srgb, var(--outage) 15%, transparent); color: var(--outage); }
.pill.maintenance, .pill.monitoring { background: color-mix(in srgb, var(--maintenance) 15%, transparent); color: var(--maintenance); }

/* ---------- Incident cards ---------- */
.incident, .maintenance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  margin-bottom: 0.65rem;
}
.incident.critical { border-left-color: var(--outage); }
.incident.high, .incident.medium, .incident.low { border-left-color: var(--degraded); }
.maintenance-card { border-left-color: var(--maintenance); }

.incident-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem;
}
.incident-header h3, .maintenance-card h3 { font-size: 1rem; margin: 0; }
.meta-line {
  font-size: 0.8rem; color: var(--text-dim);
  margin: 0.4rem 0 0.85rem;
}
.maintenance-card p:last-child { margin: 0; font-size: 0.9rem; }

.updates-heading {
  font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-dim);
  margin: 0.6rem 0 0.5rem;
}
.updates {
  list-style: none; margin: 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--border);
}
.updates li {
  margin-bottom: 0.7rem; font-size: 0.9rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.updates li:last-child { margin-bottom: 0; }
.updates .update-meta { display: flex; align-items: center; gap: 0.5rem; }
.updates time { color: var(--text-dim); font-size: 0.78rem; }

/* ---------- History — collapsible rows ---------- */
.history {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.history details { border-bottom: 1px solid var(--border); }
.history details:last-child { border-bottom: none; }
.history summary {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 0.8rem 1.1rem;
  cursor: pointer;
  list-style: none;
}
.history summary::-webkit-details-marker { display: none; }
.history-title { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.history-title strong { font-weight: 400; font-size: 0.95rem; }
.history-title .meta { font-size: 0.78rem; color: var(--text-dim); }
.history details[open] summary { border-bottom: 1px solid var(--border); }
.history-body { padding: 0.85rem 1.1rem 1rem; }

/* ---------- Footer ---------- */
.page-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 2.5rem;
}
.page-footer a { color: inherit; text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  body { padding: 1rem 0.75rem 3rem; }
  .site-header { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .hero { padding: 1.25rem; gap: 1rem; }
  .hero-icon { width: 2.25rem; height: 2.25rem; }
  .hero-text h2 { font-size: 1.15rem; }
}
