/* base.css – Reset & Grundlagen. Technisches Skelett: Jede Regel hier hat
   schon einmal eine zentrale Funktion ausgeschaltet, wenn sie fehlte.
   Die Grundtypografie ist an
   die Schriften dieser Seite angepasst (fonts.css, tokens.css). */

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

/* overflow-x: clip statt hidden auf dem Body: hidden macht ihn zum
   Scroll-Container und schaltet jedes position: sticky ab. */
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
body { overflow-x: clip; }

body.is-locked { overflow-y: hidden; }

/* Muss !important sein: display-Regeln schlagen sonst [hidden]. */
[hidden] { display: none !important; }

/* Anker springen unter den Sticky-Header. */
:where([id]) { scroll-margin-top: calc(var(--header-h) + 0.75rem); }

body {
  font-family: var(--font-body);
  font-size: var(--fs-text);
  font-weight: var(--fw-text);
  line-height: var(--lh-text);
  color: var(--color-ink);
  background: var(--color-paper);
  font-optical-sizing: auto;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

/* Überschriften und Bedienung in der Grotesk, Lesetext in der Serife. */
h1, h2, h3, h4, legend, button, input, textarea, select, label, nav, .ui {
  font-family: var(--font-display);
}
h1, h2 {
  font-weight: var(--fw-titel);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-heading);
  text-wrap: balance;
  overflow-wrap: break-word;
}
h1 { line-height: var(--lh-display); letter-spacing: var(--tracking-display); }
h3, h4 {
  font-weight: var(--fw-titel);
  line-height: var(--lh-sub);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
p, li, dd, figcaption { text-wrap: pretty; }

/* Deutsche Komposita brechen im Fließtext sonst mit Loch. */
p, li, dd { hyphens: auto; hyphenate-limit-chars: 7 3 3; }

strong, b { font-family: var(--font-display); font-weight: var(--fw-ui); font-size: 1em; }

::selection { background: var(--color-selection); color: var(--color-ink); }

/* Fokus bleibt sichtbar. --focus-ring schaltet die dunkle Fläche um. */
:focus-visible {
  outline: 3px solid var(--focus-ring, var(--color-blau));
  outline-offset: 3px;
}

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

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

/* Links im Lesetext sind unterstrichen: Farbe allein ist kein Signal. */
:where(p, li, dd, figcaption) a:not([class]) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
@media (hover: hover) {
  :where(p, li, dd, figcaption) a:not([class]):hover {
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: 2px;
  }
}

/* Grundzusicherung für Hover und Druck auf allem Anklickbaren. Die
   gestalteten Zustände stehen in styles.css und sektionen.css. */
a, button, [role="button"], summary, label[for] {
  transition: opacity 120ms ease, color 120ms ease;
}
@media (hover: hover) {
  a:hover, button:hover, [role="button"]:hover, summary:hover { cursor: pointer; }
}
a:active, button:active, [role="button"]:active, summary:active { opacity: 0.7; }

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

/* Touch-Ziele (WCAG, 44 px).
   Freistehende Links (Navigation, Footer, Labels) als inline-flex mit
   Mindesthöhe. Telefon- und Mail-Links IM Lesetext bleiben inline und
   bekommen die Höhe über padding-block: inline-flex mit min-height würde
   die Zeile auseinanderdrücken und das Wort am Bindestrich brechen. */
nav a, footer a, label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
:where(p, li, dd) a:is([href^="tel:"], [href^="mailto:"]) {
  display: inline;
  padding-block: 0.8em;
  white-space: nowrap;
}
button, [role="button"], summary { min-height: 44px; }

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