/* ============================================================================
   BASE — Reset, typography, element defaults (ERP.AI brutalist)
   ============================================================================ */

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

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

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

  /* Offset anchors for fixed nav + audience bar */
  [id] {
    scroll-margin-top: 108px; /* 48 nav + 44 audience bar + 16 breathing */
  }

  body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--foreground);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.1;
    color: var(--foreground);
    letter-spacing: -0.02em;
  }
  h1 {
    font-size: var(--text-5xl);
  }
  h2 {
    font-size: var(--text-4xl);
  }
  h3 {
    font-size: var(--text-3xl);
  }
  h4 {
    font-size: var(--text-2xl);
  }

  p {
    margin-bottom: var(--space-4);
  }

  a {
    color: var(--foreground);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-standard);
  }
  a:hover {
    color: var(--primary);
  }

  code,
  pre,
  kbd,
  samp {
    font-family: var(--font-mono);
    font-size: 0.9em;
  }
  pre {
    overflow-x: auto;
    padding: var(--space-4);
    background: var(--surface-container);
  }
  img,
  svg,
  video {
    display: block;
    max-width: 100%;
    height: auto;
  }
  button,
  input,
  select,
  textarea {
    font: inherit;
    color: inherit;
  }
  button {
    cursor: pointer;
  }
  :focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }

  .skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    padding: var(--space-2) var(--space-4);
    background: var(--primary);
    color: var(--primary-foreground);
    z-index: var(--z-skip);
    transition: top var(--duration-fast) var(--ease-standard);
  }
  .skip-link:focus {
    top: var(--space-2);
  }

  ::-webkit-scrollbar {
    width: 4px;
  }
  ::-webkit-scrollbar-track {
    background: var(--background);
  }
  ::-webkit-scrollbar-thumb {
    background: var(--foreground);
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
  }

  /* Content width cap — section backgrounds bleed full, content is capped.
     Pages with .main--full-bleed skip the cap entirely. */
  #main-content:not(.main--full-bleed) > section > *,
  #main-content:not(.main--full-bleed) > header > *,
  #main-content:not(.main--full-bleed) > div > * {
    max-width: 90rem;
    margin-inline: auto;
  }
}

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