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

* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
  /* Scrollbar gutter reserved at all times (charter 08) */
  scrollbar-gutter: stable;
}

body {
  background: var(--color-bg);
  color: var(--color-main);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Global grain: above the content, under the nav */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--color-highlight); color: var(--color-bg-deep); }

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

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

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

ul { list-style: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.12;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* Scrollbar: dark track, highlight thumb (charter 05) */
* { scrollbar-color: var(--color-highlight) var(--color-bg-deep); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--color-bg-deep); }
::-webkit-scrollbar-thumb { background: var(--color-highlight); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--color-highlight-hover); }

@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;
  }
}
