/*
 * The status page, in the language of docs/design-system.md: paper and
 * ink, hairlines, radius 0, no shadows; Space Grotesk statements, Manrope
 * body, JetBrains Mono for labels, ids and times. Fonts are self-hosted
 * (fonts/, copied from site/public/fonts with their OFL licences); nothing
 * is fetched from anyone else. The page works without script; status.js
 * refreshes it and adds the theme toggle, globe.js draws the PoP globe
 * over the flat map it replaces.
 */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url('fonts/space-grotesk-latin-wght.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('fonts/manrope-latin-wght.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('fonts/jetbrains-mono-latin-wght.woff2') format('woff2-variations');
}

:root {
  color-scheme: light dark;
  --paper: #f7f5f3;
  --paper-2: #ffffff;
  --ink: #1b1a18;
  --ink-2: #504d49;
  --ink-3: #6b6762;
  --ink-4: rgb(27 26 24 / 50%);
  --line: #ddd9d5;
  --line-2: rgb(27 26 24 / 10%);
  --brand: #2e7d4b;
  --ok: #2f6b3a;
  --bar-ok: #4a9a62;
  --degraded: #9a6a1e;
  --degraded-text: #8f6219;
  --outage: #a83a2c;
  --maint: #5b4c9a;
  --font-display: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1b1a18;
    --paper-2: #242220;
    --ink: #f7f5f3;
    --ink-2: #b8b3ad;
    --ink-3: #9a948d;
    --ink-4: rgb(247 245 243 / 42%);
    --line: #3a3733;
    --line-2: rgb(247 245 243 / 10%);
    --brand: #86cfa0;
    --ok: #7cbf87;
    --bar-ok: #7cbf87;
    --degraded: #d9a863;
    --degraded-text: #d9a863;
    --outage: #e58a7c;
    --maint: #aa9ee6;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1b1a18;
  --paper-2: #242220;
  --ink: #f7f5f3;
  --ink-2: #b8b3ad;
  --ink-3: #9a948d;
  --ink-4: rgb(247 245 243 / 42%);
  --line: #3a3733;
  --line-2: rgb(247 245 243 / 10%);
  --brand: #86cfa0;
  --ok: #7cbf87;
  --bar-ok: #7cbf87;
  --degraded: #d9a863;
  --degraded-text: #d9a863;
  --outage: #e58a7c;
  --maint: #aa9ee6;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 6vw, 3.5rem); line-height: 1.05; }
h2 { font-size: 1.375rem; line-height: 1.25; }
h3 { font-size: 1.0625rem; line-height: 1.3; }
p { margin: 0; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.brand { color: var(--brand); }
.mono, .label, time, code { font-family: var(--font-mono); }
.label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.muted { color: var(--ink-3); }
.small { font-size: 0.875rem; }

.wrap { max-width: 60rem; margin: 0 auto; padding: 0 16px; }
header.site {
  border-bottom: 1px solid var(--line);
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.wordmark .label { margin-left: 10px; letter-spacing: 0.1em; font-weight: 400; }
header.site nav { display: flex; align-items: center; gap: 20px; }
header.site nav a { font-family: var(--font-mono); font-size: 0.875rem; }
.theme {
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 0;
}
.theme:hover { border-color: var(--ink); }

main.wrap { padding-top: 40px; padding-bottom: 64px; }
section { margin-top: 48px; }
section > h2 { margin-bottom: 16px; }

.hero { display: grid; gap: 16px; }
.overall {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  padding: 20px 24px;
  font-size: 1.125rem;
  font-weight: 500;
}
.overall .dot { flex: none; }
.terminal { font-family: var(--font-mono); font-size: 0.875rem; color: var(--ink-3); }

.dot { display: inline-block; width: 10px; height: 10px; background: var(--line); }
.dot.ok { background: var(--ok); }
.dot.degraded { background: var(--degraded); }
.dot.partial, .dot.major { background: var(--outage); }
.dot.maint { background: var(--maint); }

.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.ok { border-color: var(--ok); color: var(--ok); }
.chip.degraded { border-color: var(--degraded); color: var(--degraded-text); }
.chip.partial, .chip.major, .chip.investigating, .chip.identified { border-color: var(--outage); color: var(--outage); }
.chip.maint, .chip.monitoring, .chip.scheduled, .chip.in-progress { border-color: var(--maint); color: var(--maint); }
.chip.resolved, .chip.completed { border-color: var(--ok); color: var(--ok); }

.notice {
  border: 1px solid var(--degraded);
  padding: 12px 16px;
  font-size: 0.875rem;
}
.notice.stale { border-color: var(--outage); border-left-width: 4px; font-size: 0.9375rem; }
.intro { margin-bottom: 16px; }

/* Components */
.group { border: 1px solid var(--line); background: var(--paper-2); }
.group + .group { margin-top: 24px; }
.group > .label { display: block; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.comp { padding: 16px 20px; border-top: 1px solid var(--line-2); }
.group > .label + .comp { border-top: 0; }
.comp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.comp-head h3 { display: flex; align-items: center; gap: 10px; }
.comp-stats { margin-top: 8px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-2); display: flex; gap: 16px; flex-wrap: wrap; }
.comp-notes { font-size: 0.875rem; color: var(--ink-2); margin-top: 6px; }

.bars { margin-top: 12px; }
.bars .label { display: flex; justify-content: space-between; font-size: 0.6875rem; margin-top: 4px; color: var(--ink-3); }
.strip { display: flex; gap: 2px; height: 28px; }
.strip.hours { height: 20px; }
.strip i { flex: 1 1 0; min-width: 1px; background: var(--line); }
.strip i.ok { background: var(--bar-ok); }
.strip i.degraded { background: var(--degraded); }
.strip i.partial { background: var(--outage); opacity: 0.7; }
.strip i.major { background: var(--outage); }
.strip i.maint { background: var(--maint); }
details.more { margin-top: 8px; }
details.more summary { cursor: pointer; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-2); }

/* Latency matrix */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--paper-2); }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; vertical-align: top; }
th { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); font-weight: 400; }
td.num { font-family: var(--font-mono); font-size: 0.8125rem; }
th.tr { text-transform: none; letter-spacing: 0.02em; }
th.loc { text-transform: none; letter-spacing: 0; font-size: 0.875rem; color: var(--ink); font-family: var(--font); font-weight: 500; }
td .sub { display: block; color: var(--ink-3); font-size: 0.75rem; }
tr:last-child td, tr:last-child th { border-bottom: 0; }
tr.anycast th, tr.anycast td { background: var(--line-2); }

/* Incidents */
.incident { border: 1px solid var(--line); background: var(--paper-2); padding: 20px 24px; scroll-margin-top: 16px; }
.incident + .incident { margin-top: 16px; }
.incident:target { outline: 2px solid var(--ink); }
.incident-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.incident .meta { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-2); margin-top: 6px; }
.updates { list-style: none; margin: 16px 0 0; padding: 0; }
.updates li { display: grid; grid-template-columns: 10rem 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.updates li p + p { margin-top: 8px; }
.updates .when { display: grid; gap: 4px; align-content: start; }
.updates .when time { font-size: 0.75rem; color: var(--ink-2); }
.incident .body { margin-top: 12px; font-size: 0.9375rem; color: var(--ink-2); }
.empty { color: var(--ink-3); border: 1px solid var(--line); padding: 16px 20px; }

.past-day { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3); margin: 24px 0 8px; }

footer { border-top: 1px solid var(--line); padding: 24px 0 48px; font-size: 0.875rem; color: var(--ink-2); }
footer .wrap { display: grid; gap: 8px; }

/* World map */
.map { margin: 0; border: 1px solid var(--line); background: var(--paper-2); }
.map-summary { font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); padding: 12px 20px; border-bottom: 1px solid var(--line); }
.map-canvas { position: relative; margin: 20px; }
.map-world { display: block; width: 100%; height: auto; }
.map-land { fill: url(#land-dot); }
.map-world pattern circle { fill: var(--ink-4); }
.map figcaption { border-top: 1px solid var(--line); padding: 12px 20px 16px; display: grid; gap: 10px; }

.pop {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  color: var(--ink);
  text-decoration: none;
  z-index: 1;
}
.pop:hover, .pop:focus-visible, .pop:focus-within { z-index: 3; }
.pop:focus-visible { outline: none; }
.pop-mark {
  display: inline-block;
  box-sizing: border-box;
  width: 12px;
  height: 12px;
  background: var(--line);
  border: 2px solid var(--line);
}
.pop > .pop-mark {
  position: absolute;
  left: 1px;
  top: 1px;
  box-shadow: 0 0 0 2px var(--paper-2);
}
.pop:focus-visible > .pop-mark { outline: 2px solid var(--ink); outline-offset: 3px; }
.pop--healthy .pop-mark, .pop-mark.pop--healthy { background: var(--ok); border-color: var(--ok); }
.pop--degraded .pop-mark, .pop-mark.pop--degraded { background: var(--degraded); border-color: var(--degraded); }
.pop--down .pop-mark, .pop-mark.pop--down { background: var(--outage); border-color: var(--outage); }
.pop--drained .pop-mark, .pop-mark.pop--drained { background: transparent; border-color: var(--maint); }
.pop--planned .pop-mark, .pop-mark.pop--planned { background: transparent; border: 1.5px dashed var(--ink-3); }
.pop--no-data .pop-mark, .pop-mark.pop--no-data { background: var(--paper-2); border-color: var(--ink-3); }
.pop.pop--down > .pop-mark { width: 14px; height: 14px; left: 0; top: 0; }

.pop-label {
  position: absolute;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 20px;
  padding: 0 4px;
  background: color-mix(in srgb, var(--paper-2) 85%, transparent);
}
.pop-count { font-weight: 600; }
.pop--degraded .pop-count { color: var(--degraded-text); }
.pop--down .pop-count { color: var(--outage); }
.pop--drained .pop-count { color: var(--maint); }
.pop--planned .pop-label { color: var(--ink-3); }
.pop--planned .pop-count { font-weight: 400; }
.pop--right .pop-label { left: 19px; top: -3px; }
.pop--left .pop-label { right: 19px; top: -3px; }
.pop--below .pop-label { left: 7px; top: 16px; transform: translateX(-50%); }
.pop--above .pop-label { left: 7px; bottom: 16px; transform: translateX(-50%); }

.pop-card {
  display: none;
  position: absolute;
  width: max-content;
  max-width: min(38rem, 90vw);
  background: var(--paper-2);
  border: 1px solid var(--ink);
  padding: 12px 14px;
  font-size: 0.875rem;
  line-height: 1.4;
  cursor: default;
}
.pop:hover .pop-card, .pop:focus-visible .pop-card, .pop:focus-within .pop-card { display: grid; gap: 6px; }
.pop--north .pop-card { top: 24px; }
.pop--south .pop-card { bottom: 24px; }
.pop--west .pop-card { left: -6px; }
.pop--east .pop-card { right: -6px; }
.pop-card-head b { font-family: var(--font-display); font-size: 1rem; }
.pop-card-head .muted { font-family: var(--font-mono); font-size: 0.75rem; }
.pop-card table { font-size: 0.8125rem; margin-top: 4px; width: auto; }
.pop-card td, .pop-card th { white-space: nowrap; }
.pop-card th, .pop-card td { padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line-2); }
.pop-card td .dot { margin-right: 6px; width: 8px; height: 8px; }
.pop-card th[scope="row"] { font-family: var(--font-mono); font-size: 0.75rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
.pop-card .num, .pop-card td.num { font-family: var(--font-mono); font-size: 0.75rem; text-align: right; }

.dot.nodata { background: var(--line); }
.dot.maint { background: var(--maint); }
.dot.planned { background: transparent; outline: 1px dashed var(--ink-3); outline-offset: -1px; }

.map-legend, .map-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-2); }
.map-legend li, .map-list li { display: flex; align-items: center; gap: 8px; }
.map-list { display: none; }
.map-list li .pop-count { color: var(--ink); }

/*
 * The PoP globe (public/globe.js): the shared runner's styles are
 * public/globe.css (deploy/status/globe/globe.css, copied by
 * scripts/client.ts); what follows is this page's part. Once it is up
 * (data-globe="on" on the figure) the flat map above is hidden; without
 * script, it is all there is.
 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.map[data-globe="on"] .map-canvas { display: none; }
.globe-label.pop--healthy .pop-count, .globe-label.pop--no-data .pop-count { color: var(--ink-2); }
.globe-label.pop--planned { color: var(--ink-3); }

.globe-tooltip table { width: auto; font-size: 0.75rem; }
.globe-tooltip th, .globe-tooltip td { padding: 3px 10px 3px 0; border-bottom: 1px solid var(--line-2); color: inherit; }
.globe-tooltip thead th { color: var(--ink-3); font-size: 0.625rem; }
.globe-tooltip th[scope="row"] { text-transform: none; letter-spacing: 0; font-size: 0.75rem; }
.globe-tooltip td.num { font-size: 0.75rem; text-align: right; }
.globe-tooltip td .dot { margin-right: 6px; width: 8px; height: 8px; }
/* The legend under the globe: round swatches, as the markers. */
.map[data-globe="on"] .map-legend .pop-mark, .map[data-globe="on"] .map-list .pop-mark { border-radius: 50%; }
.map[data-globe="on"] .pop-mark.pop--healthy, .map[data-globe="on"] .pop--healthy .pop-mark { background: var(--brand); border-color: var(--brand); }
.map[data-globe="on"] .pop-mark.pop--planned, .map[data-globe="on"] .pop--planned .pop-mark { border: 1.5px solid var(--ink-2); }

@media (max-width: 40rem) {
  .map-canvas { margin: 12px; }
  .globe { margin: 12px 8px; }
  .globe-tooltip th:nth-child(4), .globe-tooltip td:nth-child(4) { display: none; }
  .globe-tooltip td:nth-child(2) { white-space: normal; }
  .pop-label { display: none; }
  .pop-card { display: none !important; }
  .map-list { display: flex; }
  .pop > .pop-mark, .pop.pop--down > .pop-mark { width: 8px; height: 8px; left: 3px; top: 3px; border-width: 1.5px; }

  .updates li { grid-template-columns: 1fr; gap: 6px; }
  .strip { gap: 1px; }
  .overall { padding: 16px; }
  .comp { padding: 14px 16px; }
  .incident { padding: 16px; }
}
