/* ==========================================================================
   BASE: sensible defaults for every element.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;                         /* anchor links glide; scrolling itself is untouched */
  scroll-padding-top: calc(var(--header-h) + 16px); /* anchor targets aren't hidden under the header */
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img { display: block; max-width: 100%; height: auto; }

/* The HTML "hidden" attribute must always hide, even if a class sets display: grid/flex. */
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }

h1, h2, h3 {
  font-weight: 800;
  line-height: var(--lh-snug);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
p { text-wrap: pretty; }

a { color: inherit; }

::selection { background: var(--ink); color: var(--paper); }

/* Keyboard focus: thick, obvious, on-brand. (Mouse clicks don't show it.) */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* "Skip to content": invisible until a keyboard user tabs to it */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

/* Hidden visually but still read by screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
