:root {
  color-scheme: light;
  --bg: #f8faf9;
  --surface: #ffffff;
  --surface-2: #f1f4f2;
  --border: #dde3df;
  --border-strong: #c6cfc9;
  --text: #171a18;
  --muted: #5f6862;
  --faint: #89928c;
  --up: #059669;
  --up-soft: #d1fae5;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --down: #dc4c4c;
  --down-soft: #fde2e2;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.04);
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110;
  --surface: #1c1c1a;
  --surface-2: #232321;
  --border: #3a3a36;
  --border-strong: #4a4a45;
  --text: #ededeb;
  --muted: #a1a19a;
  --faint: #75756f;
  --up: #34d399;
  --up-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --down: #f87171;
  --down-soft: rgba(248, 113, 113, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  color: inherit;
}

button {
  font: inherit;
}

.svg-definitions {
  position: absolute;
}

.container {
  width: min(760px, calc(100% - 48px));
  margin-inline: auto;
}

.page-shell {
  flex: 1;
  padding-block: 64px 72px;
}

.page-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.page-description {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.theme-toggle {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.sun-icon,
[data-theme="dark"] .moon-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: block;
}

.overall-card {
  --status-color: var(--up);
  --status-soft: var(--up-soft);
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 36px;
  padding: 20px 24px;
  border: 1px solid color-mix(in srgb, var(--status-color) 30%, var(--border));
  border-radius: 14px;
  background: var(--status-soft);
}

.overall-card.status-degraded {
  --status-color: var(--warn);
  --status-soft: var(--warn-soft);
}

.overall-card.status-outage {
  --status-color: var(--down);
  --status-soft: var(--down-soft);
}

.overall-icon {
  display: grid;
  flex: none;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--status-color);
}

.overall-icon svg {
  width: 24px;
  height: 24px;
}

.overall-text {
  flex: 1;
  min-width: 0;
}

.overall-card h2 {
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.overall-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.overall-card .updated-at {
  flex: none;
  align-self: end;
  color: var(--muted);
  font-size: 13px;
}

.monitor-list {
  display: grid;
  gap: 16px;
  margin-top: 32px;
}

.monitor-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.monitor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 18px 24px 0;
}

.monitor-header h2 {
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.status-pill,
.component-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--up);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.status-pill {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--up-soft);
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-degraded {
  color: var(--warn);
}

.status-outage {
  color: var(--down);
}

.status-pill.status-degraded {
  background: var(--warn-soft);
}

.status-pill.status-outage {
  background: var(--down-soft);
}

.history-block {
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.metric-row,
.chart-scale {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.metric-row {
  margin-bottom: 10px;
  font-size: 13px;
}

.metric-row span {
  color: var(--muted);
}

.metric-row strong {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.availability-chart {
  display: grid;
  grid-template-columns: repeat(var(--days, 30), 1fr);
  gap: 3px;
  height: 32px;
}

.history-segment {
  position: relative;
  min-width: 2px;
  border-radius: 2px;
  outline: none;
  background: var(--up);
  transition: opacity 120ms ease;
}

.history-segment.status-degraded { background: var(--warn); }
.history-segment.status-outage { background: var(--down); }

.availability-chart:hover .history-segment:not(:hover),
.availability-chart:focus-within .history-segment:not(:focus) {
  opacity: 0.55;
}

.history-segment:focus-visible {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text);
}

.history-segment::after {
  position: absolute;
  z-index: 10;
  bottom: calc(100% + 8px);
  left: 50%;
  width: max-content;
  max-width: 200px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.25);
  content: attr(data-tooltip);
  font-size: 12px;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 120ms ease;
}

.history-segment:first-child::after,
.history-segment:nth-child(2)::after,
.history-segment:nth-child(3)::after {
  left: 0;
  transform: none;
}

.history-segment:nth-last-child(-n + 3)::after {
  right: 0;
  left: auto;
  transform: none;
}

.history-segment:hover::after,
.history-segment:focus::after {
  opacity: 1;
}

.chart-scale {
  margin-top: 6px;
  color: var(--faint);
  font-size: 12px;
}

.components {
  padding-inline: 24px;
}

.component-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 48px;
  border-bottom: 1px solid var(--border);
}

.component-row:last-child {
  border-bottom: 0;
}

.component-name {
  font-size: 14px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin: 20px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--up);
}

.legend-swatch.status-degraded { background: var(--warn); }
.legend-swatch.status-outage { background: var(--down); }

.site-footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  color: var(--faint);
  font-size: 13px;
}

.powered-by {
  text-decoration: none;
}

.powered-by strong {
  color: var(--muted);
  font-weight: 600;
}

.powered-by:hover,
.powered-by:hover strong {
  color: var(--text);
}

.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.error-page .page-description {
  margin-inline: auto;
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 32px, 760px);
  }

  .page-shell {
    padding-block: 40px 56px;
  }

  h1 {
    font-size: 26px;
  }

  .overall-card {
    flex-wrap: wrap;
    margin-top: 28px;
    padding: 18px;
  }

  .overall-card .updated-at {
    flex-basis: 100%;
    padding-left: 56px;
  }

  .monitor-header {
    padding: 16px 18px 0;
  }

  .history-block {
    padding: 16px 18px 14px;
  }

  .availability-chart {
    gap: 2px;
    height: 28px;
  }

  .components {
    padding-inline: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
