/*
 * base -- nackte HTML-Elemente: Reset, Grundtypografie, Links, Bilder,
 * Formular-Grundlagen, der sichtbare Fokus und das Attribut hidden.
 * Dazu der Block skip-link: der Sprung zum Inhalt, der auf jeder Seite steht
 * und für ein paar Zeilen keine eigene Datei braucht. Ein Zustand: sichtbar,
 * sobald er den Fokus hat.
 */

/* Die Schrift des Hauses (trail-style.md), im Projekt abgelegt statt von Google Fonts
   geladen: keine Verbindung zu Dritten beim Aufruf. Eine Datei für alle Stärken
   (variable Schrift, 200 bis 800), Teilmenge „latin" mit Umlauten, ß und deutschen
   Anführungszeichen. Lizenz SIL Open Font License 1.1 (fonts/manrope/LICENSE.txt). */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  /* Bis die Datei da ist, steht die Systemschrift -- kein unsichtbarer Text */
  font-display: swap;
  src: url("../fonts/manrope/manrope-latin-wght-normal.woff2") format("woff2");
}

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

html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  /* Lange Komposita und frei vergebene Namen müssen überall umbrechen können,
     sonst reißt die Seite unterhalb von 300px auf */
  overflow-wrap: anywhere;
  hyphens: auto;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

h1 { font-size: var(--font-size-display); }
h2 { font-size: var(--font-size-title); }
h3 { font-size: var(--font-size-large); }

h4,
h5,
h6 {
  font-size: var(--font-size-base);
}

ul,
ol {
  margin: 0;
  padding-inline-start: var(--space-5);
}

dl {
  display: grid;
  gap: var(--space-3);
  margin: 0;
}

dt {
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

dd {
  margin: 0;
}

code,
pre {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-code);
}

pre {
  margin: 0;
  padding: var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-medium);
  background-color: var(--color-surface);
  /* Eine Fehlerspur bricht nicht um, sie wird gescrollt -- umgebrochen ist sie
     nicht mehr zu lesen */
  overflow-x: auto;
  overflow-wrap: normal;
  hyphens: none;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

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

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

/* min-width: 0, sonst zwingt ein fieldset die Seite unterhalb von 300px auf */
fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
}

hr {
  margin: 0;
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
}

:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: var(--focus-ring-offset);
}

/* Was hidden trägt, ist weg -- auch wenn eine Komponente das Element per display selbst
   anzeigt (etwa card mit flex). Sonst bliebe eine vom Filter ausgeblendete Karte stehen. */
[hidden] {
  display: none !important;
}

@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;
  }
}

.skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-medium);
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  text-decoration: none;
  /* Liegt außerhalb des Sichtfelds, bleibt aber in der Tabreihenfolge */
  transform: translateY(calc(-100% - var(--space-4)));
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
}
