/*
 * Cache Flow's palette, on a page that has to survive the hub being down.
 *
 * Every colour is `light-dark()` and the document carries `color-scheme`, so
 * the theme switch is one attribute and there is no second stylesheet — the
 * same rule the hub follows. The values are lifted from the hub's globals.css
 * rather than eyeballed, so this page and the site cannot drift apart.
 */

@font-face {
  font-family: "Poppins";
  src: url("/fonts/Poppins-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/fonts/Poppins-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/fonts/Poppins-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/fonts/Poppins-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --green: light-dark(#087a00, #10ff00);
  --on-green: light-dark(#ffffff, #062b0c);
  --green-soft: light-dark(rgba(10, 146, 0, 0.12), rgba(16, 255, 0, 0.14));
  --mark-bg: light-dark(#0aa800, #10ff00);

  --amber: light-dark(#a15c00, #ffb020);
  --amber-soft: light-dark(rgba(200, 120, 0, 0.14), rgba(255, 176, 32, 0.16));
  --red: light-dark(#c62828, #ff6b6b);
  --red-soft: light-dark(rgba(198, 40, 40, 0.12), rgba(255, 107, 107, 0.16));

  --page-bg: light-dark(#d7dce3, #121212);
  --card-bg: light-dark(#eef1f5, #151515);
  --card-border: light-dark(#d9dee4, rgba(255, 255, 255, 0.1));
  --panel-bg: light-dark(#e9edf2, #0d0d0d);
  --text-strong: light-dark(#272b30, #ebebeb);
  --text-muted: light-dark(#5f646a, #8a8a8a);
  --skeleton-bg: light-dark(#dfe4ea, #202020);
}

/* The toggle wins over the system in both directions, which is why the dark
   values are written twice rather than only inside the media query. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 20px 64px;
  background: var(--page-bg);
  color: var(--text-strong);
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- header ---- */

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 0 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand img { width: 38px; height: 38px; border-radius: 11px; display: block; }

.brandWords { display: grid; gap: 1px; min-width: 0; }
.brandWords strong { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.brandWords span { font-size: 11.5px; color: var(--text-muted); }

.topTools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* A filled plate, never a bordered ring: the hub's buttons are surfaces. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 0;
  border-radius: 11px;
  background: var(--card-bg);
  color: var(--text-strong);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 130ms ease;
}

/* A filled plate darkens on hover in light and lifts in dark, so "reached for"
   reads the same way on both. Written as three blocks rather than a selector
   list because the toggle has to beat the system setting in both directions. */
.btn:hover { filter: brightness(0.96); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn:hover { filter: brightness(1.25); }
}

:root[data-theme="dark"] .btn:hover { filter: brightness(1.25); }

.btn.primary { background: var(--mark-bg); color: #0d0d0d; font-weight: 600; }

.iconBtn { width: 38px; height: 38px; padding: 0; justify-content: center; }
.iconBtn svg { width: 17px; height: 17px; }

/* ---- banner ---- */

.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  margin-bottom: 26px;
  border-radius: 16px;
  background: var(--card-bg);
}

.banner[data-state="up"] { background: var(--green-soft); }
.banner[data-state="degraded"] { background: var(--amber-soft); }
.banner[data-state="down"] { background: var(--red-soft); }

.bannerDot {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text-muted);
}

.bannerDot[data-state="up"] { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.bannerDot[data-state="degraded"] { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.bannerDot[data-state="down"] {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

@media (prefers-reduced-motion: reduce) {
  .bannerDot[data-state="down"] { animation: none; }
}

.bannerText { display: grid; gap: 2px; min-width: 0; }
.bannerText strong { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.bannerText span { font-size: 12px; color: var(--text-muted); }

/* ---- groups ---- */

.group { margin-bottom: 30px; }

.groupHead { margin-bottom: 12px; }
.groupHead h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.02em; text-transform: none; }
.groupHead p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-muted); }

.checks { display: grid; gap: 10px; }

.check {
  padding: 15px 18px 13px;
  border-radius: 15px;
  background: var(--card-bg);
}

.checkHead { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.checkNames { min-width: 0; }
.checkNames h3 { margin: 0; font-size: 14px; font-weight: 600; }
.checkNames p { margin: 1px 0 0; font-size: 11.5px; color: var(--text-muted); }

.checkState { flex: 0 0 auto; display: grid; justify-items: end; gap: 3px; }

.pill {
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--skeleton-bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pill[data-state="up"] { background: var(--mark-bg); color: #0d0d0d; }
.pill[data-state="degraded"] { background: var(--amber); color: #1a1000; }
.pill[data-state="down"] { background: var(--red); color: light-dark(#ffffff, #2b0606); }

.latency { font-size: 10.5px; color: var(--text-muted); }

.checkDetail { margin-top: 8px; font-size: 11.5px; color: var(--text-muted); }

/* ---- the 90 day bar ---- */

.bar {
  display: flex;
  gap: 2px;
  margin-top: 14px;
  height: 30px;
}

.day {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 3px;
  background: var(--skeleton-bg);
}

.day[data-state="up"] { background: var(--green); }
.day[data-state="degraded"] { background: var(--amber); }
.day[data-state="down"] { background: var(--red); }

.barFoot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
}

.uptime { font-weight: 600; color: var(--text-strong); }

/* ---- change log ---- */

.log { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }

.log li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--card-bg);
  font-size: 12.5px;
}

.logDot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.logDot[data-state="up"] { background: var(--green); }
.logDot[data-state="degraded"] { background: var(--amber); }
.logDot[data-state="down"] { background: var(--red); }

.logName { font-weight: 600; }
.logWhat { color: var(--text-muted); flex: 1 1 auto; min-width: 0; }
.log time { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

.empty {
  margin: 0;
  padding: 18px;
  border-radius: 14px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ---- footer ---- */

footer.bottom {
  margin-top: 34px;
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  font-size: 11.5px;
}

footer.bottom a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
footer.bottom a:hover { color: var(--green); }

/* ---- narrow ---- */

@media (max-width: 620px) {
  .checkHead { flex-direction: column; align-items: stretch; }
  .checkState { justify-items: start; }
  /* Ninety slivers on a phone is a grey smear. Six weeks reads. */
  .day:nth-child(-n + 48) { display: none; }
  .barFoot span:first-child { visibility: hidden; }
  .log li { flex-wrap: wrap; }
  .logWhat { flex-basis: 100%; }
}
