/* =====================================================================
   BASE
   Fonts, scale tokens (type, space, motion), the document reset and the
   typographic defaults every page shares. Colour comes from tokens.css.
   ===================================================================== */

@font-face {
  font-family: "Selawik";
  src: url("../fonts/selawik-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Selawik";
  src: url("../fonts/selawik-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cascadia Mono";
  src: url("../fonts/cascadia-mono-latin-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  /* Selawik is the interface voice; Cascadia Mono is for machine-made evidence only. */
  --font-ui: "Selawik", "Segoe UI", system-ui, sans-serif;
  --font-data: "Cascadia Mono", "Consolas", ui-monospace, monospace;

  --text-xs: 12px;   /* dense mono values: branches, ages */
  --text-sm: 13px;   /* measured labels, record context */
  --text-md: 14px;   /* status words, mono values */
  --text-base: 15px; /* interface copy */
  --text-lg: 17px;   /* repository names, alert titles */
  --text-xl: 21px;   /* section headings */
  --text-2xl: 30px;  /* page headings */

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  --radius: 2px;     /* controls only; rows and regions stay square */
  --hit: 44px;       /* minimum touch target */

  --ease-settle: cubic-bezier(.2, 0, 0, 1);
  --time-hover: 120ms;
  --time-control: 180ms;
  --time-panel: 260ms;

  --shell-top: 56px;
  --shell-rail: 232px;
  --evidence-rail: 360px;

  font-family: var(--font-ui);
  font-synthesis-weight: none;
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
  color: var(--text-body);
  background: var(--bg);
}

* { box-sizing: border-box; }
/* The shell scrolls its work pane, never the document, so the top band stays put. */
html { min-width: 0; height: 100%; overflow: clip; }
body {
  min-width: 0;
  height: 100dvh;
  margin: 0;
  overflow: clip;
  color: var(--text-body);
  background: var(--bg);
  font-family: var(--font-ui);
  font-synthesis-weight: none;
  font-size: var(--text-base);
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; font-synthesis-weight: none; }
button, a { -webkit-tap-highlight-color: var(--surface-press); }
button { color: var(--text-body); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
a:active { color: var(--accent-press); }

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

[hidden] { display: none !important; }

/* Blazor focuses each page's h1 after navigation, for screen readers; no ring for that. */
h1:focus { outline: none; }

h1, h2, h3, p { min-width: 0; }
h1, h2, h3 { margin: 0; color: var(--text); font-weight: 600; line-height: 1.15; text-wrap: balance; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); line-height: 1.3; }
p { text-wrap: pretty; }

/* ---- Utilities ------------------------------------------------------ */

/* Machine-made evidence: repo ids, branches, run numbers, versions, timestamps. */
.mono {
  font-family: var(--font-data);
  font-size: var(--text-md);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* Small uppercase tracked labels: eyebrows, column heads, measured values. */
.measured-label {
  font-family: var(--font-data);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: .08em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--text-faint);
}

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

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

/* ---- Blazor's own chrome -------------------------------------------- */

#blazor-error-ui {
  position: fixed;
  z-index: 1000;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  background: var(--danger-fill);
  border-top: 1px solid var(--danger);
}
#blazor-error-ui .reload { font-weight: 600; }
#blazor-error-ui .dismiss { margin-left: auto; cursor: pointer; }

.blazor-error-boundary {
  padding: var(--space-3) var(--space-4);
  color: var(--text);
  background: var(--danger-fill);
}
.blazor-error-boundary::after { content: "Something on this part of the page failed. Reload to try again."; }

@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
}

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