/*
 * Reset, HTML-Elemente, Markdown-Typografie, Fokus, Bewegung, Print-Basics
 * (ARCHITEKTUR-DESIGN.md §2/§5/§7). Ausgeliefert, wird bei Updates UEBERSCHRIEBEN.
 */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  font-weight: 700;
  margin-block: var(--space-xl) var(--space-md);
}

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

p, ul, ol, dl, blockquote, table, figure, pre {
  margin-block: 0 var(--space-md);
}

ul, ol {
  padding-inline-start: var(--space-lg);
}

blockquote {
  margin-inline: 0;
  padding-inline-start: var(--space-md);
  border-inline-start: var(--space-2xs) solid var(--color-border);
  color: var(--color-text-muted);
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: var(--text-sm);
}

code {
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  padding-inline: var(--space-2xs);
}

pre {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  overflow-x: auto;
}

pre code {
  background: none;
  padding-inline: 0;
}

/* Tabellen-Grundstil — horizontales Scrollen NUR ueber den .table-wrapper aus
   components.css (§7.8 "einzige erlaubte lokale Scroll-Region"). */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  text-align: start;
}

/* Links im Fliesstext UNTERSTRICHEN (§7.6 "nicht nur Farbe") — Komponenten-Links
   (Buttons, Kartentitel) uebernehmen ihre eigene Darstellung in components.css. */
a {
  color: var(--color-link);
  text-underline-offset: 0.15em;
}

a:not([class]) {
  text-decoration: underline;
}

/* Reflow (§7.8): kein Element sprengt die Viewport-Breite. */
img, video {
  max-width: 100%;
  height: auto;
}

/* Fokus sichtbar (§7.2, WCAG 2.4.7) — outline:none ist NUR mit unmittelbarem
   Ersatz-Stil in DERSELBEN Regel zulaessig (Code-Konvention); dieser globale Stil
   ist der Ersatz fuer alle interaktiven Elemente. */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Bewegung reduzieren (§7.3, WCAG 2.3.3). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .theme-toggle, .skip-link {
    display: none !important;
  }
}
