/* clubmix.ai - Markenfarben und Thema (Farbtokens 21.11.2026, Thema 20.11.2026). Geladen auf JEDER Seite: ueber
   clubmix_hdr_theme_head() (cfg/clubmix_header_lib.php, Werkzeuge) und in cfg/header.php (Shell). Eigene Datei, weil die
   Werkzeuge style-src 'self' haben. Muster: docs/clubmix/THEME.md.

   MARKENFARBEN AN EINER STELLE (Lukas 21.11.2026): acid #eeff70 ist die Hauptfarbe, Eisblau die Zweitfarbe;
   Violett und dunkles Oliv sind raus. Werkzeug-CSS nimmt var(--cm-*) statt fester Hex-Werte.
   Kontrast (WCAG): Tinte auf acid 17,2:1; acid auf Tinte 17,2:1; Eisblau #4fe3e0 auf #18181b 11,3:1, auf #0f0f11 12,2:1;
   Tinte auf #4fe3e0 12,0:1; Weiss auf #0b6e75 6,0:1.
   Im hellen Thema nutzt Eisblau als Text einen dunkleren Ton fuer Kontrast auf allen neutralen Flaechen. Der Schutztest tests/clubmix_brand_colors.mjs haelt Violett
   und dunkles Oliv fern. */
:root, html.dark {
    --cm-acid: #eeff70;                     /* Hauptmarke; im hellen Thema nur als Flaeche, nie als Schrift */
    --cm-acid-hover: #f5ffa6;
    --cm-acid-soft: rgba(238, 255, 112, .1);
    --cm-on-acid: #111113;
    --cm-ice: #4fe3e0;                      /* Links, Fortschritt, Auswahl, Nebenknoepfe */
    --cm-ice-hover: #8aeeec;
    --cm-ice-strong: #0b6e75;               /* Eisblau-Flaeche mit weisser Schrift */
    --cm-on-ice: #111113;
    --cm-ice-soft: rgba(79, 227, 224, .12);
    --cm-ice-line: rgba(79, 227, 224, .4);
    --cm-ink: #111113;
    --cm-bg: #0f0f11;
    --cm-panel: #18181b;
    --cm-raised: #26262b;
    --cm-line: #2c2c31;
    --cm-line-strong: #3f3f46;
    --cm-fg: #f8f6ef;
    --cm-muted: #a1a1aa;
    --cm-cta-bg: #eeff70;                   /* Hauptaktion: dunkel acid mit Tinte */
    --cm-cta-fg: #111113;
    --cm-cta-hover: #f5ffa6;
    --cm-focus: #eeff70;
    /* Status rot fuer gefaehrliche Aktionen (Dialoge, 21.11.2026, docs/clubmix/DIALOG.md): Weiss auf #dc2626 4,8:1,
       auf #b91c1c 6,5:1; Fehlertext #ff9aa4 auf #18181b 8,6:1. */
    --cm-danger: #dc2626;
    --cm-danger-hover: #b91c1c;
    --cm-on-danger: #ffffff;
    --cm-danger-fg: #ff9aa4;
    --cm-scrim: rgba(8, 8, 10, .62);
    --cm-shadow: rgba(0, 0, 0, .5);
}
html.light {
    --cm-acid-soft: rgba(238, 255, 112, .45);
    --cm-ice: #095f66;
    --cm-ice-hover: #074e54;
    --cm-ice-strong: #0b6e75;
    --cm-on-ice: #ffffff;
    --cm-ice-soft: rgba(11, 110, 117, .1);
    --cm-ice-line: rgba(11, 110, 117, .45);
    --cm-bg: #deded8;
    --cm-panel: #e8e9e3;
    --cm-raised: #d4d7d0;
    --cm-line: #bcc3ba;
    --cm-line-strong: #969e94;
    --cm-control-line: #687168;            /* Rahmen fuer Eingabefelder und Konturen von Knoepfen */
    --cm-fg: #20242a;
    --cm-muted: #4b5055;
    --cm-cta-bg: #111113;                   /* Hauptaktion: hell Tinte mit acid-Schrift */
    --cm-cta-fg: #eeff70;
    --cm-cta-hover: #2c2c31;
    --cm-focus: #111113;
    --cm-danger: #b42318;                   /* Weiss 6,5:1; als Schrift auf #ffffff 6,5:1 */
    --cm-danger-hover: #912018;
    --cm-on-danger: #ffffff;
    --cm-danger-fg: #9e2018;
    --cm-scrim: rgba(35, 38, 45, .38);
    --cm-shadow: rgba(17, 17, 19, .18);
}

/* Formularelemente, Bildlaufleisten und Systemfarben folgen dem gewaehlten Thema (die Seiten setzen
   :root { color-scheme: dark }; html.light ist spezifischer). */
html.light { color-scheme: light; }
html.dark { color-scheme: dark; }

/* Hell/Dunkel/Auto-Umschalter (clubmix_hdr_theme_toggle) */
.cm-theme {
    display: inline-flex; align-items: center; flex-shrink: 0; gap: 2px; padding: 2px;
    border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px; background: rgba(255, 255, 255, .04);
}
.cm-theme-opt {
    display: inline-grid; place-items: center; width: 1.85rem; height: 1.75rem; padding: 0; margin: 0;
    font: inherit; color: inherit; opacity: .72; background: transparent; border: 0; border-radius: 999px; cursor: pointer;
    transition: opacity .15s ease, background-color .15s ease, color .15s ease;
}
.cm-theme-opt svg { width: 16px; height: 16px; flex-shrink: 0; }
.cm-theme-opt:hover { opacity: 1; color: var(--cm-acid); }
.cm-theme-opt:focus-visible { opacity: 1; outline: 2px solid var(--cm-focus); outline-offset: 1px; }
.cm-theme-opt[aria-pressed="true"] { opacity: 1; color: var(--cm-on-acid); background: var(--cm-acid); }
.cm-theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

html.light .cm-theme { border-color: var(--cm-line-strong); background: var(--cm-panel); }
html.light .cm-theme-opt { color: var(--cm-muted); opacity: 1; }
html.light .cm-theme-opt:hover { color: var(--cm-ink); background: var(--cm-raised); }
html.light .cm-theme-opt:focus-visible { outline-color: var(--cm-focus); }
html.light .cm-theme-opt[aria-pressed="true"] { color: var(--cm-cta-fg); background: var(--cm-cta-bg); }

/* SPA-Rahmen (cfg/bp_frame.php, docs/clubmix/SPA.md): im Rahmen der Shell steht der Thema-Umschalter schon in
   der Kopfleiste darueber - der des Werkzeugs entfaellt (eine Stelle, ein Zustand). Ausnahme DJ-Deck
   (data-bp-chrome="own", 21.11.2026): dort blendet die Shell ihre Kopfleiste aus, der Umschalter des Decks bleibt
   (localStorage bp_theme; die Shell zieht ueber das storage-Ereignis nach). */
html[data-bp-framed]:not([data-bp-chrome="own"]) [data-cm-theme-toggle] { display: none !important; }

/* Feinschliff 01.12.2026: ausgewogene Umbrueche in Ueberschriften, keine einzelnen Woerter am Absatzende. Element-
   Selektoren in der zuerst geladenen Datei - jede eigene text-wrap-Regel einer Seite gewinnt weiter.
   Nur text-wrap-style: die Kurzform text-wrap setzt auch text-wrap-mode: wrap und hob geerbtes nowrap auf (Brotkrume der
   Werkzeugleiste brach um, 01.12.2026). */
h1, h2, h3 { text-wrap-style: balance; }
p, li, figcaption { text-wrap-style: pretty; }

/* Feinschliff 01.12.2026: Silbentrennung statt Umbruch mitten im Wort (overflow-wrap: anywhere brach am Telefon z. B.
   "Datenschutzerklaerun|g"). Ueberschriften immer, Fliesstext nur in schmalen Spalten; lang am <html> waehlt das Woerterbuch. */
h1, h2, h3 { -webkit-hyphens: auto; hyphens: auto; hyphenate-limit-chars: 10 4 4; }
@media (max-width: 40rem) {
    p, li { -webkit-hyphens: auto; hyphens: auto; hyphenate-limit-chars: 10 4 4; }
}

/* Feinschliff 01.12.2026: Textauswahl und Scrollbalken in Markenfarben. */
::selection { background: rgba(238, 255, 112, .32); color: inherit; }
html.light ::selection { background: rgba(11, 110, 117, .22); }
html { scrollbar-color: var(--cm-line-strong) var(--cm-bg); }

/* Feinschliff 01.12.2026: Druck hell und ohne Navigation (Rechtstexte, Lizenzen, Artikel, Anleitungen). */
@media print {
    html, body { background: #fff !important; color: #000 !important; }
    #bp-nav, #cm-tb, #cm-ft, .cm-skip, #bp-progress, #bp-toasts, .cm-sh-busy, dialog { display: none !important; }
    body * { color: #000 !important; background: transparent !important; box-shadow: none !important; text-shadow: none !important; border-color: #bbb !important; }
    a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; word-break: break-all; }
    h1, h2, h3 { break-after: avoid; }
    img, figure, table, pre { break-inside: avoid; max-width: 100% !important; }
}

/* Design-Tokens (P4, 01.12.2026). Schrift, Radien und Staerken wurden in 57 Dateien auf diese Stufen gezogen
   (vorher 104 Schriftgroessen, 64 Radien, 10 Staerken). Neue Regeln nehmen die Variablen statt freier Werte. */
:root {
    --cm-fs-xs: .75rem; --cm-fs-sm: .8125rem; --cm-fs-md: .875rem; --cm-fs-15: .9375rem; --cm-fs-base: 1rem;
    --cm-fs-lg: 1.125rem; --cm-fs-xl: 1.25rem; --cm-fs-2xl: 1.5rem; --cm-fs-3xl: 1.875rem; --cm-fs-4xl: 2.25rem;
    --cm-h1: clamp(1.875rem, 1.2rem + 2.2vw, 2.5rem);
    --cm-r-xs: .25rem; --cm-r-sm: .375rem; --cm-r-md: .5rem; --cm-r-ml: .625rem; --cm-r-lg: .75rem; --cm-r-xl: 1rem; --cm-r-pill: 999px;
    --cm-w-regular: 400; --cm-w-semibold: 600; --cm-w-bold: 700; --cm-w-heavy: 800;
    --cm-control-h: 2.75rem; --cm-control-r: .625rem;
    --cm-z-sticky: 20; --cm-z-dropdown: 50; --cm-z-overlay: 100; --cm-z-toast: 200;
    --cm-shadow-1: 0 1px 2px rgba(0, 0, 0, .25); --cm-shadow-2: 0 8px 24px rgba(0, 0, 0, .35); --cm-shadow-3: 0 18px 48px rgba(0, 0, 0, .5);
}

/* Weniger Bewegung (P4, 01.12.2026): systemweit statt nur in 16 Dateien. Sehr kurze statt keine Dauer, damit
   transitionend/animationend weiter feuern. */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto !important; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
        transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* Kein Doppeltipp-Zoom-Verzug auf Bedienelementen (Touch). */
a, button, input, select, textarea, label, summary, [role="button"] { touch-action: manipulation; }

/* 02.12.2026: Erfolgsfarbe als Token (Passwort-Regeln der Registrierung in www/js/app.js). Hell #166534: 5,3-5,8:1 auf den
   hellen Flaechen; das bisherige #4ade80 hatte dort 1,7:1. */
:root, html.dark { --cm-ok: #4ade80; }
html.light { --cm-ok: #166534; }
