/* ============================================================================
   BASE  —  @layer base
   Minimal reset + base element styling. All values flow from semantic tokens.
   ============================================================================ */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  * { margin: 0; }

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

  body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    font-weight: var(--weight-normal);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  /* Media defaults */
  img, svg, video, canvas { display: block; max-width: 100%; }
  svg { height: auto; }

  /* Headings — Swiss hierarchy through size/weight, tight leading */
  h1, h2, h3 {
    font-family: var(--font-display);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--color-text-strong);
    font-weight: var(--weight-bold);
    text-wrap: balance;
  }
  h1 { font-size: var(--text-2xl); font-weight: var(--weight-black); }
  h2 { font-size: var(--text-xl); }
  h3 { font-size: var(--text-lg); }
  p  { text-wrap: pretty; }

  /* Links */
  a { color: var(--color-accent); text-underline-offset: 0.15em; }
  a:hover { color: var(--color-accent-strong); }

  /* Form controls inherit type */
  button, input, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: none; }

  /* Lists used semantically without bullets in components */
  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

  /* Focus — always visible, high-contrast ring (WCAG 2.2 focus-visible) */
  :focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus);
    outline-offset: var(--focus-ring-offset);
    border-radius: var(--radius-sm);
  }
  /* Remove default outline only where we provide :focus-visible above */
  :focus:not(:focus-visible) { outline: none; }

  /* Selection */
  ::selection { background: var(--color-accent-tint); color: var(--color-text-strong); }

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