/* ============================================================
   BASE — Reset, Typografie, grundlegende HTML-Elemente
   ============================================================ */

/* --- Reset & Box-Model --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Dokument --- */
html {
  /* Stellschraube für die Gesamtgröße: 106.25 % = 17 px Basis, Fließtext damit
     rund 19 px. Alle Schriftgrößen und Abstände hängen an diesem Wert —
     wer alles größer oder kleiner will, ändert nur diese eine Zahl. */
  font-size: 106.25%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* Subpixel-Rendering verbessern */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Bilder & Medien --- */
img, video, svg {
  display: block;
  max-width: 100%;
}

/* --- Links --- */
/* Dunkleres Orange für Textlinks: das helle Akzent-Orange hat auf Weiß
   zu wenig Kontrast für normalen Fließtext */
a {
  color: var(--color-accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition);
}
a:hover {
  color: var(--color-base);
}

/* --- Fokus-Zustand (Barrierefreiheit) ---
   Sichtbarer Rahmen bei Tastaturnavigation — wichtig für alle Nutzer */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--border-radius-sm);
}

/* --- Überschriften --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-base);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

@media (max-width: 600px) {
  h1 { font-size: var(--font-size-2xl); }
  h2 { font-size: var(--font-size-xl); }
  h3 { font-size: var(--font-size-lg); }
  /* Lange Wörter wie "Kommunikationstechnik" dürfen auf dem Handy trennen,
     statt aus dem Bildschirm zu laufen */
  h1, h2, h3 {
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

/* --- Fließtext --- */
p {
  line-height: var(--line-height-loose);
}

p + p {
  margin-top: var(--space-4);
}

/* --- Listen --- */
ul, ol {
  padding-left: var(--space-6);
}

li {
  line-height: var(--line-height-loose);
  margin-top: var(--space-1);
}

/* --- Fließtext-Bereiche (Detailseiten, Rechtstexte) ---
   Regelt die Abstände zwischen Überschriften, Absätzen und Listen,
   damit nichts aneinanderklebt */
.prose > * + * {
  margin-top: var(--space-5);
}
.prose > h2 {
  margin-top: var(--space-12);
}
.prose > h3 {
  margin-top: var(--space-8);
}
.prose > h2 + *,
.prose > h3 + * {
  margin-top: var(--space-3);
}
.prose > :first-child {
  margin-top: 0;
}
.prose li + li {
  margin-top: var(--space-2);
}
/* Rechtstexte haben viele kurze Abschnitte — kleinere Zwischenüberschriften */
.prose--legal > h2 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-10);
}

/* --- Horizontale Linie --- */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* --- Barrierefreiheit: Inhalt nur für Screenreader --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* --- Skip-Link (Tastaturnutzer springen direkt zum Inhalt) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-accent);
  color: var(--color-white);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--border-radius);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  z-index: 9999;
  transition: top var(--transition);
}
.skip-link:focus {
  top: var(--space-4);
}
