/* ==========================================================================
   base.css — Foundation layer
   ========================================================================== */

@layer reset, base, layout, components, utilities, brand;

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

  html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    scroll-behavior: smooth;
  }

  body {
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  img,
  picture,
  video,
  canvas,
  svg {
    display: block;
    max-width: 100%;
    height: auto;
  }

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

  a {
    text-decoration-skip-ink: auto;
    color: currentColor;
  }

  ul[role="list"],
  ol[role="list"] {
    list-style: none;
  }

  h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
    text-wrap: balance;
  }

  p {
    overflow-wrap: break-word;
    text-wrap: pretty;
  }

  table {
    border-collapse: collapse;
  }
}

/* ---------- BASE ---------- */
@layer base {
  :root {
    /* Structural colors */
    --color-bg: #ffffff;
    --color-surface: #f6f8f7;
    --color-surface-raised: #ffffff;
    --color-text: #1a1f1c;
    --color-text-muted: #5f6b64;
    --color-text-light: #8a9690;
    --color-border: #dce3de;
    --color-border-light: #eef1ef;

    /* Brand colors */
    --color-accent: #16803c;
    --color-accent-dark: #116b30;
    --color-accent-light: #e6f5eb;
    --color-accent-lighter: #f0faf3;

    /* Typography */
    --font-heading: "Space Grotesk", system-ui, sans-serif;
    --font-body: "DM Sans", system-ui, sans-serif;

    /* Spacing scale */
    --space-2xs: 0.125rem;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Radii */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;

    /* Layout */
    --nav-height: 72px;
    --container-max: 1200px;
    --sidebar-width: 320px;

    /* Category colors */
    --color-workplace: #2563eb;
    --color-road-safety: #dc2626;
    --color-health: #0891b2;
    --color-construction: #d97706;
    --color-first-aid: #e11d48;
    --color-wellbeing: #7c3aed;
    --color-food-safety: #059669;
  }

  body {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-text);
    background-color: var(--color-bg);
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-text);
    letter-spacing: -0.02em;
  }

  h1 { font-size: clamp(2rem, 5vw, 3rem); }
  h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
  h3 { font-size: clamp(1.25rem, 2.5vw, 1.625rem); }
  h4 { font-size: 1.125rem; }

  p {
    line-height: 1.7;
  }

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

  a:hover {
    color: var(--color-accent-dark);
  }

  ::selection {
    background-color: var(--color-accent);
    color: #fff;
  }

  :focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
  }

  /* Lead text */
  .lead {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    line-height: 1.7;
    max-width: 640px;
  }

  /* Visually hidden */
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
  }
}
