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

:root {
  --bg: #09090b;
  --surface: #111113;
  --surface-hover: #18181b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #fafafa;
  --muted: #a1a1aa;
  --muted-soft: #71717a;
  --up: #22c55e;
  --up-glow: rgba(34, 197, 94, 0.35);
  --down: #ef4444;
  --down-glow: rgba(239, 68, 68, 0.35);
  --unknown: #71717a;
  --alert: #f59e0b;
  --alert-glow: rgba(245, 158, 11, 0.35);
  --violet: #8b5cf6;
  --font-body: 'Geist', -apple-system, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.011em;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(139, 92, 246, 0.08), transparent 70%),
    radial-gradient(ellipse 40% 30% at 0% 100%, rgba(34, 211, 238, 0.04), transparent 60%);
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  text-align: center;
  padding: 5rem 0 3rem;
}

#logo {
  height: 40px;
  margin-bottom: 2rem;
}

.status-orb-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.orb-up {
  background: var(--up);
  box-shadow: 0 0 0 12px var(--up-glow), 0 0 40px var(--up-glow);
  animation: pulse-up 2.5s ease-in-out infinite;
}

.orb-down {
  background: var(--down);
  box-shadow: 0 0 0 12px var(--down-glow), 0 0 40px var(--down-glow);
  animation: pulse-down 1.5s ease-in-out infinite;
}

.orb-alert {
  background: var(--alert);
  box-shadow: 0 0 0 12px var(--alert-glow), 0 0 40px var(--alert-glow);
  animation: pulse-alert 2s ease-in-out infinite;
}

@keyframes pulse-alert {
  0%, 100% { box-shadow: 0 0 0 8px var(--alert-glow), 0 0 30px var(--alert-glow); }
  50%       { box-shadow: 0 0 0 16px var(--alert-glow), 0 0 55px var(--alert-glow); }
}

.orb-unknown {
  background: var(--unknown);
  box-shadow: none;
}

@keyframes pulse-up {
  0%, 100% { box-shadow: 0 0 0 8px var(--up-glow), 0 0 30px var(--up-glow); }
  50%       { box-shadow: 0 0 0 16px var(--up-glow), 0 0 55px var(--up-glow); }
}

@keyframes pulse-down {
  0%, 100% { box-shadow: 0 0 0 8px var(--down-glow), 0 0 30px var(--down-glow); }
  50%       { box-shadow: 0 0 0 16px var(--down-glow), 0 0 55px var(--down-glow); }
}

h1 {
  font-family: var(--font-body);
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 0.625rem;
}

.subtitle {
  color: var(--muted);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

/* Sections */
main {
  padding-bottom: 3rem;
}

.section {
  margin-bottom: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-soft);
  padding: 1rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* Monitor rows */
.monitor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.monitor-row:last-child {
  border-bottom: none;
}

.monitor-row:hover {
  background: rgba(255,255,255,0.02);
}

.monitor-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.monitor-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
}

.monitor-uptime {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.monitor-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot-up { background: var(--up); }
.status-dot-down { background: var(--down); }
.status-dot-alert { background: var(--alert); }
.status-dot-unknown { background: var(--unknown); }

.status-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.status-label-up { color: var(--up); }
.status-label-down { color: var(--down); }
.status-label-alert { color: var(--alert); }
.status-label-unknown { color: var(--unknown); }

/* Incidents */
.incident-row {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.incident-row:last-child {
  border-bottom: none;
}

.incident-name {
  font-weight: 500;
  font-size: 0.9375rem;
  margin-bottom: 0.2rem;
}

.incident-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.incident-badge {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.incident-badge-open { background: rgba(244, 63, 94, 0.15); color: var(--down); }
.incident-badge-closed { background: rgba(34, 197, 94, 0.12); color: var(--up); }

.incident-timeline {
  list-style: none;
  padding: 0;
  margin: 0.8rem 0 0;
  border-left: 1px dashed var(--border);
  padding-left: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.incident-timeline li {
  display: flex;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--fg);
}
.incident-timeline-date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  min-width: 110px;
  flex-shrink: 0;
}
.incident-timeline-content {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
}
@media (max-width: 520px) {
  .incident-timeline li { flex-direction: column; gap: 0.1rem; }
  .incident-timeline-date { min-width: 0; }
}

.no-data {
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-family: var(--font-mono);
  text-align: center;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem 0 3rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

/* Fade-in animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

header { animation: fadeUp 0.5s ease both; }
.section:nth-child(1) { animation: fadeUp 0.5s 0.1s ease both; }
.section:nth-child(2) { animation: fadeUp 0.5s 0.2s ease both; }

/* Active maintenance window banner (public status page) */
.maintenance-block {
  margin: 0 auto 2rem;
  max-width: 720px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.16), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  animation: fadeUp 0.5s 0.05s ease both;
}
.maintenance-block-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--alert);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}
.maintenance-block-title svg { width: 16px; height: 16px; }
.maintenance-block-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.maintenance-block-item {
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.45;
}
.maintenance-block-item-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-top: 0.15rem;
}

/* Uptime bars (aggregated 90-day timeline) — copied and adapted from the
   dashboard .history-bar-* classes so the public page stays decoupled from
   the dashboard stylesheet. Palette matches: green for UP, amber for content
   alert, red for down, diagonal hatching for empty. */
.uptime-bars-section .uptime-bars-body {
  padding: 1rem 1.5rem 1.25rem;
}
.uptime-bars-row {
  display: flex;
  gap: 2px;
  align-items: stretch;
  overflow-x: auto;
  padding: 0.625rem 0 0.5rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.uptime-bars-row::-webkit-scrollbar { height: 6px; }
.uptime-bars-row::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}
.uptime-bar {
  display: block;
  flex: 1 0 4px;
  min-width: 4px;
  max-width: 10px;
  height: 36px;
  border-radius: 1.5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 160ms var(--ease), filter 160ms var(--ease);
  cursor: default;
}
.uptime-bar:hover { transform: scaleY(1.18); filter: brightness(1.18); }
.uptime-bar-up    { background: linear-gradient(180deg, #34d27a 0%, var(--up) 100%); }
.uptime-bar-alert { background: linear-gradient(180deg, #ffba3a 0%, var(--alert) 100%); }
.uptime-bar-down  { background: linear-gradient(180deg, #f56565 0%, var(--down) 100%); }
.uptime-bar-empty {
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0 2px,
    rgba(255, 255, 255, 0.015) 2px 4px
  );
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.uptime-bars-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted-soft);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  padding: 0.5rem 0 0.75rem;
}
.uptime-bars-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.65rem;
}
.uptime-bars-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.uptime-bars-chip {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.uptime-bars-chip.chip-up    { background: var(--up); }
.uptime-bars-chip.chip-alert { background: var(--alert); }
.uptime-bars-chip.chip-down  { background: var(--down); }
.uptime-bars-chip.chip-empty {
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05) 0 2px,
    rgba(255, 255, 255, 0.02) 2px 4px
  );
}

/* Upcoming maintenance banner — same layout, subtler palette so it reads as
   informational rather than in-progress. */
.maintenance-block-upcoming {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.maintenance-block-upcoming .maintenance-block-title {
  color: var(--muted);
}
