/* assets/css/lw-dark.css — dark mode for light page styles (2026-10-15).
 *
 * Loaded by layouts/head-css.php after the theme, so these apply before the
 * page is painted. They cover the shared patterns written for a white page:
 * Bootstrap's light utility classes and the usual white / light-grey inline
 * styles. Page-specific classes and anything a script builds later are
 * handled by assets/js/lw-dark.js, which also fixes text contrast.
 *
 * Only in dark mode, never with the high-contrast setting (body.lw-hc), and
 * never inside content shown as authored ([data-lw-keep-light],
 * .lw-keep-light, rich-text editors).
 */

[data-bs-theme="dark"] body:not(.lw-hc) :is(.bg-white, .bg-light):not(:is([data-lw-keep-light], .lw-keep-light) *) {
    background-color: var(--vz-secondary-bg) !important;
}
[data-bs-theme="dark"] body:not(.lw-hc) :is(.table-light, thead.table-light > tr > th, .table-light > tr > th) {
    --vz-table-bg: var(--vz-tertiary-bg);
    --vz-table-color: var(--vz-body-color);
    background-color: var(--vz-tertiary-bg);
    color: var(--vz-body-color);
}
[data-bs-theme="dark"] body:not(.lw-hc) :is(.card-header, .card-footer):is(.bg-white, .bg-light) {
    background-color: var(--vz-tertiary-bg) !important;
}
[data-bs-theme="dark"] body:not(.lw-hc) .text-dark:not(:is(.bg-warning, .bg-light, .bg-white, .text-bg-warning, .text-bg-light, .badge, [class*="bg-warning"]) *):not(:is(.bg-warning, .text-bg-warning, .text-bg-light, .badge)) {
    color: var(--vz-body-color) !important;
}

/* style="" written for a white page: white and very light greys. */
[data-bs-theme="dark"] body:not(.lw-hc) :is(
    [style*="background:#fff;"], [style*="background: #fff;"], [style*="background:#fff\""], [style*="background:#ffffff"], [style*="background: #ffffff"],
    [style*="background-color:#fff;"], [style*="background-color: #fff;"], [style*="background-color:#ffffff"], [style*="background-color: #ffffff"],
    [style*="background:white"], [style*="background: white"], [style*="background-color:white"], [style*="background-color: white"]
):not(:is([data-lw-keep-light], .lw-keep-light, .sun-editor-editable, .note-editable, .tox) *):not(img, svg, canvas) {
    background-color: var(--vz-secondary-bg) !important;
}
[data-bs-theme="dark"] body:not(.lw-hc) :is(
    [style*="background:#f8f9fa"], [style*="background: #f8f9fa"], [style*="background-color:#f8f9fa"], [style*="background-color: #f8f9fa"],
    [style*="background:#f8fafc"], [style*="background: #f8fafc"], [style*="background:#f9fafb"], [style*="background: #f9fafb"],
    [style*="background:#fafafa"], [style*="background: #fafafa"], [style*="background:#f5f5f5"], [style*="background: #f5f5f5"],
    [style*="background:#f3f4f6"], [style*="background: #f3f4f6"], [style*="background:#f1f5f9"], [style*="background: #f1f5f9"],
    [style*="background:#f4f6f8"], [style*="background: #f4f6f8"], [style*="background:#eef2f7"], [style*="background: #eef2f7"]
):not(:is([data-lw-keep-light], .lw-keep-light, .sun-editor-editable, .note-editable, .tox) *):not(img, svg, canvas) {
    background-color: var(--vz-tertiary-bg) !important;
}

/* Content kept as authored keeps dark text on its light background. */
[data-bs-theme="dark"] body:not(.lw-hc) :is([data-lw-keep-light], .lw-keep-light) {
    color: #212529;
}
