/* ============================================================================
   ATLAS REDESIGN — System Status screen styles
   Prefix: .rd-status. Tokens only (--r-*) so Calm (almanac) + Operator themes
   both work automatically. $100M status-page language: calm grid, clear
   chips, zero drama — state is carried by the chip + a whisper of card
   border, never by loud fills. Content scrolls with the page.
   ========================================================================== */

.rd-status {
  font-family: var(--r-font-body);
  color: var(--r-body);
  padding: var(--r-gutter);
  max-width: var(--r-page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- page header ----------------------------------------------------------- */
.rd-sysstat-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-sysstat-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-clay);
}
.rd-sysstat-h1 {
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h1);
  font-weight: 600;
  line-height: 1.1;
  color: var(--r-ink);
  margin: 0;
}
.rd-sysstat-sub {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--r-muted);
  max-width: 640px;
}

/* ---- summary hero ------------------------------------------------------------ */
.rd-sysstat-hero {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.rd-sysstat-hero-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}
.rd-sysstat-count {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.rd-sysstat-count-n {
  font-family: var(--r-font-display);
  font-size: 46px;
  font-weight: 600;
  line-height: 1;
  color: var(--r-ink);
  font-variant-numeric: tabular-nums;
}
.rd-sysstat-count-of {
  font-family: var(--r-font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--r-muted);
}
.rd-sysstat-count-label {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--r-faint);
}
.rd-sysstat-count-skel {
  display: inline-block;
  width: 108px;
  height: 40px;
  border-radius: var(--r-radius-badge);
}

.rd-sysstat-hero-side {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.rd-sysstat-hero-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 200px;
}
.rd-sysstat-breakdown {
  font-size: 12px;
  line-height: 1.45;
  color: var(--r-muted);
  text-align: right;
}

/* ---- status chips (shared card + hero) ----------------------------------------
   Tone is the ONLY loud element on the page — everything else stays quiet. */
.rd-sysstat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--r-font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-radius: var(--r-radius-pill);
  padding: 3px 10px;
  white-space: nowrap;
}
.rd-sysstat-chip--hero { font-size: 11px; padding: 5px 13px; }
.rd-sysstat-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.rd-sysstat-chip[data-tone="good"] {
  background: color-mix(in srgb, var(--r-good) 13%, transparent);
  color: var(--r-good);
}
.rd-sysstat-chip[data-tone="neutral"] {
  background: var(--r-well);
  color: var(--r-muted);
}
.rd-sysstat-chip[data-tone="warn"] {
  background: color-mix(in srgb, var(--r-alert) 13%, transparent);
  color: var(--r-alert);
}
.rd-sysstat-chip[data-tone="pending"] {
  background: var(--r-well);
  color: var(--r-muted);
}
.rd-sysstat-chip[data-tone="pending"] .rd-sysstat-chip-dot {
  animation: rd-sysstat-pulse 1.2s ease-in-out infinite;
}

/* ---- "Run checks again" (≥44px target, keyboard-visible) ---------------------- */
.rd-sysstat-run {
  min-height: 44px;
  min-width: 44px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--r-font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--r-primary-ink);
  background: var(--r-primary);
  border: 1px solid transparent;
  border-radius: var(--r-radius-control);
  cursor: pointer;
  transition: box-shadow var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease),
              opacity var(--r-dur) var(--r-ease);
}
.rd-sysstat-run i { font-size: 16px; }
.rd-sysstat-run:hover:not(:disabled) {
  box-shadow: var(--r-shadow-hover);
  transform: translateY(-1px);
}
.rd-sysstat-run:active:not(:disabled) { transform: translateY(0); }
.rd-sysstat-run:disabled {
  opacity: .55;
  cursor: default;
}
.rd-sysstat-run[aria-busy="true"] i {
  animation: rd-sysstat-spin 1.1s linear infinite;
}

/* ---- component grid ------------------------------------------------------------ */
.rd-sysstat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}
.rd-sysstat-tile {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  transition: box-shadow var(--r-dur) var(--r-ease),
              border-color var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease);
}
.rd-sysstat-tile:hover { box-shadow: var(--r-shadow-hover); transform: translateY(-1px); }
/* a whisper of state on the border — chip stays the primary signal */
.rd-sysstat-tile[data-state="down"] {
  border-color: color-mix(in srgb, var(--r-alert) 38%, var(--r-border));
}
.rd-sysstat-tile[data-state="ok"] {
  border-color: color-mix(in srgb, var(--r-good) 22%, var(--r-border));
}

.rd-sysstat-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.rd-sysstat-name {
  margin: 0;
  font-family: var(--r-font-body);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--r-ink);
  min-width: 0;
}
.rd-sysstat-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--r-muted);
}

/* meta row pinned to the card foot so latency/time align across the grid */
.rd-sysstat-meta {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  color: var(--r-muted);
  border-top: 1px solid var(--r-hairline-2);
}
.rd-sysstat-lat {
  color: var(--r-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* semantic tone from the real measured round trip (ok checks only) */
.rd-sysstat-lat[data-tone="good"] { color: var(--r-good); }
.rd-sysstat-lat[data-tone="warn"] { color: var(--r-alert); }
.rd-sysstat-sep { color: var(--r-faint); }
.rd-sysstat-at { color: var(--r-faint); font-variant-numeric: tabular-nums; }
.rd-sysstat-meta-skel {
  width: 140px;
  height: 13px;
  border-radius: var(--r-radius-chip);
}

/* honest note (only for non-operational states — e.g. "warming") */
.rd-sysstat-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--r-faint);
  background: var(--r-well);
  border-radius: var(--r-radius-chip);
  padding: 6px 9px;
  overflow-wrap: anywhere;
}

/* ---- skeleton (shimmer while a check is in flight — never a number) ------------- */
.rd-sysstat-skel {
  background: linear-gradient(90deg,
    var(--r-well) 25%,
    color-mix(in srgb, var(--r-well) 45%, var(--r-surface)) 50%,
    var(--r-well) 75%);
  background-size: 200% 100%;
  animation: rd-sysstat-shimmer 1.4s ease infinite;
}
.rd-sysstat-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- history note (honest — no fabricated uptime) -------------------------------- */
.rd-sysstat-history {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--r-muted);
  padding: 11px 14px;
  border: 1px solid var(--r-hairline-2);
  border-radius: var(--r-radius-control);
  background: var(--r-well);
}
.rd-sysstat-history i {
  flex: none;
  font-size: 14px;
  color: var(--r-faint);
  transform: translateY(1px);
}

/* ---- provenance footer ------------------------------------------------------------ */
.rd-sysstat-foot {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .03em;
  color: var(--r-faint);
  padding: 2px 2px 6px;
}
.rd-sysstat-org {
  font-size: var(--r-fs-meta);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--r-mint-ink);
  background: var(--r-mint-surface);
  border-radius: var(--r-radius-pill);
  padding: 1px 8px;
}

/* ---- motion (respect reduced-motion) ------------------------------------------------ */
@keyframes rd-sysstat-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes rd-sysstat-pulse {
  0%, 100% { opacity: .35; }
  50%      { opacity: 1; }
}
@keyframes rd-sysstat-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .rd-sysstat-skel,
  .rd-sysstat-chip[data-tone="pending"] .rd-sysstat-chip-dot,
  .rd-sysstat-run[aria-busy="true"] i { animation: none; }
  .rd-sysstat-tile,
  .rd-sysstat-run { transition: none; }
  .rd-sysstat-tile:hover,
  .rd-sysstat-run:hover:not(:disabled) { transform: none; }
}

/* ---- focus visibility (keyboard) ----------------------------------------------------- */
.rd-status :focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* ---- responsive ------------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .rd-sysstat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .rd-sysstat-grid { grid-template-columns: 1fr; }
  .rd-sysstat-hero { flex-direction: column; align-items: stretch; }
  .rd-sysstat-hero-state { align-items: flex-start; min-width: 0; }
  .rd-sysstat-breakdown { text-align: left; }
  .rd-sysstat-hero-side { justify-content: space-between; }
}
@media (max-width: 480px) {
  .rd-sysstat-hero-side { flex-direction: column; align-items: stretch; gap: 14px; }
  .rd-sysstat-run { width: 100%; justify-content: center; }
  .rd-sysstat-count-n { font-size: 38px; }
}
