/* Status page styles. Design tokens come from the docs site (tokens.css, Starlight's --sl-*), with the same system fonts.
   The --st-* names below are local aliases of --sl-* and follow the theme. */
:root {
  --st-bg: var(--sl-color-black);
  --st-text: var(--sl-color-gray-1);
  --st-text-muted: var(--sl-color-gray-3);
  --st-border: var(--sl-color-hairline-light);
  --st-surface: var(--sl-color-bg-nav);
  --st-surface-2: var(--sl-color-bg-inline-code);
  --st-accent: var(--sl-color-accent);
  --st-accent-bg: var(--sl-color-accent-low);
  --st-accent-line: color-mix(in srgb, var(--sl-color-accent) 45%, transparent);
  --st-btn: var(--sl-color-accent);
  --st-btn-text: var(--sl-color-black);
  --st-success-bg: color-mix(in srgb, var(--sl-color-green-low) 55%, var(--sl-color-black));
  --st-warning-bg: color-mix(in srgb, var(--sl-color-orange-low) 55%, var(--sl-color-black));
  --st-warning-line: color-mix(in srgb, var(--sl-color-orange) 45%, transparent);
  --st-danger: var(--sl-color-red-high);
  --st-danger-bg: color-mix(in srgb, var(--sl-color-red-low) 55%, var(--sl-color-black));
  --st-danger-line: color-mix(in srgb, var(--sl-color-red) 45%, transparent);
  --st-grid: color-mix(in srgb, var(--sl-color-gray-5) 35%, transparent);
  --st-radius: 0.4rem;
  --st-radius-lg: 0.6rem;
  --st-shadow: var(--sl-shadow-md);
  --st-font-sans: var(--sl-font-system);
  --st-font-mono: var(--sl-font-system-mono);
  /* Status bars: at least 3:1 against the background */
  --bar-ok: hsl(var(--sl-hue-green), 55%, 52%);
  --bar-warn: var(--sl-color-orange);
  --bar-down: var(--sl-color-red);
  --bar-none: var(--sl-color-gray-5);
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bar-ok: hsl(var(--sl-hue-green), 80%, 34%);
  --bar-down: hsl(var(--sl-hue-red), 75%, 48%);
  --bar-warn: hsl(var(--sl-hue-orange), 90%, 42%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--st-bg);
  color: var(--st-text);
  font: 400 16px/1.65 var(--st-font-sans);
}
a { color: inherit; text-decoration: underline; text-decoration-color: var(--st-accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--st-accent); }
h1, h2 { font-weight: 500; letter-spacing: -0.01em; margin: 0; }
.muted { color: var(--st-text-muted); }
.small { font-size: 0.8125rem; }
.mono { font-family: var(--st-font-mono); }

.wrap { max-width: 46rem; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 10; background: var(--st-bg); border-bottom: 1px solid var(--st-border); }
.top-in { height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 64rem; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--st-text); min-width: 0; }
.brand:hover { color: var(--st-text); }
.brand img { display: block; height: 20px; width: auto; }
.brand-name { font-weight: 600; font-size: 0.9375rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.875rem; color: var(--st-text-muted); padding-left: 8px; border-left: 1px solid var(--st-border); }
.top-right { display: flex; align-items: center; gap: 6px; }
.nav-link { font-size: 0.875rem; font-weight: 500; text-decoration: none; padding: 6px 10px; border-radius: 999px; color: var(--st-text-muted); }
.nav-link:hover { color: var(--st-text); background: var(--st-surface); }
.icon-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; min-width: 30px; justify-content: center;
  padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--st-text-muted);
  font: 500 0.75rem var(--st-font-sans); cursor: pointer;
}
.icon-btn:hover { color: var(--st-text); background: var(--st-surface); }
.icon-btn:focus-visible, a:focus-visible, .bars:focus-visible, .row-toggle:focus-visible { outline: 2px solid var(--st-accent); outline-offset: 2px; }
:root[data-theme='light'] .i-sun, :root:not([data-theme='light']) .i-moon { display: none; }
.console {
  padding: 0.3rem 0.85rem; border-radius: 999px; background: var(--st-btn); color: var(--st-btn-text);
  font-weight: 500; font-size: 0.8125rem; text-decoration: none; white-space: nowrap; margin-left: 4px;
}
.console:hover { color: var(--st-btn-text); opacity: 0.9; }
.wide { display: none; }
@media (min-width: 40rem) { .wide { display: inline-flex; } }

/* Overall status */
main.wrap { padding-top: 40px; padding-bottom: 64px; }
.hero {
  display: flex; gap: 16px; align-items: center; padding: 22px 24px; border-radius: var(--st-radius-lg);
  border: 1px solid var(--st-border); background: var(--st-surface);
  background-image: linear-gradient(var(--st-grid) 1px, transparent 1px), linear-gradient(90deg, var(--st-grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
.hero h1 { font-size: clamp(1.375rem, 3vw, 1.75rem); line-height: 1.25; letter-spacing: -0.02em; }
.hero p { margin: 4px 0 0; font-size: 0.875rem; }
.hero-icon { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--st-surface-2); }
.hero-icon::after { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--bar-none); }
.hero[data-state='operational'] { background-color: var(--st-success-bg); }
.hero[data-state='operational'] .hero-icon { background: color-mix(in srgb, var(--bar-ok) 18%, transparent); }
.hero[data-state='operational'] .hero-icon::after { background: var(--bar-ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bar-ok) 25%, transparent); }
.hero[data-state='partial'], .hero[data-state='stale'], .hero[data-state='maintenance'] { background-color: var(--st-warning-bg); border-color: var(--st-warning-line); }
.hero[data-state='partial'] .hero-icon::after, .hero[data-state='stale'] .hero-icon::after, .hero[data-state='maintenance'] .hero-icon::after { background: var(--bar-warn); }
.hero[data-state='major'] { background-color: var(--st-danger-bg); border-color: var(--st-danger-line); }
.hero[data-state='major'] .hero-icon::after { background: var(--bar-down); }
.hero[data-state='error'] .hero-icon::after { background: var(--bar-down); }

/* Notices */
.notice { margin-top: 16px; padding: 14px 18px; border-radius: 14px; border: 1px solid var(--st-accent-line); background: var(--st-accent-bg); }
.notice.incident { border-color: var(--st-danger-line); background: var(--st-danger-bg); }
.notice h3 { margin: 0; font-size: 0.9375rem; font-weight: 600; }
.notice p { margin: 4px 0 0; font-size: 0.875rem; white-space: pre-line; }
.notice .when { margin-top: 6px; font-size: 0.8125rem; color: var(--st-text-muted); }

/* Sections */
section { margin-top: 36px; }
section.hero { margin-top: 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { font-size: 1.25rem; }
.card { border: 1px solid var(--st-border); border-radius: var(--st-radius-lg); background: var(--st-bg); }
.group + .group { margin-top: 16px; }
.group-name { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; color: var(--st-text-muted); padding: 14px 20px 0; }

/* One row per monitor */
.row { padding: 14px 20px 16px; }
.row + .row { border-top: 1px solid var(--st-border); }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-name { min-width: 0; }
.row-name strong { font-weight: 500; font-size: 0.9375rem; }
.row-name .desc { display: block; font-family: var(--st-font-mono); font-size: 0.75rem; color: var(--st-text-muted); line-height: 1.4; }
.row-meta { display: flex; align-items: center; gap: 10px; flex: none; font-size: 0.8125rem; }
.pct { font-family: var(--st-font-mono); color: var(--st-text-muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 500; background: var(--st-surface); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--bar-ok); }
.pill.down { background: var(--st-danger-bg); color: var(--st-danger); }
.pill.down::before { background: var(--bar-down); }
.pill.ongoing { background: var(--st-danger-bg); color: var(--st-danger); }
.pill.ongoing::before { background: var(--bar-down); }

.bars { display: flex; gap: 2px; height: 30px; margin-top: 12px; border-radius: 4px; cursor: default; }
.bars i { flex: 1 1 0; min-width: 0; border-radius: 2px; background: var(--bar-none); transition: opacity 0.1s; }
.bars i.ok { background: var(--bar-ok); }
.bars i.warn { background: var(--bar-warn); }
.bars i.down { background: var(--bar-down); }
.bars:hover i { opacity: 0.55; }
.bars:hover i:hover, .bars i.on { opacity: 1; }
/* Narrow screens show the last 30 days only */
@media (max-width: 39.99rem) { .bars i:nth-child(-n + 60) { display: none; } }
.bars-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.75rem; color: var(--st-text-muted); }
.bars-axis .d90 { display: none; }
@media (min-width: 40rem) { .bars-axis .d90 { display: inline; } .bars-axis .d30 { display: none; } }

.row-toggle { margin-top: 8px; padding: 0; border: 0; background: none; color: var(--st-text-muted); font: 400 0.75rem var(--st-font-sans); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.row-toggle:hover { color: var(--st-text); }
.row-toggle svg { transition: transform 0.15s; }
.row-toggle[aria-expanded='true'] svg { transform: rotate(180deg); }
.detail { margin-top: 12px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--st-border); border: 1px solid var(--st-border); border-radius: var(--st-radius); overflow: hidden; }
.stats div { background: var(--st-bg); padding: 8px 12px; }
.stats b { display: block; font-family: var(--st-font-mono); font-weight: 400; font-size: 0.875rem; }
.stats span { font-size: 0.75rem; color: var(--st-text-muted); }
@media (max-width: 39.99rem) { .stats { grid-template-columns: repeat(2, 1fr); } .stats div:first-child { grid-column: span 2; } }
.chart { margin-top: 12px; }
.chart svg { display: block; width: 100%; height: 96px; }
.chart .line { fill: none; stroke: var(--st-accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart .area { fill: color-mix(in srgb, var(--st-accent) 12%, transparent); }
.chart .grid { stroke: var(--st-border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--st-text-muted); margin-top: 4px; }

/* Incident list */
#incidents { padding: 4px 20px; }
.inc { display: flex; gap: 12px; padding: 12px 0; align-items: flex-start; }
.inc + .inc { border-top: 1px solid var(--st-border); }
.inc .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; background: var(--bar-warn); }
.inc .dot.down { background: var(--bar-down); }
.inc-main { flex: 1; min-width: 0; }
.inc-title { font-size: 0.9375rem; font-weight: 500; }
.inc-title .pill { margin-left: 6px; vertical-align: 1px; }
.inc-sub { font-size: 0.8125rem; color: var(--st-text-muted); }
.empty { padding: 16px 0; color: var(--st-text-muted); font-size: 0.875rem; }

/* Tooltip */
.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 240px; padding: 8px 12px; border-radius: var(--st-radius);
  background: var(--st-surface-2); border: 1px solid var(--st-border); box-shadow: var(--st-shadow); font-size: 0.8125rem; line-height: 1.5;
}
.tip b { font-weight: 600; display: block; }

.foot { border-top: 1px solid var(--st-border); padding: 20px 0 28px; font-size: 0.875rem; }
.foot-in { display: flex; flex-direction: column; gap: 8px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot-links a { text-decoration: none; color: var(--st-text-muted); }
.foot-links a:hover { color: var(--st-text); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
