/* base.css — what every MMG system shares, and nothing of how it looks.
   It holds behaviour, accessibility and print: the things that must work the same way in every system
   whatever its design. It sets no typeface, no palette, no radius, no shadow and no layout; those are
   this system's own, in ui/theme.css (its tokens) and ui/system.css (its styling), and the reasons for
   them are in design/direction.md.
   It reads the contract tokens that every ui/theme.css must define on :root:
     --font-body  --font-display  --font-mono  --text-body
     --canvas  --surface  --ink  --ink-2  --ink-3  --line  --line-strong
     --accent  --accent-ink  --accent-soft  --focus
     --ok  --ok-soft  --warn  --warn-soft  --bad  --bad-soft  --none  --none-soft
     --ease  --dur-fast  --dur-base
   Serve this file unchanged, before theme.css and system.css. The kit owns it. */

/* ---------- ground ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--ink);
  background: var(--canvas);
}
button, input, select, textarea { font: inherit; color: inherit; }
img, video { max-width: 100%; height: auto; }

/* ---------- focus: a system may restyle the ring; it may never remove it ---------- */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- states every control answers to; the look of each state is the system's ---------- */
[aria-busy="true"] { cursor: progress; }
:disabled, [aria-disabled="true"] { cursor: not-allowed; }

/* ---------- numbers and tables: mechanics only ---------- */
table { font-variant-numeric: tabular-nums; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow: auto; }
.table-wrap thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }  /* the header row stays while the wrap scrolls */

/* ---------- status: colour, symbol and word together, the same meaning in every system ----------
   <span class="status" data-state="ok">Слово</span> with ok, warn or bad; no data-state means no data.
   base.css gives the meaning (the colour role and the symbol); system.css gives the shape.
   A system may replace the symbol with its own icon, as long as the four states keep four different shapes. */
.status { color: var(--none); }
.status::before { content: "–"; margin-inline-end: 0.35em; }
.status[data-state="ok"] { color: var(--ok); }
.status[data-state="ok"]::before { content: "✓"; }
.status[data-state="warn"] { color: var(--warn); }
.status[data-state="warn"]::before { content: "!"; }
.status[data-state="bad"] { color: var(--bad); }
.status[data-state="bad"]::before { content: "✕"; }

/* ---------- utilities ---------- */
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- reduced motion: every system's motion switches off here, so design it to be optional ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- print: black on white, controls out, rows whole ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .no-print, button, .btn, nav { display: none !important; }
  a { color: #000; text-decoration: none; }
  .table-wrap { overflow: visible; }
  thead { display: table-header-group; }
  .table-wrap thead th { position: static; background: #fff; }
  tr { break-inside: avoid; }
  .status, .status[data-state] { color: #000; }
  * { box-shadow: none !important; text-shadow: none !important; }
}
