/* base.css — reset, ground, typography.
   Loads after tokens.css; every value below reads a custom property from
   there rather than hard-coding a hex or a size. */

/* Source Serif 4 is a variable font; Google serves the same physical file
   for every static weight instance, so regular and bold below point at
   byte-identical files (see assets/vendor/SOURCES.md) and rely on the
   font's own fvar table to render the requested weight. */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/source-serif-4-regular.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/source-serif-4-bold.woff2") format("woff2");
}

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

body {
  margin: 0;
}

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

html {
  color-scheme: dark;
  /* The accent glow is deliberately painted wider than the region it sits
     behind, which on a narrow viewport would otherwise push the document
     sideways. `clip` rather than `hidden`: it suppresses the overflow
     without turning the root into a scroll container, so the sticky header
     keeps working. */
  overflow-x: clip;
}

body {
  overflow-x: clip;
}

body {
  background: var(--canvas);
  background-image: var(--canvas-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  font: var(--size-body)/var(--leading-body) var(--font-body);
  /* No -webkit-font-smoothing: antialiased here — on this near-black ground
     it thins the stems and costs legibility rather than improving it. */
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-ui);
  font-weight: bold;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

.article h1,
article h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 0.98;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-line: underline;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

/* Scrollbar — always visible, never auto-hidden. */
html {
  scrollbar-color: var(--panel-border-bright) transparent;
  scrollbar-width: auto;
}

::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--panel-border-bright);
  border-radius: 7px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* Focus rings are never suppressed. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
