/* =========================================================
   Basis: Reset, Typografie, Layout-Grundlagen
   ========================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow-x: clip;
}

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

img {
  height: auto;
}

h1, h2, h3, h4 {
  overflow-wrap: break-word;
  margin: 0;
  color: var(--color-heading);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: -0.025em; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.02em; }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p, ul, ol, dl, blockquote, figure {
  margin: 0;
}

p, li {
  text-wrap: pretty;
}

/* Abstände im Fließtext */
.flow > * + * {
  margin-top: var(--flow-space, 1em);
}

a {
  color: var(--color-link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease-out), text-decoration-color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--salbei-900);
  text-decoration-color: var(--ocker-600);
}

/* Fokus: immer sichtbar bei Tastaturbedienung */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--ocker-100);
  color: var(--salbei-900);
}

strong { font-weight: var(--fw-semibold); }

/* ---------- Layout ---------- */

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2 * var(--gutter), var(--container-narrow));
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.measure { max-width: var(--measure); }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
}

.small { font-size: var(--fs-small); }

.tabular { font-variant-numeric: tabular-nums; }

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-3) var(--space-5);
  background: var(--salbei-900);
  color: var(--weiss);
  border-radius: var(--radius-pill);
  font-weight: var(--fw-medium);
  text-decoration: none;
}

.skip-link:focus-visible {
  top: var(--space-4);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Lange Komposita (z. B. Datenschutzerklärung) auf schmalen Bildschirmen trennen */
@media (max-width: 40rem) {
  h1, h2, h3 { hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 16 6 6; }
}
