/* Status palette. Fixed roles: good / warning / critical are never reused for
   decoration, and every use is paired with a glyph and a word, because the
   critical-vs-good pair is the red/green collision that roughly one man in
   twelve cannot separate by colour. */
:root {
  color-scheme: light;
  --plane:    #f9f9f7;
  --surface:  #fcfcfb;
  --ink:      #0b0b0b;
  --ink-2:    #52514e;
  --muted:    #898781;
  --border:   rgba(11, 11, 11, .10);
  --good:     #0ca30c;
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;
  --nodata:   #e1e0d9;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane:  #0d0d0d;
    --surface:#1a1a19;
    --ink:    #fff;
    --ink-2:  #c3c2b7;
    --border: rgba(255, 255, 255, .10);
    --nodata: #2c2c2a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:  #0d0d0d;
  --surface:#1a1a19;
  --ink:    #fff;
  --ink-2:  #c3c2b7;
  --border: rgba(255, 255, 255, .10);
  --nodata: #2c2c2a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 48px 20px 72px; }
a { color: inherit; }

.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 32px;
}
.masthead h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.masthead .sub { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.btn {
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 14px; background: var(--surface); color: var(--ink); cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--plane); border-color: var(--ink); }

/* Dark ink on the light fills: white text on good or warning falls under 4.5:1. */
.banner {
  display: flex; align-items: center; gap: 12px;
  border-radius: 10px; padding: 20px 24px; margin-bottom: 40px;
  font-size: 19px; font-weight: 620; color: #0b0b0b;
}
.banner.up       { background: var(--good); }
.banner.degraded { background: var(--warning); }
.banner.down     { background: var(--critical); color: #fff; }
.banner.nodata   { background: var(--nodata); color: var(--ink); }
.banner .icon {
  display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: 50%; border: 2px solid currentColor; font-size: 14px; font-weight: 700;
}

.caption {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-bottom: 10px;
}

.component {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px 14px; margin-bottom: 12px;
}
.component header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.component h2 { font-size: 15px; font-weight: 600; margin: 0; }

.state {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 550; color: var(--ink-2); white-space: nowrap;
}
.state .icon {
  display: grid; place-items: center; width: 16px; height: 16px;
  border-radius: 50%; color: #fff; font-size: 10px; font-weight: 700; line-height: 1;
}
.state.up .icon       { background: var(--good); }
.state.degraded .icon { background: var(--warning); color: #0b0b0b; }
.state.down .icon     { background: var(--critical); }
.state.nodata .icon   { background: var(--nodata); color: var(--ink-2); }

.strip { display: flex; gap: 2px; height: 34px; align-items: stretch; }
.bar { flex: 1 1 0; min-width: 0; border-radius: 2px; transition: transform .08s ease; }
.bar:hover { transform: scaleY(1.12); }
.bar.up       { background: var(--good); }
.bar.degraded { background: var(--warning); }
.bar.down     { background: var(--critical); }
.bar.nodata   { background: var(--nodata); }

/* Texture is the accessibility channel, not decoration: it appears only when the
   viewer has asked for more contrast or the platform forces its own colours. */
@media (prefers-contrast: more), (forced-colors: active) {
  .bar.down     { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.55) 0 2px, transparent 2px 4px); }
  .bar.degraded { background-image: repeating-linear-gradient(135deg, rgba(0,0,0,.45) 0 2px, transparent 2px 4px); }
}

.component footer {
  display: flex; align-items: baseline; gap: 10px;
  margin-top: 10px; color: var(--muted); font-size: 12px;
}
.component footer .mid {
  flex: 1; text-align: center; color: var(--ink-2); font-variant-numeric: tabular-nums;
}

.incidents { margin-top: 56px; }
.incidents h2 { font-size: 20px; font-weight: 650; margin: 0 0 8px; }
.incident-day {
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  border-bottom: 1px solid var(--border); padding-bottom: 8px; margin: 28px 0 14px;
}
.incident { margin-bottom: 26px; }
.incident h3 { font-size: 16px; font-weight: 620; margin: 0 0 10px; }
.incident h3.minor    { color: var(--warning); }
.incident h3.major    { color: var(--serious); }
.incident h3.critical { color: var(--critical); }
.update { margin: 0 0 14px; padding-left: 2px; }
.update .lead { font-weight: 650; }
.update p { margin: 0 0 3px; }
.update .stamp { color: var(--muted); font-size: 12.5px; }
.update img {
  display: block; max-width: 100%; height: auto; margin: 10px 0 0;
  border: 1px solid var(--border); border-radius: 8px;
}
.empty { color: var(--muted); font-size: 14px; }

.foot { margin-top: 44px; color: var(--muted); font-size: 12px; text-align: center; }

/* Admin */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; margin-bottom: 20px;
}
.card h2 { font-size: 15px; font-weight: 620; margin: 0 0 14px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
input[type=text], input[type=password], select, textarea {
  width: 100%; padding: 9px 11px; margin-bottom: 14px;
  background: var(--plane); color: var(--ink);
  border: 1px solid var(--border); border-radius: 6px;
  font: inherit; font-size: 14px;
}
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > div { flex: 1 1 180px; }
.alert {
  background: var(--critical); color: #fff; border-radius: 8px;
  padding: 11px 14px; margin-bottom: 18px; font-size: 14px;
}

@media (max-width: 640px) {
  .wrap { padding: 32px 14px 56px; }
  /* Show the most recent 45 days rather than squeezing 90 bars below one
     device pixel each. */
  .strip .bar:nth-child(-n+45) { display: none; }
  .component footer span:first-child { visibility: hidden; }
}
