/*
 * Spitzengeraete.de – gemeinsamer Darkmode
 * Diese Datei NACH modern.css laden.
 */

html {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

/*
 * Gemeinsame Body-Klassen:
 * - .sg-modern ist die allgemeine Klasse für modernisierte Seiten.
 * - .dreampc-modern und .dreampc bleiben vorübergehend kompatibel.
 */
body:is(.sg-modern, .dreampc-modern, .dreampc) {
    --dm-page-bg: #f4f6f8;
    --dm-toggle-bg: #ffffff;
    --dm-toggle-hover: #eef2f5;
    --dm-toggle-text: #1c2430;
    --dm-toggle-border: #cbd5e1;
    --dm-focus: #64748b;

    min-height: 100vh;
    background: var(--dm-page-bg);
    color: #1c2430;
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc) {
    --dm-page-bg: #0e141b;
    --dm-toggle-bg: #202b37;
    --dm-toggle-hover: #293644;
    --dm-toggle-text: #e8edf2;
    --dm-toggle-border: #4a5b6b;
    --dm-focus: #c3cf86;

    background: var(--dm-page-bg);
    color: #e8edf2;
}

/*
 * modern.css definiert die zentralen --sg-Variablen auf
 * .sg-site-shell und aus Kompatibilitätsgründen auf .sg-dreampc.
 *
 * Deshalb müssen die Darkmode-Werte auf genau diesen Elementen
 * überschrieben werden – nicht auf einem inneren .sg-modern-Element.
 */
html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
:is(.sg-site-shell, .sg-dreampc) {
    --sg-bg: #111923;
    --sg-surface: #18212b;
    --sg-surface-soft: #202b37;
    --sg-text: #e8edf2;
    --sg-muted: #aeb9c4;
    --sg-border: #344352;
    --sg-accent: #c3cf86;
    --sg-accent-strong: #f2f5df;
    --sg-accent-soft: #303b27;
    --sg-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);

    background:
        radial-gradient(
            circle at top left,
            rgba(102, 119, 138, 0.18),
            transparent 34rem
        ),
        linear-gradient(
            180deg,
            #121b25 0%,
            var(--sg-bg) 100%
        );

    color: var(--sg-text);
}

/* =========================================================
   Kopfbereich und Navigation
   ========================================================= */

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-logo {
    color: var(--sg-text);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-main-nav a {
    color: var(--sg-muted);
    background: rgba(24, 33, 43, 0.78);
    border-color: var(--sg-border);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-main-nav a:hover,
html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-main-nav a:focus-visible {
    color: var(--sg-text);
    background: var(--sg-surface-soft);
    border-color: #526476;
}

/* =========================================================
   Hero
   ========================================================= */

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-hero {
    background: rgba(24, 33, 43, 0.93);
    border-color: var(--sg-border);
    box-shadow: var(--sg-shadow);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-hero-media {
    background:
        radial-gradient(
            circle at top,
            rgba(102, 119, 138, 0.22),
            transparent 70%
        ),
        linear-gradient(145deg, #202b37, #151e28);

    border-color: var(--sg-border);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-hero-media img {
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.42));
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
:is(
    .sg-hero h1,
    .sg-section-intro h2,
    .sg-component-card h3,
    .sg-content-card h2,
    .sg-content-card h3
) {
    color: var(--sg-text);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
:is(
    .sg-kicker,
    .sg-subtitle,
    .sg-section-intro p
) {
    color: var(--sg-muted);
}

/* =========================================================
   Hinweise, Listen und Karten
   ========================================================= */

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-price-note {
    background: var(--sg-accent-soft);
    color: var(--sg-accent);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-price-note strong {
    color: var(--sg-accent-strong);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
:is(
    .sg-summary-list strong,
    .sg-component-list strong
) {
    color: var(--sg-text);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-component-list em {
    color: var(--sg-muted);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
:is(
    .sg-component-card,
    .sg-content-card,
    .sg-content-nav
) {
    background: var(--sg-surface);
    border-color: var(--sg-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.20);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-prose {
    color: var(--sg-text);
}

/* =========================================================
   Footer
   ========================================================= */

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
:is(.sg-footer, .sg-page-counter) {
    color: var(--sg-muted);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-footer a {
    color: var(--sg-accent);
}

html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-footer a:hover,
html[data-theme="dark"]
body:is(.sg-modern, .dreampc-modern, .dreampc)
.sg-footer a:focus-visible {
    color: var(--sg-accent-strong);
}

/* =========================================================
   Darkmode-Schalter
   ========================================================= */

body:is(.sg-modern, .dreampc-modern, .dreampc)
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-height: 34px;
    padding: 7px 11px;

    border: 1px solid var(--dm-toggle-border);
    border-radius: 999px;
    background: var(--dm-toggle-bg);
    color: var(--dm-toggle-text);

    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.10);
}

body:is(.sg-modern, .dreampc-modern, .dreampc)
.theme-toggle:hover {
    background: var(--dm-toggle-hover);
    border-color: var(--dm-focus);
}

body:is(.sg-modern, .dreampc-modern, .dreampc)
.theme-toggle:focus-visible {
    outline: 3px solid var(--dm-focus);
    outline-offset: 2px;
}

body:is(.sg-modern, .dreampc-modern, .dreampc)
.theme-toggle__icon {
    display: inline-grid;
    place-items: center;

    width: 1.25em;
    height: 1.25em;

    font-size: 15px;
}

body:is(.sg-modern, .dreampc-modern, .dreampc)
.theme-toggle__text {
    min-width: 42px;
    text-align: left;
}

/* Kompatibilität mit älteren Header-Strukturen */
body:is(.sg-modern, .dreampc-modern, .dreampc)
.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* =========================================================
   Übergänge
   ========================================================= */

@media (prefers-reduced-motion: no-preference) {
    body:is(.sg-modern, .dreampc-modern, .dreampc),
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    :is(.sg-site-shell, .sg-dreampc),
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .sg-main-nav a,
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .sg-hero,
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .sg-hero-media,
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .sg-component-card,
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .sg-content-card,
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .sg-content-nav,
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .sg-price-note,
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .theme-toggle {
        transition:
            background-color 160ms ease,
            color 160ms ease,
            border-color 160ms ease,
            box-shadow 160ms ease;
    }
}

/* =========================================================
   Mobile Anpassungen
   ========================================================= */

@media (max-width: 820px) {
    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    body:is(.sg-modern, .dreampc-modern, .dreampc)
    .theme-toggle {
        min-height: 38px;
        padding-inline: 12px;
    }
}
