/* PhishFort Status — Watchstand Sentinel system, public face.
   Tokens mirror dashboard-2.0 DESIGN.md; status hues are functional encoding,
   never decoration. */

:root {
  --sentinel: #456ceb;
  --sentinel-deep: #3a5ac4;
  --sentinel-night: #132769;
  --sentinel-mist: #e3e9ff;
  --ink: #0a0d12;
  --ink-strong: #181d27;
  --ink-body: #414651;
  --ink-soft: #535862;
  --ink-mute: #717680;
  --ink-quiet: #a4a7ae;
  --divider: #e9eaeb;
  --surface: #fdfdfd;
  --surface-panel: #f5f5f5;
  --surface-card: #ffffff;

  --st-operational: #17b26a;
  --st-operational-soft: #ecfdf3;
  --st-operational-text: #067647;
  --st-degraded: #f79009;
  --st-degraded-soft: #fffaeb;
  --st-degraded-text: #b54708;
  --st-delayed: #7a5af8;
  --st-delayed-soft: #f5f3ff;
  --st-delayed-text: #5925dc;
  --st-partial: #f04438;
  --st-partial-soft: #fef3f2;
  --st-partial-text: #b42318;
  --st-major: #f04438;
  --st-major-soft: #fef3f2;
  --st-major-text: #b42318;
  --st-maintenance: #4e5ba6;
  --st-maintenance-soft: #f8f9fc;
  --st-maintenance-text: #3e4784;
  --st-unknown: #a4a7ae;
  --st-unknown-soft: #f5f5f5;
  --st-unknown-text: #535862;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-menu: 0 2.91px 4.58px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);

  --z-dropdown: 30;
}

* { box-sizing: border-box; }

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: InterVariable, Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: "cv05";
  color: var(--ink);
  background: var(--surface);
  line-height: 1.5;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--sentinel); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--sentinel-deep); }
b { font-weight: 600; }
time { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--sentinel);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Sentinel-on-Sentinel is invisible; the band gets a white ring. */
.band :focus-visible { outline-color: #fff; }

/* ---------- Header band ---------- */

.band {
  background: var(--sentinel-deep);
  color: #fff;
}

.band__inner {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mesh {
  position: absolute;
  inset: 0 0 0 auto;
  width: 340px;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to left, rgba(0,0,0,0.9), transparent);
  mask-image: linear-gradient(to left, rgba(0,0,0,0.9), transparent);
}

.band__brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.band__mark { width: 20px; height: 22px; }

.band__name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.band__page { font-weight: 400; color: var(--sentinel-mist); }

/* ---------- Subscribe ---------- */

.subscribe { position: relative; z-index: var(--z-dropdown); }

.subscribe__button {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 1rem;
  white-space: nowrap;
  transition: box-shadow 150ms cubic-bezier(0.22, 1, 0.36, 1);
}
.subscribe__button::-webkit-details-marker { display: none; }
.subscribe__button:hover { box-shadow: 0 0 0 2px var(--sentinel-deep), 0 0 0 4px rgba(255, 255, 255, 0.45); }

.subscribe__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 40px));
  background: var(--surface-card);
  color: var(--ink);
  border: 1px solid var(--divider);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-menu);
  padding: 16px;
}

.subscribe__label {
  display: block;
  color: var(--ink-body);
  margin-bottom: 10px;
}

.subscribe__row { display: flex; gap: 8px; }

.subscribe__input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 4px 12px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
  font: inherit;
  color: var(--ink);
  background: var(--surface-card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.subscribe__input::placeholder { color: var(--ink-mute); }
.subscribe__input:focus { outline: 2px solid var(--sentinel); outline-offset: 0; }

.subscribe__submit {
  height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--sentinel);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 150ms cubic-bezier(0.22, 1, 0.36, 1);
}
.subscribe__submit:hover { box-shadow: 0 0 0 2px var(--surface-card), 0 0 0 4px rgba(69, 108, 235, 0.55); }

.subscribe__hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.subscribe__done { color: var(--st-operational-text); font-weight: 500; }
.subscribe__error { color: var(--st-partial-text); margin-top: 8px; }

/* ---------- Page ---------- */

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 0;
}

/* ---------- Verdict ---------- */

.verdict {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface-card);
  border: 1px solid var(--divider);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 20px 24px;
}
.verdict--operational { border-color: var(--st-operational); }
.verdict--degraded { border-color: var(--st-degraded); }
.verdict--delayed { border-color: var(--st-delayed); }
.verdict--partial { border-color: var(--st-partial); }
.verdict--major { border-color: var(--st-major); }
.verdict--maintenance { border-color: var(--st-maintenance); }

.verdict__main { display: flex; align-items: center; gap: 14px; min-width: 0; }

.verdict__icon { width: 26px; height: 26px; flex: none; }
.verdict--operational .verdict__icon { color: var(--st-operational); }
.verdict--degraded .verdict__icon { color: var(--st-degraded); }
.verdict--delayed .verdict__icon { color: var(--st-delayed); }
.verdict--partial .verdict__icon { color: var(--st-partial); }
.verdict--major .verdict__icon { color: var(--st-major); }
.verdict--maintenance .verdict__icon { color: var(--st-maintenance); }
.verdict--unknown .verdict__icon { color: var(--st-unknown); }

.verdict__headline {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-wrap: balance;
}

.verdict__note { color: var(--ink-soft); margin-top: 4px; max-width: 60ch; }
.verdict__note[hidden] { display: none; }

.verdict__fresh {
  color: var(--ink-soft);
  font-size: 0.857rem;
  text-align: right;
  flex: none;
}
.verdict__cadence { color: var(--ink-mute); }

/* ---------- Pills ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border-radius: var(--radius-lg);
  font-size: 0.857rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.pill__dot { position: relative; display: inline-flex; }
.pill__icon { width: 13px; height: 13px; }

.pill--operational { background: var(--st-operational-soft); color: var(--st-operational-text); }
.pill--operational .pill__icon { color: var(--st-operational); }
.pill--degraded { background: var(--st-degraded-soft); color: var(--st-degraded-text); }
.pill--degraded .pill__icon { color: var(--st-degraded); }
.pill--delayed { background: var(--st-delayed-soft); color: var(--st-delayed-text); }
.pill--delayed .pill__icon { color: var(--st-delayed); }
.pill--partial { background: var(--st-partial-soft); color: var(--st-partial-text); }
.pill--partial .pill__icon { color: var(--st-partial); }
.pill--major { background: var(--st-major-soft); color: var(--st-major-text); }
.pill--major .pill__icon { color: var(--st-major); }
.pill--maintenance { background: var(--st-maintenance-soft); color: var(--st-maintenance-text); }
.pill--maintenance .pill__icon { color: var(--st-maintenance); }
.pill--unknown { background: var(--st-unknown-soft); color: var(--st-unknown-text); }
.pill--unknown .pill__icon { color: var(--st-unknown); }

/* The one sanctioned motion: a ping behind an active incident's dot. */
.pill__ping {
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .pill__ping { animation: ping 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite; }
  @keyframes ping {
    0% { transform: scale(0.6); opacity: 0.7; }
    70%, 100% { transform: scale(1.45); opacity: 0; }
  }
}

/* ---------- Groups & ledger ---------- */

.group { margin-top: 36px; }

.group__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.group__title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.group__note { color: var(--ink-soft); font-size: 0.857rem; margin-top: 3px; max-width: 56ch; }

.ledger {
  background: var(--surface-card);
  border: 1px solid var(--divider);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.system + .system { border-top: 1px solid var(--divider); }

.system__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 20px 16px;
  cursor: pointer;
  list-style: none;
  transition: background-color 150ms cubic-bezier(0.22, 1, 0.36, 1);
}
.system__head::-webkit-details-marker { display: none; }
.system__head:hover { background: #f8f9fb; }
.system__head:focus-visible { outline-offset: -2px; }

.system__title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.system__name { font-weight: 500; white-space: nowrap; }
.system__desc {
  color: var(--ink-soft);
  font-size: 0.857rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system__chevron {
  width: 14px;
  height: 14px;
  color: var(--ink-quiet);
  transition: transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
}
.system[open] .system__chevron { transform: rotate(90deg); }

/* ---------- Uptime bars ---------- */

.uptime { grid-column: 1 / -1; }

.uptime__bar {
  display: grid;
  grid-template-columns: repeat(90, 1fr);
  gap: 2px;
  height: 22px;
}

.cell { border-radius: 2px; background: var(--surface-panel); min-width: 0; }
.cell--operational { background: rgba(23, 178, 106, 0.5); }
.cell--degraded { background: var(--st-degraded); }
.cell--delayed { background: var(--st-delayed); }
.cell--partial { background: rgba(240, 68, 56, 0.65); }
.cell--major { background: var(--st-major); }
.cell--maintenance { background: var(--st-maintenance); }
.cell--nodata { background: #ededee; }

.uptime__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.857rem;
  font-variant-numeric: tabular-nums;
}
.uptime__pct { color: var(--ink-body); font-weight: 500; }

/* ---------- Drill-down ---------- */

.system__body { padding: 2px 20px 16px; }

.drill {
  background: var(--surface-panel);
  border-radius: var(--radius-lg);
  padding: 4px 14px;
}

.drill__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
}
.drill__item + .drill__item { border-top: 1px solid var(--divider); }

.drill__name { color: var(--ink-body); }

.drill__state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.857rem;
  font-weight: 600;
}
.drill__state svg { width: 12px; height: 12px; }
.drill__state--ok { color: var(--st-operational-text); }
.drill__state--ok svg { color: var(--st-operational); }
.drill__state--fail { color: var(--st-degraded-text); }
.drill__state--fail svg { color: var(--st-degraded); }

.drill--empty { color: var(--ink-soft); padding: 12px 14px; }

.system__checked {
  color: var(--ink-mute);
  font-size: 0.857rem;
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Incidents ---------- */

.incidents { margin-top: 20px; display: grid; gap: 12px; }

.incident, .maint {
  background: var(--surface-card);
  border: 1px solid var(--divider);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 20px 24px;
}
.incident--degraded { border-color: #fedf89; }
.incident--delayed { border-color: #ddd6fe; }
.incident--partial, .incident--major { border-color: #fecdca; }

.incident__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.incident__title { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }

.incident__meta {
  color: var(--ink-mute);
  font-size: 0.857rem;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

.incident__updates { margin-top: 14px; display: grid; gap: 12px; }

.incident__update {
  border-left: 1px solid var(--divider);
  padding-left: 14px;
}

.incident__stamp { color: var(--ink-mute); font-size: 0.857rem; font-variant-numeric: tabular-nums; }
.incident__stamp b { color: var(--ink-body); font-weight: 600; }

.incident__body { color: var(--ink-body); margin-top: 3px; max-width: 70ch; }

/* ---------- Sections, legend, footer ---------- */

.section { margin-top: 40px; display: grid; gap: 12px; }

.section__title { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.section__sub { color: var(--ink-mute); font-weight: 400; font-size: 0.857rem; margin-left: 6px; }

.empty {
  color: var(--ink-soft);
  background: var(--surface-panel);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  max-width: none;
}

.legend {
  margin-top: 22px;
  padding: 0 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--ink-soft);
  font-size: 0.857rem;
}
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__icon { width: 12px; height: 12px; }
.legend__icon--operational { color: var(--st-operational); }
.legend__icon--degraded { color: var(--st-degraded); }
.legend__icon--delayed { color: var(--st-delayed); }
.legend__icon--partial { color: var(--st-partial); }
.legend__icon--major { color: var(--st-major); }
.legend__icon--maintenance { color: var(--st-maintenance); }

.foot {
  max-width: 760px;
  margin: 48px auto 0;
  padding: 20px 20px 44px;
  border-top: 1px solid var(--divider);
  color: var(--ink-mute);
  font-size: 0.857rem;
  display: grid;
  gap: 6px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .system__desc { display: none; }
  .verdict { flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px 20px; }
  .verdict__fresh { text-align: left; }
  .uptime__bar { gap: 1px; }
  .group__head { flex-wrap: wrap; }
  .band__inner { padding: 14px 16px; }
  .page { padding: 20px 16px 0; }
  .incident__head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  .system__chevron, .subscribe__button, .subscribe__submit, .system__head { transition: none; }
}
