/* ============================================================
   Gemeinsames Design für alle Seiten auf verstehen.io
   Quelle: @Vorlage_Design (design_regeln.md). Aufbau:
     1. Schriften   2. Farben   3. Seite   4. Fenster
     5. Fußzeile    6. Tag/Nacht-Knopf   7. Druck
   ============================================================ */

/* ---------- 1. SCHRIFTEN (lokal aus data/@fonts, nur Latein) ----------
   Genau drei Rollen:
     --font-comic  Überschriften
     --font-text   normaler Text
     --font-code   Code-artiges (hier: Platzhalter-Hinweise)
   Fehlt eine Datei, greift die Ersatzschrift dahinter. */
@font-face { font-family: 'Comic Relief'; font-weight: 400; font-display: swap;
  src: url('data/@fonts/comic-relief/comic-relief-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Comic Relief'; font-weight: 700; font-display: swap;
  src: url('data/@fonts/comic-relief/comic-relief-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'M PLUS Rounded 1c'; font-weight: 400; font-display: swap;
  src: url('data/@fonts/m-plus-rounded-1c/m-plus-rounded-1c-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'M PLUS Rounded 1c'; font-weight: 500; font-display: swap;
  src: url('data/@fonts/m-plus-rounded-1c/m-plus-rounded-1c-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'M PLUS Rounded 1c'; font-weight: 700; font-display: swap;
  src: url('data/@fonts/m-plus-rounded-1c/m-plus-rounded-1c-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap;
  src: url('data/@fonts/ibm-plex-mono/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap;
  src: url('data/@fonts/ibm-plex-mono/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

:root {
  --font-comic: 'Comic Relief', 'Comic Sans MS', sans-serif;
  --font-text:  'M PLUS Rounded 1c', 'Segoe UI', sans-serif;
  --font-code:  'IBM Plex Mono', Consolas, monospace;

  /* ---------- 2. FARBROLLEN (Light = Standardwerte) ----------
     Light: --bg ist identisch mit --card-bg. Die Fenster heben sich über
     Rahmen und Schatten nach außen ab. */
  --card-bg: #FFF9E5;         /* Fenster, Felder, Buttons */
  --bg: var(--card-bg);       /* Seitenhintergrund (Light = wie Fenster) */
  --text-primary: #0A0A0A;
  --text-secondary: #73736D;
  --text-emphasis: #0A0A0A;
  --border: #E0E0E0;
  --stroke: #0A0A0A;          /* Icons */

  --mix-target: black;        /* Mischrichtung für Hover/Fokus: Light = Richtung Schwarz */
  --focus-amount: 20%;
  --window-shadow: 0 0 12px color-mix(in srgb, var(--card-bg), black 20%);  /* nur Light */
}
:root[data-theme="dark"] {
  --bg: #121212;              /* NUR Seitenhintergrund, nie in Fenstern */
  --card-bg: #1E1E1E;
  --text-primary: #B5B5B5;
  --text-secondary: #A0A0A0;
  --text-emphasis: #CBCBCB;
  --border: #454545;
  --stroke: #E6E6E2;

  --mix-target: white;        /* Dark = Richtung Weiß */
  --window-shadow: none;
}

/* Schriftstärke: Dunkle Schrift auf hellem Grund wirkt dünner.
   Fest: Light = 500, Dark = 400. */
:root { --weight-text: 500; --weight-code: 500; }
:root[data-theme="dark"] { --weight-text: 400; --weight-code: 400; }

/* ---------- 3. SEITE ---------- */
body {
  margin: 0; padding: 24px 16px 56px;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-text);
  font-size: 16px; line-height: 1.5;
  font-weight: var(--weight-text);
}
h1, h2, h3 { font-family: var(--font-comic); color: var(--text-emphasis); margin: 0; }
h1 { font-size: 26px; text-align: center; margin-bottom: 6px; }
h2 { font-size: 18px; margin: 22px 0 8px; }
h3 { font-size: 16px; margin: 16px 0 6px; }
.subtitle { text-align: center; color: var(--text-secondary); margin: 0 0 24px; }
a { color: var(--text-emphasis); }

/* ---------- 4. FENSTER (Karten) ---------- */
.stack { max-width: 760px; margin: 0 auto; display: grid; gap: 20px; }
.window {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--window-shadow, none);
}
/* Langer Fließtext im Blocksatz (Seite hat lang="de" für die Silbentrennung) */
.window p { margin: 0 0 10px; text-align: justify; hyphens: auto; }
.window p:last-child { margin-bottom: 0; }
.window h2:first-child { margin-top: 0; }
.window ul { margin: 0 0 10px; padding-left: 22px; }

/* Platzhalter, die du noch ausfüllen musst: Code-Schrift, gut sichtbar */
.platzhalter {
  font-family: var(--font-code); font-weight: var(--weight-code);
  font-size: 14px; color: var(--text-emphasis);
  border: 1px dashed var(--border); border-radius: 4px; padding: 0 4px;
}

/* ---------- 5. FUSSZEILE ---------- */
footer { max-width: 760px; margin: 20px auto 0; text-align: center; font-size: 14px; color: var(--text-secondary); }
footer a { color: var(--text-secondary); margin: 0 8px; }

/* ---------- 6. TAG/NACHT-KNOPF (einziger Umschalter) ---------- */
.theme-toggle {
  position: fixed; top: 14px; right: 18px;
  width: 34px; height: 34px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card-bg); color: var(--text-primary);
  border: 1px solid var(--border); font-size: 16px; cursor: pointer;
}
.theme-toggle:hover {
  border-width: 2px;
  border-color: color-mix(in srgb, var(--border), var(--mix-target) var(--focus-amount));
}

/* ---------- 7. DRUCK: strikt Schwarz/Weiß, unabhängig vom Theme ---------- */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --card-bg: #fff; --text-primary: #000; --text-secondary: #000;
    --text-emphasis: #000; --border: #000; --window-shadow: none;
  }
  .theme-toggle { display: none !important; }
}
