*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light dark;
}

html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-base), color var(--transition-base);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 var(--sp-4);
}

p { margin: 0 0 var(--sp-4); }

a {
  color: inherit;
  text-decoration-color: var(--border-strong);
}

a:not([class]) {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:not([class]):hover { text-decoration-thickness: 2px; }

img { max-width: 100%; display: block; }

button, input, select, textarea { font-family: inherit; font-size: 100%; color: inherit; }

/* Neutralize UA button chrome (default padding, border, background, OS bevel) so component
   classes (.btn, .icon-btn, .editor-toolbar__btn, ...) are the only thing deciding how a button
   looks. Without this, any button that doesn't explicitly set its own padding quietly falls back
   to the browser's default box model and looks "unstyled" next to ones that do (reported bug on
   the editor toolbar). */
button {
  cursor: pointer;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

/* Native checkboxes/radios keep their real semantics and keyboard behaviour but pick up the
   brand colour instead of the OS default blue - broadly supported, far simpler than rebuilding
   the control from scratch. */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent-ink);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

ul, ol { padding-left: 1.3em; }

hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }

::selection { background: var(--accent); color: var(--accent-contrast); }

/* Visible, deliberate focus ring everywhere - never rely on colour alone (spec #41/#95) */
:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
  border-radius: var(--r-1);
}
:focus:not(:focus-visible) { outline: none; }

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

.skip-link {
  position: absolute;
  left: var(--sp-3);
  top: -48px;
  background: var(--fg);
  color: var(--bg);
  padding: var(--sp-2) var(--sp-4);
  font-family: var(--font-mono);
  font-size: 13px;
  z-index: 200;
  transition: top var(--transition-fast);
  border-radius: var(--r-2);
}
.skip-link:focus { top: var(--sp-3); }

/* Monospace utility - dates, labels, status, counters (spec #39) */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

@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;
  }
}
