/* ==========================================================================
   base.css — Schriften, Reset, Grundtypografie, Fokus, Bewegung.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Schriften — ausschliesslich lokal. Keine Einbindung über ein CDN: das würde
   die IP-Adresse jedes Besuchers an einen Dritten übertragen und wäre ohne
   Einwilligung nicht zulässig. Lizenztexte liegen neben den Dateien.
   Space Grotesk und IBM Plex Sans sind variable Schriften — eine Datei deckt
   den gesamten Strichstärkenbereich ab.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/SpaceGrotesk-Var.woff2") format("woff2-variations"),
       url("../fonts/SpaceGrotesk-Var.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/IBMPlexSansVar-Latin1.woff2") format("woff2-variations"),
       url("../fonts/IBMPlexSansVar-Latin1.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

/* Wird nur für Zahlen und technische Angaben gebraucht und deshalb bewusst
   nicht vorgeladen. Der unicode-range beschränkt den Abruf auf lateinische
   Zeichen — auf Seiten ohne .mono-Element lädt die Datei gar nicht erst. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+20A0-20BF, U+2212;
}

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

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-xl);
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

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

/* Unter 16 px zoomt iOS beim Antippen automatisch in das Feld hinein. */
input,
textarea,
select {
  font-size: max(1rem, var(--text-md));
}

ul,
ol {
  padding-inline-start: 1.25em;
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

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

p,
li {
  text-wrap: pretty;
}

p {
  max-width: var(--measure);
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease);
}

a:hover {
  text-decoration-thickness: 2px;
}

strong {
  font-weight: 600;
}

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

.text-soft {
  color: var(--ink-soft);
}

/* Zahlen und technische Angaben. Tabellenziffern, damit Spalten fluchten. */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.94em;
}

/* Kleine Überschrift über einem Abschnitt. */
.eyebrow {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-soft);
}

.lead {
  font-size: var(--text-lg);
  color: var(--ink-soft);
  max-width: var(--measure);
}

/* --------------------------------------------------------------------------
   Fokus und Sprungmarke — Tastaturbedienung muss jederzeit sichtbar sein.
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: var(--focus-ring) solid var(--link);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.stage :focus-visible,
.on-stage :focus-visible {
  outline-color: var(--stage-accent);
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--gutter);
  inset-block-start: -100%;
  z-index: 100;
  padding: var(--space-2xs) var(--space-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus-visible {
  inset-block-start: var(--space-2xs);
}

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

/* --------------------------------------------------------------------------
   Seitenwechsel — weicher Übergang zwischen den Seiten, ohne Einzelseiten-App.
   Chromium und Safari zeigen ihn, Firefox wechselt normal. Kein Bruch.
   -------------------------------------------------------------------------- */

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vt-out 90ms var(--ease) both;
}

::view-transition-new(root) {
  animation: vt-in 220ms var(--ease) both;
}

@keyframes vt-out {
  to { opacity: 0; }
}

@keyframes vt-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* --------------------------------------------------------------------------
   Einblenden beim Scrollen — reines CSS, kein JavaScript. Zurückhaltend:
   nur Deckkraft und ein kleiner Versatz, keine Rotationen oder Sprünge.
   -------------------------------------------------------------------------- */

@supports (animation-timeline: view()) {
  .reveal {
    animation: reveal-in linear both;
    animation-timeline: view();
    animation-range: entry 10% cover 26%;
  }
}

@keyframes reveal-in {
  from { opacity: 0; transform: translateY(1.25rem); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Wer Bewegung reduziert haben will, bekommt eine stehende Seite.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    animation: none;
    opacity: 1;
    transform: none;
  }

  @view-transition {
    navigation: none;
  }
}
