/* BrainWeave — base: reset, type, links, focus. Uses tokens.css only. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + var(--s4)); }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font-family: var(--font-ui); font-size: var(--fs-md); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }

h1, h2, h3, .display { font-family: var(--font-read); font-weight: 500; line-height: var(--lh-tight); letter-spacing: -0.012em; text-wrap: balance; }
h1 { font-size: var(--fs-3xl); font-variation-settings: "opsz" 60; }
h2 { font-size: var(--fs-xl); font-variation-settings: "opsz" 30; font-weight: 550; }
h3 { font-size: var(--fs-lg); font-variation-settings: "opsz" 20; font-weight: 600; letter-spacing: 0; }
p { text-wrap: pretty; }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
a:hover { color: var(--accent-strong); text-decoration-color: currentColor; }
strong, b { font-weight: 650; }
mark { background: var(--mark); color: var(--ink); border-radius: 3px; padding: 0 .12em; }
kbd { font-family: var(--font-mono); font-size: .75rem; line-height: 1; padding: 3px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--ink-2); white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s6) 0; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

/* One focus ring everywhere: two-tone so it shows on paper, on cards and on the accent colour. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 4px var(--paper); border-radius: var(--r-sm); }
/* After each move to another page the app puts focus on the page's title (tabindex="-1"), or on the part of the page it
   opened at ([data-landing]), so a screen reader says where the reader is. Neither is a control, and the app put the
   focus there, not the reader: no ring, in any look. Everything the reader can press keeps its ring. */
h1[tabindex="-1"]:focus, [data-landing][tabindex="-1"]:focus { outline: none !important; box-shadow: none !important; }

.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: var(--s4); top: var(--s4); z-index: 100; transform: translateY(-200%); background: var(--ink); color: var(--paper); padding: var(--s3) var(--s4); border-radius: var(--r); font-weight: 600; text-decoration: none; }
.skip:focus { transform: none; color: var(--paper); }

/* small helpers the screens share */
.eyebrow { font-family: var(--font-ui); font-size: var(--fs-xs); font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.read { font-family: var(--font-read); font-size: var(--fs-read); line-height: var(--lh-read); font-variation-settings: "opsz" 18; }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.stack.tight { gap: var(--s2); }
.stack.loose { gap: var(--s8); }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }

@media (pointer: coarse) { :root { --hit: 44px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
