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

html {
  color-scheme: dark;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Legacy WebKit fallback only for browsers without standard scrollbar-color */
@supports not (scrollbar-color: auto) {
  html {
    scrollbar-width: auto;
  }

  html::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  html::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }

  html::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 9999px;
    border: 2px solid var(--scrollbar-track);
  }
}

::selection {
  background-color: var(--color-grid);
  color: var(--color-text-on-accent);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--color-bg);
  color: var(--color-text);
  overflow-x: clip;
}

img {
  display: block;
  max-width: 100%;
}

/* Accessible skip link */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.625rem 1rem;
  background-color: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease-standard);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* High-contrast keyboard focus indicator (preserves strict #0047FF rule) */
:where(a:any-link, button, [tabindex="-1"]):focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
}

main,
section[tabindex="-1"]:focus {
  outline: none;
}

/* Visually hidden accessible text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Empty section anchors reserved for future development */
.section-anchor {
  position: relative;
  display: block;
  height: 0;
  overflow: hidden;
}
