/* =========================================================================
   JSC – Base / Reset / Typografie
   ========================================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  /* Notbremse gegen horizontalen Overflow auf schmalen Android-Viewports.
     `clip` ist moderner als `hidden` — kein scroll-Container, kein iOS-Bug. */
  overflow-x: clip;
}

/* Body NICHT auf overflow-x: hidden setzen — das wuerde `position: sticky`
   im Header brechen, weil body dadurch zum Scroll-Container wird.
   Auf html oben reicht `overflow-x: clip` (kein Scroll-Container).
   Fallback nur fuer alte Browser, die `clip` nicht kennen (Safari <16). */
@supports not (overflow-x: clip) {
  body { overflow-x: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Typografie ----------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-text-strong);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-4);
  /* Safety-Net gegen Overflow durch lange unbrechbare Wörter
     (z.B. "Muttersprachlich") auf schmalen Viewports. */
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

h1 { font-size: var(--fs-3xl); font-weight: var(--fw-bold); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p {
  margin: 0 0 var(--space-4);
  max-width: 65ch;
}

.lead {
  font-size: var(--fs-md);
  line-height: var(--lh-snug);
  color: var(--color-text);
  max-width: 60ch;
}

small, .text-xs { font-size: var(--fs-xs); }
.text-sm        { font-size: var(--fs-sm); }
.text-muted     { color: var(--color-text-muted); }

/* Links ---------------------------------------------------------------- */
a {
  color: var(--color-link);
  text-decoration: none;
  text-underline-offset: 0.2em;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--color-link-hover); text-decoration: underline; }

/* Listen --------------------------------------------------------------- */
ul, ol { margin: 0 0 var(--space-4); padding-left: 1.25rem; }
li + li { margin-top: var(--space-2); }
ul.unstyled, ol.unstyled { list-style: none; padding: 0; }
ul.unstyled li + li, ol.unstyled li + li { margin-top: 0; }

/* Medien --------------------------------------------------------------- */
img, svg, picture, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Forms (Basis) -------------------------------------------------------- */
input, textarea, select, button {
  font: inherit;
  color: inherit;
}

/* Focus Ring (sichtbar, barrierearm) ---------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Selection ------------------------------------------------------------ */
::selection {
  background: var(--color-brand);
  color: var(--color-text-on-brand);
}

/* Utilities ------------------------------------------------------------ */
.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;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--color-text-strong);
  color: var(--color-bg);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  z-index: var(--z-modal);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* Legal-Page-spezifisch ------------------------------------------------ */
.legal-page__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  margin-bottom: var(--space-5);
}
.legal-page__back:hover { color: var(--color-brand-strong); }
.legal-page__updated {
  display: inline-block;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
}

/* Print ---------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .nav-toggle, .lang-switch,
  .skip-link, .legal-page__back {
    display: none !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }
  a { color: #000 !important; text-decoration: underline; }
  .section { padding-block: 1rem !important; }
  .container, .container--narrow { max-width: 100% !important; padding: 0 !important; }
  h1, h2, h3 { color: #000 !important; page-break-after: avoid; }
  p, li { page-break-inside: avoid; }
}
