:root {
  color-scheme: light dark;
  --background: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #eef2f6;
  --text: #18202a;
  --muted: #5c6875;
  --border: #d9e0e7;
  --accent: #3157d5;
  --accent-contrast: #ffffff;
  --success: #18794e;
  --warning: #956200;
  --danger: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #10151c;
    --surface: #18212b;
    --surface-muted: #202b37;
    --text: #edf2f7;
    --muted: #a9b5c2;
    --border: #344150;
    --accent: #8aa4ff;
    --accent-contrast: #10151c;
    --success: #75d6a8;
    --warning: #f2c45e;
    --danger: #ff8a80;
  }
}

* { box-sizing: border-box; }

html { line-height: 1.6; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}

a { color: var(--accent); }

a:focus-visible {
  outline: 0.2rem solid var(--accent);
  outline-offset: 0.2rem;
  border-radius: 0.2rem;
}

.shell {
  width: min(70rem, calc(100% - 2rem));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -6rem;
  z-index: 20;
  padding: 0.65rem 0.9rem;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 750;
}

.skip-link:focus { top: 1rem; }

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-row,
.footer-row {
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-name {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-header nav a {
  font-weight: 650;
  text-decoration: none;
}

.hero {
  padding: clamp(3rem, 8vw, 5rem) 0 2rem;
}

.hero h1 {
  margin: 0;
  max-width: 52rem;
  font-size: clamp(2.4rem, 7vw, 4.75rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lede {
  max-width: 50rem;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
}

.panel {
  margin: 1rem 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.05);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-heading h2 {
  margin: 0;
  line-height: 1.2;
}

.muted { color: var(--muted); }

.button-link {
  display: inline-block;
  flex: none;
  padding: 0.65rem 0.9rem;
  border-radius: 0.55rem;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 750;
  text-decoration: none;
}

.relay-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--surface);
}

.relay-table-header,
.relay-summary {
  display: grid;
  grid-template-columns:
    minmax(13rem, 2fr)
    minmax(7rem, 0.78fr)
    minmax(8rem, 0.9fr)
    minmax(10rem, 1.08fr)
    minmax(10rem, 1.08fr);
  gap: 0.9rem;
  align-items: center;
}

.relay-table-header {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.relay-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.relay-rows > li + li {
  border-top: 1px solid var(--border);
}

.relay-row {
  background: var(--surface);
}

.relay-row[open] {
  background: var(--background);
}

.relay-summary {
  min-height: 3.45rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  list-style-position: outside;
}

.relay-summary:hover {
  background: var(--surface-muted);
}

.relay-summary:focus-visible {
  outline: 0.2rem solid var(--accent);
  outline-offset: -0.2rem;
}

.relay-name,
.relay-cell {
  min-width: 0;
}

.relay-name {
  font-weight: 750;
  overflow-wrap: anywhere;
}

.relay-name a {
  text-underline-offset: 0.12em;
}

.relay-cell {
  color: var(--muted);
  font-size: 0.9rem;
}

.relay-time time {
  white-space: nowrap;
}

.cell-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.relay-details {
  padding: 0 1rem 1rem 2.35rem;
}

.relay-details dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.relay-details dt {
  margin-bottom: 0.2rem;
  font-size: 0.78rem;
}

.relay-details dd {
  font-size: 0.88rem;
}

.empty-state {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px dashed var(--border);
  border-radius: 0.8rem;
  background: var(--surface-muted);
  text-align: center;
}

.empty-state p {
  max-width: 42rem;
  margin: 0.5rem auto 0;
  color: var(--muted);
}

.empty-state .empty-title {
  margin-top: 0;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 800;
}

.pagination {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: 1.25rem;
}

/* Keep backward navigation at the left edge and forward navigation at the right.
   The current public cursor is forward-only, so only the next slot is rendered. */
.pagination-previous { margin-right: auto; }
.pagination-next { margin-left: auto; }

dt { font-weight: 750; }

dd {
  margin-left: 0;
  color: var(--muted);
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}


.operator-contact {
  display: grid;
  justify-items: end;
  gap: 0.45rem;
}

.operator-links,
.operator-diagnostics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1rem;
}

.operator-links a { font-weight: 650; }

.operator-diagnostics {
  justify-content: flex-end;
  color: var(--warning);
  font-size: 0.9rem;
  font-weight: 650;
}

.operator-diagnostic { max-width: 34rem; }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.footer-row { min-height: 5rem; }

.footer-about,
.software-links {
  display: grid;
  gap: 0.2rem;
}

.software-links {
  font-size: 0.9rem;
}

@media (max-width: 48rem) {
  .section-heading,
  .header-row,
  .footer-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-row,
  .footer-row { padding-block: 1rem; }

  .operator-contact { justify-items: start; }

  .operator-diagnostics { justify-content: flex-start; }
}

.signal-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.signal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
}

.signal-badge::before {
  display: inline-block;
  min-width: 1em;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.heartbeat-healthy,
.reachability-reachable { color: var(--success); }

.heartbeat-healthy::before,
.reachability-reachable::before { content: "✓"; }

.heartbeat-stale {
  color: var(--warning);
  border-style: dashed;
}

.heartbeat-stale::before { content: "!"; }

.heartbeat-dead,
.heartbeat-prune,
.reachability-unreachable { color: var(--danger); }

.heartbeat-dead,
.heartbeat-prune { border-style: double; border-width: 3px; }

.heartbeat-dead::before,
.reachability-unreachable::before { content: "×"; }

.heartbeat-prune::before { content: "!!"; min-width: 1.4em; }

.heartbeat-not_observed,
.reachability-unknown {
  color: var(--muted);
  border-style: dotted;
}

.heartbeat-not_observed::before,
.reachability-unknown::before { content: "?"; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
}

.status-definition {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--background);
}

.status-definition dd { margin-top: 0.35rem; }


@media (max-width: 62rem) {
  .relay-table-header {
    display: none;
  }

  .relay-summary {
    grid-template-columns: minmax(12rem, 1.8fr) repeat(2, minmax(7rem, 0.85fr));
    gap: 0.55rem 0.8rem;
    padding-block: 0.7rem;
  }

  .relay-time {
    display: none;
  }

  .relay-details dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 42rem) {
  .relay-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .relay-name {
    grid-column: 1 / -1;
    font-size: 1rem;
  }

  .relay-cell {
    display: grid;
    gap: 0.25rem;
  }

  .cell-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
  }

  .relay-details {
    padding: 0 0.75rem 0.75rem;
  }

  .relay-details dl,
  .status-grid {
    grid-template-columns: 1fr;
  }
}
