/* ==========================================================================
   Base – Reset, Typografie, Container, Barrierefreiheit, Utilities
   Setzt tokens.css voraus.
   ========================================================================== */

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

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  hanging-punctuation: first last;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-text);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

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

button {
  cursor: pointer;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

p,
li,
figcaption,
blockquote {
  overflow-wrap: break-word;
  text-wrap: pretty;
}

::selection {
  background: var(--color-selection);
  color: var(--color-white);
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
  overflow-wrap: break-word;
  hyphens: auto;
}

h1 { font-size: var(--text-4xl); letter-spacing: var(--tracking-display); }
h2 { font-size: var(--text-3xl); letter-spacing: var(--tracking-display); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p,
ul,
ol,
blockquote {
  max-width: var(--measure);
}

* + p {
  margin-top: 1em;
}

strong,
b {
  font-weight: var(--weight-semibold);
}

small {
  font-size: var(--text-sm);
}

a {
  color: var(--color-link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--dur-fast) var(--ease-out-expo),
              text-decoration-color var(--dur-fast) var(--ease-out-expo);
}

a:hover {
  color: var(--color-link-hover);
  text-decoration-thickness: 2px;
}

hr {
  border: 0;
  border-top: var(--border-hairline);
}

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

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

:focus:not(:focus-visible) {
  outline: none;
}

/* Auf dunklen Flächen (z.B. .on-dark) weisser Fokusring */
.on-dark :focus-visible {
  outline-color: var(--color-focus-on-dark);
}

/* Programmatisch fokussiertes <main> (Skip-Link-Ziel) ohne Ring */
main:focus {
  outline: none;
}

/* ---------- Skip-Link ---------- */

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-skip);
  padding: var(--space-3) var(--space-5);
  background: var(--color-blue);
  color: var(--color-white);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transform: translateY(calc(-100% - var(--space-4)));
  transition: transform var(--dur-fast) var(--ease-out-expo);
}

.skip-link:focus-visible {
  transform: none;
  color: var(--color-white);
  outline-color: var(--color-ink);
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: calc(var(--container-narrow) + 2 * var(--gutter));
}

.section {
  padding-block: var(--space-section);
}

.stack > * + * {
  margin-top: var(--stack-space, var(--space-4));
}

/* ---------- Utilities: Typografie ---------- */

.t-hero,
.t-display {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-none);
  letter-spacing: var(--tracking-display);
  text-wrap: balance;
}

.t-hero    { font-size: var(--text-hero); }
.t-display { font-size: var(--text-display); }

.t-lead {
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}

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

/* Label in Klammern und Grossbuchstaben, z.B. (SCHWERPUNKTE).
   Die Klammern sind Deko und werden von Screenreadern nicht vorgelesen. */
.label {
  display: inline-block;
  font-family: var(--font-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.4;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.label::before { content: "("; content: "(" / ""; }
.label::after  { content: ")"; content: ")" / ""; }

/* Variante ohne Klammern, z.B. für Meta-Zeilen */
.label--plain::before,
.label--plain::after {
  content: none;
}

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

/* Nur für Screenreader sichtbar */
.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Reduzierte Bewegung (Sicherheitsnetz) ---------- */

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