/*
  Self-hosted fonts (spec §4.3, D-022 — no font CDNs) + global resets.
  Only the weights the type scale actually uses were copied in: Alokary
  Personal Use (400) and Nexa Light(300)/Regular(400)/Bold(700) — see
  docs/05-ai/.impeccable.md for the full font-asset inventory notes.
  Nexa has no true 500/600 file; medium(500) and semibold(600) roles alias
  to the nearest real weight (500→Regular, 600→Bold) rather than guessing.
*/

@font-face {
  font-family: "Alokary Personal Use";
  src: url("../fonts/alokary/alokary.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Nexa";
  src: url("../fonts/nexa/NexaLight.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Nexa";
  src: url("../fonts/nexa/NexaRegular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  /* Aliased to Regular — nearest real weight to 500, see file header note. */
  font-family: "Nexa";
  src: url("../fonts/nexa/NexaRegular.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  /* Aliased to Bold — nearest real weight to 600, see file header note. */
  font-family: "Nexa";
  src: url("../fonts/nexa/NexaBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Nexa";
  src: url("../fonts/nexa/NexaBold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

/* Internal anchor navigation offset by the Header height (spec §6 Navigation D-066). */
[id] {
  scroll-margin-top: calc(var(--header-height) + var(--space-md));
}

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-primary-text);
  font-family: var(--font-body);
  font-size: var(--text-body-size);
  line-height: var(--text-body-lh);
  font-weight: var(--font-weight-regular);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; margin: 0; }

h1, h2, h3, h4, p, dl, dd { margin: 0; }

h1, h2, h3, h4 {
  font-family: var(--font-page-title);
  font-weight: var(--font-weight-regular);
  color: var(--color-primary-text);
  line-height: 1.1;
}

h1 { font-size: var(--text-h1-size); line-height: var(--text-h1-lh); letter-spacing: var(--text-h1-ls); }
h2 { font-size: var(--text-h2-size); line-height: var(--text-h2-lh); letter-spacing: var(--text-h2-ls); }
h3 {
  font-family: var(--font-body);
  font-size: var(--text-h3-size);
  line-height: var(--text-h3-lh);
  font-weight: var(--text-h3-weight);
}
h4 {
  font-family: var(--font-body);
  font-size: var(--text-h4-size);
  line-height: var(--text-h4-lh);
  font-weight: var(--text-h4-weight);
}

/* Skip link — baseline keyboard accessibility (spec §6 Accessibility Behavior, D-078) */
.skip-link {
  position: fixed;
  z-index: 1000;
  top: var(--space-sm);
  left: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: var(--color-secondary-brand);
  color: var(--color-background);
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
  transition: transform var(--duration-fast) var(--ease-standard);
}
.skip-link:focus { transform: none; }

/* Global focus state — spec §6 D-081, contrast target 3:1 */
:focus-visible {
  outline: 2px solid var(--color-secondary-brand);
  outline-offset: 4px;
}

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

/* Styled scrollbar — V1 Decisions §6 "Scrollbar": palette colors, subtle, readable */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary-brand) var(--color-background);
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--color-background); }
::-webkit-scrollbar-thumb {
  background: var(--color-primary-brand);
  border: 3px solid var(--color-background);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-primary-brand-hover); }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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