/* ==========================================================================
   Responsive Basis-Stylesheet
   1. Design-Tokens
   2. Reset & Basis
   3. Typografie
   4. Layout (Container, Grid, Flex, Stack)
   5. Komponenten (Header, Nav, Button, Card, Formular, Tabelle)
   6. Utilities
   7. Breakpoints
   8. Dark Mode, Motion, Print
   Breakpoint-Strategie: Mobile First. Media Queries erweitern nach oben.
   ========================================================================== */

/* 1. Design-Tokens ======================================================== */

:root {
  /* Farben – neutrale Graustufen + ein Akzent */
  --color-bg: #ffffff;
  --color-surface: #f6f7f9;
  --color-border: #dfe3e8;
  --color-text: #1c2024;
  --color-text-muted: #5b6570;
  --color-accent: #2f6fdb;
  --color-accent-hover: #2457ae;
  --color-accent-contrast: #ffffff;
  --color-success: #1f7a4d;
  --color-danger: #c0392f;

  /* Typografie */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    monospace;

  /* Fluide Schriftgrößen: skalieren zwischen 320px und 1200px Viewport */
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.06rem + 0.3vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.24rem + 0.6vw, 1.75rem);
  --text-2xl: clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  --text-3xl: clamp(2.25rem, 1.8rem + 2.2vw, 3.5rem);

  --leading-tight: 1.15;
  --leading-normal: 1.6;
  --measure: 68ch; /* max. Zeilenlänge für Fließtext */

  /* Abstände – 4px-Raster */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4.5rem;
  --space-3xl: 6rem;

  /* Sonstiges */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.06);
  --shadow-md: 0 4px 12px rgb(16 24 40 / 0.08);
  --container-width: 1180px;
  --container-padding: var(--space-sm);
  --transition: 150ms ease;
}

@media (min-width: 48em) {
  :root {
    --container-padding: var(--space-lg);
  }
}

/* 2. Reset & Basis ======================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-xl);
}

body {
  min-height: 100svh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

button {
  cursor: pointer;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

/* Sichtbarer Tastaturfokus – nie entfernen */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background-color: var(--color-accent);
  color: var(--color-accent-contrast);
}

/* 3. Typografie =========================================================== */

h1,
h2,
h3,
h4 {
  line-height: var(--leading-tight);
  text-wrap: balance;
  font-weight: 650;
  letter-spacing: -0.015em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p,
li,
figcaption {
  text-wrap: pretty;
  max-width: var(--measure);
}

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

small {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

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

pre {
  overflow-x: auto;
  padding: var(--space-sm);
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
}

blockquote {
  padding-left: var(--space-sm);
  border-left: 3px solid var(--color-border);
  color: var(--color-text-muted);
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-lg);
}

/* 4. Layout =============================================================== */

/* Container: zentriert, mit responsivem Innenabstand */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.container--narrow {
  max-width: 44rem;
}

/* Section: vertikaler Rhythmus zwischen Seitenabschnitten */
.section {
  padding-block: var(--space-xl);
}

@media (min-width: 48em) {
  .section {
    padding-block: var(--space-2xl);
  }
}

/* Stack: gleichmäßiger Abstand zwischen direkten Kindern */
.stack > * + * {
  margin-top: var(--flow, var(--space-sm));
}

.stack--md { --flow: var(--space-md); }
.stack--lg { --flow: var(--space-lg); }

/* Auto-Grid: bricht ohne Media Query um */
.grid {
  display: grid;
  gap: var(--gap, var(--space-md));
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(var(--col-min, 17rem), 100%), 1fr)
  );
}

.grid--2 { --col-min: 24rem; }
.grid--4 { --col-min: 13rem; }

/* Explizites 12-Spalten-Grid für komplexere Layouts */
.grid-12 {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(4, 1fr);
}

@media (min-width: 48em) {
  .grid-12 {
    grid-template-columns: repeat(12, 1fr);
  }
}

.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 4; }
.col-span-8 { grid-column: span 4; }
.col-span-12 { grid-column: span 4; }

@media (min-width: 48em) {
  .col-span-6 { grid-column: span 6; }
  .col-span-8 { grid-column: span 8; }
  .col-span-12 { grid-column: span 12; }
}

/* Cluster: Flex-Reihe, die umbricht */
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap, var(--space-sm));
  align-items: center;
}

.cluster--between {
  justify-content: space-between;
}

/* Sidebar: Seitenspalte, die unterhalb des Platzbedarfs umbricht */
.with-sidebar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.with-sidebar > :first-child {
  flex-basis: 18rem;
  flex-grow: 1;
}

.with-sidebar > :last-child {
  flex-basis: 0;
  flex-grow: 999;
  min-inline-size: 60%;
}

/* 5. Komponenten ========================================================== */

/* Header + Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 3.75rem;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  list-style: none;
  padding: 0;
}

.site-nav a {
  color: var(--color-text);
  text-decoration: none;
  padding-block: var(--space-3xs);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--color-accent);
}

/* Mobile-Navigation: ohne JS per Checkbox/Details oder mit aria-expanded.
   Hier: Toggle-Button sichtbar bis 48em, Nav klappt darunter. */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-xs);
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

@media (max-width: 47.9375em) {
  .site-nav {
    display: none;
    width: 100%;
  }

  .site-nav[data-open="true"] {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    gap: var(--space-2xs);
    padding-block: var(--space-sm);
  }

  .site-header__inner {
    flex-wrap: wrap;
  }
}

@media (min-width: 48em) {
  .nav-toggle {
    display: none;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: 0.625rem 1.125rem;
  min-height: 2.75rem; /* Touch-Ziel */
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background-color: var(--color-accent);
  color: var(--color-accent-contrast);
  font-weight: 550;
  text-decoration: none;
  transition: background-color var(--transition), border-color var(--transition);
}

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

.btn--secondary {
  background-color: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

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

.btn--ghost {
  background-color: transparent;
  color: var(--color-accent);
}

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

/* Card */
.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding: var(--space-md);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card__media {
  margin: calc(var(--space-md) * -1) calc(var(--space-md) * -1) var(--space-sm);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: calc(100% + var(--space-md) * 2);
}

/* Formulare */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.field label {
  font-size: var(--text-sm);
  font-weight: 550;
}

.field .hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--color-text-muted);
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.field__error {
  font-size: var(--text-sm);
  color: var(--color-danger);
}

/* Tabelle: scrollt horizontal statt das Layout zu sprengen */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th,
td {
  padding: var(--space-2xs) var(--space-xs);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

th {
  font-weight: 600;
  background-color: var(--color-surface);
}

/* Footer */
.site-footer {
  margin-top: var(--space-2xl);
  padding-block: var(--space-lg);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}



/* 6. Utilities ============================================================ */

.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Skip-Link: erster Fokus auf der Seite */
.skip-link {
  position: absolute;
  left: var(--space-sm);
  top: -4rem;
  z-index: 100;
  padding: var(--space-2xs) var(--space-sm);
  background-color: var(--color-accent);
  color: var(--color-accent-contrast);
  border-radius: var(--radius-sm);
  transition: top var(--transition);
}

.skip-link:focus {
  top: var(--space-sm);
}

.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
.measure-none { max-width: none; }
.flow-none > * + * { margin-top: 0; }

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

.aspect-video {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
}

/* Sichtbarkeit nach Viewport */
.hide-sm { display: none; }

@media (min-width: 48em) {
  .hide-sm { display: revert; }
  .hide-md { display: none; }
}

/* 7. Breakpoints (Referenz) ==============================================
   30em  /  480px – große Handys
   48em  /  768px – Tablet hoch
   64em  / 1024px – Tablet quer, kleine Laptops
   80em  / 1280px – Desktop
   em statt px, damit Layouts der Browser-Schriftgröße folgen.
   ======================================================================== */

/* 8. Dark Mode, Motion, Print ============================================= */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
 
    --color-bg: #0b1622;

/* dkfz-blau    --color-bg: #006bb4; */

    --color-surface: #1c2126;
    --color-border: #2c333b;
    --color-text: #ffffff;
    --color-text-muted: #9aa5b1;
    --color-accent: #7aa7f0;
    --color-accent-hover: #9dbff5;
    --color-accent-contrast: #10131a;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 12px rgb(0 0 0 / 0.5);
  }
}

/* Manueller Umschalter: <html data-theme="dark"> */
:root[data-theme="dark"] {
  --color-bg: #14171a;
  --color-surface: #1c2126;
  --color-border: #2c333b;
  --color-text: #e8ebee;
  --color-text-muted: #9aa5b1;
  --color-accent: #7aa7f0;
  --color-accent-hover: #9dbff5;
  --color-accent-contrast: #10131a;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 0.5);
}

@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;
  }
}

@media print {
  .site-header,
  .site-footer,
  .nav-toggle {
    display: none;
  }

  body {
    color: #000;
    background: #fff;
  }

  a::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }
}
