/* The status page: a standalone page (no site.css, no clock field), one calm column with the state
   first and the 90-day bars as its hero. Every colour comes from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font: 0.95rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-deep); }
:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 2px; border-radius: 2px; }
h1, h2 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.015em; text-wrap: balance; }
h2 { margin-bottom: 0.75rem; font-size: 1.25rem; line-height: 1.2; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.eyebrow {
  font: 500 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-page {
  display: grid;
  gap: 2.25rem;
  max-width: 860px;
  margin-inline: auto;
  padding: 1.75rem max(16px, env(safe-area-inset-right, 0px)) 4rem max(16px, env(safe-area-inset-left, 0px));
}
main { display: grid; gap: 2.25rem; }

/* ---------- Header ---------- */
.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; color: var(--ink); text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.brand b { font: 600 1.2rem/1 var(--font-display); letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 500; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.nav a:hover { background: var(--surface); }
.nav .lang { gap: 0.3em; border: 1px solid var(--line); font: 500 0.75rem/1 var(--font-mono); color: var(--muted); }
.nav .lang .current { color: var(--ink); font-weight: 600; }

/* ---------- State banner ---------- */
.hero { display: grid; gap: 0.875rem; }
.state {
  --state: var(--ok);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.375rem 1.5rem;
  border: 1px solid color-mix(in srgb, var(--state) 25%, transparent);
  border-radius: var(--radius-panel);
  background: var(--ok-soft);
}
.state-degraded { --state: var(--warn); background: var(--warn-soft); }
.state-partial, .state-outage { --state: var(--down); background: var(--down-soft); }
.state-unknown { --state: var(--muted); background: var(--surface); }
.pulse { position: relative; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--state); }
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--state);
  animation: status-ping 2.4s ease-out infinite;
}
.state-unknown .pulse::after { animation: none; }
@keyframes status-ping {
  from { transform: scale(1); opacity: 0.55; }
  to { transform: scale(3); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse::after { animation: none; }
  html { scroll-behavior: auto; }
}
.state h1 { font-size: clamp(1.375rem, 4.2vw, 1.875rem); line-height: 1.15; }
.state p { margin-top: 0.15rem; color: var(--muted); font-size: 0.875rem; }
.state .stale { color: var(--ink); font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.125rem; color: var(--muted); font-size: 0.8125rem; }
.meta b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Sites and their 90 daily bars ---------- */
.sites { border: 1px solid var(--line); border-radius: var(--radius-panel); }
.site { display: grid; gap: 0.875rem; padding: 1.25rem 1.375rem; }
.site + .site { border-top: 1px solid var(--line); }
.site-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.site-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.625rem; }
.site-name strong { font: 600 1.0625rem/1.2 var(--font-display); }
.site-name small { color: var(--muted); font-size: 0.8125rem; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-operational { color: var(--ok-ink); background: var(--ok-soft); }
.pill-degraded { color: var(--warn-ink); background: var(--warn-soft); }
.pill-outage { color: var(--down-ink); background: var(--down-soft); }

.bars { display: grid; grid-template-columns: repeat(90, minmax(0, 1fr)); gap: 2px; height: 38px; }
.bar {
  position: relative;
  border-radius: 3px;
  background: var(--ok);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.bar:hover, .bar:focus-visible { transform: scaleY(1.12); filter: brightness(1.08); }
.bar.warn { background: var(--warn); }
.bar.down { background: var(--down); }
.bar.none { background: var(--nodata); }
@media (prefers-reduced-motion: reduce) { .bar { transition: none; } }

.scale { display: flex; align-items: center; justify-content: space-between; gap: 0.625rem; color: var(--muted); font-size: 0.75rem; }
.scale .rule { flex: 1; height: 1px; background: var(--line); }
.scale b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.75rem; color: var(--muted); font-size: 0.8rem; }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 0.4rem; border-radius: 3px; vertical-align: -1px; background: var(--ok); }
.swatch.warn { background: var(--warn); }
.swatch.down { background: var(--down); }
.swatch.none { background: var(--nodata); }

/* The hover and focus tooltip of a bar, above its strip (status.js fills it in and sets --tip-at, 0 at the
   first bar and 1 at the last). Shifting it back by the same fraction of its own width keeps it over the bar
   and inside the strip at both ends; without the script the bar's title says the same. */
.strip { position: relative; }
.tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: calc(var(--tip-at, 0.5) * 100%);
  z-index: 20;
  width: max-content;
  max-width: min(240px, 100%);
  transform: translateX(calc(var(--tip-at, 0.5) * -100%));
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-card);
  background: var(--ink);
  color: var(--white);
  font-size: 0.78rem;
  line-height: 1.45;
  pointer-events: none;
  box-shadow: var(--tip-shadow);
}
.tip b { display: block; font-family: var(--font-display); font-size: 0.875rem; font-weight: 600; }
.tip span { display: block; color: var(--tip-muted); }
.tip [hidden] { display: none; }

/* ---------- Monthly availability ---------- */
.months { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.75rem; }
.month { display: grid; gap: 0.4rem; padding: 1rem 1.125rem; border: 1px solid var(--line); border-radius: var(--radius-panel); }
.month .value { font: 600 1.625rem/1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.meter { display: block; height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface); }
.meter svg { display: block; width: 100%; height: 100%; }
.meter rect { fill: var(--ok); }
.month-note { color: var(--muted); font-size: 0.8rem; }

/* ---------- Incidents ---------- */
.incidents { display: grid; margin-left: 6px; border-left: 2px solid var(--line); }
.incident { position: relative; display: grid; gap: 0.25rem; padding: 2px 0 1.25rem 1.375rem; }
.incident::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--down);
  border-radius: 50%;
  background: var(--white);
}
.incident.resolved::before { border-color: var(--ok); }
.incident-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.625rem; }
.incident-head strong { font-weight: 600; }
.tag {
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent-deep);
  font: 500 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.incident-state { color: var(--ok-ink); font-size: 0.8rem; font-weight: 600; }
.incident.ongoing .incident-state { color: var(--down-ink); }
.incident p { max-width: 62ch; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.no-incidents { color: var(--muted); }

/* ---------- Contact ---------- */
.contact {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.125rem;
  padding: 1.5rem;
  border-radius: var(--radius-panel);
  background: var(--surface);
  scroll-margin-top: 1rem;
}
.contact h2 { margin: 0; }
.contact p { max-width: 52ch; margin-top: 0.4rem; color: var(--muted); }
.box {
  display: grid;
  align-content: start;
  gap: 0.625rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--white);
}
.mail {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font: 600 1rem/1.3 var(--font-mono);
  text-decoration: none;
  word-break: break-all;
}
.mail:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.14s, border-color 0.14s, color 0.14s;
}
.btn:hover { background: var(--primary-hover); }
.btn.ghost { border-color: var(--ghost-border); background: transparent; color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-deep); }

/* ---------- Footer ---------- */
.bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1.125rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .contact { grid-template-columns: 1fr; padding: 1.25rem; }
  .bars { gap: 1px; height: 32px; }
  .bar { border-radius: 2px; }
  .state { padding: 1.125rem; }
  .site { padding: 1.125rem 1rem; }
}
