/* ===========================================================================
 * base.css — Global base styles for Hedensia
 *
 * Loaded EFTER design-tokens.css, FØR alle component-stylesheets. Etablerer
 * minimal reset + html/body defaults + element-level typografi-defaults for
 * h1-h6, lister, blockquote, figure, code, pre.
 *
 * Princip (Fase 2): headings får IKKE eksplicit font-size — utility-klasser
 * (`.hd-text--xl`, `.hd-text--lg` osv.) leverer størrelser. <h1> uden klasse
 * er nydelig (bold + margin) men ikke skrigende.
 *
 * Default voice: <body> bruger `var(--hd-font-ui)`. Containere kan override
 * via `.hd-voice--narrative` / `.hd-voice--display`. Voice virker via CSS
 * inheritance — descendant-selectors UNDGÅS.
 *
 * Compatibility: vanilla CSS — Safari 16.6 iPadOS 16. @layer base er
 * understøttet på Safari 15.4+.
 * =========================================================================== */

@layer reset {
  *, *::before, *::after {
    box-sizing: border-box;
  }
  body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote, dl, dd {
    margin: 0;
  }
  ul, ol {
    padding: 0;
  }
  /* Ensure [hidden] works even when an element has an author-level display rule. */
  [hidden] { display: none !important; }
}

@layer base {
  html {
    scroll-behavior: smooth;
    color-scheme: dark;   /* hint til UA — light-tema overrider via [data-theme] */
  }

  [data-theme="light"] html,
  html[data-theme="light"] {
    color-scheme: light;
  }

  body {
    background: var(--hd-surface-base);
    color: var(--hd-text-primary);
    font-family: var(--hd-font-ui);   /* Fase 2 — default voice; .hd-voice--narrative overrider via inheritance */
    font-size: var(--hd-text-body);
    line-height: var(--hd-leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* === Headings — semantik + weight; size leveres af .hd-text--* utility ===
   *
   * <h1> uden utility-klasse rendres med default body-font-size; bold + margin
   * giver et minimum af visuel hierarki. Brug `.hd-text--display/xl/lg/md`
   * for eksplicit størrelse. */
  h1, h2, h3, h4, h5, h6 {
    font-weight: var(--hd-weight-bold);
    color: inherit;
    margin-block-end: 0.5em;
    line-height: var(--hd-leading-tight);
  }

  /* === Lister === */
  ul, ol {
    padding-inline-start: 1.5rem;
    margin-block: 0.75em;
  }
  ul { list-style: disc; }
  ol { list-style: decimal; }
  ul ul, ol ol, ul ol, ol ul {
    margin-block: 0.25em;
  }
  li + li {
    margin-block-start: 0.25em;
  }

  /* === Blockquote — semantic-italic bevares per § Italics-policy === */
  blockquote {
    margin-block: 1em;
    padding-inline-start: 1em;
    border-inline-start: 3px solid var(--hd-border-subtle);
    color: var(--hd-text-secondary);
    font-style: italic;
  }

  /* === Figure + figcaption === */
  figure {
    margin-block: 1em;
  }
  figcaption {
    font-size: var(--hd-text-caption);
    color: var(--hd-text-tertiary);
    margin-block-start: 0.5em;
  }

  /* === Code, kbd, samp, pre === */
  code, kbd, samp {
    --hd-code-inline-size: 0.9em;
    font-family: var(--hd-font-mono);
    font-size: var(--hd-code-inline-size);
    background: var(--hd-surface-3);
    padding: 0.15em 0.35em;
    border-radius: var(--hd-radius-sm);
  }
  pre {
    font-family: var(--hd-font-mono);
    background: var(--hd-surface-3);
    padding: 1em;
    border-radius: var(--hd-radius-md);
    overflow-x: auto;
    margin-block: 1em;
    line-height: var(--hd-leading-normal);
  }
  pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
  }
}
