/* The logo responds to the selected site theme, independently of the OS theme. */
.hdh-library .library-logo,
.hdh-library .library-drawer-brand img {
    color-scheme: dark;
}

.hdh-library .library-theme-option .library-theme-check { visibility: hidden; }
html:not([data-hdh-color-theme="light"]) .hdh-library .library-theme-option[data-hdh-color-theme="dark"] .library-theme-check,
html[data-hdh-color-theme="light"] .hdh-library .library-theme-option[data-hdh-color-theme="light"] .library-theme-check { visibility: visible; }
.hdh-library .library-theme-options-compact {
    flex: 0 0 auto;
    gap: 2px;
    height: var(--library-header-control-height, 44px);
    padding: 1px;
    border-radius: var(--library-header-radius, 12px);
    background: #1b1e20;
}
.hdh-library .library-theme-options-compact .library-theme-option {
    width: 40px;
    min-height: 40px;
    padding: 9px;
    border-radius: 10px;
}
.hdh-library .library-theme-options-compact .library-theme-option svg {
    width: var(--library-header-icon-size, 20px);
    height: var(--library-header-icon-size, 20px);
}
.hdh-library .library-theme-options-compact :is(.library-theme-copy, .library-theme-check) { display: none; }

@media (max-width: 1000px) {
    .hdh-library .library-theme-options-compact { display: none; }
}

html[data-hdh-color-theme="light"] {
    color-scheme: light;
    background: #f7f5f0;
}

html[data-hdh-color-theme="light"] .hdh-library {
    --library-bg: #f7f5f0;
    --library-panel: #fff;
    --library-border: #dedad2;
    --library-text: #262a2c;
    --library-muted: #6d726f;
    --library-accent: #b3432d;
    --library-light-body: #3d4243;
    --library-light-soft: #f2efe9;
    --library-light-hover: #ece8e0;
    --library-light-selected: #fff0e9;
    --library-light-field-border: #878880;
    --library-light-shadow: 0 5px 18px #302a2010, 0 1px 3px #302a200d;
    background: var(--library-bg);
    color: var(--library-text);
}

html[data-hdh-color-theme="light"] .hdh-library :is(.library-logo, .library-drawer-brand img) { color-scheme: light; }
html[data-hdh-color-theme="light"] .hdh-library .library-header { background: var(--library-bg); }

@media (min-width: 1001px) {
    html[data-hdh-color-theme="light"] .hdh-library .library-header {
        --library-header-active-bg: var(--library-light-selected);
        --library-header-active-border: var(--library-accent);
        --library-header-hover-bg: var(--library-light-hover);
    }
    html[data-hdh-color-theme="light"] .hdh-library .library-header .library-theme-options-compact {
        background: var(--library-panel);
        border-color: var(--library-light-field-border);
    }
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-card, .library-empty, .library-comic-hero,
    .library-attachment-image, .library-tag-filters, .library-tag-sort-menu,
    .library-navigation-drawer, .library-mobile-menu nav
) {
    background: var(--library-panel);
    border-color: var(--library-border);
    box-shadow: var(--library-light-shadow);
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-chip, .library-sort, .library-card-meta a, .library-tag-cloud a,
    .library-other-sites a, .library-button-secondary, .library-prose blockquote,
    .library-tag-pill, .library-tag-page, .library-theme-options,
    .library-drawer-close, .library-navigation-drawer nav a,
    .library-carousel-controls button, .reader-pagination a, .reader-pagination button
),
html[data-hdh-color-theme="light"] .hdh-library #navigation .page-numbers {
    background: var(--library-light-soft);
    border-color: var(--library-border);
    color: var(--library-text);
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-search, .library-recovery-search input, .library-tag-search,
    .library-tag-sort-toggle, .library-tag-filters select,
    [data-test="contact-form"] .form-control
) {
    background: var(--library-panel);
    border-color: var(--library-light-field-border);
    color: var(--library-text);
    color-scheme: light;
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-search input, .library-tag-search input, .library-tag-search button
) { color: var(--library-light-body); }

html[data-hdh-color-theme="light"] .hdh-library :is(input, textarea)::placeholder {
    color: var(--library-muted);
    opacity: 1;
}

html[data-hdh-color-theme="light"] .hdh-library :is(.library-search, .library-tag-search):focus-within,
html[data-hdh-color-theme="light"] .hdh-library .library-tag-sort-toggle[aria-expanded="true"] {
    border-color: var(--library-accent);
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-chip:hover, .library-card-meta a:hover, .library-tag-cloud a:hover,
    .library-other-sites a:hover, .library-button-secondary:is(:hover, :focus-visible),
    .library-tag-pill:hover, .library-tag-sort-toggle:hover,
    .library-tag-sort-menu button:hover, .library-drawer-close:hover,
    .library-navigation-drawer nav a:hover, .library-carousel-controls button:not(:disabled):hover
) {
    background: var(--library-light-hover);
    border-color: var(--library-accent);
    color: var(--library-accent);
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-card-meta a.library-card-category, .library-comic-taxonomies .library-category-links a,
    .library-tag-sort-menu button[aria-checked="true"], .library-theme-option[data-hdh-color-theme="light"],
    .library-navigation-drawer nav a[aria-current], .library-mobile-menu a[aria-current]
) {
    background: var(--library-light-selected);
    border-color: var(--library-accent);
    color: var(--library-accent);
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-chip-active, .library-chip-active:hover,
    .library-button:where(:not(.library-button-secondary)), .library-skip,
    [data-test="contact-form"] button, .library-back-to-top
),
html[data-hdh-color-theme="light"] .hdh-library #navigation :is(.current, a.page-numbers:hover) {
    background: var(--library-accent);
    border-color: var(--library-accent);
    color: #fff;
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-button:where(:not(.library-button-secondary)):hover,
    .library-skip:hover, [data-test="contact-form"] button:hover,
    .library-back-to-top:is(:hover, :focus-visible)
) {
    background: #963723;
    border-color: #963723;
    color: #fff;
}

html[data-hdh-color-theme="light"] .hdh-library .library-tag-page.is-current {
    background: var(--library-accent);
    border-color: var(--library-accent);
    color: #fff;
}

html[data-hdh-color-theme="light"] .hdh-library .library-message .library-recovery-links .library-button {
    background: transparent;
    border-color: transparent;
    color: var(--library-accent);
}

html[data-hdh-color-theme="light"] .hdh-library #navigation .dots {
    background: transparent;
    border-color: transparent;
    color: var(--library-muted);
}

html[data-hdh-color-theme="light"] .hdh-library .library-card-taxonomy-control { color: var(--library-text); }
html[data-hdh-color-theme="light"] .hdh-library .library-card-taxonomy-control::before {
    background: var(--library-panel);
    border-color: var(--library-border);
    box-shadow: 0 1px 6px #302a2029;
}
html[data-hdh-color-theme="light"] .hdh-library .library-card-taxonomy-control:hover::before {
    background: var(--library-light-selected);
    border-color: var(--library-accent);
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-prose, .library-byline, .library-comic-published time,
    .library-comic-taxonomies a, .reader-pagination .page-number,
    .library-sitemap table, .library-footer-bottom p a
) { color: var(--library-light-body); }

html[data-hdh-color-theme="light"] .hdh-library .library-comic-taxonomies .library-category-links a { color: var(--library-accent); }
html[data-hdh-color-theme="light"] .hdh-library .library-tag-count {
    color: var(--library-light-body);
    background: #e8e5de;
}

html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-cover, .library-comic-cover, .library-comic-pages .my-gallery figure,
    [data-test="native-gallery"] > a, .library-comic-neighbors img, .library-error-banner,
    .library-popular-card, #image-container
) {
    background: var(--library-light-soft);
    border-color: var(--library-border);
}

html[data-hdh-color-theme="light"] .hdh-library :is(.library-cover-empty, .library-comic-cover-empty) {
    background: linear-gradient(145deg, #e9e5dd, #f3f0e9);
    color: var(--library-muted);
}

/* Captions stay light on their existing dark media overlays; media are never filtered. */
html[data-hdh-color-theme="light"] .hdh-library :is(
    .library-popular-caption h3, .library-comic-pages .my-gallery figcaption,
    .library-page-number, .library-directory .category-container .posttitle
) { color: #f4eee0; }
html[data-hdh-color-theme="light"] .hdh-library .library-comic-pages .my-gallery figure a::after { color: #f4eee0; }
html[data-hdh-color-theme="light"] .hdh-library .library-popular-card:hover h3 { color: #ff9884; }

/* Override the retained WordPress #footer colors on the light footer. */
html[data-hdh-color-theme="light"] .hdh-library #footer.library-footer {
    background: #f1eee7;
    color: var(--library-light-body);
}
html[data-hdh-color-theme="light"] .hdh-library #footer.library-footer a { color: var(--library-light-body); }
html[data-hdh-color-theme="light"] .hdh-library #footer.library-footer a:is(:hover, :focus-visible) { color: var(--library-accent); }
html[data-hdh-color-theme="light"] .hdh-library .library-footer-bottom { border-color: var(--library-border); }
html[data-hdh-color-theme="light"] .hdh-library .library-sitemap th { background: #eeebe4; }
html[data-hdh-color-theme="light"] .hdh-library .library-sitemap tbody tr:nth-child(even) { background: #f2efe9; }
html[data-hdh-color-theme="light"] .hdh-library :is(.library-categories, .library-popular-track) { scrollbar-color: #b8b3a9 transparent; }

html[data-hdh-color-theme="light"] .hdh-library .library-navigation-drawer { box-shadow: -20px 0 70px #302a2026; }
html[data-hdh-color-theme="light"] .hdh-library .library-navigation-drawer[open]::backdrop { background: #282c2e55; }
html[data-hdh-color-theme="light"] .hdh-library .library-drawer-panel { background: none; }
html[data-hdh-color-theme="light"] .hdh-library .library-theme-check { color: #fff; }
html[data-hdh-color-theme="light"] .hdh-library .library-navigation-drawer nav a::after { color: var(--library-muted); }
html[data-hdh-color-theme="light"] .hdh-library .library-navigation-drawer nav a[aria-current]::after { color: var(--library-accent); }

html[data-hdh-color-theme="light"] .hdh-library [data-test="contact-form"] .text-danger { color: #a52d24; }
html[data-hdh-color-theme="light"] .hdh-library .library-contact .alert-success {
    color: #245539;
    background: #eaf4eb;
    border-color: #78987d;
}

@media (forced-colors: active) {
    html:not([data-hdh-color-theme="light"]) .hdh-library .library-theme-option[data-hdh-color-theme="dark"],
    html[data-hdh-color-theme="light"] .hdh-library .library-theme-option[data-hdh-color-theme="light"] { outline: 2px solid Highlight; outline-offset: -3px; }
}
