/* ═══════════════════════════════════════════════════════════════════════════
   Conaxity Status — presentation
   ═══════════════════════════════════════════════════════════════════════════
   No build step, no framework, no external requests. The page must render from
   a cold CDN cache during an incident, so everything it needs is these three
   files plus two images.

   COLOUR AND MEANING — the rule this file exists to enforce
   ---------------------------------------------------------
   Status colours are the reserved status palette (good/warning/serious/
   critical), not series colours. They are validated, and the validation says
   plainly that colour alone cannot carry the meaning here:

     · operational green #0ca30c vs major-outage red #d03b3b measure ΔE 4.1
       under deuteranopia — near-identical for the most common form of colour
       blindness, and they are the two most important states on the page.
     · degraded amber #fab219 vs partial-outage orange #ec835a measure ΔE 13.6
       under NORMAL vision — below the 15 floor, i.e. hard to separate even
       with full colour vision.

   So every status carries three channels, and colour is the least of them:
     1. a text label,
     2. a distinct icon shape,
     3. in the history strip, a distinct texture — solid / 45° / 135° /
        cross-hatch / hollow — that increases in visual weight with severity.

   Remove any of those and the page becomes unreadable for a large minority of
   its audience. Do not "simplify" the strip back to flat colour blocks.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  --surface: #fcfcfb;
  --surface-raised: #ffffff;
  --plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --hairline: rgba(11, 11, 11, 0.1);
  --gridline: #e1e0d9;
  --brand: #2a78d6;

  /* Reserved status palette — fixed, never themed. */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --status-maintenance: #2a78d6;
  --status-unknown: #898781;
  /* Cross-hatch ink for the major-outage bar. Darkens on light surfaces and
     lightens on dark ones — a fixed black overlay muddies to near-invisible
     against the dark surface, losing the density cue that carries this state
     for viewers who cannot separate its red from the operational green. */
  --bar-hatch: rgba(0, 0, 0, 0.45);

  --radius: 10px;
  --bar-radius: 2px;
  --wrap: 62rem;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme='light'])) {
    color-scheme: dark;
    --surface: #1a1a19;
    --surface-raised: #232322;
    --plane: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --hairline: rgba(255, 255, 255, 0.1);
    --gridline: #2c2c2a;
    --brand: #3987e5;
    --status-maintenance: #3987e5;
    --bar-hatch: rgba(255, 255, 255, 0.42);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --surface: #1a1a19;
  --surface-raised: #232322;
  --plane: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --hairline: rgba(255, 255, 255, 0.1);
  --gridline: #2c2c2a;
  --brand: #3987e5;
  --status-maintenance: #3987e5;
  --bar-hatch: rgba(255, 255, 255, 0.42);
}

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

body {
  margin: 0;
  background: var(--plane);
  color: var(--text-primary);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--surface-raised);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
}

/* ── Masthead ────────────────────────────────────────────────────────────── */
.masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
}
.masthead-inner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}
.wordmark {
  height: 24px;
  width: auto;
}
.masthead-title {
  font-size: 1.05rem;
  color: var(--text-secondary);
  padding-left: 0.85rem;
  border-left: 1px solid var(--hairline);
}

main {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* ── Overall headline ────────────────────────────────────────────────────── */
.overall {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.5rem 1.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  border-left: 4px solid var(--status-unknown);
  background: var(--surface);
  margin-bottom: 1.5rem;
}
.overall-headline {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.overall-headline .status-icon {
  width: 22px;
  height: 22px;
  flex: none;
}
.overall-sub {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.overall-operational {
  border-left-color: var(--status-good);
}
.overall-degraded {
  border-left-color: var(--status-warning);
}
.overall-partial-outage {
  border-left-color: var(--status-serious);
}
.overall-major-outage {
  border-left-color: var(--status-critical);
}
.overall-maintenance {
  border-left-color: var(--status-maintenance);
}

/* ── Banners & notices ───────────────────────────────────────────────────── */
.banner {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--surface);
  margin-bottom: 1rem;
}
.banner p {
  margin: 0;
  font-size: 0.93rem;
}
.banner-icon {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 2px;
}
.banner-warning {
  border-left: 4px solid var(--status-warning);
}
.banner-warning .banner-icon {
  color: var(--status-warning);
}
.banner-critical {
  border-left: 4px solid var(--status-critical);
}
.banner-critical .banner-icon {
  color: var(--status-critical);
}
.banner-title {
  font-weight: 600;
  display: block;
  margin-bottom: 0.15rem;
}
.banner-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ── Region panels ───────────────────────────────────────────────────────── */
.regions {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  margin-top: 1.5rem;
}
.region {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}
.region-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--hairline);
}
.region-name {
  margin: 0;
  font-size: 1.15rem;
}
.region-host {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.region-sla {
  margin-left: auto;
  display: flex;
  gap: 1.4rem;
}
.sla-figure {
  text-align: right;
}
.sla-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sla-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.group-heading {
  padding: 1rem 1.5rem 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.group-note {
  padding: 0 1.5rem 0.4rem;
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Component rows ──────────────────────────────────────────────────────── */
.component {
  padding: 0.95rem 1.5rem;
  border-top: 1px solid var(--gridline);
}
.component:first-of-type {
  border-top: none;
}
.component-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.component-name {
  font-weight: 600;
  font-size: 0.97rem;
}
.component-state {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  font-size: 0.87rem;
  font-weight: 600;
}
.status-icon {
  width: 16px;
  height: 16px;
  flex: none;
}
.state-operational {
  color: var(--status-good);
}
.state-degraded {
  color: var(--status-warning);
}
.state-partial-outage {
  color: var(--status-serious);
}
.state-major-outage {
  color: var(--status-critical);
}
.state-maintenance {
  color: var(--status-maintenance);
}
.state-unknown {
  color: var(--status-unknown);
}

/* On the light surface amber (1.79:1) and orange (2.57:1) fall below 3:1
   against the surface. The status palette documents the mitigation as visible
   labels, which every row has; darkening the text keeps the *word* legible
   without repainting the reserved swatch used in the strip. */
@media (prefers-color-scheme: light) {
  .state-degraded {
    color: #8a5a00;
  }
  .state-partial-outage {
    color: #9c4a22;
  }
}

.component-detail {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── 90-day history strip ────────────────────────────────────────────────── */
.history {
  margin-top: 0.7rem;
}
.history-bars {
  display: flex;
  gap: 2px; /* the 2px surface gap between adjacent marks */
  align-items: flex-end;
  height: 34px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.bar {
  flex: 1 1 0;
  min-width: 2px;
  height: 100%;
  border-radius: var(--bar-radius);
  background: var(--status-unknown);
  cursor: default;
}
.bar:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Texture is the accessibility channel, not decoration: it separates the
   states that colour cannot. Weight rises with severity — solid, then one
   diagonal, then the mirrored diagonal, then both. */
.bar-operational {
  background: var(--status-good);
}
.bar-degraded {
  background: repeating-linear-gradient(45deg, var(--status-warning) 0 3px, #b87f00 3px 6px);
}
.bar-partial-outage {
  background: repeating-linear-gradient(135deg, var(--status-serious) 0 3px, #a9502a 3px 6px);
}
.bar-major-outage {
  background:
    repeating-linear-gradient(45deg, transparent 0 3px, var(--bar-hatch) 3px 6px),
    repeating-linear-gradient(135deg, var(--status-critical) 0 3px, #9b2020 3px 6px);
}
.bar-maintenance {
  background: var(--status-maintenance);
}
.bar-unknown {
  background: transparent;
  border: 1px dashed var(--status-unknown);
}

.history-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.history-axis .uptime-figure {
  font-variant-numeric: tabular-nums;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin: 0.9rem 0 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--gridline);
  list-style: none;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.legend li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.legend .swatch {
  width: 14px;
  height: 14px;
  border-radius: var(--bar-radius);
  flex: none;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
.tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: var(--text-primary);
  color: var(--surface);
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.4;
  max-width: 18rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.tooltip strong {
  display: block;
}

/* ── Incident history ────────────────────────────────────────────────────── */
.panel-title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}
.panel-note {
  margin: 0 0 1rem;
  font-size: 0.87rem;
  color: var(--text-secondary);
}
.incident {
  padding: 1rem 0;
  border-top: 1px solid var(--gridline);
}
.incident:first-child {
  border-top: none;
  padding-top: 0;
}
.incident-title {
  margin: 0 0 0.2rem;
  font-size: 0.97rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.incident-meta {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
  font-weight: 600;
}
.update {
  margin: 0 0 0.6rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--gridline);
  font-size: 0.88rem;
}
.update-time {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.empty {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0;
}

/* ── Dependencies ────────────────────────────────────────────────────────── */
.deps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.5rem 1.25rem;
}
.deps a {
  color: var(--brand);
  font-size: 0.9rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--hairline);
  background: var(--surface);
  padding: 1.75rem 0 2.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.footer p {
  margin: 0 0 0.75rem;
  max-width: 46rem;
}
.footer-meta {
  color: var(--text-muted);
}
.footer a {
  color: var(--brand);
}

@media (max-width: 44rem) {
  .region-sla {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    gap: 1.5rem;
  }
  .sla-figure {
    text-align: left;
  }
  .component-state {
    margin-left: 0;
    width: 100%;
  }
}

/* Windows high-contrast: system colours replace ours, so the texture channel
   disappears. Fall back to border weight, which forced-colors preserves. */
/* Must stay LAST. `.banner` and friends set `display: flex`, which has the same
   specificity as the UA's `[hidden] { display: none }` and therefore beats it —
   leaving an empty banner visible on the page. Source order is what settles the
   tie, so this rule lives at the end of the file on purpose. */
[hidden] {
  display: none;
}

@media (forced-colors: active) {
  .bar {
    border: 1px solid CanvasText;
    background: Canvas;
  }
  .bar-operational {
    background: Highlight;
  }
  .bar-major-outage,
  .bar-partial-outage,
  .bar-degraded {
    border-width: 3px;
  }
}
