/* base.css — element defaults and the cascade-layer order for the whole site.
   Architecture: one explicit layer order, declared here once. Anything outside
   a layer (OpenProps variables, tokens.css variables) is unaffected because it
   only declares custom properties. See docs/components.md. */

@layer reset, base, components, utilities;

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

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

  body {
    margin: 0;
  }

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

  button,
  input,
  select,
  textarea {
    font: inherit;
    color: inherit;
  }
}

@layer base {
  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--step-0);
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 560;
    line-height: 1.12;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
    font-optical-sizing: auto;
    text-wrap: balance;
  }

  h1 { font-size: var(--step-4); }
  h2 { font-size: var(--step-3); }
  h3 { font-size: var(--step-2); }
  h4 { font-size: var(--step-1); }

  /* In-headline emphasis stays in the same family (design.md rule). */
  h1 em, h2 em, h3 em { font-style: italic; font-weight: inherit; }

  p { max-width: var(--measure); text-wrap: pretty; }

  a {
    color: var(--brand);
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
  }
  a:hover { color: var(--spruce-soft); }

  code, .mono, .domain, .price {
    font-family: var(--font-mono);
    font-feature-settings: "tnum" 1;
  }

  /* Focus — visible, in copper, never removed. */
  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
  }

  ::selection {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
  }
}

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