/* ============================================================
   base.css — Fonts, Reset, Basis-Typografie, Korn, Motion-Gate
   ============================================================ */

/* ── Selbst-gehostete Variable Fonts (DSGVO: kein CDN) ──── */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/fraunces-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-wght-normal.woff2") format("woff2");
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  min-height: 100svh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  font-weight: 400;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv05";
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
  overflow-x: hidden;
}

img, picture, svg, video, canvas { display: block; max-width: 100%; height: auto; }
svg { fill: currentColor; }
[hidden] { display: none !important; } /* Author-Reset darf [hidden] nicht aushebeln */
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
:target { scroll-margin-top: 6rem; }

/* ── Feines „Papier"-Korn über die ganze Seite ─────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.09'/%3E%3C/svg%3E");
}
:root[data-theme="evening"] body::before { mix-blend-mode: screen; opacity: 0.35; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="day"]) body::before { mix-blend-mode: screen; opacity: 0.35; }
}

/* ── Basis-Typografie ─────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 380;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  font-optical-sizing: auto;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); font-weight: 420; }
h4 { font-size: var(--step-1); font-weight: 500; font-family: var(--font-body); letter-spacing: 0; }
p { max-width: var(--measure); text-wrap: pretty; }
strong, b { font-weight: 600; }
/* Keine Italics (bewusste Entscheidung) — Betonung über Farbe/Unterstreichung */
em, i { font-style: normal; }
small { font-size: var(--step--1); }

::selection { background: var(--clay); color: var(--paper); }

/* ── Fokus-Sichtbarkeit ───────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── Skip-Link ────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: 50%;
  top: -4rem;
  transform: translateX(-50%);
  z-index: var(--z-modal);
  padding: 0.7rem 1.4rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-pill);
  font-size: var(--step--1);
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus-visible { top: 1rem; }

/* ── Utilities ────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.u-mono {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  font-weight: 500;
}
.u-accent { color: var(--clay); }
.u-center { text-align: center; }
.u-balance { text-wrap: balance; }
.u-flow > * + * { margin-block-start: var(--flow, 1.1em); }
.u-hidden { display: none !important; }

/* ── Globales Reduced-Motion-Gate ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
