/* static/style.css */
:root {
  --bg: #0a0e14;
  --surface: #12171f;
  --surface-raised: #1a2130;
  --border: #252d3a;
  --text: #e6edf3;
  --text-muted: #7a8595;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --green-bg: #0d2818;
  --yellow-bg: #2d2000;
  --red-bg: #2d0000;
  --nodata: #2d3545;
  --accent: #58a6ff;
  --purple: #bc8cff;
}

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

body {
  font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

/* -- Header -------------------------------- */
.page-header {
  margin-bottom: 2.5rem;
}

.header-bg {
  background:
    radial-gradient(
      ellipse 80% 50% at 50% -20%,
      rgba(88, 166, 255, 0.12),
      transparent
    ),
    radial-gradient(
      ellipse 60% 40% at 70% 0%,
      rgba(188, 140, 255, 0.08),
      transparent
    ),
    linear-gradient(to bottom, #0f1520 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 3rem 1.5rem 2rem;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

.header-content {
  max-width: 900px;
  margin: 0 auto;
}

.site-title {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(
    135deg,
    var(--text) 0%,
    var(--accent) 50%,
    var(--purple) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.3rem;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
}

/* -- Hero stats ---------------------------- */
.hero-stats {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.header-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 1.75rem;
  gap: 0.2rem;
}

.stat-divider {
  width: 1px;
  background: var(--border);
  align-self: stretch;
}

.stat-value {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.nines-block .stat-value {
  color: var(--accent);
}

.stat-uptime {
  font-variant-numeric: tabular-nums;
}

.stat-grade {
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* -- Status pill --------------------------- */
.overall-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-up {
  background: var(--green-bg);
  color: var(--green);
}
.status-degraded {
  background: var(--yellow-bg);
  color: var(--yellow);
}
.status-down {
  background: var(--red-bg);
  color: var(--red);
}
.status-nodata {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

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

/* -- Service Rows -------------------------- */
.services {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.service-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: border-color 0.15s;
}

.service-row:hover {
  border-color: #354050;
}

.service-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.service-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}

.badge-up {
  background: var(--green-bg);
  color: var(--green);
}
.badge-degraded {
  background: var(--yellow-bg);
  color: var(--yellow);
}
.badge-down {
  background: var(--red-bg);
  color: var(--red);
}
.badge-nodata {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* -- Bar Strip ----------------------------- */
.bar-strip {
  display: flex;
  gap: 1px;
}

.bar {
  flex: 1 1 0%;
  min-width: 1px;
  min-height: 34px;
  border-radius: 3px;
  transition: transform 0.1s, opacity 0.1s;
  cursor: default;
  position: relative;
}

.bar-up { background: var(--green); }
.bar-degraded { background: var(--yellow); }
.bar-down { background: var(--red); }
.bar-nodata { background: var(--nodata); }

.bar:hover {
  transform: scaleY(1.25);
  opacity: 0.85;
  z-index: 10;
}

/* -- Tooltips ------------------------------ */
.bar[data-tooltip] {
  position: relative;
}

.bar[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  padding: 0.6rem 0.85rem;
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-variant-numeric: tabular-nums;
}

.bar[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 101;
}

.bar[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.bar[data-tooltip]:hover::before {
  opacity: 1;
}

/* Keep tooltips on-screen at edges */
.bar:first-child[data-tooltip]::after {
  left: 0;
  transform: translateX(0) scale(0.95);
}
.bar:first-child[data-tooltip]:hover::after {
  transform: translateX(0) scale(1);
}
.bar:first-child[data-tooltip]::before {
  left: 8px;
  transform: none;
}

.bar:last-child[data-tooltip]::after {
  left: auto;
  right: 0;
  transform: translateX(0) scale(0.95);
}
.bar:last-child[data-tooltip]:hover::after {
  transform: translateX(0) scale(1);
}
.bar:last-child[data-tooltip]::before {
  left: auto;
  right: 8px;
  transform: none;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* -- Footer -------------------------------- */
footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-note {
  margin-top: 0.35rem;
  font-style: italic;
  font-size: 0.75rem;
  color: #555d6a;
}

/* -- Responsive ---------------------------- */
@media (max-width: 640px) {
  .container {
    padding: 0 1rem 1.5rem;
  }
  .header-bg {
    padding: 2rem 1rem 1.5rem;
  }
  .site-title {
    font-size: 1.5rem;
  }
  .hero-stats {
    flex-direction: column;
  }
  .stat-divider {
    width: auto;
    height: 1px;
    align-self: stretch;
  }
  .stat-block {
    padding: 0.75rem 1.5rem;
  }
  .bar-strip {
    height: 28px;
  }
  .service-row {
    padding: 1rem;
  }
  .bar[data-tooltip]::after {
    font-size: 0.72rem;
    padding: 0.5rem 0.7rem;
  }
}
