/* ============================================
   loom — base styles
   Minimal reset + element defaults using tokens.
   ============================================ */

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  /* Smooth scroll for in-page anchor links (TOC, FAQs, etc.).
     Pair with `scroll-margin-top` on the target so it lands
     below any fixed/sticky headers instead of behind them. */
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-fg-body);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  background: none;
  border: 0;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-fg);
  margin-bottom: 0.5em;
  /* Balance line lengths within the available width — the browser
     picks break points that distribute characters evenly across
     lines (avoiding orphan words / cramped narrow columns).
     Critical for i18n: a fixed character-width cap (`max-width:
     18ch`) tuned for one language squeezes the other when text
     length differs. `balance` adapts naturally to whatever
     content fills the heading, so EN + DE both wrap cleanly
     within the same container width. */
  text-wrap: balance;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); line-height: var(--leading-snug); }
h4 { font-size: var(--text-h4); line-height: var(--leading-snug); }
h5 { font-size: var(--text-h5); line-height: var(--leading-snug); }
h6 { font-size: var(--text-h6); line-height: var(--leading-snug); }

/* Paragraph */
p {
  line-height: var(--leading-relaxed);
  margin-bottom: 1em;
  /* Sister to text-wrap: balance on headings. `pretty` is designed
     for paragraphs — it doesn't fully balance every line (that's
     expensive at paragraph length), it specifically targets
     orphan-avoidance: the browser rebalances the last 2-3 lines
     so the paragraph doesn't end with a single dangling word
     ("Experten-Support." alone on its own line, etc.). Universal
     fix; applies to every <p> across the site, EN + DE. */
  text-wrap: pretty;
}

p:last-child {
  margin-bottom: 0;
}

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-muted);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
