/* Design tokens and rules live in DESIGN.md ("The Calibrated Instrument").
   Neutrals are chroma-0 by doctrine; the only color on the page is probe status. */

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/ibm-plex-mono-latin-400-d13bb5b4.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/ibm-plex-mono-latin-500-deab9c2b.woff2") format("woff2");
}

:root {
  --color-bg: oklch(1 0 0);
  --color-surface: oklch(0.97 0 0);
  --color-border: oklch(0.9 0 0);
  --color-ink: oklch(0.15 0 0);
  --color-muted: oklch(0.45 0 0);

  --color-success: oklch(0.45 0.11 152);
  --color-success-bg: oklch(0.96 0.03 152);
  --color-failure: oklch(0.5 0.11 70);
  --color-failure-bg: oklch(0.96 0.04 85);
  --color-error: oklch(0.45 0.15 27);
  --color-error-bg: oklch(0.95 0.03 27);
  --color-skipped: oklch(0.45 0 0);
  --color-skipped-bg: oklch(0.95 0 0);
  --color-unknown: oklch(0.45 0 0);
  --color-unknown-bg: oklch(0.95 0 0);

  /* Strip fills follow the Lightness Ladder: down < up < degraded.
     No-data days are shape-coded (short cells), not color-coded. */
  --strip-up: oklch(0.58 0.13 152);
  --strip-degraded: oklch(0.78 0.14 85);
  --strip-down: oklch(0.45 0.17 27);
  --strip-nodata: oklch(0.88 0 0);

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  background: var(--color-bg);
  color: var(--color-ink);
  line-height: 1.55;
}

:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

/* No link may ever fall through to user-agent blue — ink is the link color.
   Prose links underline at rest; data-surface links rely on weight. */
main a {
  color: var(--color-ink);
  font-weight: 600;
}

main p a,
main li a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  background: var(--color-bg);
  color: var(--color-ink);
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-ink);
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.site-header__brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-ink);
  text-decoration: none;
}

.container {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
  text-wrap: balance;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 1rem 0 0.25rem;
  text-wrap: balance;
}

.subtitle {
  color: var(--color-muted);
  margin-top: 0;
  max-width: 62ch;
}

section p,
section li {
  max-width: 62ch;
  text-wrap: pretty;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  background: var(--color-surface);
}

tbody td {
  transition: background 150ms var(--ease-out);
}

tbody tr:hover td {
  background: var(--color-surface);
}

tbody tr:last-child td {
  border-bottom: none;
}

td a {
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

.domain {
  display: block;
  font-family: var(--font-mono);
  color: var(--color-muted);
  font-size: 0.8rem;
}

.badge-row,
.anchor-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.5;
  white-space: nowrap;
}

.badge--success {
  color: var(--color-success);
  background: var(--color-success-bg);
}

.badge--failure {
  color: var(--color-failure);
  background: var(--color-failure-bg);
}

.badge--error {
  color: var(--color-error);
  background: var(--color-error-bg);
}

.badge--skipped {
  color: var(--color-skipped);
  background: var(--color-skipped-bg);
}

.badge--unknown {
  color: var(--color-unknown);
  background: var(--color-unknown-bg);
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: 6px;
}

.verdict {
  margin: 1rem 0 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.verdict--operational {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.verdict--error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.verdict--failure {
  background: var(--color-failure-bg);
  color: var(--color-failure);
}

.verdict__headline {
  margin: 0;
  font-weight: 500;
}

.verdict__incidents {
  list-style: none;
  margin: 0.375rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* The page's primary action mid-incident — underlined at rest, per the
   prose-link rule (weight alone is not enough inside a tinted module). */
.verdict__incidents a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.flash {
  margin: 0 0 1rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
}

.flash--notice {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.flash--alert {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.freshness {
  margin: 0.75rem 0 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.freshness--stale {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background: var(--color-failure-bg);
  color: var(--color-failure);
  font-weight: 500;
}

.incident-summary {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.incident-summary__item {
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.incident-summary__item--error {
  background: var(--color-error-bg);
}

.incident-summary__item--failure {
  background: var(--color-failure-bg);
}

.incident-summary__fact {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.incident-summary__item--error .incident-summary__fact {
  color: var(--color-error);
}

.incident-summary__item--failure .incident-summary__fact {
  color: var(--color-failure);
}

.incident-summary__meaning {
  display: block;
  margin-top: 0.125rem;
}

.alert-interest {
  margin: 0.75rem 0 0;
  padding: 0.875rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.alert-interest__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

.alert-interest__note {
  margin: 0.125rem 0 0.625rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  max-width: 62ch;
}

.alert-interest__form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.input-text {
  flex: 1 1 14rem;
  padding: 0.45rem 0.75rem;
  font: inherit;
  color: var(--color-ink);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.input-text::placeholder {
  color: var(--color-muted);
}

.button-primary {
  padding: 0.45rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--color-bg);
  background: var(--color-ink);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms var(--ease-out);
}

.button-primary:hover {
  background: oklch(0.3 0 0);
}

.anchor-meta {
  display: flex;
  gap: 1rem;
  margin: 1rem 0 2rem;
  flex-wrap: wrap;
}

.anchor-meta__item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 12px 20px;
}

.anchor-meta__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.anchor-meta__value {
  font-size: 1.25rem;
  font-weight: 500;
}

.anchor-meta__sub {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.runs-count {
  display: inline-block;
  margin-left: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--color-muted);
  text-decoration: none;
  transition: color 150ms var(--ease-out);
}

.back-link:hover {
  color: var(--color-ink);
  text-decoration: underline;
}

section {
  margin-bottom: 2rem;
}

.numeric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

td.numeric,
th.numeric {
  text-align: right;
  white-space: nowrap;
}

tbody td:first-child {
  white-space: nowrap;
}

.site-header__nav {
  margin-left: auto;
}

.site-header__nav a {
  color: var(--color-muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 150ms var(--ease-out);
}

.site-header__nav a:hover {
  color: var(--color-ink);
  text-decoration: underline;
}

.site-header__nav a[aria-current="page"] {
  color: var(--color-ink);
  font-weight: 600;
}

.anchor-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.anchor-filter__input {
  flex: 0 1 20rem;
}

.anchor-filter__count {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.anchor-rows-header {
  display: none;
}

.anchor-card__meta-item--muted {
  white-space: nowrap;
}

.anchor-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}


.anchor-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
}

.anchor-card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.anchor-card__heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
}

.anchor-card__name {
  color: var(--color-ink);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
}

.anchor-card__name:hover {
  text-decoration: underline;
}

.anchor-card__meta {
  margin: 0.5rem 0 0;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.uptime-strip {
  display: flex;
  gap: 2px;
  align-items: center;
  height: 18px;
}

/* Days without data are short cells — a shape difference no color vision
   can miss; only measured days get full-height colored cells. */
.uptime-strip__cell {
  flex: 1 1 0;
  min-width: 2px;
  height: 8px;
  border-radius: 2px;
  background: var(--strip-nodata);
  transition: filter 150ms var(--ease-out);
}

.uptime-strip__cell:hover {
  filter: brightness(1.08);
}

.uptime-strip__cell--up {
  height: 18px;
  background: var(--strip-up);
}

.uptime-strip__cell--degraded {
  height: 18px;
  background: var(--strip-degraded);
}

.uptime-strip__cell--down {
  height: 18px;
  background: var(--strip-down);
}

.uptime-strip-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.strip-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1.25rem;
  margin: 0.75rem 0 1rem;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-muted);
}

.strip-legend li {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.strip-legend__swatch {
  display: inline-block;
  width: 10px;
  height: 5px;
  border-radius: 2px;
  background: var(--strip-nodata);
}

.strip-legend__swatch--up {
  height: 10px;
  background: var(--strip-up);
}

.strip-legend__swatch--degraded {
  height: 10px;
  background: var(--strip-degraded);
}

.strip-legend__swatch--down {
  height: 10px;
  background: var(--strip-down);
}

.status-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
  align-items: baseline;
}

.status-list dd {
  margin: 0;
  max-width: 62ch;
}

/* Desktop: the anchor list becomes compact evidence rows under a mono
   header — scan cost stays low as the directory grows. Cards remain the
   mobile/tablet presentation. Column widths are fixed so the header grid
   and each row grid align. */
@media (min-width: 1024px) {
  .anchor-rows-header {
    display: grid;
    grid-template-columns: 11rem 22rem minmax(10rem, 1fr) 10rem;
    gap: 1rem;
    padding: 0.5rem 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
  }

  .anchor-cards {
    gap: 0;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
  }

  .anchor-card {
    display: grid;
    grid-template-columns: 11rem 22rem minmax(10rem, 1fr) 10rem;
    gap: 1rem;
    align-items: center;
    padding: 0.625rem 1.25rem;
    border: none;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    transition: background 150ms var(--ease-out);
  }

  .anchor-card:hover {
    background: var(--color-surface);
  }

  .anchor-card:last-child {
    border-bottom: none;
  }

  .anchor-card[hidden] {
    display: none;
  }

  .anchor-card__header {
    display: contents;
  }

  /* At row density the strip is a trend texture, not a per-day reader —
     cells go fluid so 90 days always fit the column. */
  .anchor-card__strip .uptime-strip {
    gap: 1px;
  }

  .anchor-card__strip .uptime-strip__cell {
    min-width: 0;
    border-radius: 1px;
  }

  .anchor-card__meta {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    font-size: 0.8125rem;
  }

  .anchor-card__meta-label,
  .anchor-card__meta-sep {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
}

/* Phones: restack the data tables into labeled rows — every column stays
   visible (the error message is the content that matters mid-incident). */
@media (max-width: 639px) {
  .container {
    padding: 1rem;
  }

  .site-header {
    padding: 0.875rem 1rem;
  }

  .anchor-meta {
    gap: 0.75rem;
  }

  .anchor-meta__item {
    flex: 1 1 8rem;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--color-border);
  }

  tbody tr:last-child {
    border-bottom: none;
  }

  td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.2rem 0;
    border-bottom: none;
  }

  td:empty {
    display: none;
  }

  /* Values must wrap rather than clip — the evidence timestamps are the
     point; nowrap here plus the table's overflow:hidden loses data. */
  td.numeric {
    white-space: normal;
  }

  td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
  }

  tbody td {
    transition: none;
  }

  tbody tr:hover td {
    background: transparent;
  }
}

/* Narrow phones */
@media (max-width: 479px) {
  .uptime-strip {
    gap: 1px;
  }

  .uptime-strip__cell {
    border-radius: 1px;
  }

  .status-list {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .status-list dd {
    margin-bottom: 0.75rem;
  }
}

/* Touch: hit areas ≥44px via padding + negative margin (visual layout unchanged) */
@media (pointer: coarse) {
  .site-header__nav a {
    display: inline-block;
    padding: 0.75rem 0.5rem;
    margin: -0.75rem -0.5rem;
  }

  .back-link {
    padding: 0.75rem 0.75rem 0.75rem 0;
    margin: -0.75rem 0;
  }

  .anchor-card__name {
    display: inline-block;
    padding: 0.5rem 0.5rem 0.5rem 0;
    margin: -0.5rem 0;
  }
}

.site-footer {
  margin-top: 2.5rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0 0 0.5rem;
  max-width: 70ch;
}

.site-footer a {
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
