/* Base element styles, typography and utilities. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt" 0;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
h1 { font-size: var(--fs-h1); letter-spacing: 0.01em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-sm); color: var(--text-2); }

p { margin: 0; }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; text-underline-offset: 2px; }

code,
kbd,
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  line-height: 18px;
  text-align: center;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Page headings receive focus programmatically on every navigation (so screen
 * readers announce the new screen). They are not controls: no ring, which
 * Chromium would otherwise draw on load (HANDOFF_U3 U3-H4). */
[tabindex="-1"]:focus-visible { outline: none; }

::selection { background: var(--accent-soft); }

.num,
.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

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

.muted { color: var(--text-3); }
.subtle { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }

.row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
}
.row--top { align-items: flex-start; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.stack--3 { gap: var(--s3); }
.stack--4 { gap: var(--s4); }
.stack--6 { gap: var(--s6); }

.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 0;
}

.skip-link {
  position: absolute;
  left: var(--s2);
  top: -40px;
  z-index: 100;
  padding: var(--s1) var(--s3);
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--s2); }

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

/* Boot screen (static HTML before the app module runs). */
.boot {
  min-height: 100vh;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
}
.boot__bar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 0 var(--s4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.boot__body {
  display: grid;
  place-items: center;
  color: var(--text-3);
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
}
