/*
 * Grundlagen (5.2.3, 5.3.1, 5.12): Schriften, Reset, Typografie, Fokus, Hilfsklassen,
 * Icons, reduzierte Bewegung.
 *
 * Schriften liegen lokal (Teilmenge Latin, SIL OFL 1.1, siehe fonts/OFL.txt).
 * Die URLs tragen kein ?v=, damit sie zum Preload im <head> passen (6.2 der Schnittstellen).
 */

@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/barlow-semi-condensed-700.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow Semi Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/barlow-semi-condensed-600.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/barlow-600.woff2") format("woff2");
}

/* ------------------------------------------------------------------ Reset */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 100%;
  line-height: var(--lh-m);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--fs-m);
  line-height: var(--lh-m);
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
}

/* Lange deutsche Wörter trennen statt mitten im Wort umzubrechen (lang="de", 200 % Text, 5.12);
   Überschriften bleiben ungetrennt */
p,
li,
dd,
.lead {
  -webkit-hyphens: auto;
  hyphens: auto;
}

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

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

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------- Typografie */

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-synthesis: none;
  color: var(--c-text);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-2xl);
  line-height: var(--lh-2xl);
  font-weight: 700;
}

h2 {
  font-size: var(--fs-xl);
  line-height: var(--lh-xl);
  font-weight: 600;
}

h3 {
  font-size: var(--fs-l);
  line-height: var(--lh-l);
  font-weight: 600;
}

h4 {
  font-size: var(--fs-m);
  line-height: var(--lh-m);
  font-weight: 600;
}

@media (min-width: 1024px) {
  h1 {
    font-size: var(--fs-3xl);
    line-height: var(--lh-3xl);
  }
}

p,
ul,
ol {
  margin-block: 0;
}

a {
  color: var(--c-accent-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

/* Gedrückt-Zustand statt Tipp-Blitz (5.3.1): html setzt -webkit-tap-highlight-color: transparent.
   Knöpfe und Chips haben eigene :active-Regeln. */
a:where(:not(.btn, .chip)):active {
  background-color: var(--c-surface-2);
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    text-decoration-thickness: 2px;
  }
}

strong,
b {
  font-weight: 700;
}

small {
  font-size: var(--fs-s);
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: .9375em;
}

time,
.tabular {
  font-variant-numeric: tabular-nums;
}

/* Trennlinie im Fahrbahn-Rhythmus: 24 px Strich, 12 px Lücke (5.2.5) */
hr {
  height: 3px;
  margin: var(--sp-6) 0;
  border: 0;
  background: repeating-linear-gradient(90deg, var(--c-border-strong) 0 24px, transparent 24px 36px);
}

::selection {
  background: var(--c-accent-soft);
  color: var(--c-text);
}

/* Einleitung, Metatext */
.lead {
  font-size: var(--fs-l);
  line-height: var(--lh-l);
}

.muted {
  color: var(--c-text-muted);
}

/* Rechtstexte und lange Texte: Lesebreite höchstens 720 px */
.prose {
  max-width: var(--read-width);
}

.prose > * + * {
  margin-top: var(--sp-3);
}

.prose h1 {
  margin-bottom: var(--sp-4);
}

.prose h2 {
  margin-top: var(--sp-6);
}

.prose h3 {
  margin-top: var(--sp-5);
}

.prose h2 + *,
.prose h3 + * {
  margin-top: var(--sp-2);
}

/* :where() hält die Spezifität niedrig, damit Listen mit eigener Klasse (z. B. .contact-list) gewinnen */
.prose :where(ul, ol) {
  padding-left: var(--sp-5);
}

.prose :where(li + li) {
  margin-top: var(--sp-1);
}

.prose a {
  overflow-wrap: anywhere;
}

.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.prose th,
.prose td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--c-border);
  text-align: left;
  vertical-align: top;
}

/* ------------------------------------------------------------------ Fokus */

/* Ring per outline, damit er im Kontrastmodus (forced-colors) erhalten bleibt (5.3.1) */
:focus-visible {
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: var(--focus-offset);
}

/* Programmatischer Fokus ohne Tastatur (z. B. h1 nach Routenwechsel) zeigt keinen Ring (5.12) */
:focus:not(:focus-visible) {
  outline: none;
}

/* Sprungziel des Skip-Links (main#main) ist ein Container: kein Ring um den ganzen Inhalt */
main[tabindex="-1"]:focus {
  outline: none;
}

/* ----------------------------------------------------------- Hilfsklassen */

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Erstes fokussierbares Element, sichtbar bei Fokus (5.12) */
.skip-link {
  position: absolute;
  top: 0;
  left: max(var(--sp-4), env(safe-area-inset-left));
  z-index: var(--z-skip);
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 var(--sp-4);
  border-radius: var(--r-m);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: var(--font-ui);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus,
.skip-link:focus-visible {
  top: max(var(--sp-2), env(safe-area-inset-top));
  transform: none;
  box-shadow: var(--shadow-2);
  outline: var(--focus-width) solid var(--c-focus);
  outline-offset: var(--focus-offset);
}

/* Inline-Sprite am Anfang von <body> (5.2.6) */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------- Icons */

/* 24 px (bei Standard-Schriftgröße), Strich 2, Farbe currentColor (5.2.6) */
.icon {
  display: inline-block;
  flex-shrink: 0;
  width: var(--icon-size);
  height: var(--icon-size);
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: hidden;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
}

.icon-lg {
  width: 2rem;
  height: 2rem;
}

/* ------------------------------------------------------- Bewegung reduziert */

/* Alle Dauer-Tokens 0,01 ms, keine Transform-Animationen, kein weiches Scrollen (5.2.4) */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: .01ms;
    --dur-base: .01ms;
    --dur-slow: .01ms;
  }

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* Windows-Kontrastmodus: Icons folgen der Systemfarbe */
@media (forced-colors: active) {
  .icon {
    stroke: currentColor;
  }

  :focus-visible {
    outline-color: Highlight;
  }
}
