/*
 * Sumaji fixed site-wide dark theme.
 * The dark palette follows Dark Reader's documented neutral defaults
 * (#181a1b background / #e8e6e3 text) but does not bundle Dark Reader's
 * dynamic theme engine. Images and video are intentionally left untouched.
 */
:root {
    --sumaji-theme-bg: #ffffff;
    --sumaji-theme-surface: #ffffff;
    --sumaji-theme-surface-2: #f6f7f7;
    --sumaji-theme-text: #1d2327;
    --sumaji-theme-muted: #646970;
    --sumaji-theme-border: #d9d9d9;
    --sumaji-theme-link: #2271b1;
    --sumaji-theme-link-hover: #135e96;
    --sumaji-theme-input-bg: #ffffff;
    --sumaji-theme-input-text: #1d2327;
    --sumaji-theme-code-bg: #f0f0f1;
    --sumaji-theme-selection-bg: #b8d9f3;
    --sumaji-theme-selection-text: #111111;
}

html[data-sumaji-theme="dark"] {
    color-scheme: dark;
    --sumaji-theme-bg: #181a1b;
    /* Dark Reader default neutral palette / generated user-agent colors. */
    --sumaji-theme-surface: #181a1b;
    --sumaji-theme-surface-2: #202324;
    --sumaji-theme-text: #e8e6e3;
    --sumaji-theme-muted: #b2aba1;
    --sumaji-theme-border: #736b5e;
    --sumaji-theme-border-soft: #545b5e;
    --sumaji-theme-link: #3391ff;
    --sumaji-theme-link-hover: #66a9ff;
    --sumaji-theme-input-bg: #181a1b;
    --sumaji-theme-input-text: #e8e6e3;
    --sumaji-theme-code-bg: #202324;
    --sumaji-theme-selection-bg: #004daa;
    --sumaji-theme-selection-text: #e8e6e3;
    --sumaji-theme-scrollbar-bg: #202324;
    --sumaji-theme-scrollbar-thumb: #454a4d;
    --sumaji-theme-scrollbar-thumb-hover: #575e62;

    /* Kadence/Kadence Blocks use these palette variables heavily. */
    --global-palette1: #3391ff;
    --global-palette2: #66a9ff;
    --global-palette3: #e8e6e3;
    --global-palette4: #d5d2ce;
    --global-palette5: #b2aba1;
    --global-palette6: #9b948a;
    --global-palette7: #545b5e;
    --global-palette8: #202324;
    --global-palette9: #181a1b;
}

html[data-sumaji-theme="dark"],
html[data-sumaji-theme="dark"] body,
html[data-sumaji-theme="dark"] #wrapper,
html[data-sumaji-theme="dark"] #inner-wrap,
html[data-sumaji-theme="dark"] .site,
html[data-sumaji-theme="dark"] .site-main,
html[data-sumaji-theme="dark"] .content-area,
html[data-sumaji-theme="dark"] .content-bg,
html[data-sumaji-theme="dark"] .wp-site-blocks {
    background-color: var(--sumaji-theme-bg) !important;
    color: var(--sumaji-theme-text);
}

/* Kadence structural surfaces. Keep image/media backgrounds unchanged. */
html[data-sumaji-theme="dark"] .entry,
html[data-sumaji-theme="dark"] .entry-content-wrap,
html[data-sumaji-theme="dark"] .site-header,
html[data-sumaji-theme="dark"] .site-header-wrap,
html[data-sumaji-theme="dark"] .site-top-header-wrap,
html[data-sumaji-theme="dark"] .site-main-header-wrap,
html[data-sumaji-theme="dark"] .site-bottom-header-wrap,
html[data-sumaji-theme="dark"] .site-footer,
html[data-sumaji-theme="dark"] .site-footer-wrap,
html[data-sumaji-theme="dark"] .site-middle-footer-wrap,
html[data-sumaji-theme="dark"] .site-bottom-footer-wrap,
html[data-sumaji-theme="dark"] .site-top-footer-wrap,
html[data-sumaji-theme="dark"] .widget,
html[data-sumaji-theme="dark"] .comment-body,
html[data-sumaji-theme="dark"] .navigation.post-navigation,
html[data-sumaji-theme="dark"] .navigation.pagination {
    background-color: var(--sumaji-theme-surface) !important;
    color: var(--sumaji-theme-text) !important;
    border-color: var(--sumaji-theme-border) !important;
}

html[data-sumaji-theme="dark"] body,
html[data-sumaji-theme="dark"] p,
html[data-sumaji-theme="dark"] li,
html[data-sumaji-theme="dark"] dt,
html[data-sumaji-theme="dark"] dd,
html[data-sumaji-theme="dark"] label,
html[data-sumaji-theme="dark"] legend,
html[data-sumaji-theme="dark"] figcaption,
html[data-sumaji-theme="dark"] .entry-meta,
html[data-sumaji-theme="dark"] .entry-summary,
html[data-sumaji-theme="dark"] .site-title,
html[data-sumaji-theme="dark"] .site-description {
    color: var(--sumaji-theme-text);
}

html[data-sumaji-theme="dark"] h1,
html[data-sumaji-theme="dark"] h2,
html[data-sumaji-theme="dark"] h3,
html[data-sumaji-theme="dark"] h4,
html[data-sumaji-theme="dark"] h5,
html[data-sumaji-theme="dark"] h6,
html[data-sumaji-theme="dark"] .entry-title,
html[data-sumaji-theme="dark"] .wp-block-heading {
    color: var(--sumaji-theme-text) !important;
}

html[data-sumaji-theme="dark"] a:not(.wp-element-button):not(.button) {
    color: var(--sumaji-theme-link);
}

html[data-sumaji-theme="dark"] a:not(.wp-element-button):not(.button):hover,
html[data-sumaji-theme="dark"] a:not(.wp-element-button):not(.button):focus-visible {
    color: var(--sumaji-theme-link-hover);
}

html[data-sumaji-theme="dark"] hr,
html[data-sumaji-theme="dark"] table,
html[data-sumaji-theme="dark"] th,
html[data-sumaji-theme="dark"] td,
html[data-sumaji-theme="dark"] blockquote,
html[data-sumaji-theme="dark"] .wp-block-separator {
    border-color: var(--sumaji-theme-border) !important;
}

html[data-sumaji-theme="dark"] th,
html[data-sumaji-theme="dark"] td {
    background-color: transparent;
    color: var(--sumaji-theme-text);
}

html[data-sumaji-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-sumaji-theme="dark"] textarea,
html[data-sumaji-theme="dark"] select,
html[data-sumaji-theme="dark"] button {
    background-color: var(--sumaji-theme-input-bg) !important;
    color: var(--sumaji-theme-input-text) !important;
    border-color: var(--sumaji-theme-border) !important;
    color-scheme: dark;
}

/* Chrome/Samsung/Windows may render an opened <select> in a native popup.
 * Styling option/optgroup plus color-scheme avoids the low-contrast light
 * popup that appeared with the fixed dark site theme. */
html[data-sumaji-theme="dark"] select option,
html[data-sumaji-theme="dark"] select optgroup {
    background-color: #181a1b !important;
    color: #e8e6e3 !important;
}

html[data-sumaji-theme="dark"] input[type="range"],
html[data-sumaji-theme="dark"] input[type="checkbox"],
html[data-sumaji-theme="dark"] input[type="radio"] {
    accent-color: var(--sumaji-theme-link);
    color-scheme: dark;
}

html[data-sumaji-theme="dark"] input::placeholder,
html[data-sumaji-theme="dark"] textarea::placeholder {
    color: var(--sumaji-theme-muted);
    opacity: 1;
}

html[data-sumaji-theme="dark"] pre,
html[data-sumaji-theme="dark"] code,
html[data-sumaji-theme="dark"] kbd,
html[data-sumaji-theme="dark"] samp {
    background-color: var(--sumaji-theme-code-bg);
    color: var(--sumaji-theme-text);
}

html[data-sumaji-theme="dark"] ::selection {
    background: var(--sumaji-theme-selection-bg);
    color: var(--sumaji-theme-selection-text);
}

/* Plugin surfaces follow the same site palette. */
html[data-sumaji-theme="dark"] .sumaji-auto-toc,
html[data-sumaji-theme="dark"] .sumaji-article-reader,
html[data-sumaji-theme="dark"] .sumaji-article-reader__resume {
    background: var(--sumaji-theme-surface) !important;
    color: var(--sumaji-theme-text) !important;
    border-color: var(--sumaji-theme-border) !important;
}

html[data-sumaji-theme="dark"] .sumaji-article-reader__status,
html[data-sumaji-theme="dark"] .sumaji-article-reader__progress-meta,
html[data-sumaji-theme="dark"] .sumaji-article-reader__current {
    color: var(--sumaji-theme-muted);
}

html[data-sumaji-theme="dark"] .sumaji-article-reader__current {
    border-color: var(--sumaji-theme-border);
}

html[data-sumaji-theme="dark"] .sumaji-article-reader button:not(.sumaji-article-reader__play) {
    background: var(--sumaji-theme-surface-2) !important;
    color: var(--sumaji-theme-text) !important;
    border-color: var(--sumaji-theme-border) !important;
}


html[data-sumaji-theme="dark"] ::-webkit-scrollbar {
    background-color: var(--sumaji-theme-scrollbar-bg);
    color: var(--sumaji-theme-muted);
}

html[data-sumaji-theme="dark"] ::-webkit-scrollbar-thumb {
    background-color: var(--sumaji-theme-scrollbar-thumb);
}

html[data-sumaji-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background-color: var(--sumaji-theme-scrollbar-thumb-hover);
}

html[data-sumaji-theme="dark"] * {
    scrollbar-color: var(--sumaji-theme-scrollbar-thumb) var(--sumaji-theme-scrollbar-bg);
}

/* Never invert or recolor visual media. */
html[data-sumaji-theme="dark"] img,
html[data-sumaji-theme="dark"] picture,
html[data-sumaji-theme="dark"] video,
html[data-sumaji-theme="dark"] canvas,
html[data-sumaji-theme="dark"] svg,
html[data-sumaji-theme="dark"] iframe {
    filter: none;
}


html[data-sumaji-theme="dark"] .sumaji-article-reader .sumaji-article-reader__play {
    background: var(--sumaji-theme-selection-bg) !important;
    color: var(--sumaji-theme-selection-text) !important;
    border-color: var(--sumaji-theme-link) !important;
}

html[data-sumaji-theme="dark"] .sumaji-article-reader select:focus,
html[data-sumaji-theme="dark"] .sumaji-article-reader input:focus,
html[data-sumaji-theme="dark"] .sumaji-article-reader button:focus-visible {
    outline: 2px solid var(--sumaji-theme-link) !important;
    outline-offset: 2px;
}

/* v1.4.1 no longer renders a theme toggle. Keep this defensive rule for
 * cached pages that may still contain the old v1.4.0 button markup. */
.sumaji-theme-toggle {
    display: none !important;
}
