/* Reset, typography, layout primitives. One-class selectors keep specificity flat. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-muted: var(--muted);
  --bd: var(--line);
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.05; letter-spacing: var(--tracking-snug); margin: 0; text-wrap: balance; }
p { margin: 0; }
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--bd); margin: 0; }
::selection { background: var(--accent); color: var(--on-accent); }

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

/* themes: set on a section or body */
.theme-dark { --bg: var(--ink); --fg: var(--paper); --fg-muted: var(--muted-inv); --bd: var(--line-inv); }
.theme-soft { --bg: var(--soft); --fg: var(--ink); --fg-muted: var(--muted); --bd: var(--line); }
.theme-dark, .theme-soft { background: var(--bg); color: var(--fg); }

/* layout */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--space-5); }
.span-all { grid-column: 1 / -1; }
@media (min-width: 56rem) {
  .col-1-7 { grid-column: 1 / 8; }
  .col-1-8 { grid-column: 1 / 9; }
  .col-1-10 { grid-column: 1 / 11; }
  .col-5-12 { grid-column: 5 / 13; }
  .col-7-12 { grid-column: 7 / 13; }
  .col-8-12 { grid-column: 8 / 13; }
  .col-9-12 { grid-column: 9 / 13; }
}
.section { padding-block: var(--space-9); }
.section--tight { padding-block: var(--space-8); }
.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }
.measure { max-width: 62ch; }
.muted { color: var(--fg-muted); }

/* type helpers */
.display-xl { font-size: var(--step-5); letter-spacing: var(--tracking-tight); line-height: 0.92; font-weight: 600; }
.display-l { font-size: var(--step-4); letter-spacing: var(--tracking-tight); line-height: 0.96; font-weight: 600; }
.display-m { font-size: var(--step-3); letter-spacing: var(--tracking-snug); line-height: 1; }
.lead { font-size: var(--step-1); line-height: 1.45; }
.small { font-size: var(--step--1); }

.visually-hidden { 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-link { position: fixed; left: var(--space-3); top: -4rem; z-index: 200; background: var(--accent); color: var(--on-accent); padding: var(--space-3) var(--space-4); border-radius: var(--radius); font-weight: 600; transition: top var(--t-fast); }
.skip-link:focus { top: var(--space-3); }

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