/* =====================================================================
   kalenderwoche.jetzt - Stylesheet
   ---------------------------------------------------------------------
   Stil:        modern, ruhig, vertrauenswuerdig, sehr gut lesbar
   Ansatz:      Mobile-first, responsiv, ohne Frameworks, ohne externe Fonts
   Typografie:  System-Font-Stack, fluide Groessen via clamp()
   Aufbau:      1. Design-Tokens (:root)        5. Hero
                2. Reset & Basis                6. Sektionen, Karten
                3. Layout (.container)          7. Tabelle, FAQ, Formular
                4. Header / Nav / Footer        8. Dark-Mode, Reduced-Motion
   ===================================================================== */


/* =====================================================================
   1. Design-Tokens (CSS-Variablen)
   ===================================================================== */
:root {
  /* Native UI (Formular-Widgets, Scrollbars) an das Theme koppeln.
     Im Dark-Block gespiegelt (color-scheme: dark). */
  color-scheme: light;

  /* --- Farben: neutrale Graustufen --------------------------------- */
  --color-bg: #f7f8fa;          /* Seitenhintergrund; gekoppelt an theme-color in layout-header.php */
  --color-surface: #ffffff;     /* Karten / erhabene Flaechen           */
  --color-surface-2: #f1f3f7;   /* dezent abgesetzte Flaechen           */
  --color-border: #e2e6ed;      /* feine Trennlinien                    */
  --color-text: #1f2733;        /* Fliesstext, hoher Kontrast           */
  --color-text-soft: #515b6b;   /* Sekundaertext, Labels                */
  --color-text-muted: #626c7d;  /* Hinweise, Meta (WCAG-AA >= 4.5:1)    */

  /* --- Farben: Primaer / Akzent ------------------------------------ */
  --color-primary: #2563eb;     /* Primaerblau                          */
  --color-primary-strong: #1d4ed8;
  --color-primary-soft: #eaf1ff;   /* getoenter Hintergrund            */
  --color-primary-contrast: #ffffff;
  --color-primary-border: #b7caf0; /* weicher Blauton: Aktiv-/Fokusring */
  --color-focus: #1d4ed8;          /* Fokusring                        */

  /* --- Sekundaerer Struktur-Akzent (tiefes Navy, sehr zurueckhaltend)
     Nur fuer strukturelle Akzente: Tabellenkopf, Querverweis-Box,
     Hero-Raster. Bewusst monochrom-naher Ton -> ruhig & serioes. ---- */
  --color-accent: #1e3a5f;         /* tiefes Navy-Slate                */
  --color-accent-soft: #eef2f7;    /* dezent getoente Flaeche          */

  /* --- Farben: Status & Interaktion -------------------------------- */
  --color-error: #8a1f1f;          /* Fehlertext                       */
  --color-error-soft: #fdeaea;     /* Fehler-Hintergrund               */
  --color-success: #1d6b3a;        /* Erfolgstext                      */
  --color-success-soft: #e7f6ec;   /* Erfolgs-Hintergrund              */
  --color-border-hover: #cbd2dd;   /* Rahmen bei Hover                 */

  /* Interaktive Rahmen brauchen 3:1 Non-Text-Kontrast (WCAG 1.4.11);
     dunkler als die rein dekorativen --color-border-Linien. */
  --color-input-border: #838d9c;        /* Eingabefeld-Rahmen (Ruhezustand) */
  --color-input-border-hover: #6b7686;  /* Eingabefeld-Rahmen bei Hover     */

  /* Hintergrund des Sticky-Headers. Grundton = --color-surface, Alpha
     noetig fuer den Backdrop-Blur. Im Dark-Block gespiegelt (dort = --color-bg). */
  --color-header-bg: rgba(255, 255, 255, 0.88);

  /* Dekorativer Hero-Verlauf (in Dark Mode ueberschrieben) */
  --hero-gradient: radial-gradient(120% 140% at 100% 0%, var(--color-primary-soft) 0%, transparent 55%);
  /* Sehr feines, kalenderartiges Raster hinter der KW-Zahl (maximal dezent) */
  --hero-grid: repeating-linear-gradient(to right, rgba(30, 58, 95, 0.04) 0 1px, transparent 1px 3.5rem);

  /* --- Abstaende (modulare Skala) ---------------------------------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* --- Radien ------------------------------------------------------ */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* --- Schatten (weich, dezent) ------------------------------------ */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.12);

  /* --- Layout ------------------------------------------------------ */
  --container-max: 1080px;
  --header-height: 4rem;

  /* --- Typografie -------------------------------------------------- */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas",
    "Liberation Mono", monospace;
  --line-body: 1.65;
  --line-tight: 1.2;

  /* --- Uebergaenge ------------------------------------------------- */
  --transition: 160ms ease;
}


/* =====================================================================
   2. Reset & Basis
   ===================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Sticky-Header beim Ankersprung beruecksichtigen */
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: var(--line-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

/* Lange Woerter/URLs nicht ueberlaufen lassen */
p,
li,
h1,
h2,
h3,
h4 {
  overflow-wrap: break-word;
}

/* --- Fliesstext-Typografie ---------------------------------------- */
h1,
h2,
h3,
h4 {
  line-height: var(--line-tight);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

/* Fliesstext mit vollem Kontrast (bessere Lesbarkeit). Sekundaertext
   (Leads, Labels, Hinweise) setzt seine eigene, dezentere Farbe. */
p {
  color: var(--color-text);
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-strong);
  text-decoration: underline;
}

/* Inhaltslinks im Fliesstext auch ohne Farbwahrnehmung erkennbar (WCAG 1.4.1).
   Navigations-, Button- und Karten-Links bleiben bewusst ohne Unterstreichung. */
main p a,
main li a,
.kw-table a,
.faq__answer a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

/* --- Globaler, sichtbarer Fokuszustand (Tastatur) ----------------- */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* nur sichtbar fuer Screenreader (z. B. Skip-Link) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}


/* =====================================================================
   3. Layout
   ===================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 48rem) {
  .container {
    padding-inline: var(--space-6);
  }
}


/* =====================================================================
   4. Header / Navigation / Footer
   ===================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--color-header-bg);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-height);
  flex-wrap: wrap;
}

.site-header__brand {
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}

.site-header__brand:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* --- Anker-Navigation --------------------------------------------- */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.site-nav a {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-soft);
  text-decoration: none;
  transition: color var(--transition), background-color var(--transition);
}

.site-nav a:hover {
  color: var(--color-primary-strong);
  background-color: var(--color-primary-soft);
  text-decoration: none;
}

/* Aktiver Link: serverseitig (aria-current="page") auf Spoke-Seiten oder per
   Scroll-Spy (aria-current="true") auf der Startseite. Beide Werte greifen. */
.site-nav a[aria-current] {
  color: var(--color-primary-strong);
  font-weight: 600;
  background-color: var(--color-primary-soft);
  box-shadow: inset 0 0 0 1px var(--color-primary-border);
}

/* --- Footer ------------------------------------------------------- */
.site-footer {
  margin-top: var(--space-8);
  padding-block: var(--space-7);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.site-footer a {
  color: var(--color-text-soft);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Footer-Navigation in benannte Themengruppen statt einer Linkwueste.
   flex-basis: 100% ist noetig, weil .site-footer__inner ein Flex-Container
   mit space-between ist – sonst rutschte die Nav neben die Copyright-Zeile. */
.site-footer__nav {
  flex-basis: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-2);
}

.site-footer__heading {
  margin-bottom: var(--space-3);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.site-footer__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Groessere, sicher treffbare Touch-Ziele ohne die Optik aufzublaehen:
   row-gap 0, das Padding uebernimmt den vertikalen Abstand (~40px Zielhoehe). */
.site-footer__list a,
.site-footer__legal a {
  display: inline-block;
  padding-block: var(--space-2);
}

/* Rechtliche Links als dezente, abgesetzte Zeile darunter */
.site-footer__legal {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-4);
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
}


/* =====================================================================
   5. Hero (auffaellige Card mit grosser KW-Zahl)
   ===================================================================== */
.hero {
  position: relative;
  margin-top: var(--space-6);
  padding: clamp(var(--space-5), 4vw, var(--space-8));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--hero-gradient), var(--hero-grid), var(--color-surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.hero__label {
  display: inline-block;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary-strong);
}

/* Die grosse, sehr prominente KW-Zahl – klarer Blickfang im obersten Drittel */
.hero__kw {
  display: block;
  margin: 0;
  font-size: clamp(4.5rem, 15vw, 9.5rem);
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--color-primary);
}

.hero__kw small {
  display: inline;
  font-size: 0.32em;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text-muted);
  vertical-align: baseline;
}

/* Zeitraum direkt unter der KW-Zahl (zweitwichtigste Information) */
.hero__dates {
  margin-top: var(--space-3);
  font-size: clamp(1.0625rem, 1rem + 0.5vw, 1.5rem);
  font-weight: 600;
  color: var(--color-text-soft);
  font-variant-numeric: tabular-nums;
}

/* Restliche Infos mit deutlichem Abstand und feiner Trennlinie darunter */
.hero__details {
  margin-top: clamp(var(--space-6), 5vw, var(--space-8));
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.hero__lead {
  max-width: 62ch;
  margin: 0;
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  color: var(--color-text-soft);
}

/* Live-Uhr (dekorativ, via main.js befuellt).
   Fliesstext-Font, aber tabellenziffern gegen Breiten-Jitter beim Minutenwechsel. */
.hero__clock {
  font-variant-numeric: tabular-nums;
}

/* --- Hero-Meta: Statistik-Kacheln --------------------------------- */
.hero__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-6);
  /* Kacheln nicht ueber die ganze Breite dehnen (wirkt sonst leer/ueberdehnt) */
  max-width: 44rem;
}

.stat {
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.stat__label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.stat__value {
  display: block;
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.stat__value a {
  text-decoration: none;
}

.stat__value a:hover {
  text-decoration: underline;
}


/* =====================================================================
   6. Sektionen & Karten
   ===================================================================== */
.section {
  margin-top: clamp(var(--space-7), 6vw, var(--space-8));
  scroll-margin-top: calc(var(--header-height) + var(--space-4));
}

.section__title {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.125rem);
  margin-bottom: var(--space-3);
}

/* Eigene, groessere Stufe fuer Seitentitel (H1 der Unterseiten), damit die
   Hierarchie sichtbar ueber den H2-Sektionstiteln der Startseite liegt. */
h1.section__title {
  font-size: clamp(1.75rem, 1.35rem + 1.9vw, 2.5rem);
  letter-spacing: -0.02em;
}

/* Prosa auf angenehme Zeilenlaenge begrenzen (Lesbarkeit ~60-80 Zeichen).
   Kind-Kombinator: Karten, Callouts, Formulare und Tabellen bleiben unberuehrt.
   :where() haelt die Spezifitaet niedrig, damit .section__lead (65ch) gewinnt. */
.section > :where(p, ul, ol, h2, h3, h4) {
  max-width: 72ch;
}

/* Inhaltsueberschriften innerhalb eingebundener Sektionen (nicht der H1/H2-Titel) */
.section h2:not(.section__title):not(.card__title) {
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
  font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.6rem);
  line-height: var(--line-tight);
}

.section h3 {
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
}

/* Inhaltsabstaende innerhalb von Sektionen */
.section ul,
.section ol {
  margin-top: var(--space-3);
  padding-left: var(--space-5);
  color: var(--color-text);
}

.section li + li {
  margin-top: var(--space-2);
}

/* --- Karten ------------------------------------------------------- */
.card {
  padding: clamp(var(--space-4), 3vw, var(--space-6));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.card > :first-child {
  margin-top: 0;
}

.card__title {
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  margin-top: 0;
  margin-bottom: var(--space-2);
  line-height: var(--line-tight);
}

/* --- Responsives Karten-Raster ------------------------------------ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
}


/* =====================================================================
   7a. Tabelle (.kw-table)
   ===================================================================== */
/* Wrapper sorgt fuer horizontales Scrollen bei schmalen Viewports */
.kw-table-wrap {
  margin-top: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.kw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background-color: var(--color-surface);
}

.kw-table caption {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.kw-table th,
.kw-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
  white-space: normal; /* lange Textzellen (z. B. Vergleichstabelle) duerfen umbrechen */
}

/* Nur kurze, zusammengehoerige Zellen (Datumsangaben, KW) nicht umbrechen */
.kw-table .kw-nowrap {
  white-space: nowrap;
}

.kw-table thead th {
  position: sticky;
  top: 0;
  background-color: var(--color-surface-2);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
}

/* gestreifte Zeilen fuer bessere Lesbarkeit */
.kw-table tbody tr:nth-child(even) {
  background-color: var(--color-surface-2);
}

/* Kein Hover-Effekt: Die Zeilen sind nicht interaktiv, und ein blauer Hover
   liesse sich nicht von der reservierten "Heute"-Markierung unterscheiden. */

.kw-table td:first-child,
.kw-table th:first-child {
  font-variant-numeric: tabular-nums;
}

/* aktuelle/hervorgehobene Zeile */
.kw-table tbody tr.is-current {
  background-color: var(--color-primary-soft);
  box-shadow: inset 3px 0 0 var(--color-primary);
}

/* Sticky-Tabellenkopf erst ab Breiten, in denen die Tabelle nicht mehr
   horizontal scrollt. overflow-x: clip (statt auto) erzeugt keinen
   Scroll-Container, sodass "position: sticky" gegen den Viewport greift und
   der Kopf unter dem Header stehen bleibt. Alt-Browser ignorieren clip. */
@media (min-width: 64rem) {
  .kw-table-wrap {
    overflow-x: clip;
  }

  .kw-table thead th {
    top: var(--header-height);
    z-index: 1;
  }
}


/* =====================================================================
   7b. FAQ (native <details>/<summary>, barrierefrei)
   ===================================================================== */
.faq__item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.faq__item + .faq__item {
  margin-top: var(--space-3);
}

.faq__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  font-weight: 600;
  color: var(--color-text);
  list-style: none; /* Standard-Marker entfernen */
  transition: background-color var(--transition);
}

/* Standard-Disclosure-Dreieck in WebKit ausblenden */
.faq__item summary::-webkit-details-marker {
  display: none;
}

/* Eigener Pfeil-Indikator */
.faq__item summary::after {
  content: "";
  flex: 0 0 auto;
  width: 0.6rem;
  height: 0.6rem;
  margin-left: var(--space-3);
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform var(--transition);
}

.faq__item[open] summary::after {
  transform: rotate(-135deg);
}

.faq__item summary:hover {
  background-color: var(--color-primary-soft);
}

/* Fokusring sauber auf das Summary-Element */
.faq__item summary:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: -3px;
  border-radius: var(--radius-md);
}

.faq__item[open] summary {
  border-bottom: 1px solid var(--color-border);
}

.faq__answer {
  padding: var(--space-4) var(--space-5) var(--space-5);
  color: var(--color-text-soft);
}

.faq__answer > :first-child {
  margin-top: 0;
}


/* =====================================================================
   7c. Formular (.kw-form) & Buttons
   ===================================================================== */
.kw-form {
  margin-top: var(--space-4);
  padding: clamp(var(--space-4), 3vw, var(--space-6));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.kw-form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-4);
}

.kw-form__field {
  flex: 1 1 12rem;
  min-width: 0;
}

.kw-form label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-soft);
}

.kw-form input,
.kw-form select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 1rem;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.kw-form input::placeholder {
  color: var(--color-text-muted);
}

.kw-form input:hover,
.kw-form select:hover {
  border-color: var(--color-input-border-hover);
}

.kw-form input:focus,
.kw-form select:focus {
  border-color: var(--color-primary);
  /* --color-primary-border ist in beiden Themes gespiegelt, daher auch im
     Dark-Mode als 3px-Glow sichtbar (anders als --color-primary-soft). */
  box-shadow: 0 0 0 3px var(--color-primary-border);
}

/* Tastatur-Fokus: gleicher sichtbarer Outline-Ring wie Buttons/Links,
   damit alle interaktiven Elemente konsistent fokussiert werden. */
.kw-form input:focus-visible,
.kw-form select:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.kw-form__hint {
  margin-top: var(--space-2);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.kw-form__result {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background-color: var(--color-primary-soft);
  color: var(--color-text);
  font-weight: 600;
}

/* --- Buttons ------------------------------------------------------ */
.btn,
.btn--ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition), box-shadow var(--transition), transform var(--transition);
}

/* Primaer-Button: WCAG-AA-Kontrast (Weiss auf #2563eb) */
.btn {
  color: var(--color-primary-contrast);
  background-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background-color: var(--color-primary-strong);
  color: var(--color-primary-contrast);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

/* Ghost-Button: dezent, klare Kontur */
.btn--ghost {
  color: var(--color-primary-strong);
  background-color: transparent;
  border-color: var(--color-input-border);
}

.btn--ghost:hover {
  color: var(--color-primary-strong);
  background-color: var(--color-primary-soft);
  border-color: var(--color-primary);
  text-decoration: none;
}

/* deutlicher Tastatur-Fokus auf beide Button-Varianten */
.btn:focus-visible,
.btn--ghost:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}


/* =====================================================================
   8a. Dark-Mode (dezent, automatisch nach Systemeinstellung)
   ===================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --color-bg: #0e1320;          /* gekoppelt an theme-color in layout-header.php */
    --color-surface: #161c2b;
    --color-surface-2: #1d2538;
    --color-border: #2a3447;
    --color-text: #e6eaf2;
    --color-text-soft: #b3bccc;
    --color-text-muted: #8893a6;

    --color-primary: #5b8bff;
    --color-primary-strong: #7aa2ff;
    --color-primary-soft: #1b2540;
    --color-primary-contrast: #0b1020;
    --color-primary-border: #34507f;
    --color-focus: #7aa2ff;

    /* Sekundaer-Akzent aufgehellt fuer Kontrast auf dunklem Grund */
    --color-accent: #9db8d8;
    --color-accent-soft: #182234;

    /* Status: aufgehellt fuer ausreichenden Kontrast (>= 4.5:1) */
    --color-error: #ffb4b4;
    --color-error-soft: #46201f;
    --color-success: #7fdfa0;
    --color-success-soft: #143524;
    --color-border-hover: #3a4760;

    /* Interaktive Rahmen: 3:1 Non-Text-Kontrast auf dunklem Grund */
    --color-input-border: #5d6d89;
    --color-input-border-hover: #7286a5;

    /* Header-Hintergrund im Dark-Mode. Grundton = --color-bg (Navy). */
    --color-header-bg: rgba(14, 19, 32, 0.85);

    --hero-gradient: radial-gradient(120% 140% at 100% 0%, rgba(91, 139, 255, 0.16) 0%, transparent 55%);
    --hero-grid: repeating-linear-gradient(to right, rgba(157, 184, 216, 0.05) 0 1px, transparent 1px 3.5rem);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  }
}


/* =====================================================================
   8b. Reduzierte Bewegung respektieren
   ===================================================================== */
@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;
  }
}


/* =====================================================================
   8c. Print (sparsam, lesbar)
   ===================================================================== */
@media print {
  .site-header,
  .site-footer,
  .site-nav,
  .kw-form {
    display: none;
  }

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

  .hero,
  .card,
  .faq__item {
    box-shadow: none;
    border: 1px solid #999;
  }
}


/* =====================================================================
   9. Ergaenzungen: Hero-H1, Praxis, Rechner, Infobox, Copy, Chips
   ===================================================================== */

/* --- Skip-Link (Tastatur/Screenreader) --------------------------------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus {
  left: 0;
}

/* --- Marken-Akzent im Header ------------------------------------------- */
.site-header__brand-accent {
  color: var(--color-primary);
}

/* --- Hero-Ueberschrift (genau eine H1, KW visuell dominant) ------------ */
.hero__h1 {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
}
.hero__eyebrow {
  font-size: clamp(0.875rem, 0.8rem + 0.3vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary-strong);
}

/* --- Badge (z. B. "heute" in der Jahrestabelle) ------------------------ */
.badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-primary-contrast);
  background: var(--color-primary);
  border-radius: var(--radius-pill);
  vertical-align: middle;
}

/* --- Sektions-Lead-Text ------------------------------------------------ */
.section__lead {
  max-width: 65ch;
  margin-bottom: var(--space-4);
  color: var(--color-text-soft);
}

/* --- Untergliederte Praxis-Abschnitte (h3/h4) -------------------------- */
.section h4 {
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
}
.practice {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}
.practice:first-of-type {
  margin-top: var(--space-4);
  padding-top: 0;
  border-top: none;
}

/* --- Sprung-Chips (Schnellnavigation innerhalb der Praxis) ------------- */
.chip-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-2);
  padding: 0;
  list-style: none;
}
.chip-nav a {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-soft);
  background: var(--color-surface);
}
.chip-nav a:hover {
  color: var(--color-primary-strong);
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  text-decoration: none;
}

/* --- Code / Formeln ---------------------------------------------------- */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-surface-2);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}
.code-block {
  margin: var(--space-3) 0;
  padding: var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}
.code-block code {
  display: block;
  padding: 0;
  background: none;
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre;
}

/* --- Infobox / Merksaetze ---------------------------------------------- */
.infobox {
  margin-top: var(--space-5);
  padding: clamp(var(--space-4), 3vw, var(--space-6));
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
}
.infobox > :first-child {
  margin-top: 0;
}
.infobox ul {
  margin-top: var(--space-3);
}

/* --- Callout (Hinweis-/Querverweis-Box, v. a. Unterseiten) -------------
   Querverweis = ruhige weisse (Surface-)Flaeche mit Navy-Linksrand; die
   getoente blaue Infobox bleibt exklusiv fuer Merksaetze/Tipps. So sind
   die beiden Boxentypen klar voneinander unterscheidbar. */
.callout {
  margin-top: var(--space-5);
  padding: clamp(var(--space-4), 3vw, var(--space-5));
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.callout > :first-child {
  margin-top: 0;
}

/* --- Rechner-Raster (zwei Formulare) ----------------------------------- */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  margin-top: var(--space-5);
}
@media (min-width: 52rem) {
  .calc-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.kw-form > h3 {
  margin-top: 0;
}
.kw-form__intro {
  margin-bottom: var(--space-4);
  font-size: 0.95rem;
  color: var(--color-text-soft);
}
.kw-form__field--action {
  display: flex;
  align-items: flex-end;
  flex: 1 1 12rem;
}
.kw-form__field--action .btn {
  width: 100%;
}
.kw-result-list {
  margin-top: var(--space-3);
  padding-left: var(--space-5);
}
.kw-result-list li + li {
  margin-top: var(--space-1);
}
.kw-form__result--error {
  background: var(--color-error-soft);
  color: var(--color-error);
}

/* --- Copy-to-Clipboard ------------------------------------------------- */
.copy-box {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.copy-text {
  margin: 0;
  font-weight: 500;
  color: var(--color-text);
}
.js-copy.is-copied {
  color: var(--color-primary-contrast);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* Fehlerzustand, falls das Kopieren nicht moeglich war (z. B. kein Clipboard-API) */
.js-copy.is-copy-error {
  color: var(--color-error);
  background: var(--color-error-soft);
  border-color: var(--color-error);
}

/* --- Aufklappbare Jahrestabelle ---------------------------------------- */
.reveal {
  margin-top: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.reveal > summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.reveal > summary::-webkit-details-marker {
  display: none;
}
.reveal > summary::after {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  margin-left: auto;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform var(--transition);
}
.reveal[open] > summary::after {
  transform: rotate(-135deg);
}
.reveal > summary:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: -3px;
  border-radius: var(--radius-md);
}
.reveal__body {
  padding: 0 var(--space-5) var(--space-5);
}

/* --- Verweise auf Jahres-Unterseiten ----------------------------------- */
.year-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* =====================================================================
   10. Mobile-Navigation: einzeilig + horizontal scrollbar
   ---------------------------------------------------------------------
   Verhindert einen sehr hohen Sticky-Header (mehrzeilige Navigation) und
   damit das Verdecken von Ankerzielen beim Sprung.
   ===================================================================== */
@media (max-width: 47.99rem) {
  .site-nav {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* Firefox */
    padding-bottom: 2px;
    /* Rechter Padding-Puffer: am Scroll-Ende bleibt das letzte Item klar
       lesbar (links des Fade-Bereichs). */
    padding-right: var(--space-6);
    /* Beidseitiger Scroll-Fade als Affordanz ("es geht weiter"). Ohne JS bleibt
       es beim rechten Fade (am Scroll-Anfang korrekt); main.js aktualisiert
       --fade-l/--fade-r je nach Position: links faden sobald gescrollt wurde,
       rechts nur solange noch Inhalt folgt. */
    --fade-l: 0rem;
    --fade-r: 1.5rem;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
    mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
  }
  .site-nav::-webkit-scrollbar {
    display: none;                  /* WebKit */
  }
  /* Etwas schmaleres Item-Padding, damit ein weiterer Eintrag anschneidet und
     so sichtbar wird, dass die Navigation horizontal scrollbar ist. */
  .site-nav a {
    white-space: nowrap;
    padding-inline: var(--space-2);
  }

  /* Sticky-Header schlanker: nur vertikaler Abstand zwischen Marke und
     Nav-Zeile, spart Hoehe ohne die Nav-Pills zu gedraengt wirken zu lassen. */
  .site-header__inner {
    row-gap: var(--space-2);
  }

  /* Zweizeiliger Header (Marke + Navizeile): Ankerziele nicht darunter
     verschwinden lassen. Gebuendelt in einem Token als einzige Pflegestelle. */
  :root {
    --header-offset-mobile: 7rem;
  }
  html {
    scroll-padding-top: var(--header-offset-mobile);
  }
  .section,
  .hero {
    scroll-margin-top: var(--header-offset-mobile);
  }

  /* Jahrestabelle bei 375px kompakter, damit die 4 Spalten ohne Scrollen
     passen; bleibt es zu breit (Badge-Zeile), zeigt eine schmale sichtbare
     Scrollleiste die Scrollbarkeit an. */
  .kw-table th,
  .kw-table td {
    padding: var(--space-2) var(--space-3);
  }
  .kw-table {
    font-size: 0.875rem;
  }
  .kw-table caption {
    padding: var(--space-2) var(--space-3);
  }
  .kw-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
  }
  .kw-table-wrap::-webkit-scrollbar {
    height: 8px;
  }
  .kw-table-wrap::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-pill);
  }
}


/* =====================================================================
   11. Breadcrumbs (sichtbare Brotkrumen-Navigation auf Unterseiten)
   ===================================================================== */
.breadcrumbs {
  margin-top: var(--space-5);
  margin-bottom: calc(-1 * var(--space-2));
  font-size: 0.875rem;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: var(--space-2);
  color: var(--color-text-muted);
}

.breadcrumbs a {
  color: var(--color-text-soft);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--color-primary-strong);
  text-decoration: underline;
}

.breadcrumbs [aria-current="page"] {
  color: var(--color-text);
  font-weight: 600;
}


/* =====================================================================
   12. Teaser-Karten (Praxis-Hub auf der Startseite verlinkt die Spokes)
   ===================================================================== */
.teaser .card {
  display: flex;
  flex-direction: column;
  /* Verlinkte Teaser-Karten signalisieren Klickbarkeit durch einen
     dezenten Hover-/Fokus-Lift. Rein informative Karten (z. B. im
     Unternehmens-Abschnitt) bleiben bewusst flach. */
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition);
}

.teaser .card:hover,
.teaser .card:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary-border);
}

.teaser .card p {
  flex: 1 1 auto;
}

/* Dezentes Linien-Icon je Teaser (statisches Inline-SVG, keine Abhaengigkeit) */
.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-primary-strong);
  background: var(--color-primary-soft);
}

.card__icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.teaser-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
  font-weight: 600;
  color: var(--color-primary-strong);
}

.teaser-link:hover {
  text-decoration: underline;
}

/* --- Hero-Aktionszeile (primaerer Weg zum Rechner) -------------------- */
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}
