/*
  The status page's own styles. The frame — header, drawer, footer, fonts and the
  brand tokens (--nx-cream, --nx-ink, --nx-violet, …) — is /assets/frame.css, a copy
  of public-frame/frame.css that docs.nexym.nl is built with too (CLAUDE.md §10d½).
  This file only draws what is between the header and the footer.

  NO LAYOUT SHIFT (§10d½): every box here has its final size before the API has
  answered. Values are fixed-width columns, text blocks reserve their lines, and the
  ninety squares per component are in the HTML from the start. When something new is
  added, give it a size that does not depend on what the script writes into it.
*/
:root {
  /* State colours. The API sends a state key; these are what it looks like. */
  --st-ok: #0f9b5c;
  --st-warn: #d9822b;
  --st-err: #c8402f;
  --st-info: #3b82c4;
  --st-none: #e4e6ee;
  --st-unmeasured: #bfc1d1;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--nx-cream); color: var(--nx-ink); font-family: var(--nx-sans);
  font-size: 16px; font-weight: 500; line-height: 1.5; -webkit-font-smoothing: antialiased;
  scroll-padding-top: calc(var(--nx-top-h) + 16px);
}
body { margin: 0; background: var(--nx-cream); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--nx-violet); }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.035em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
button { font-family: inherit; }
::selection { background: var(--nx-violet); color: #fff; }
:focus-visible { outline: none; box-shadow: var(--nx-ring); }

.st-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.st-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* The cards stand apart: one gap between every section of the page. */
.st-main {
  display: flex; flex-direction: column; gap: clamp(16px, 2vw, 24px);
  padding-top: clamp(20px, 3vw, 40px); padding-bottom: clamp(48px, 7vw, 100px);
}

/* ── The banner ─────────────────────────────────────────────────────────── */
.st-hero {
  --st-h1: clamp(28px, 3.6vw, 44px);
  border-radius: var(--nx-radius-tile); padding: clamp(24px, 3vw, 36px);
  background: var(--nx-sand); transition: background-color 0.2s ease;
  display: flex; flex-direction: column; gap: clamp(20px, 2.4vw, 28px);
}
.st-hero[data-tone='operational'] { background: var(--nx-mint); }
.st-hero[data-tone='maintenance'] { background: var(--nx-sky); }
.st-hero[data-tone='degraded'] { background: var(--nx-butter); }
.st-hero[data-tone='outage'], .st-hero[data-tone='unreachable'] { background: #f7dad5; }

.st-hero__head { display: flex; align-items: flex-start; gap: 18px; }
.st-dot {
  flex: none; width: 18px; height: 18px; border-radius: 50%; margin-top: calc(var(--st-h1) * 0.525 - 9px);
  background: var(--nx-faint); box-shadow: 0 0 0 7px rgba(123, 127, 147, 0.18);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
[data-tone='operational'] .st-dot { background: var(--st-ok); box-shadow: 0 0 0 7px rgba(15, 155, 92, 0.18); }
[data-tone='maintenance'] .st-dot { background: var(--st-info); box-shadow: 0 0 0 7px rgba(59, 130, 196, 0.18); }
[data-tone='degraded'] .st-dot { background: var(--st-warn); box-shadow: 0 0 0 7px rgba(217, 130, 43, 0.18); }
[data-tone='outage'] .st-dot, [data-tone='unreachable'] .st-dot { background: var(--st-err); box-shadow: 0 0 0 7px rgba(200, 64, 47, 0.18); }

/* Two lines for the headline and two for the sentence, whatever they say: the
   longest state fits in that at 360px, so the figures under it never move. */
.st-hero__text { min-width: 0; flex: 1 1 auto; }
.st-hero h1 {
  font-size: var(--st-h1); line-height: 1.05; letter-spacing: -0.04em;
  min-height: calc(var(--st-h1) * 1.05 * 2);
}
.st-hero__sub { margin-top: 8px; font-size: 15px; line-height: 22px; color: var(--nx-ink-2); min-height: 44px; }
.st-hero__meta { margin-top: 2px; height: 20px; font-size: 13px; line-height: 20px; color: var(--nx-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-hero__meta .mono { font-family: var(--nx-mono); font-size: 12.5px; line-height: 1; } /* the time must not grow the line by half a pixel */
@media (min-width: 900px) {
  /* Wide enough for every headline and sentence on one line. */
  .st-hero h1 { min-height: calc(var(--st-h1) * 1.05); }
  .st-hero__sub { min-height: 22px; }
}

.st-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.st-metric { position: relative; background: #fff; border-radius: 18px; padding: 14px 18px; min-width: 0; }
.st-metric__k {
  display: flex; align-items: center; gap: 6px; height: 18px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em; line-height: 18px; text-transform: uppercase; color: var(--nx-faint); white-space: nowrap;
}
.st-metric__v {
  margin-top: 4px; height: 30px; font-family: var(--nx-mono); font-size: 24px; font-weight: 500; line-height: 30px;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.st-metric__h { margin-top: 2px; font-size: 12px; line-height: 18px; color: var(--nx-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 639.98px) {
  .st-metrics { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  /* A fixed column for the figure: "—" and "99,38%" must not move the labels. */
  .st-metric { display: grid; grid-template-columns: minmax(0, 1fr) 104px; grid-template-areas: 'k v' 'h v'; align-items: center; column-gap: 12px; padding: 12px 16px; }
  .st-metric__k { grid-area: k; }
  .st-metric__h { grid-area: h; }
  .st-metric__v { grid-area: v; margin: 0; font-size: 22px; text-align: right; }
}

/* ── The (i) and what it explains ─────────────────────────────────────────
   The tooltip is fixed-position and placed by the script, so opening it moves
   nothing. Hover, focus and tap all open it; Escape, blur and a second tap close. */
.st-info {
  display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; margin: -1px 0; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--nx-faint); cursor: help;
}
.st-info:hover, .st-info[aria-expanded='true'] { color: var(--nx-violet); }
.st-tip {
  position: fixed; z-index: 60; top: 0; left: 0; width: max-content; max-width: min(320px, calc(100vw - 32px));
  background: var(--nx-ink); color: #fff; border-radius: 12px; padding: 10px 14px;
  font-size: 13px; font-weight: 500; line-height: 1.5; letter-spacing: 0; text-transform: none; white-space: normal; text-align: left;
  box-shadow: var(--nx-shadow-float);
  visibility: hidden; opacity: 0; transition: opacity 0.12s ease, visibility 0s linear 0.12s; pointer-events: none;
}
.st-tip.is-open { visibility: visible; opacity: 1; transition: opacity 0.12s ease; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.st-card { background: #fff; border-radius: var(--nx-radius-tile); padding: clamp(22px, 2.6vw, 32px); }
.st-card[hidden] { display: none; }
.st-card__head { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.st-card__head h2 { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.2; }
.st-card__hint { color: var(--nx-faint); font-size: 13px; line-height: 20px; white-space: nowrap; }
.st-narrow { display: none; }

/* One component. The value column has a fixed width so no status word can
   narrow the name column and re-wrap its description. */
.st-comps { margin-top: 18px; }
.st-comp { padding: 18px 0; border-top: 1px solid var(--nx-line); }
.st-comp__top { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 16px; align-items: start; }
.st-comp__name { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; line-height: 24px; }
.st-comp__dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--st-unmeasured); transition: background-color 0.2s ease; }
.st-comp__desc { margin-top: 2px; padding-left: 20px; font-size: 13.5px; line-height: 20px; color: var(--nx-muted); }
.st-comp__val { text-align: right; white-space: nowrap; }
.st-u { font-family: var(--nx-mono); font-size: 15px; line-height: 24px; font-variant-numeric: tabular-nums; }
.st-avg { font-size: 11.5px; line-height: 16px; color: var(--nx-faint); white-space: normal; }
.st-s { font-size: 13px; font-weight: 700; line-height: 20px; color: var(--nx-faint); overflow: hidden; text-overflow: ellipsis; }

/* One square a day. A day nobody measured is grey, never green. */
.st-strip { display: flex; gap: 2px; height: 34px; margin-top: 12px; }
.st-strip i { flex: 1 1 0; min-width: 0; border-radius: 2px; background: var(--st-none); transition: background-color 0.2s ease; }

.st-legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 16px; border-top: 1px solid var(--nx-line);
  font-size: 12.5px; line-height: 18px; color: var(--nx-muted);
}
.st-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.st-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }

.is-operational { background: var(--st-ok) !important; }
.is-maintenance { background: var(--st-info) !important; }
.is-degraded { background: var(--st-warn) !important; }
.is-outage { background: var(--st-err) !important; }
.is-none { background: var(--st-none) !important; }
.is-unmeasured { background: var(--st-unmeasured) !important; }
.st-s.is-t-operational { color: var(--st-ok); }
.st-s.is-t-maintenance { color: var(--st-info); }
.st-s.is-t-degraded { color: var(--st-warn); }
.st-s.is-t-outage { color: var(--st-err); }

@media (max-width: 639.98px) {
  /* Ninety squares in 300px are 1.3px each: the phone shows the last thirty. */
  .st-strip i:nth-child(-n + 60) { display: none; }
  .st-wide { display: none; }
  .st-narrow { display: inline; }
  .st-comp__top { grid-template-columns: minmax(0, 1fr) 104px; gap: 12px; }
}

/* ── Incidents and maintenance ───────────────────────────────────────────── */
.st-subscribe-link {
  margin-left: auto; display: inline-flex; align-items: center; gap: 10px;
  background: var(--nx-ink); color: #fff !important; border-radius: 999px; padding: 6px 6px 6px 16px;
  font-size: 13.5px; font-weight: 700; line-height: 20px; white-space: nowrap;
}
.st-subscribe-link__arrow { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--nx-teal); color: var(--nx-ink); }
.st-incidents { min-height: 58px; }
.st-empty { padding-top: 14px; }
.st-item { padding: 20px 0; border-top: 1px solid var(--nx-line); }
.st-incidents > .st-item:first-child, [data-maintenance-list] > .st-item:first-child { margin-top: 14px; }
.st-item__head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.st-item__title { font-weight: 800; font-size: 17px; line-height: 24px; }
.st-badge { border-radius: 6px; padding: 4px 9px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; line-height: 1.3; text-transform: uppercase; white-space: nowrap; }
.st-when { margin-top: 8px; font-family: var(--nx-mono); font-size: 12.5px; line-height: 20px; color: var(--nx-muted); }
.st-body { margin-top: 10px; color: var(--nx-ink-2); font-size: 14.5px; line-height: 1.55; }
.st-empty.st-body { margin-top: 0; }
.st-updates { margin-top: 12px; }
.st-update { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 14px; padding: 10px 0; border-top: 1px solid var(--nx-line); font-size: 14px; line-height: 1.55; }
.st-update__t { font-family: var(--nx-mono); font-size: 12.5px; color: var(--nx-faint); }
.st-note { margin-top: 16px; color: var(--nx-faint); font-size: 13px; line-height: 20px; }

/* ── Subscribe ───────────────────────────────────────────────────────────── */
.st-subscribe {
  background: var(--nx-ink); color: #fff; border-radius: var(--nx-radius-tile); padding: clamp(24px, 3vw, 36px);
  display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
}
.st-subscribe h2 { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.2; }
.st-subscribe p { margin-top: 8px; color: rgba(255, 255, 255, 0.72); font-size: 15px; line-height: 1.55; max-width: 46ch; }
.st-subscribe form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.st-subscribe input[type='email'] {
  background: #fff; color: var(--nx-ink); border: 0; border-radius: 999px; padding: 13px 20px;
  font: inherit; font-size: 15px; font-weight: 600; min-width: 240px; max-width: 100%;
}
.st-subscribe input[type='email']:focus { outline: none; box-shadow: 0 0 0 3px rgba(47, 182, 168, 0.55); }
.st-subscribe button {
  display: inline-flex; align-items: center; gap: 10px; background: var(--nx-teal); color: var(--nx-ink);
  border: 0; border-radius: 999px; padding: 8px 8px 8px 22px; font-size: 15px; font-weight: 800; line-height: 26px; cursor: pointer; white-space: nowrap;
}
.st-subscribe button .st-subscribe-link__arrow { background: var(--nx-ink); color: #fff; }
.st-subscribe button:disabled { opacity: 0.6; cursor: default; }
.st-subscribe #said { flex-basis: 100%; min-height: 20px; margin: 0; color: rgba(255, 255, 255, 0.72); font-size: 13.5px; line-height: 20px; max-width: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.001ms !important; } }
