/* css/base.css — Fonts, Spacing, Typography, Animationen (Design-System) */

/* === FONTS: self-hosted Variable Fonts, kein Schriftflackern === */
@font-face {
  font-family: "Heading";
  src: url("/fonts/heading-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-display: optional;
}
@font-face {
  font-family: "Body";
  src: url("/fonts/body-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-display: optional;
}

/* Metrisch angepasste Fallbacks (aus den echten Font-Metriken berechnet:
   hhea ascent/descent von Space Grotesk bzw. Work Sans), damit auch im
   seltenen Fallback-Fall kein Layout-Shift entsteht. */
@font-face {
  font-family: "Heading Fallback";
  src: local("Georgia");
  size-adjust: 101%;
  ascent-override: 98.4%;
  descent-override: 29.2%;
}
@font-face {
  font-family: "Body Fallback";
  src: local("Arial");
  size-adjust: 92%;
  ascent-override: 93%;
  descent-override: 24.3%;
}

:root {
  color-scheme: light;

  /* --- Spacing-Scale (8px Grid) --- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* --- Timing --- */
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
  --duration-slower: 600ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  --color-surface-alt: #f7f9fa;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body {
  font-family: var(--font-body);
  color: var(--color-ink-800);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--color-ink-900);
}

/* === Typography-Skala === */
.heading-hero {
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 1.7rem + 2.4vw, 3.75rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--color-ink-900);
}
.heading-1 {
  font-family: var(--font-heading);
  font-size: clamp(1.875rem, 1.5rem + 1.5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-ink-900);
}
.heading-2 {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-ink-900);
}
.heading-3 {
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-ink-900);
}
.subheading {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--color-ink-600);
}
.body-lg { font-size: 1.125rem; line-height: 1.75; color: var(--color-ink-700); }
.body-md { font-size: 1rem; line-height: 1.7; color: var(--color-ink-700); }
.body-sm { font-size: 0.875rem; line-height: 1.6; color: var(--color-ink-600); }
.caption { font-size: 0.75rem; font-weight: 500; color: var(--color-ink-400); letter-spacing: 0.025em; }
.overline {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary-700);
}
.text-balance { text-wrap: balance; }

/* Lesbare Zeilenlaenge fuer Fliesstext-Container */
.prose-measure { max-width: 65ch; }

/* === Reveal-Animationen: einmaliges Einblenden per IntersectionObserver (js/reveal.js) ===
   Bewusst KEIN animation-timeline:view() fuer Content-Sichtbarkeit: Scroll-Timelines sind
   live an die Scrollposition gebunden und blenden Inhalte beim Zurueckscrollen wieder aus
   (und bleiben unsichtbar, wenn kein echtes Scroll-Event stattfindet, z.B. bei Screenshot-
   Tools, manchen Crawlern oder Sprungnavigation). Der JS-Observer laeuft daher immer und
   entfernt sich nach dem ersten Treffer selbst -- "revealed" bleibt dauerhaft. Ohne JavaScript
   sorgt der <noscript>-Block in partials/head.php dafuer, dass Inhalte trotzdem sichtbar sind. */
.reveal {
  opacity: 0;
  transform: translateY(20px);
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
  }
}

/* === Skip-Link (Barrierefreiheit) === */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--color-ink-900);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  z-index: 100;
  transition: top var(--duration-fast) var(--ease-out);
}
.skip-link:focus {
  top: 1rem;
}

/* === Print (Long-Read-Seiten) === */
@media print {
  header, footer, .no-print, .skip-link, .cta-banner, form {
    display: none !important;
  }
  body { color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
}
