/**
 * Base Typography & Layout Foundation
 * Normalizes CSS, sets up accessible typography scale, and handles base resets.
 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background-color: var(--bg-black);
  color: var(--text-primary);
  font-family: var(--font-family-sans);
  line-height: 1.6;
  font-size: 1rem;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-black);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-black);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--emerald-dark);
}

::selection {
  background: var(--emerald-bright);
  color: var(--text-inverse);
}

/* Accessible Layout Wrapper */
.site-container {
  width: min(var(--max-width-site), calc(100% - 48px));
  margin-inline: auto;
}

@media (max-width: 640px) {
  .site-container {
    width: calc(100% - 32px);
  }
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 650;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 3.8vw, 2.85rem);
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
}

h3 {
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
}

h4 {
  font-size: 1.05rem;
}

p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.65;
}

p.lead {
  font-size: clamp(0.95rem, 1.25vw, 1.075rem);
  line-height: 1.65;
  color: var(--text-secondary);
}

small, .text-small {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

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

/* Accessibility Skip Link */
.skip-nav-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: var(--emerald-bright);
  color: var(--text-inverse);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  z-index: 9999;
  transition: top var(--transition-fast);
}
.skip-nav-link:focus {
  top: 20px;
}
