/* Reset, typography and global primitives. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
:root[data-motion="reduce"] { scroll-behavior: auto; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, pre { margin: 0; }
ul[role="list"], ol[role="list"], .list-reset { list-style: none; padding: 0; margin: 0; }
img, svg, video, canvas, audio { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
table { border-collapse: collapse; border-spacing: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
[hidden] { display: none !important; }
template { display: none; }
summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }
abbr[title] { text-decoration: none; }

h1, .h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  font-weight: 600;
  letter-spacing: -0.015em;
}
h2, .h2 {
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  font-weight: 600;
  letter-spacing: -0.01em;
}
h3, .h3 {
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  font-weight: 600;
}
.eyebrow {
  font-size: var(--fs-eyebrow);
  line-height: var(--lh-eyebrow);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
}
.prose {
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body-lg);
  max-width: var(--prose-max);
}
.prose p + p { margin-top: var(--space-3); }

a {
  color: var(--color-primary-fg);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover { text-decoration: underline; }

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

/* Focus ring (§6.1.4): blue, never removed without replacement. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible { outline-offset: 1px; }

code, kbd, pre, samp, .mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: var(--lh-mono);
}
kbd, .kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1;
}

.tabular { font-variant-numeric: tabular-nums; }

/* Visually hidden but available to assistive tech. */
.sr-only {
  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 links (§10 2.4.1). */
.skip-link {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-skiplink);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-weight: 600;
  box-shadow: var(--shadow-3);
  transform: translateY(-200%);
}
.skip-link:focus,
.skip-link:focus-visible { transform: none; text-decoration: none; }

/* Icons (Lucide sprite): stroke inherits into the <use> shadow tree. */
.icon {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.icon--14 { width: 14px; height: 14px; stroke-width: 2; }
.icon--18 { width: 18px; height: 18px; }
.icon--20 { width: 20px; height: 20px; }
.icon--24 { width: 24px; height: 24px; }
.icon--32 { width: 32px; height: 32px; stroke-width: 1.5; }
.icon--40 { width: 40px; height: 40px; stroke-width: 1.5; }
.icon--glyph { fill: currentColor; stroke: none; }

@keyframes spin { to { transform: rotate(360deg); } }
.icon--spin { animation: spin 0.9s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="no"]) .icon--spin { animation: none; }
}
:root[data-motion="reduce"] .icon--spin { animation: none; }

@media (forced-colors: active) {
  .icon { stroke: CanvasText; }
  .pill, .badge, .tag { border: 1px solid CanvasText; }
}

/* Scrollbars that match the theme. */
* { scrollbar-color: var(--color-surface-3) transparent; scrollbar-width: thin; }

/* Links inside running text are underlined (not identified by colour alone). */
:is(.banner, .prose, .field__help, .empty__body) a:not(.btn),
p:not(.page-header__meta) > a:not([class]) { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
