/* =============================================================================
   base.css — reset + typography + layout primitives + print
   ============================================================================= */

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

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Reduced motion: the single legitimate !important use site-wide.
     Author animations must always lose to user preference here. */
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    color: var(--c-text);
    background: var(--c-background);
    min-height: 100vh;
  }

  img, svg, video { display: block; max-width: 100%; height: auto; }
  img { font-style: italic; background-repeat: no-repeat; background-size: cover; }

  ul, ol { padding-left: 1.25em; }
  li + li { margin-top: var(--s-xs); }
}

@layer base {
  /* === Links === */
  a { color: var(--c-accent); text-decoration: underline; text-underline-offset: 3px; }
  a:hover { color: var(--c-accent-hover); }

  /* === Focus visible === */
  :focus-visible {
    outline: 3px solid var(--c-focus-ring);
    outline-offset: 3px;
    transition: outline-color 180ms var(--ease), outline-offset 180ms var(--ease);
  }

  /* === Skip link === */
  .skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--c-primary);
    color: var(--c-on-accent);
    padding: var(--s-md) var(--s-lg);
    z-index: 1000;
  }
  .skip-link:focus { top: 0; }

  /* === Visually hidden (a11y) === */
  .visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* === Headings === */
  h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    color: var(--c-primary);
  }
  h1 { font-size: var(--fs-4xl); margin-bottom: var(--s-lg); }
  h2 {
    font-family: var(--font-body);
    font-weight: var(--fw-medium);
    font-size: var(--fs-display-lg);
    letter-spacing: var(--tracking-tight);
    margin-bottom: var(--s-md);
  }
  h3 { font-size: var(--fs-xl); margin-bottom: var(--s-sm); }
  h4 { font-size: var(--fs-lg); margin-bottom: var(--s-sm); }

  /* Italic serif accent word inside sans display headings.
     Used optionally per page: <h1>text <span class="accent">text</span></h1> */
  h1 .accent,
  h2 .accent {
    font-family: var(--font-heading);
    font-style: italic;
    font-weight: var(--fw-regular);
    color: var(--c-accent);
    letter-spacing: 0;
  }

  p { line-height: var(--lh-loose); }
  p + p { margin-top: var(--s-md); }

  .lead { font-size: var(--fs-md); color: var(--c-text-soft); }
  .text-muted { color: var(--c-text-muted); }
  .text-center { text-align: center; }

  strong { font-weight: var(--fw-bold); color: var(--c-primary); }

  .bullet-list { list-style: disc; padding-left: 1.25em; line-height: var(--lh-loose); }
  .bullet-list li { margin-top: var(--s-xs); }

  .steps-list { padding-left: 1.5em; }
  .steps-list li { margin-bottom: var(--s-md); line-height: var(--lh-loose); }

  /* === Layout primitives === */
  .container { max-width: var(--w-container); margin: 0 auto; }
  .prose { max-width: var(--w-reading); }
  .prose h2 { margin-top: var(--s-2xl); }
  .prose h3 { margin-top: var(--s-xl); }

  section + section { margin-top: var(--s-2xl); }

  /* === App shell grid === */
  .layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main"
      "footer";
    min-height: 100vh;
  }
  @media (min-width: 70em) {
    .layout {
      grid-template-columns: var(--w-sidebar) 1fr;
      grid-template-rows: auto 1fr auto;
      grid-template-areas:
        "sidebar header"
        "sidebar main"
        "sidebar footer";
    }
  }

  /* === Main padding === */
  .main {
    grid-area: main;
    padding: var(--s-xl) var(--s-lg);
  }
  @media (min-width: 48em) { .main { padding: var(--s-2xl) var(--s-xl); } }
  @media (min-width: 70em) { .main { padding: var(--s-2xl) var(--s-3xl); } }

  /* Article drop-cap — opt-in via class.
     Usage: <p class="article-drop-cap">First paragraph copy…</p>
     Reserved for blog + klinische-uitleg articles; other page types should skip. */
  .article-drop-cap::first-letter {
    font-family: var(--font-heading);
    font-weight: var(--fw-bold);
    float: left;
    font-size: 3.5em;
    line-height: .85;
    padding: .1em .15em 0 0;
    color: var(--c-primary);
  }
}

/* =============================================================================
   Print — scoped to @media print, kept lean (~70 lines).
   No !important — rely on cascade specificity.
   ============================================================================= */

@media print {
  :root {
    --c-background: #fff;
    --c-surface: #fff;
    --c-text: #000;
    --c-text-soft: #333;
    --c-text-muted: #555;
    --c-border-light: #ccc;
    --c-primary: #000;
  }

  body {
    background: var(--c-background);
    color: var(--c-text);
    font-size: 11pt;
    line-height: 1.5;
  }

  /* Hide non-essentials */
  .sidebar,
  .mobile-header,
  .site-header,
  .site-footer,
  .toast,
  #toast,
  .skip-link,
  .mobile-menu,
  .mobile-menu__close,
  .mobile-header__menu-toggle,
  .mobile-header__reset,
  .sidebar__reset,
  .btn { display: none; }

  .layout { display: block; }
  .main { padding: 0; }

  h1 { font-size: 22pt; }
  h2 { font-size: 15pt; margin-top: 18pt; }
  h3 { font-size: 12pt; margin-top: 12pt; }

  h1, h2, h3 { page-break-after: avoid; }

  a { color: var(--c-text); text-decoration: none; }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: var(--c-text-muted);
  }

  .card,
  .exercise-card,
  .recommendation-card {
    border: 1px solid var(--c-border-light);
    box-shadow: none;
    page-break-inside: avoid;
  }

  .disclaimer {
    border: 1px solid var(--c-text-muted);
    page-break-inside: avoid;
    margin-top: 24pt;
  }

  p, li { orphans: 3; widows: 3; }
}
