/*
 * SPDX-FileCopyrightText: 2026 Projekt LUDUS 2.0 (Rechtekette nach MoU vom 19.10.2026, siehe LICENSING.md)
 * SPDX-License-Identifier: AGPL-3.0-or-later
 *
 * Startseite LUDUS (Auftrag Markus 18.11.2026). Farben, Schrift, Radien und Abstände nach dem Designsystem der modernen
 * Oberfläche (ludus2-web, packages/ui-modern/src/tokens.css: Schiefer, Tintenblau, Bühne „Spielblau“, Ortstöne,
 * Display-Schrift Alexandria). Kein Skript: Hell/Dunkel folgt dem System (prefers-color-scheme), der Schalter im Kopf
 * (#thema, reines CSS über :has) kehrt die Vorgabe um. Kontraste prüft tools/startseite.py (WCAG 2.1 AA).
 */

@font-face {
  font-family: "Alexandria";
  src: url("schrift/alexandria-latin.woff2") format("woff2");
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}

/* Rückfall ohne light-dark(): helles Thema. Die Werte müssen den hellen Werten im @supports-Block gleichen (Test). */
:root {
  --farbe-hintergrund: #f4f6f8;
  --farbe-flaeche: #ffffff;
  --farbe-band: #edf0f4;
  --farbe-text: #14171d;
  --farbe-text-gedaempft: #4e5667;
  --farbe-rand: #d9dee6;
  --farbe-rand-bedienelement: #7a8396;
  --farbe-primaer: #2450b8;
  --farbe-primaer-text: #ffffff;
  --farbe-primaer-hover: #1c409a;
  --farbe-verweis: #2450b8;
  --farbe-fokus: #2450b8;
  --farbe-hinweis-flaeche: #fff1d6;
  --farbe-hinweis-text: #6e3b00;
  --schatten-knopf: #1b2440;
  --schatten-karte: #d9dee6;
  --ort-1: #b04f2a;
  --ort-2: #3d6587;
  --ort-3: #7754a0;
  --ort-4: #2b7468;
  --ort-text: #ffffff;

  /* Bühne „Spielblau“: in beiden Themen gleich, Text weiß. */
  --buehne-1: #0b1f4b;
  --buehne-2: #1d4797;
  --buehne-text: #ffffff;
  --buehne-text-gedaempft: #c7d4f0;
  --buehne-raster: rgb(255 255 255 / 0.05);
  --buehne-rand: rgb(255 255 255 / 0.28);

  --radius-klein: 0.375rem;
  --radius: 0.625rem;
  --radius-gross: 0.875rem;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --schrift-display: "Alexandria", var(--schrift);
  --breite: 72rem;
  --rand-seite: clamp(1rem, 4vw, 2rem);
  --versatz-spiel: 3px;
}

@supports (color: light-dark(#000, #fff)) {
  :root {
    color-scheme: light dark;
    --farbe-hintergrund: light-dark(#f4f6f8, #0f1217);
    --farbe-flaeche: light-dark(#ffffff, #171a21);
    --farbe-band: light-dark(#edf0f4, #13161c);
    --farbe-text: light-dark(#14171d, #e8ebf0);
    --farbe-text-gedaempft: light-dark(#4e5667, #a4acba);
    --farbe-rand: light-dark(#d9dee6, #232833);
    --farbe-rand-bedienelement: light-dark(#7a8396, #737c8f);
    --farbe-primaer: light-dark(#2450b8, #7ea2ff);
    --farbe-primaer-text: light-dark(#ffffff, #0f1217);
    --farbe-primaer-hover: light-dark(#1c409a, #9db8ff);
    --farbe-verweis: light-dark(#2450b8, #9db8ff);
    --farbe-fokus: light-dark(#2450b8, #9db8ff);
    --farbe-hinweis-flaeche: light-dark(#fff1d6, #33260f);
    --farbe-hinweis-text: light-dark(#6e3b00, #f5c26b);
    --schatten-knopf: light-dark(#1b2440, #2450b8);
    --schatten-karte: light-dark(#d9dee6, #000000);
    --ort-1: light-dark(#b04f2a, #b04f2a);
    --ort-2: light-dark(#3d6587, #3d6587);
    --ort-3: light-dark(#7754a0, #7754a0);
    --ort-4: light-dark(#2b7468, #2b7468);
    --ort-text: light-dark(#ffffff, #ffffff);
  }
  @media (prefers-color-scheme: light) {
    :root:has(#thema:checked) { color-scheme: dark; }
  }
  @media (prefers-color-scheme: dark) {
    :root:has(#thema:checked) { color-scheme: light; }
  }
}

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

html {
  font-family: var(--schrift);
  font-size: 100%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0;
  background: var(--farbe-hintergrund);
  color: var(--farbe-text);
  font-size: 1.0625rem;
}

img { max-width: 100%; height: auto; }
a { color: var(--farbe-verweis); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--farbe-fokus); outline-offset: 2px; border-radius: var(--radius-klein); }

h1, h2, h3 {
  font-family: var(--schrift-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 4.6vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.125rem); }
h3 { font-size: 1.125rem; line-height: 1.3; }
p { margin: 0; text-wrap: pretty; }

.innen { width: 100%; max-width: var(--breite); margin-inline: auto; padding-inline: var(--rand-seite); }
.nur-vorlesen {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.sprung {
  position: absolute; left: var(--rand-seite); top: -4rem; z-index: 20;
  background: var(--farbe-flaeche); color: var(--farbe-text); padding: 0.5rem 0.875rem;
  border: 2px solid var(--farbe-fokus); border-radius: var(--radius);
}
.sprung:focus { top: 0.5rem; }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 10;
  background: var(--farbe-flaeche);
  border-bottom: 1px solid var(--farbe-rand);
}
.kopf .innen { display: flex; align-items: center; gap: 0.75rem; min-height: 3.5rem; }
.wortmarke {
  font-family: var(--schrift-display); font-weight: 800; font-size: 1.375rem; letter-spacing: 0.06em;
  color: var(--farbe-text); text-decoration: none; margin-right: auto; padding-block: 0.5rem;
}
.kopf-navigation { display: none; gap: 1.25rem; margin-right: 0.75rem; }
.kopf-navigation a { color: var(--farbe-text-gedaempft); text-decoration: none; font-size: 0.9375rem; font-weight: 600; padding-block: 0.75rem; }
.kopf-navigation a:hover { color: var(--farbe-text); text-decoration: underline; }
@media (min-width: 56rem) { .kopf-navigation { display: flex; } }

/* Schalter Hell/Dunkel: echtes Kontrollkästchen (Rolle switch), sichtbar ist nur die Beschriftung. */
.thema-eingabe { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.thema-schalter {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
  min-width: 2.75rem; min-height: 2.75rem; padding-inline: 0.625rem;
  border: 1px solid var(--farbe-rand-bedienelement); border-radius: var(--radius);
  background: var(--farbe-flaeche); color: var(--farbe-text); font-size: 0.875rem; font-weight: 600;
  pointer-events: none; user-select: none;
}
.thema-halter { position: relative; display: inline-flex; }
.thema-eingabe:focus-visible + .thema-schalter { outline: 2px solid var(--farbe-fokus); outline-offset: 2px; }
.thema-eingabe:hover + .thema-schalter { border-color: var(--farbe-text); }
.thema-zeichen { width: 1.125rem; height: 1.125rem; flex: none; }
.thema-text { display: none; }
@media (min-width: 30rem) { .thema-text { display: inline; } }

/* ---------- Knöpfe ---------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0.5rem 1.125rem;
  border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.2; text-decoration: none; text-align: center;
  transition: transform 120ms, box-shadow 120ms, background-color 120ms;
}
.knopf-primaer {
  background: var(--farbe-primaer); color: var(--farbe-primaer-text);
  box-shadow: 0 var(--versatz-spiel) 0 var(--schatten-knopf);
}
.knopf-primaer:hover { background: var(--farbe-primaer-hover); }
.knopf-primaer:active { transform: translateY(var(--versatz-spiel)); box-shadow: none; }
.knopf-sekundaer {
  background: var(--farbe-flaeche); color: var(--farbe-text); border-color: var(--farbe-rand-bedienelement);
}
.knopf-sekundaer:hover { border-color: var(--farbe-text); }
.knopf-klein { min-height: 2.75rem; padding-inline: 0.875rem; font-size: 0.9375rem; }
/* Auf der Bühne: heller Hauptknopf, Nebenknopf als Umriss. */
.buehne .knopf-primaer { background: #ffffff; color: #0b1f4b; box-shadow: 0 var(--versatz-spiel) 0 rgb(0 0 0 / 0.35); }
.buehne .knopf-primaer:hover { background: #e6edfc; }
.buehne .knopf-sekundaer { background: transparent; color: #ffffff; border-color: var(--buehne-rand); }
.buehne .knopf-sekundaer:hover { border-color: #ffffff; }
.buehne :focus-visible { outline-color: #ffffff; }
.knopfzeile { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ---------- Bühne (Hero) ---------- */
.buehne {
  color: var(--buehne-text);
  background-color: var(--buehne-1);
  background-image:
    repeating-linear-gradient(135deg, var(--buehne-raster) 0 0.75rem, transparent 0.75rem 1.5rem),
    linear-gradient(135deg, var(--buehne-1), var(--buehne-2));
  border-bottom: 4px solid var(--farbe-primaer);
  overflow: hidden;
}
.buehne .innen { padding-block: clamp(2.5rem, 7vw, 5rem) 0; }
.buehne-text { max-width: 44rem; }
.ueberzeile {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--farbe-text-gedaempft); margin-bottom: 0.75rem;
}
.buehne .ueberzeile { color: var(--buehne-text-gedaempft); }
.buehne h1 { color: #ffffff; }
.buehne .einleitung { color: var(--buehne-text-gedaempft); font-size: clamp(1.0625rem, 1.6vw, 1.25rem); margin-block: 1.25rem 1.75rem; max-width: 40rem; }
.buehne-bild { margin: clamp(2rem, 5vw, 3.5rem) 0 0; }
.buehne-bild img {
  display: block; width: 100%;
  border: 1px solid var(--buehne-rand); border-bottom: 0;
  border-radius: var(--radius-gross) var(--radius-gross) 0 0;
  box-shadow: 0 -0.5rem 2.5rem rgb(0 0 0 / 0.35);
}

/* ---------- Abschnitte ---------- */
.abschnitt { padding-block: clamp(3rem, 7vw, 5.5rem); }
.abschnitt-band { background: var(--farbe-band); border-block: 1px solid var(--farbe-rand); }
.abschnitt-kopf { max-width: 46rem; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.abschnitt-kopf p { color: var(--farbe-text-gedaempft); margin-top: 0.875rem; font-size: 1.125rem; }

.dreier { display: grid; gap: 1rem; grid-template-columns: 1fr; list-style: none; margin: 0; padding: 0; }
@media (min-width: 48rem) { .dreier { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }
.karte {
  background: var(--farbe-flaeche); border: 1px solid var(--farbe-rand); border-radius: var(--radius-gross);
  padding: 1.25rem 1.25rem 1.375rem; box-shadow: 0 var(--versatz-spiel) 0 var(--schatten-karte);
}
.karte h3 { margin-bottom: 0.5rem; }
.karte p { color: var(--farbe-text-gedaempft); font-size: 1rem; }
.kreislauf {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.625rem; list-style: none;
  margin: clamp(1.5rem, 4vw, 2.25rem) 0 0; padding: 0; font-weight: 700; font-family: var(--schrift-display);
}
.kreislauf li { display: inline-flex; align-items: center; gap: 0.625rem; }
.kreislauf li span {
  display: inline-block; padding: 0.375rem 0.875rem; border-radius: 999px;
  background: var(--farbe-flaeche); border: 1px solid var(--farbe-rand); font-size: 0.9375rem;
}
.kreislauf li + li::before { content: "→"; color: var(--farbe-text-gedaempft); font-family: var(--schrift); }
.fussnote { margin-top: 1.5rem; color: var(--farbe-text-gedaempft); font-size: 0.9375rem; max-width: 46rem; }

/* ---------- So funktioniert’s ---------- */
.schritte { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(2.5rem, 6vw, 4.5rem); }
.schritt { display: grid; gap: 1.25rem; align-items: center; }
@media (min-width: 56rem) {
  .schritt { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 3rem; }
  .schritt:nth-child(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .schritt:nth-child(even) .schritt-text { order: 2; }
}
.schritt-nummer {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: var(--radius);
  font-family: var(--schrift-display); font-weight: 800; font-size: 1.125rem;
  color: var(--ort-text); margin-bottom: 0.875rem;
}
.schritt:nth-child(1) .schritt-nummer { background: var(--ort-1); }
.schritt:nth-child(2) .schritt-nummer { background: var(--ort-2); }
.schritt:nth-child(3) .schritt-nummer { background: var(--ort-3); }
.schritt:nth-child(4) .schritt-nummer { background: var(--ort-4); }
.schritt h3 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); margin-bottom: 0.625rem; }
.schritt-text p { color: var(--farbe-text-gedaempft); }
.schritt-rolle { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--farbe-text-gedaempft); display: block; margin-bottom: 0.25rem; }
.rahmen { margin: 0; }
.rahmen img {
  display: block; width: 100%;
  border: 1px solid var(--farbe-rand); border-radius: var(--radius-gross);
  box-shadow: 0 var(--versatz-spiel) 0 var(--schatten-karte), 0 0.75rem 2rem rgb(0 0 0 / 0.08);
}

/* ---------- Funktionsraster ---------- */
.raster { display: grid; gap: 1rem; grid-template-columns: 1fr; list-style: none; margin: 0; padding: 0; }
@media (min-width: 40rem) { .raster { grid-template-columns: repeat(2, 1fr); } }
/* Zehn Karten: breit zwei hervorgehobene (je zwei Spalten) über acht in vier Spalten. */
@media (min-width: 64rem) {
  .raster { grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
  .raster .karte:nth-child(-n + 2) { grid-column: span 2; }
  .raster .karte:nth-child(-n + 2) h3 { font-size: 1.25rem; }
}
.raster .karte { border-top: 3px solid var(--farbe-primaer); box-shadow: none; }
.raster .karte:nth-child(4n + 1) { border-top-color: var(--ort-1); }
.raster .karte:nth-child(4n + 2) { border-top-color: var(--ort-2); }
.raster .karte:nth-child(4n + 3) { border-top-color: var(--ort-3); }
.raster .karte:nth-child(4n + 4) { border-top-color: var(--ort-4); }

/* ---------- Absender und Schluss ---------- */
.zweier { display: grid; gap: 1.25rem; }
@media (min-width: 56rem) { .zweier { grid-template-columns: 1fr 1fr; } }
.tafel {
  border-radius: var(--radius-gross); padding: clamp(1.5rem, 4vw, 2.25rem);
  background: var(--farbe-flaeche); border: 1px solid var(--farbe-rand);
}
.tafel h2 { font-size: clamp(1.375rem, 2.4vw, 1.75rem); margin-bottom: 0.75rem; }
.tafel p { color: var(--farbe-text-gedaempft); }
.tafel p + p { margin-top: 0.75rem; }
.tafel .knopfzeile { margin-top: 1.5rem; }
.tafel-buehne {
  color: #ffffff; border: 0;
  background-color: var(--buehne-1);
  background-image:
    repeating-linear-gradient(135deg, var(--buehne-raster) 0 0.75rem, transparent 0.75rem 1.5rem),
    linear-gradient(135deg, var(--buehne-1), var(--buehne-2));
}
.tafel-buehne h2 { color: #ffffff; }
.tafel-buehne p { color: var(--buehne-text-gedaempft); }

/* ---------- Fuß ---------- */
.fuss { border-top: 1px solid var(--farbe-rand); background: var(--farbe-flaeche); }
.fuss .innen { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: center; padding-block: 1.5rem; font-size: 0.9375rem; color: var(--farbe-text-gedaempft); }
.fuss p { margin-right: auto; }
.fuss ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.fuss a { color: var(--farbe-text-gedaempft); display: inline-block; padding-block: 0.625rem; }
.fuss a:hover { color: var(--farbe-text); }

/* ---------- Textseiten (Impressum, Datenschutz, Hinweis) ---------- */
.textseite { padding-block: clamp(2.5rem, 6vw, 4rem); }
.textseite .innen { max-width: 48rem; }
.textseite h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 1.5rem; }
.textseite h2 { font-size: 1.25rem; margin: 2.25rem 0 0.625rem; }
.textseite p, .textseite ul, .textseite dl, .textseite address { margin-block: 0 0.875rem; }
.textseite ul { padding-left: 1.25rem; }
.textseite li + li { margin-top: 0.25rem; }
.textseite address { font-style: normal; }
.textseite dl { display: grid; grid-template-columns: 1fr; gap: 0.125rem 1.5rem; }
.textseite dt { font-weight: 700; margin-top: 0.625rem; }
.textseite dd { margin: 0; }
@media (min-width: 40rem) {
  .textseite dl { grid-template-columns: 14rem 1fr; }
  .textseite dt { margin-top: 0; }
  .textseite dt, .textseite dd { padding-block: 0.375rem; border-top: 1px solid var(--farbe-rand); }
}
.stand { color: var(--farbe-text-gedaempft); font-size: 0.9375rem; }
.hinweistafel { max-width: 40rem; margin-inline: auto; text-align: left; }
.hinweistafel .tafel { box-shadow: 0 var(--versatz-spiel) 0 var(--schatten-karte); }
.hinweistafel h1 { font-size: clamp(1.625rem, 4vw, 2.125rem); margin-bottom: 1rem; }
.hinweistafel p { color: var(--farbe-text-gedaempft); }
.hinweistafel p + p { margin-top: 0.75rem; }

/* Offene Angabe (sichtbar markiert; ein Ausrollen mit offenen Angaben verhindert tools/testserver_deploy.py). */
.offen {
  background: var(--farbe-hinweis-flaeche); color: var(--farbe-hinweis-text);
  padding: 0.0625rem 0.375rem; border-radius: var(--radius-klein); font-weight: 700;
  border: 1px dashed currentColor;
}

/* ---------- Bilder der Oberfläche je Thema ----------
   Vorgabe hell; dunkel nach System, der Schalter kehrt um. Steht nach den Regeln der Bildrahmen (.buehne-bild img,
   .rahmen img) und ist mit img.… mindestens gleich spezifisch, damit das ausgeblendete Bild ausgeblendet bleibt. */
img.bild-dunkel { display: none; }
@media (prefers-color-scheme: light) {
  :root:has(#thema:checked) img.bild-hell { display: none; }
  :root:has(#thema:checked) img.bild-dunkel { display: block; }
}
@media (prefers-color-scheme: dark) {
  img.bild-hell { display: none; }
  img.bild-dunkel { display: block; }
  :root:has(#thema:checked) img.bild-hell { display: block; }
  :root:has(#thema:checked) img.bild-dunkel { display: none; }
}

@media print {
  .kopf { position: static; }
  .thema-halter, .sprung { display: none; }
  .buehne, .tafel-buehne { background: none; color: #000000; }
  .buehne h1, .buehne .einleitung, .tafel-buehne h2, .tafel-buehne p { color: #000000; }
}
