/* ═══════════════════════════════════════════════════════════════
 * NEXUS DSP — Base
 * Reset · font-face · html/body defaults · a11y primitives
 * ═══════════════════════════════════════════════════════════════ */

/* ── Self-hosted fonts — ZERO Google Fonts runtime loads ──── */

@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-latin-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-latin-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Public Sans — variable font, covers weights 400/500/600 via single file */
@font-face {
  font-family: 'Public Sans';
  src: url('/fonts/public-sans-latin-variable.woff2') format('woff2-variations'),
       url('/fonts/public-sans-latin-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* JetBrains Mono — variable font, covers weights 400/500 via single file */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-latin-variable.woff2') format('woff2-variations'),
       url('/fonts/jetbrains-mono-latin-variable.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Reset ─────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: 400;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100svh;
  overflow-x: hidden;
}

img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

input, textarea, select {
  font: inherit;
  color: inherit;
}

ol, ul {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* ── Selection ─────────────────────────────────────────────── */

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

/* ── Skip link — first focusable element on every page ────── */

.skip-link {
  position: fixed;
  top: var(--sp-3);
  left: var(--sp-3);
  z-index: var(--z-skip);
  padding: var(--sp-3) var(--sp-5);
  background: var(--amber);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: var(--t-ui);
  font-weight: 600;
  border-radius: var(--r-sm);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out-expo);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ── Focus ring — global :focus-visible system ─────────────── */

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ── Main landmark: allow programmatic focus without visual ring when focused via skip-link */

main:focus {
  outline: none;
}

/* ── Content wrapper ───────────────────────────────────────── */

.wrap {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding-left: var(--wrap-pad);
  padding-right: var(--wrap-pad);
  width: 100%;
}

.wrap--narrow {
  max-width: calc(var(--body-max) + (var(--wrap-pad) * 2));
}

/* ── Type utilities ────────────────────────────────────────── */

.kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--t-kicker);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--steel);
}

.kicker::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--steel);
  opacity: 0.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.018em;
  color: var(--ink);
  font-optical-sizing: auto;
}

h1 {
  font-size: var(--t-h1);
  line-height: 0.95;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 48;
}

h2 {
  font-size: var(--t-h2);
  line-height: 1.05;
  font-variation-settings: "opsz" 36;
}

h3 {
  font-size: var(--t-h3);
  line-height: var(--lh-h3);
  letter-spacing: -0.008em;
}

p {
  color: var(--ink);
}

.muted {
  color: var(--ink-2);
}

.t-accent {
  color: var(--amber);
}

.t-steel {
  color: var(--steel);
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  font-feature-settings: "tnum";
}

.sans {
  font-family: var(--font-sans);
}

/* ── Links in body text ────────────────────────────────────── */

.body-link,
main p a,
main li a {
  color: var(--amber);
  border-bottom: 1px solid var(--amber-rule);
  transition: border-color var(--dur-fast) var(--ease-out-expo);
}

.body-link:hover,
main p a:hover,
main li a:hover {
  border-bottom-color: var(--amber);
}

/* ── Horizontal rules ──────────────────────────────────────── */

hr {
  border: none;
  height: 1px;
  background: var(--rule-2);
  margin: var(--sp-12) 0;
}

.rule-top {
  border-top: 1px solid var(--rule-2);
}

.rule-bot {
  border-bottom: 1px solid var(--rule-2);
}
