/* status-chip.css — shared styling for the API-status nav chip + the
   /status detail page. Both surfaces are populated by status-chip.js
   from /api/status. */

/* ── Edge cluster (.nav-edge): pin What's new + status to viewport right
   ────────────────────────────────────────────────────────────────────
   The right cluster on every gated page is .nav-secondary, which itself
   sits inside .nav-inner. The latter has `max-width: 1400px; margin: 0
   auto;` — so on a 1920px viewport, "the right edge of .nav-secondary"
   is ~260px short of the actual screen edge.

   To pin the system-info chips (What's new + All systems, plus the sep
   that visually leads them) to the actual viewport edge, the HTML wraps
   them in a `<div class="nav-edge">` placed at the end of .nav-secondary.

   At narrow viewports (< 1500px), .nav-edge stays in flow inside
   .nav-secondary — `margin-left: auto` pushes it to the right of the
   cluster, same way as everything else.

   At wide viewports, the wrapper escapes its flex parent via
   `position: absolute` against `nav.site` (set position:relative so
   .nav-edge anchors to the full nav width = viewport width). The
   `right: 16px` is the "bit of space" buffer so the chips don't touch
   the literal pixel edge.

   PR #238 first attempt used `order:` rules on individual chips —
   that only pushed them to .nav-secondary's right edge, which is
   constrained by .nav-inner's 1400px max-width. The wrapper escape
   here is the actual fix. */

.nav-edge {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

@media (min-width: 1500px) {
  nav.site { position: relative; }
  .nav-edge {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    margin-left: 0;
  }
}

.nav-status { position: relative; }

.nav-status-btn {
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.nav-status-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255,255,255,0.02);
}

.nav-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
  transition: background 0.2s;
}

/* Severity color glow — degraded + down get a soft pulsing halo so the
   chip catches the eye without being aggressive. */
.nav-status[data-level="ok"]       .nav-status-dot { box-shadow: 0 0 0 3px rgba(111,207,111,0.16); }
.nav-status[data-level="degraded"] .nav-status-dot { box-shadow: 0 0 0 3px rgba(212,194,122,0.18); animation: nav-status-pulse 2.4s ease-in-out infinite; }
.nav-status[data-level="down"]     .nav-status-dot { box-shadow: 0 0 0 3px rgba(200,122,122,0.22); animation: nav-status-pulse 1.8s ease-in-out infinite; }

.nav-status[data-level="degraded"] .nav-status-btn { border-color: rgba(212,194,122,0.28); color: var(--text); }
.nav-status[data-level="down"]     .nav-status-btn { border-color: rgba(200,122,122,0.32); color: var(--text); }

@keyframes nav-status-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* ── Dropdown panel ─────────────────────────────────────────────────── */

.nav-status-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  background: var(--surface-2, #221f1a);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 14px 16px;
  min-width: 300px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  z-index: 200;
}
.nav-status-menu.open { display: block; }

.nav-status-header {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-strong);
}

.nav-status-list { display: flex; flex-direction: column; gap: 8px; }

.nav-status-row {
  display: grid;
  grid-template-columns: 10px 1fr;
  column-gap: 10px;
  row-gap: 2px;
  align-items: start;
}
.nav-status-row-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--muted-2);
}
.nav-status-row-name {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
}
.nav-status-row-summary {
  grid-column: 2;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.nav-status-detail {
  display: block;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-strong);
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
}
.nav-status-detail:hover { color: var(--chalk); }

@media (max-width: 720px) {
  .nav-status-label { display: none; }
  .nav-status-btn { padding: 5px 8px; }
  .nav-status-menu { min-width: 240px; right: -8px; }
}

/* ── /status detail page (#statusPageMount) ─────────────────────────── */

.status-page-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 36px 40px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 32px;
}
.status-page-hero[data-level="ok"]       { border-color: rgba(111,207,111,0.32); }
.status-page-hero[data-level="degraded"] { border-color: rgba(212,194,122,0.38); }
.status-page-hero[data-level="down"]     { border-color: rgba(200,122,122,0.38); }

.status-page-overall {
  display: flex;
  align-items: center;
  gap: 14px;
}
.status-page-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 5px rgba(255,255,255,0.04);
}
.status-page-hero[data-level="degraded"] .status-page-dot,
.status-page-hero[data-level="down"]     .status-page-dot { animation: nav-status-pulse 2s ease-in-out infinite; }

.status-page-label {
  font-family: var(--f-serif);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--chalk);
  letter-spacing: -0.005em;
}
.status-page-note {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 720px;
}

/* ── Category cards (#234 redesign) ──────────────────────────────────
   Replaces the per-vendor table. Each card is collapsed by default;
   clicking the head expands the body inline (vendor breakdown +
   "what breaking means" line). One-screen layout — no separate
   detail pages.

   Color tiers driven by `data-level` on the .status-cat root:
     ok        — accent border on hover only, muted state text
     unknown   — same as ok, but state pill says "Status unknown"
     degraded  — amber border + state pill
     down      — danger border + state pill, soft pulse on the dot
*/

.status-page-categories {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.status-cat {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.status-cat[data-level="degraded"] { border-color: rgba(212,194,122,0.28); background: rgba(212,194,122,0.025); }
.status-cat[data-level="down"]     { border-color: rgba(200,122,122,0.32); background: rgba(200,122,122,0.025); }
.status-cat:hover { border-color: var(--border-strong); }

.status-cat-head {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}
.status-cat-head:hover { background: rgba(255,255,255,0.015); }

.status-cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted-2);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.04);
  transition: background 0.2s;
}
.status-cat[data-level="ok"]       .status-cat-dot { box-shadow: 0 0 0 4px rgba(111,207,111,0.12); }
.status-cat[data-level="degraded"] .status-cat-dot { box-shadow: 0 0 0 4px rgba(212,194,122,0.18); animation: nav-status-pulse 2.4s ease-in-out infinite; }
.status-cat[data-level="down"]     .status-cat-dot { box-shadow: 0 0 0 4px rgba(200,122,122,0.22); animation: nav-status-pulse 1.8s ease-in-out infinite; }

.status-cat-label-col { display: flex; flex-direction: column; gap: 2px; }
.status-cat-label {
  font-family: var(--f-serif);
  font-size: 1.1rem;
  color: var(--chalk);
  letter-spacing: -0.005em;
}
.status-cat-subtitle {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.4;
}

.status-cat-state {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.status-cat[data-level="ok"]       .status-cat-state { color: #6fcf6f; }
.status-cat[data-level="degraded"] .status-cat-state { color: var(--accent); }
.status-cat[data-level="down"]     .status-cat-state { color: var(--danger); }

.status-cat-chev {
  font-family: var(--f-mono);
  font-size: 0.95rem;
  color: var(--muted-2);
  width: 1.5em;
  text-align: center;
  transition: color 0.15s;
}
.status-cat-head:hover .status-cat-chev { color: var(--text); }

/* Expanded body */
.status-cat-body {
  padding: 4px 20px 20px;
  border-top: 1px solid var(--border);
}
.status-cat-impact {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
  padding: 14px 0;
  margin: 0;
}
.status-cat-impact.broken {
  color: var(--text);
  /* When something's actually broken, the impact line is the most
     important text in the body — give it a thin accent rule on the
     left like a callout. */
  padding-left: 12px;
  border-left: 2px solid var(--danger);
}
.status-cat[data-level="degraded"] .status-cat-impact.broken { border-left-color: var(--accent); }

/* Vendor breakdown table inside the expanded body */
.status-cat-vendors {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.status-cat-vendor {
  display: grid;
  grid-template-columns: auto 1.3fr 2fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 0.86rem;
}
.status-cat-vendor .vendor-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted-2);
}
.status-cat-vendor .vendor-name {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
}
.status-cat-vendor .vendor-summary {
  color: var(--muted);
  line-height: 1.4;
}
.status-cat-vendor .vendor-checked {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--muted-2);
  white-space: nowrap;
}
.status-cat-vendor .vendor-link {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.status-cat-vendor .vendor-link:hover { color: var(--chalk); }

@media (max-width: 720px) {
  .status-cat-head { padding: 14px 14px; gap: 10px; }
  .status-cat-state { display: none; }
  .status-cat-vendor {
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
  }
  .status-cat-vendor .vendor-summary { grid-column: 2; }
  .status-cat-vendor .vendor-checked,
  .status-cat-vendor .vendor-link { grid-column: 2; font-size: 0.7rem; }
}

.status-page-coverage {
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.6;
  padding: 18px 22px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.status-page-coverage code {
  background: rgba(255,255,255,0.05);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--f-mono);
  font-size: 0.86rem;
  color: var(--accent);
}

@media (max-width: 720px) {
  .status-page-hero { padding: 24px 20px; }
  .status-row-checked { display: none; }
}
