/* LostDoge dark theme – drop-in for frontend/shared/tokens.css (load AFTER the light :root block).
   Base = Ink #23263A (splash-sherlock dark background). Contrast ratios: see DARK-MODE-SPEC.md §2.
   Strategy: the existing --ld-* names are role-based in practice (ink = text/outline, cream = page,
   white = card/input + label-on-colour), so dark mode re-points the SAME names. No component CSS
   has to change except the hardcoded spots listed in the spec (§1.2).
   New semantic aliases (--ld-bg, --ld-surface-*, --ld-text*, --ld-border*) work in both themes. */

:root {
    color-scheme: light;
    --ld-bg: var(--ld-cream);
    --ld-surface-1: var(--ld-white);     /* cards, inputs */
    --ld-surface-2: var(--ld-white);     /* sheets, modals */
    --ld-surface-3: var(--ld-ink-20);    /* pressed / grabber / disabled fill */
    --ld-text: var(--ld-ink);
    --ld-text-2: var(--ld-ink-60);
    --ld-border: var(--ld-ink);          /* sticker outline */
    --ld-divider: var(--ld-ink-20);
    --ld-on-color: var(--ld-white);      /* label on caramel / coral / teal fills */
    --ld-on-honey: var(--ld-ink);
    --ld-sticker-shadow: var(--ld-ink);
    --ld-sheet-glass: rgba(255, 248, 236, .95);
    --ld-pin-halo: #FFFFFF;
}

/* Dark values, written once and reused by the two selectors below */
:root[data-theme="dark"] {
    color-scheme: dark;
    --ld-cream: #23263A;        /* page background (Ink) */
    --ld-white: #2C3047;        /* raised 1: cards, inputs, list rows */
    --ld-ink: #FFF8EC;          /* text + outlines (Cream) */
    --ld-ink-60: #B9BBC9;       /* secondary text */
    --ld-ink-20: #4E5270;       /* dividers, disabled fill (no text) */
    --ld-honey: #6A5434;        /* "Honey Deep": active tab, own chat bubble, chips (Cream text) */
    --ld-caramel: #D9904E;      /* primary button fill (Ink label) */
    --ld-caramel-hover: #E8A266;
    --ld-coral: #F08A82;        /* Lost text/icon/fill (Ink label) */
    --ld-coral-hover: #F2A39C;
    --ld-teal: #5EC4B8;         /* Found text/icon/fill (Ink label) */
    --ld-teal-hover: #7CD3C8;
    --ld-sky: #2E4A5A;          /* map fallback bg, info banner */
    --ld-tan: #E8B679;          /* mascot only, unchanged */
    --ld-teal-12: rgba(94, 196, 184, .16);
    --ld-coral-12: rgba(240, 138, 130, .16);
    --ld-scrim: rgba(10, 11, 20, .7);

    --ld-bg: #23263A;
    --ld-surface-1: #2C3047;
    --ld-surface-2: #363A53;    /* sheets, modals, chat input bar */
    --ld-surface-3: #42465F;    /* pressed, grabber */
    --ld-text: #FFF8EC;
    --ld-text-2: #B9BBC9;
    --ld-text-disabled: #9496A8;
    --ld-border: #A3A6BA;       /* outline on cards/inputs (6.19:1 on bg) – softer than full Cream */
    --ld-divider: #4E5270;
    --ld-on-color: #23263A;     /* labels on caramel/coral/teal/honey-bright fills */
    --ld-on-honey: #FFF8EC;     /* on Honey Deep */
    --ld-sticker-shadow: #12141F;
    --ld-sheet-glass: rgba(54, 58, 83, .96);
    --ld-pin-halo: #23263A;
    --ld-shadow-sticker: 3px 5px 0 0 #12141F;
    --ld-shadow-sticker-pressed: 0 1px 0 0 #12141F;
}

/* System preference, unless the user forced Light */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --ld-cream: #23263A; --ld-white: #2C3047; --ld-ink: #FFF8EC; --ld-ink-60: #B9BBC9; --ld-ink-20: #4E5270;
        --ld-honey: #6A5434; --ld-caramel: #D9904E; --ld-caramel-hover: #E8A266;
        --ld-coral: #F08A82; --ld-coral-hover: #F2A39C; --ld-teal: #5EC4B8; --ld-teal-hover: #7CD3C8;
        --ld-sky: #2E4A5A; --ld-tan: #E8B679;
        --ld-teal-12: rgba(94, 196, 184, .16); --ld-coral-12: rgba(240, 138, 130, .16); --ld-scrim: rgba(10, 11, 20, .7);
        --ld-bg: #23263A; --ld-surface-1: #2C3047; --ld-surface-2: #363A53; --ld-surface-3: #42465F;
        --ld-text: #FFF8EC; --ld-text-2: #B9BBC9; --ld-text-disabled: #9496A8;
        --ld-border: #A3A6BA; --ld-divider: #4E5270; --ld-on-color: #23263A; --ld-on-honey: #FFF8EC;
        --ld-sticker-shadow: #12141F; --ld-sheet-glass: rgba(54, 58, 83, .96); --ld-pin-halo: #23263A;
        --ld-shadow-sticker: 3px 5px 0 0 #12141F; --ld-shadow-sticker-pressed: 0 1px 0 0 #12141F;
    }
}

/* ---- Component patches needed because of hardcoded colours (see spec §1.2) ---- */
html, body { background: var(--ld-bg); color: var(--ld-text); }
#authSection .text-dark, .ld-userline, #userStatus, :root[data-theme="dark"] .text-muted, :root[data-theme="dark"] .small { color: var(--ld-text, #23263A) !important; }
:root[data-theme="dark"] .text-muted, :root[data-theme="dark"] .ld-cp-meta, :root[data-theme="dark"] .ld-faq-empty-body { color: var(--ld-text-2, #B9BBC9) !important; }
.ld-ss { background: var(--ld-sheet-glass); }                         /* search-sheet.css:7 */
.ld-ss-backdrop { background: var(--ld-scrim); }                       /* search-sheet.css:56 */
#ageGate, #consentGate { background: var(--ld-scrim); }                /* index.html:81 */
/* Labels on filled brand buttons: white in light, Ink in dark.
   Sekundär/Outline behalten das Ink-Label auf Cream. Sonst überschreibt diese spätere
   .ld-btn-Regel die Sekundärfarbe und der Text wird im Hellen weiß auf Cream. */
.ld-btn:not(.ld-btn-secondary), .btn-primary:not(.btn-sm):not(.ld-btn-secondary), .ld-btn-lost, .ld-btn-found {
    --bs-btn-color: var(--ld-on-color); --bs-btn-hover-color: var(--ld-on-color); --bs-btn-active-color: var(--ld-on-color);
}
.ld-btn.ld-btn-secondary,
.btn-secondary:not(.btn-sm),
.btn-outline-primary:not(.btn-sm),
.btn-outline-secondary:not(.btn-sm),
.btn-outline-dark:not(.btn-sm) {
    --bs-btn-color: var(--ld-ink, #23263A);
    --bs-btn-hover-color: var(--ld-ink, #23263A);
    --bs-btn-active-color: var(--ld-ink, #23263A);
    color: var(--ld-ink, #23263A);
    background-color: var(--ld-cream, #FFF8EC);
}

/* Kartenkacheln kommen nur aus der Protomaps-Datei. Ein CSS-Filter ist keine dunkle Karte.
   Pins behalten ihre Farben und bekommen nur einen schmalen Rand, damit sie auf dunklem Grund lesbar bleiben. */
.leaflet-marker-icon { filter: drop-shadow(0 0 1.5px var(--ld-pin-halo)) drop-shadow(0 0 1.5px var(--ld-pin-halo)); }
.leaflet-container { background: var(--ld-sky); }
:root { --ld-map-inset-bottom: calc(86px + var(--ld-safe-bottom, 0px)); }
.leaflet-bottom.leaflet-right { bottom: var(--ld-map-inset-bottom); margin-right: 4px; margin-bottom: 4px; }
.leaflet-control-attribution {
    font-family: Nunito, "Nunito Fallback", system-ui, sans-serif; font-weight: 600; font-size: 11px; line-height: 14px;
    background: var(--ld-sheet-glass) !important; color: var(--ld-text-2) !important; border-radius: 6px; padding: 2px 6px;
    white-space: normal; max-width: 280px;
}
.leaflet-control-attribution a { color: var(--ld-text) !important; text-decoration: underline; }
