/*
 * T0 status page styles. No build step, so the portal's SCSS tokens cannot be
 * imported — the custom-property names below mirror packages/portal/src/styles/
 * _tokens.scss (and the values in globals.scss) exactly, so the two hosts read
 * as one product and a palette change is a copy, not a re-derivation.
 */

:root {
  color-scheme: light dark;

  /* colour — same names and values as the portal */
  --c-bg: #ffffff;
  --c-bg-raised: #f7f8fa;
  --c-bg-sunken: #eef1f4;
  --c-fg: #12171c;
  --c-fg-muted: #5b6672;
  --c-fg-faint: #8b95a1;
  --c-border: #e3e7ec;
  --c-border-strong: #cfd6de;
  --c-accent: #0f9e91;
  --c-accent-fg: #ffffff;
  --c-accent-soft: #e3f6f3;
  --c-code-bg: #0d1117;
  --c-code-fg: #e6edf3;

  /* status colours — hues borrowed from the portal's method badges */
  --c-ok: #0a7d32;
  --c-ok-soft: #e6f4ea;
  --c-degraded: #b45309;
  --c-degraded-soft: #fbf1e4;
  --c-down: #b91c1c;
  --c-down-soft: #fbeaea;
  --c-nodata: #d5d9e0;

  /* spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* type */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 22px;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* shape */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 6%);

  /* layout */
  --prose-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #0c0f13;
    --c-bg-raised: #141920;
    --c-bg-sunken: #10151b;
    --c-fg: #e7ebef;
    --c-fg-muted: #9aa4b0;
    --c-fg-faint: #78838f;
    --c-border: #232a33;
    --c-border-strong: #323b46;
    --c-accent: #2dd4bf;
    --c-accent-fg: #05201d;
    --c-accent-soft: #10312e;
    --c-code-bg: #080b0f;
    --c-code-fg: #dbe4ec;

    --c-ok: #4ade80;
    --c-ok-soft: #12251a;
    --c-degraded: #fbbf24;
    --c-degraded-soft: #2a2013;
    --c-down: #f87171;
    --c-down-soft: #2a1414;
    --c-nodata: #2b303a;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--c-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 var(--space-4);
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--c-bg-sunken);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  padding: var(--space-2) var(--space-3);
  background: var(--c-accent);
  color: var(--c-accent-fg);
  border-radius: var(--radius-sm);
  z-index: 10;
}

.skip:focus {
  top: var(--space-4);
}

.muted {
  color: var(--c-fg-muted);
}

.wrap {
  max-width: var(--prose-width);
  margin: 0 auto;
  padding: var(--space-10) var(--space-5) var(--space-16);
}

/* ------------------------------------------------------------- header --- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex: none;
}

.brand h1 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.brand .sub {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--c-fg-muted);
}

.links {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-sm);
}

/* ------------------------------------------------------------- banner --- */
.banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  background: var(--c-bg-raised);
}

.banner .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
  background: var(--c-nodata);
}

.banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.banner-text strong {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.banner-detail {
  font-size: var(--text-sm);
  color: var(--c-fg-muted);
}

.banner.is-loading {
  opacity: 0.6;
}

.banner.is-ok { background: var(--c-ok-soft); }
.banner.is-ok .dot { background: var(--c-ok); }
.banner.is-degraded { background: var(--c-degraded-soft); }
.banner.is-degraded .dot { background: var(--c-degraded); }
.banner.is-down { background: var(--c-down-soft); }
.banner.is-down .dot { background: var(--c-down); }

/* --------------------------------------------------------- components --- */
.components {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-10);
}

.comp {
  background: var(--c-bg-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}

.comp-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.comp-name {
  font-weight: var(--weight-semibold);
}

.comp-desc {
  font-size: var(--text-xs);
  color: var(--c-fg-muted);
  margin: 0;
}

.state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  color: var(--c-fg-muted);
}

.state .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c-nodata);
}

.state.is-ok { color: var(--c-ok); }
.state.is-ok .dot { background: var(--c-ok); }
.state.is-degraded { color: var(--c-degraded); }
.state.is-degraded .dot { background: var(--c-degraded); }
.state.is-down { color: var(--c-down); }
.state.is-down .dot { background: var(--c-down); }

.state .meta {
  font-weight: var(--weight-medium);
  color: var(--c-fg-faint);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* 90-day strip: one flex cell per day, oldest on the left */
.bars {
  display: flex;
  gap: 2px;
  height: 34px;
  align-items: stretch;
}

.bars i {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 2px;
  background: var(--c-nodata);
}

.bars i.is-ok { background: var(--c-ok); }
.bars i.is-degraded { background: var(--c-degraded); }
.bars i.is-down { background: var(--c-down); }

.bars i:hover {
  opacity: 0.65;
}

.scale {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  color: var(--c-fg-muted);
  margin-top: var(--space-2);
}

.scale .uptime {
  font-weight: var(--weight-semibold);
  color: var(--c-fg);
}

/* ---------------------------------------------------------- incidents --- */
.incidents h2 {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-3);
}

.incident-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.incident {
  background: var(--c-bg-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}

.incident-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.incident-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.incident-when {
  font-size: var(--text-xs);
  color: var(--c-fg-muted);
  font-family: var(--font-mono);
}

.pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: var(--c-bg-sunken);
  color: var(--c-fg-muted);
  vertical-align: middle;
}

.pill.is-resolved { background: var(--c-ok-soft); color: var(--c-ok); }
.pill.is-monitoring { background: var(--c-accent-soft); color: var(--c-accent); }
.pill.is-identified,
.pill.is-investigating { background: var(--c-degraded-soft); color: var(--c-degraded); }

.incident-components {
  font-size: var(--text-xs);
  color: var(--c-fg-faint);
  margin: var(--space-1) 0 0;
}

.updates {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  border-left: 2px solid var(--c-border-strong);
  display: grid;
  gap: var(--space-2);
}

.updates li {
  padding-left: var(--space-3);
  font-size: var(--text-sm);
}

.updates .when {
  color: var(--c-fg-faint);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  margin-right: var(--space-2);
}

/* ------------------------------------------------------------- footer --- */
.updated {
  text-align: center;
  color: var(--c-fg-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-8);
}

.notice {
  border: 1px solid var(--c-border);
  background: var(--c-bg-raised);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--c-border);
  color: var(--c-fg-muted);
  font-size: var(--text-sm);
}

@media (max-width: 640px) {
  .wrap {
    padding: var(--space-6) var(--space-4) var(--space-12);
  }

  .banner-text strong {
    font-size: var(--text-lg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .bars i {
    transition: opacity 0.1s;
  }
}
