/* ==========================================================================
   Base — Schrift, Typografie, Grundlayout
   ========================================================================== */

/*
 * Self-hosted Variable Fonts (DSGVO: kein fonts.googleapis.com).
 * Heading = Bricolage Grotesque (charaktervolle, variable Grotesk),
 * Body    = Public Sans (ruhige, gut lesbare, variable Grotesk).
 * Beide WOFF2 werden in partials/head.php per <link rel="preload"> geladen;
 * font-display: optional verhindert sichtbaren Font-Swap. Die metrisch
 * angepassten Fallbacks minimieren Layout-Shift im seltenen Fallback-Fall.
 */
@font-face {
  font-family: 'Heading';
  src: url('../fonts/bricolage-grotesque-wght.woff2') format('woff2');
  font-weight: 300 800;
  font-stretch: 100%;
  font-display: optional;
}
@font-face {
  font-family: 'Body';
  src: url('../fonts/public-sans-wght.woff2') format('woff2');
  font-weight: 300 700;
  font-display: optional;
}

/* Metrisch angepasste Fallbacks (greifen nur, wenn die Schrift ausnahmsweise
   nicht rechtzeitig da ist). Werte aus den echten Font-Metriken abgeleitet. */
@font-face {
  font-family: 'Heading Fallback';
  src: local('Arial');
  size-adjust: 106%;
  ascent-override: 88%;
  descent-override: 25%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Body Fallback';
  src: local('Arial');
  size-adjust: 106%;
  ascent-override: 90%;
  descent-override: 21%;
  line-gap-override: 0%;
}

:root {
  --font-heading: 'Heading', 'Heading Fallback', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Body', 'Body Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

html {
  scroll-behavior: smooth;
  /* Verhindert, dass Sprungmarken hinter dem Sticky-Header verschwinden. */
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

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

body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.35vw, 1.125rem);
  line-height: 1.65;
  color: var(--color-neutral-800);
  background-color: var(--color-neutral-50);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* Fokus-Sichtbarkeit für Tastaturnutzung */
:focus-visible {
  outline: 3px solid var(--color-primary-500);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- Fluid-Headings als Utility-Klassen ------------------------------------ */
.font-heading { font-family: var(--font-heading); }

.h-display {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2.4rem, 1.6rem + 3.6vw, 4.25rem);
  line-height: 1.03;
  letter-spacing: -0.025em;
}
.h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2rem, 1.5rem + 2.2vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.65rem, 1.35rem + 1.5vw, 2.4rem);
  line-height: 1.14;
  letter-spacing: -0.015em;
}
.h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.6rem);
  line-height: 1.22;
  letter-spacing: -0.01em;
}
.h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.08rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.3;
  letter-spacing: -0.005em;
}

/* ---- Lauftext im Inhaltsbereich (Prosa) ----------------------------------- */
/* Keine eigene Breitenbegrenzung: Der Fließtext folgt der Breite seines
   Containers und liegt damit auf einer Linie mit Tabellen und Bildern. In
   zweispaltigen Split-Layouts begrenzt die Grid-Spalte die Breite. */
.prose-content {
  max-width: none;
}
.prose-content p {
  margin: 0 0 1.25rem;
  color: var(--color-neutral-700);
}
.prose-content p:last-child {
  margin-bottom: 0;
}
.prose-content strong {
  color: var(--color-neutral-900);
  font-weight: 600;
}

/* Lange Rechtstexte (Impressum, Datenschutz): klare Absatz-/Überschriftenluft. */
.legal h2 {
  margin: 2.5rem 0 0.75rem;
  color: var(--color-neutral-900);
}
.legal h3 {
  margin: 1.75rem 0 0.5rem;
  color: var(--color-neutral-900);
}
.legal > :first-child {
  margin-top: 0;
}
.legal a {
  overflow-wrap: anywhere;
}

/* Screenreader-only (Ergänzung zu Tailwinds sr-only für statisches CSS) */
.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;
}
