/* ── Base layer: reset, typography, layout primitives ───────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px; /* sticky masthead must not cover anchor targets */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16.5px/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5 {
  margin: 0 0 .5em;
  font-weight: 600;
  letter-spacing: -.022em;
  line-height: 1.15;
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 1.35rem + 2.6vw, 3.35rem); letter-spacing: -.032em; }
h2 { font-size: clamp(1.55rem, 1.2rem + 1.3vw, 2.2rem); letter-spacing: -.028em; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1.1em; color: var(--text-soft); }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 1.1em; padding-left: 1.25em; color: var(--text-soft); }
li { margin-bottom: .4em; }
li:last-child { margin-bottom: 0; }

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

strong, b { font-weight: 600; color: var(--text); }

img, svg, video { max-width: 100%; height: auto; display: block; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: .92em; }
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .08em .38em;
}

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

blockquote { margin: 0; }

[hidden] { display: none !important; }

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

/* ── Focus ─────────────────────────────────────────────────────────────── */

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}
.on-ink :focus-visible,
.masthead :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--focus-ink);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: top .12s ease-out;
}
.skip-link:focus { top: 12px; color: #fff; }

/* Visually hidden but available to assistive technology. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Layout primitives ─────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}
.narrow { max-width: var(--narrow); margin-inline: auto; }

/* Explicit column counts rather than auto-fit: a six-card set must land as
   3 + 3, not 4 + 2. */
.grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 660px) {
  .grid-2, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 980px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.section { padding: clamp(56px, 7vw, 88px) 0; }
.section-soft { background: var(--bg-soft); }
.section-ink { background: var(--ink); color: var(--on-ink); }

.lead { font-size: 1.1rem; line-height: 1.6; color: var(--text-soft); }

/* ── Motion ────────────────────────────────────────────────────────────── */

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