/* =============================================================================
   base.css — Reset, Basis-Elemente, Layout-Primitives, Accessibility-Floor.
   Lädt NACH tokens.css + fonts.css.
   ========================================================================== */

/* ---- Reset (schlank, modern) ---------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--w-reg);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
  min-height: 100vh;
}
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
ul, ol { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* ---- Typo-Basis ----------------------------------------------------------- */
h1, h2, h3, h4 { line-height: var(--lh-snug); font-weight: var(--w-semi); letter-spacing: var(--tracking-tight); text-wrap: balance; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
p  { text-wrap: pretty; }
strong, b { font-weight: var(--w-semi); }
small { font-size: var(--fs-xs); }

/* Alle Zahlen tabellarisch, wo Mono im Einsatz ist */
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; letter-spacing: -0.01em; }

/* Fließtext-Links */
.prose a { color: var(--signal-700); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.prose a:hover { color: var(--signal-800); }
.prose p + p { margin-top: var(--s4); }
.prose { max-width: var(--container-text); }

/* ---- Layout-Primitives ---------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--wide { max-width: var(--container-wide); }
.container--text { max-width: var(--container-text); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2rem, 1.5rem + 1.5vw, 3.5rem); }
.section--paper2 { background: var(--paper-2); }
.section--ink { background: var(--ink); color: var(--paper); }

/* 12-Spalten-Grid, strikt (V1) */
.grid { display: grid; gap: var(--gutter); }
.grid > * { min-width: 0; }
.grid-12 { grid-template-columns: repeat(12, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }

.stack > * + * { margin-top: var(--s4); }
.stack-lg > * + * { margin-top: var(--s6); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }

/* ---- Accessibility-Floor --------------------------------------------------- */
.skip-link {
  position: absolute; left: var(--s3); top: -60px; z-index: var(--z-toast);
  background: var(--ink); color: var(--paper); padding: var(--s3) var(--s4);
  border-radius: var(--r-sm); transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--s3); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
:focus:not(:focus-visible) { outline: none; }

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

/* Reduced Motion: alles zur Ruhe bringen (V1-Default ist ohnehin near-none) */
@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;
  }
}

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-graphite { color: var(--graphite); }
.hide-desktop { display: none; }
@media (max-width: 860px) { .hide-mobile { display: none !important; } .hide-desktop { display: revert; } }
.nowrap { white-space: nowrap; }
