/* ──────────────────────────────────────────────────────────────
   CI/CD Debug Assistant — design tokens and shared UI.

   Direction: a diagnostic instrument, not a marketing page. The
   product reads log text, so monospace carries the display type
   and the accent is reserved for annotation — the mark that points
   at the line that broke the build.
   ────────────────────────────────────────────────────────────── */

:root {
  color-scheme: light;

  --paper: #edeff2;
  --slab: #ffffff;
  --ink: #14181f;
  --ink-soft: #4a5361;
  --ink-faint: #79828f;
  --rule: #c9cfd8;
  --rule-soft: #dfe3e9;

  /* Reserved for annotation and interaction, nothing decorative. */
  --signal: #1f4fd8;
  --signal-wash: #e8edfd;

  --fault: #b3261e;
  --fault-wash: #fbeceb;
  --ok: #12704a;
  --ok-wash: #e7f2ed;
  --warn: #8a5a00;
  --warn-wash: #fbf1de;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo,
    Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --measure: 78rem;

  --radius: 3px;
  --shadow: 0 1px 2px rgba(20, 24, 31, 0.06), 0 8px 24px rgba(20, 24, 31, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

p {
  margin: 0;
}

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

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

.u-wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* An eyebrow labels a region; it never repeats the heading. */
.u-eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ── Controls ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.125rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:hover {
  background: var(--signal);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  background: var(--rule);
  color: var(--ink-faint);
  cursor: not-allowed;
}

.btn--quiet {
  background: transparent;
  border-color: var(--rule);
  color: var(--ink);
}

.btn--quiet:hover {
  background: var(--slab);
  border-color: var(--signal);
  color: var(--signal);
}

.btn--danger:hover {
  background: var(--fault);
}

.btn--sm {
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
}

/* ── Status pills ─────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.pill--fault {
  background: var(--fault-wash);
  color: var(--fault);
}

.pill--ok {
  background: var(--ok-wash);
  color: var(--ok);
}

.pill--warn {
  background: var(--warn-wash);
  color: var(--warn);
}

.pill--idle {
  background: var(--rule-soft);
  color: var(--ink-soft);
}

/* ── Cards ────────────────────────────────────────────────── */

.card {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--slab);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--rule-soft);
}

.card__body {
  padding: 1.125rem;
}

/* ── Empty and error states: direction, not mood ──────────── */

.state {
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.state__title {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
}

.state__hint {
  margin-top: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.state__action {
  margin-top: 1.25rem;
}

.state--fault .state__title {
  color: var(--fault);
}

/* ── Log viewer: the signature element ────────────────────────
   A numbered gutter with the failing line bracketed and annotated
   in the margin, the way a reader marks up a page. The annotation
   is the product's whole claim, so it is the one loud thing here.
   ────────────────────────────────────────────────────────────── */

.log {
  overflow-x: auto;
  padding: 0.875rem 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--slab);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.log__line {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 1rem;
  padding-inline: 0.875rem 1.125rem;
  white-space: pre;
}

.log__no {
  color: var(--ink-faint);
  text-align: right;
  user-select: none;
}

.log__text {
  color: var(--ink-soft);
}

.log__line--fault {
  background: var(--fault-wash);
}

.log__line--fault .log__text {
  color: var(--fault);
  font-weight: 500;
}

.log__line--fault .log__no {
  color: var(--fault);
}

/* The margin mark: box-drawing glyph plus the engine's own words. */
.log__mark {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 1rem;
  padding: 0.25rem 1.125rem 0.375rem 0.875rem;
  color: var(--signal);
  font-size: 0.75rem;
  white-space: pre;
}

.log__mark span:last-child {
  font-weight: 500;
}

@media (max-width: 34rem) {
  .log__line,
  .log__mark {
    grid-template-columns: 2rem 1fr;
    gap: 0.625rem;
  }
}

/* ── Diagnosis ────────────────────────────────────────────── */

.dx__summary {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.dx__finding {
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--rule-soft);
}

.dx__finding:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.dx__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.dx__title {
  font-family: var(--mono);
  font-size: 0.9375rem;
  font-weight: 600;
}

.dx__detail {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

/* The fix is the payload, so it gets the accent rule. */
.dx__fix {
  margin-top: 0.75rem;
  padding: 0.75rem 0.875rem;
  border-left: 2px solid var(--signal);
  background: var(--signal-wash);
  font-size: 0.9375rem;
}

.dx__fix strong {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--signal);
  display: block;
  margin-bottom: 0.25rem;
}

/* ── Data table ───────────────────────────────────────────── */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  padding: 0.625rem 1.125rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 0.75rem 1.125rem;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table__link {
  font-family: var(--mono);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}

.table__link:hover {
  color: var(--signal);
  text-decoration: underline;
}

.table__meta {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.table__scroll {
  overflow-x: auto;
}

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

