/* ==========================================================================
   DAO Systems — base.css
   Reset, Basis-Typografie, Buttons, Karten, Layout-Primitive, Utilities.
   Setzt css/tokens.css voraus und wird VOR css/style.css eingebunden.

   Regel: keine Literalwerte für Farben, Abstände oder Schriftgrößen.
   Ausschließlich var(--…) aus tokens.css.

   Namenskonvention:
     .btn, .card, .container, .section  Komponenten / Layout-Primitive
     .btn--primary                      Modifier (BEM, doppelter Bindestrich)
     .u-*                               Utility, ein Zweck, darf überschreiben
     .on-dark                           Kontextklasse: Inhalt auf dunkler Fläche
   ========================================================================== */

/* ==========================================================================
   1. RESET / NORMALIZE
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-2));
  -moz-tab-size: 4;
  tab-size: 4;
}

body {
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Deutsche Komposita sind länger als ein schmales Display breit ist
     ("Auftragsverarbeitungsvertrag", "Datenschutzerklärung"). <html lang="de">
     steht, damit greift die deutsche Silbentrennung und das Wort bricht sauber,
     statt die Seite horizontal scrollen zu lassen. text-wrap: balance/pretty
     bricht KEINE Wörter — dafür zusätzlich overflow-wrap weiter unten.
     Das -webkit-Präfix ist nötig: Safari kennt `hyphens` erst ab Version 17. */
  -webkit-hyphens: auto;
  hyphens: auto;
}

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

svg {
  fill: currentColor;
}

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
  margin-block: var(--space-4);
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   2. BASIS-TYPOGRAFIE
   ========================================================================== */

/* Umbruch-Sicherheitsnetz: Überschriften laufen in großen Schriftgraden sonst
   aus dem Container (gemessen: "Datenschutzerklärung" als h1 bei 375px, 36px
   Überlauf). Zusammen mit `hyphens: auto` am body bricht das Wort zuerst an
   einer Trennstelle und erst zur Not mitten im Wort. */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-heading);
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--font-size-h1);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  font-weight: var(--font-weight-bold);
}

h2 {
  font-size: var(--font-size-h2);
}

h3 {
  font-size: var(--font-size-h3);
}

h4 {
  font-size: var(--font-size-h4);
}

h5,
h6 {
  font-size: var(--font-size-md);
}

/* Abstand kommt vom Folge-Element, nicht vom Heading selbst
   -> keine Collapsing-Überraschungen, keine leeren Vorspänne. */
h1 + *,
h2 + *,
h3 + *,
h4 + * {
  margin-top: var(--space-2);
}

p {
  max-width: var(--measure);
  text-wrap: pretty;
  overflow-wrap: break-word;
}

p + p {
  margin-top: var(--space-2);
}

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: from-font;
  transition: var(--transition-color);
}

a:hover {
  color: var(--color-link-hover);
}

strong,
b {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

small {
  font-size: var(--font-size-sm);
  color: var(--color-text-subtle);
  line-height: var(--line-height-snug);
}

ul,
ol {
  padding-left: var(--space-3);
  max-width: var(--measure);
}

li + li {
  margin-top: var(--space-1);
}

li::marker {
  color: var(--color-secondary);
}

ul ul,
ol ol,
ul ol,
ol ul {
  margin-top: var(--space-1);
}

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

dt {
  font-weight: var(--font-weight-semibold);
  color: var(--color-primary);
}

dd {
  margin-top: var(--space-0-5);
  color: var(--color-text-muted);
}

dd + dt {
  margin-top: var(--space-2);
}

blockquote {
  border-left: var(--border-width-accent) solid var(--color-secondary);
  padding-left: var(--space-2);
  color: var(--color-text-muted);
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

code {
  background-color: var(--color-surface-tinted);
  border-radius: var(--radius-sm);
  padding: var(--space-0-5) var(--space-1);
}

address {
  font-style: normal;
}

::selection {
  background-color: var(--color-primary);
  color: var(--color-text-invert);
}

/* ==========================================================================
   3. FOKUS — immer sichtbar, nie ausgeblendet
   ========================================================================== */

:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* Browser ohne :focus-visible bekommen den klassischen Ring zurück. */
:focus:not(:focus-visible) {
  outline: none;
}

/* Auf dunklen Flächen ist das dunkle Amber zu schwach -> helles Amber. */
.on-dark :focus-visible {
  outline-color: var(--color-focus-invert);
}

/* ==========================================================================
   4. LAYOUT-PRIMITIVE
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

.section {
  padding-block: var(--section-padding-y);
}

.section--lg {
  padding-block: var(--section-padding-y-lg);
}

.section--tinted {
  background-color: var(--color-surface-tinted);
}

/* Zwei gleich getönte Sektionen direkt untereinander sollen wie eine wirken. */
.section--tinted + .section--tinted {
  padding-top: var(--space-0);
}

/* ==========================================================================
   5. KONTEXT: INHALT AUF DUNKLER FLÄCHE
   Auf ein Element mit dunklem Hintergrund setzen (Footer, dunkler Hero).
   Der Hintergrund selbst wird in style.css gesetzt.
   ========================================================================== */

.on-dark {
  color: var(--color-text-invert-muted);
}

.on-dark h1,
.on-dark h2,
.on-dark h3,
.on-dark h4,
.on-dark h5,
.on-dark h6,
.on-dark strong,
.on-dark dt {
  color: var(--color-text-invert);
}

.on-dark a {
  color: var(--color-text-invert);
}

.on-dark a:hover {
  color: var(--color-focus-invert);
}

.on-dark small,
.on-dark .u-text-muted,
.on-dark .u-text-subtle {
  color: var(--color-text-invert-muted);
}

.on-dark hr {
  border-top-color: var(--color-border-on-dark);
}

.on-dark li::marker {
  color: var(--color-text-invert-muted);
}

/* ==========================================================================
   6. BUTTONS
   Basis + Farbvarianten. Immer auf <a> oder <button> anwenden.

   Kontrast (siehe tokens.css):
     .btn--primary    weiß auf #1a2942   14.6:1  AAA
     .btn--accent     #1a2332 auf #d97706  5.0:1  AA   <- CTA, dunkle Schrift!
     .btn--secondary  #1a2942 auf weiß   13.7:1  AAA
     .btn--ghost      #1a2942 auf Bg     13.7:1  AAA
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--control-height);
  padding: var(--space-1) var(--control-padding-x);
  border: var(--border-width-thick) solid transparent;
  border-radius: var(--control-radius);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-normal);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-color), box-shadow var(--duration-fast) var(--ease-standard);
}

.btn:hover {
  text-decoration: none;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Varianten ---------------------------------------------------------- */

.btn--primary {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-invert);
}

.btn--primary:hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-text-invert);
}

/* CTA. Amber trägt IMMER dunkle Schrift (weiß fällt auf 3.2:1 durch)
   und wird beim Hover HELLER, nicht dunkler. */
.btn--accent {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-text);
}

.btn--accent:hover {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-text);
}

.btn--secondary {
  background-color: var(--color-surface);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn--secondary:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-primary-hover);
}

.btn--ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--color-primary);
  padding-inline: var(--space-2);
}

.btn--ghost:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-primary-hover);
}

/* Auf dunkler Fläche: Umriss- und Ghost-Button umkehren. */
.on-dark .btn--secondary {
  background-color: transparent;
  border-color: var(--color-text-invert-muted);
  color: var(--color-text-invert);
}

.on-dark .btn--secondary:hover {
  background-color: var(--color-primary-hover);
  border-color: var(--color-text-invert);
  color: var(--color-text-invert);
}

.on-dark .btn--ghost {
  color: var(--color-text-invert);
}

.on-dark .btn--ghost:hover {
  background-color: var(--color-primary-hover);
  color: var(--color-text-invert);
}

/* --- Größen und Breite -------------------------------------------------- */

.btn--sm {
  min-height: var(--control-height-sm);
  padding-inline: var(--space-2);
  font-size: var(--font-size-sm);
}

.btn--lg {
  min-height: var(--control-height-lg);
  padding-inline: var(--space-4);
  font-size: var(--font-size-md);
}

.btn--block {
  display: flex;
  width: 100%;
}

/* ==========================================================================
   7. KARTEN
   ========================================================================== */

.card {
  background-color: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--card-padding);
  box-shadow: var(--shadow-sm);
}

.card--flat {
  box-shadow: var(--shadow-none);
}

/* Für vollflächig verlinkte Karten. */
.card--interactive {
  transition: box-shadow var(--duration-base) var(--ease-standard),
              border-color var(--duration-base) var(--ease-standard);
}

.card--interactive:hover,
.card--interactive:focus-within {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
}

.card > * + * {
  margin-top: var(--space-2);
}

.card > h2,
.card > h3,
.card > h4 {
  margin-top: var(--space-0);
}

/* ==========================================================================
   8. UTILITIES
   ========================================================================== */

/* --- Textausrichtung ---------------------------------------------------- */
.u-text-left   { text-align: left; }
.u-text-center { text-align: center; }
.u-text-right  { text-align: right; }

/* Zentrierter Fließtext braucht auch zentrierte Blockachse. */
.u-text-center p,
.u-text-center .u-measure {
  margin-inline: auto;
}

/* --- Textfarbe und -form ------------------------------------------------ */
.u-text-muted   { color: var(--color-text-muted); }
.u-text-subtle  { color: var(--color-text-subtle); }
.u-text-invert  { color: var(--color-text-invert); }
.u-text-accent  { color: var(--color-accent-text); }   /* nie var(--color-accent) */
.u-text-primary { color: var(--color-primary); }

.u-text-sm { font-size: var(--font-size-sm); }
.u-text-xs { font-size: var(--font-size-xs); }

.u-lead {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-snug);
  color: var(--color-text-muted);
  max-width: var(--measure-narrow);
}

/* Versal-Label über einer Überschrift. */
.u-eyebrow {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-secondary);
  margin-bottom: var(--space-1);
}

.on-dark .u-eyebrow {
  color: var(--color-focus-invert);
}

.u-measure        { max-width: var(--measure); }
.u-measure-narrow { max-width: var(--measure-narrow); }
.u-balance        { text-wrap: balance; }

/* --- Abstände (8px-Raster) ---------------------------------------------- */
.u-mt-0 { margin-top: var(--space-0); }
.u-mt-1 { margin-top: var(--space-1); }
.u-mt-2 { margin-top: var(--space-2); }
.u-mt-3 { margin-top: var(--space-3); }
.u-mt-4 { margin-top: var(--space-4); }
.u-mt-5 { margin-top: var(--space-5); }
.u-mt-6 { margin-top: var(--space-6); }
.u-mt-8 { margin-top: var(--space-8); }

.u-mb-0 { margin-bottom: var(--space-0); }
.u-mb-1 { margin-bottom: var(--space-1); }
.u-mb-2 { margin-bottom: var(--space-2); }
.u-mb-3 { margin-bottom: var(--space-3); }
.u-mb-4 { margin-bottom: var(--space-4); }
.u-mb-5 { margin-bottom: var(--space-5); }
.u-mb-6 { margin-bottom: var(--space-6); }
.u-mb-8 { margin-bottom: var(--space-8); }

.u-pt-0 { padding-top: var(--space-0); }
.u-pb-0 { padding-bottom: var(--space-0); }

.u-mx-auto { margin-inline: auto; }

/* Vertikaler Rhythmus für Textblöcke: gleichmäßiger Abstand zwischen
   allen direkten Kindern, ohne Rand oben oder unten. */
.u-flow > * + * {
  margin-top: var(--space-2);
}

.u-flow-lg > * + * {
  margin-top: var(--space-3);
}

/* --- Listen ------------------------------------------------------------- */
.u-list-plain {
  list-style: none;
  padding-left: var(--space-0);
  max-width: none;
}

.u-list-plain > li + li {
  margin-top: var(--space-1);
}

/* --- Sonstiges ---------------------------------------------------------- */
.u-full-width { width: 100%; }

.u-no-wrap { white-space: nowrap; }

/* ==========================================================================
   9. BARRIEREFREIHEIT
   ========================================================================== */

/* Nur für Screenreader sichtbar. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Sprunglink: erstes Element im <body>, Ziel ist <main id="inhalt">. */
.skip-link {
  position: absolute;
  top: var(--space-1);
  left: var(--space-1);
  z-index: var(--z-skip-link);
  padding: var(--space-1) var(--space-2);
  background-color: var(--color-primary);
  color: var(--color-text-invert);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  transform: translateY(-200%);
  transition: transform var(--duration-fast) var(--ease-standard);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-text-invert);
}

/* ==========================================================================
   10. REDUZIERTE BEWEGUNG
   ========================================================================== */

@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;
    scroll-behavior: auto !important;
  }

  .skip-link {
    transition: none;
  }
}

/* ==========================================================================
   11. DRUCK
   ========================================================================== */

@media print {
  body {
    background: none;
    color: var(--color-text);
  }

  .skip-link,
  .btn {
    display: none;
  }

  .card {
    box-shadow: var(--shadow-none);
    border-color: var(--color-border-strong);
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: var(--font-size-xs);
    color: var(--color-text-subtle);
  }

  a[href^="#"]::after {
    content: "";
  }
}
