/* DurNama 1.0.46 — complete public dark mode.
 * Loaded after theme CSS and runtime Theme Studio overrides so the visitor's
 * dark-mode choice always produces a coherent, readable dark interface.
 */
html[data-color-mode="dark"] {
    color-scheme: dark;
    background: #0d1113;
}

html[data-color-mode="dark"] body.public-site[class*="theme-"] {
    --paper: #101517 !important;
    --paper-deep: #0b0f11 !important;
    --cream: #1a2023 !important;
    --ink: #f3f0ea !important;
    --ink-soft: #b8b3aa !important;
    --line: rgba(255,255,255,.14) !important;
    --line-strong: rgba(255,255,255,.26) !important;
    --shadow: 0 24px 70px rgba(0,0,0,.38) !important;
    color: var(--ink) !important;
    background-color: var(--paper) !important;
    background-image: none !important;
}

/* Keep each historical theme recognizable while lifting its accents for dark contrast. */
html[data-color-mode="dark"] body.public-site.theme-emerald {
    --wine: #73c7b5 !important;
    --wine-dark: #4da391 !important;
    --wine-soft: #183a34 !important;
    --gold: #d3ad67 !important;
    --gold-soft: #edd7a5 !important;
    --teal: #73c7b5 !important;
}
html[data-color-mode="dark"] body.public-site.theme-classic {
    --wine: #d78398 !important;
    --wine-dark: #b86077 !important;
    --wine-soft: #3c232b !important;
    --gold: #d5b16e !important;
    --gold-soft: #eed7a5 !important;
    --teal: #79aa9e !important;
}
html[data-color-mode="dark"] body.public-site.theme-ivory {
    --wine: #d69476 !important;
    --wine-dark: #b87458 !important;
    --wine-soft: #3b2922 !important;
    --gold: #d0ae70 !important;
    --gold-soft: #ead5aa !important;
    --teal: #7eb0bc !important;
}
html[data-color-mode="dark"] body.public-site.theme-midnight {
    --wine: #ce829a !important;
    --wine-dark: #a95e75 !important;
    --wine-soft: #38242b !important;
    --gold: #d7b46d !important;
    --gold-soft: #f0d7a2 !important;
    --teal: #77afa5 !important;
}

/* Whole-page shells and every theme home/inner-page background. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] main,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .page-paper,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .poets-section,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .latest-section,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .content-section,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .about-shell,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .search-page,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .category-page,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .poem-page,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .verse-seo-page,
html[data-color-mode="dark"] body.public-site[class*="theme-"] .profile-settings,
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.classic-opening,.classic-poets-section,.classic-latest-section,.emerald-title-page,.emerald-poet-catalogue-opening,.emerald-shelves-section,.emerald-ledger-section,.ivory-frontpage,.ivory-directory-section,.ivory-editions-section,.midnight-salon,.midnight-portraits-section,.midnight-programme-section) {
    color: var(--ink) !important;
    background-color: var(--paper) !important;
    background-image: none !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.page-paper::before,.poem-paper::before,.classic-texture,.midnight-velvet) {
    opacity: .06 !important;
}

/* Header, masthead, sticky navigation and search/control rails. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.site-header,.classic-header,.classic-masthead,.classic-nav,.emerald-header,.emerald-masthead,.emerald-catalog-nav,.ivory-header,.ivory-masthead,.ivory-nav,.midnight-header) {
    color: var(--ink) !important;
    background-color: #12181b !important;
    background-image: none !important;
    border-color: var(--line) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.classic-search,.classic-masthead-search form,.emerald-search,.emerald-catalog-slip,.ivory-front-column form,.header-search,.hero-search,.midnight-hero-search,.search-primary) {
    color: var(--ink) !important;
    background: #0d1214 !important;
    border-color: var(--line-strong) !important;
}


html[data-color-mode="dark"] body.public-site.theme-classic .classic-opening-copy::before,
html[data-color-mode="dark"] body.public-site.theme-classic .classic-opening-copy::after {
    color: var(--gold) !important;
    background: var(--paper) !important;
}

/* Core cards and content surfaces. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(
    .stats-ribbon,.poet-card,.latest-card,.intro-prose,.poet-profile,.profile-stats,.profile-stats>div,
    .book-card,.chapter-card,.empty-state,.result-count,.poem-article,.poem-header,.poem-stage,
    .poem-navigation>a,.similar-grid>a,.audio-deck,.audio-track,.prose-block,
    .contribution-accordion .accordion-item,.contribution-accordion .accordion-button,.contribution-accordion .accordion-body,
    .published-comments article,.advanced-search,.search-result-card,.about-copy,.poet-about-card,.contributor-credits,
    .settings-card,.security-state,.setup-secret code,.captcha-field,.verse-focus,.verse-focus-header,
    .verse-source-facts,.verse-context-note,.verse-navigation,.verse-navigation>a,.toast,
    .classic-illumination-frame,.classic-arch,.classic-stat-register,.classic-poet-card,.classic-latest-ledger,.classic-latest-list>article,
    .emerald-classification,.emerald-catalog-slip,.emerald-book-card,.emerald-ledger>article,.poet-directory-intro,.poet-about-section,
    .ivory-directory,.ivory-poet-entry,.ivory-editions>article,.ivory-ticker,
    .midnight-stage,.midnight-portrait-wall,.midnight-salon-poet,.midnight-salon-stats,.midnight-programme-list>article>a
) {
    color: var(--ink) !important;
    background-color: var(--cream) !important;
    background-image: none !important;
    border-color: var(--line) !important;
    box-shadow: none !important;
}

/* Theme Studio can give these scopes images/light colors. Dark mode deliberately
   suppresses those light surfaces so the mode is complete and contrast-safe. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.poem-article,.poem-stage,.refined-list,.catalog-list,.verse-focus,table) {
    color: var(--ink) !important;
    background-color: var(--cream) !important;
    background-image: none !important;
    border-color: var(--line-strong) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] .poem-stage::after {
    content: none !important;
    display: none !important;
    background-image: none !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] .poem-stage::before {
    border-color: var(--line) !important;
}

/* Lists, tables, stats and their row/cell surfaces. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.refined-list>a,.catalog-list>a,table tr,table th,table td,.profile-stats>div,.verse-source-facts>div,.verse-context li,.poem-text>.couplet,.poem-text>.verse-row,.poem-text>.prose-block) {
    color: var(--ink) !important;
    background-color: transparent !important;
    background-image: none !important;
    border-color: var(--line) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.refined-list>a:hover,.catalog-list>a:hover,.poem-navigation>a:hover,.similar-grid>a:hover,.ivory-poet-entry:hover) {
    background-color: #232b2e !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.stage-ornament,.midnight-rule) {
    background: linear-gradient(90deg,transparent,var(--line-strong),transparent) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] hr {
    color: var(--line-strong) !important;
    border-color: var(--line-strong) !important;
}

/* Filters, alphabet strips, pagination, tools and neutral buttons. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(
    .alphabet-filter,.classic-alphabet,.emerald-alphabet,.ivory-alphabet,.midnight-alphabet,
    .alphabet-filter button,.classic-alphabet button,.emerald-alphabet button,.ivory-alphabet button,.midnight-alphabet button,
    .page-link,.round-arrow,.poem-tools button,.poem-tools a,.captcha-refresh,.account-button
) {
    color: var(--ink) !important;
    background-color: #171d20 !important;
    border-color: var(--line-strong) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(
    .alphabet-filter button.active,.alphabet-filter button:hover,
    .classic-alphabet button.active,.classic-alphabet button:hover,
    .emerald-alphabet button.active,.emerald-alphabet button:hover,
    .ivory-alphabet button.active,.ivory-alphabet button:hover,
    .midnight-alphabet button.active,.midnight-alphabet button:hover,
    .active>.page-link,.page-link:hover
) {
    color: #0d1113 !important;
    background-color: var(--gold-soft) !important;
    border-color: var(--gold-soft) !important;
}

/* Form controls, dropdowns, captcha and authentication surfaces. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(input,select,textarea,.form-control,.form-select) {
    color: var(--ink) !important;
    background-color: #0e1315 !important;
    border-color: var(--line-strong) !important;
    caret-color: var(--ink) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(input,textarea)::placeholder {
    color: #817f79 !important;
    opacity: 1 !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.captcha-challenge img,.verse-source-poet>span,.poet-monogram) {
    color: var(--ink) !important;
    background-color: #151b1e !important;
    border-color: var(--line) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.auth-shell,.auth-shell.single) {
    color: var(--ink) !important;
    background: var(--paper) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.auth-panel,.auth-shell.single .auth-panel,.auth-recovery-option,.recovery-codes-panel) {
    color: var(--ink) !important;
    background: var(--cream) !important;
    border-color: var(--line) !important;
}

/* Ensure explicit Theme Studio text overrides cannot leave light-on-light or
   dark-on-dark content when visitor dark mode is active. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(header,main,footer) [class],
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(header,main,footer) [class] * {
    color: var(--ink) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.poem-article,.poem-article p,.poem-article h1,.poem-article h2,.poem-article h3,.poem-article strong,.poem-stage,.poem-stage p,.poem-stage .verse-text,.refined-list>a,.catalog-list>a,table th,table td) {
    color: var(--ink) !important;
}

/* Secondary and accent text restored after the blanket readability rule. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(
    .poem-meta,.profile-bio,.result-footer,.search-within-poet,.security-state p,.published-comments time,
    .published-comments p,.book-meta,.list-copy,.intro-prose p,.classic-lead,.poet-directory-note,
    .emerald-opening-heading p,.ivory-lead-story p,.midnight-kicker
) {
    color: var(--ink-soft) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(
    .eyebrow,.path-title,.result-meta,.verse-number,.chapter-number,.list-index,.classic-overline,
    .classic-section-title span,.emerald-section-heading span,.ivory-section-heading span,.midnight-section-heading span
) {
    color: var(--gold-soft) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] a:hover {
    color: var(--gold-soft) !important;
}

/* Breadcrumbs and utility blocks should never retain a paper/cream fill. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.poetry-breadcrumb,.theme-preview-bar,.emerald-top,.ivory-utility) {
    color: var(--ink) !important;
    background-color: #12181b !important;
    border-color: var(--line) !important;
}

/* Footer remains intentionally darker than the content canvas. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.site-footer,.classic-footer,.emerald-footer,.ivory-footer,.midnight-footer) {
    color: #d6d2ca !important;
    background-color: #090d0f !important;
    background-image: none !important;
    border-color: var(--line) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(.site-footer,.classic-footer,.emerald-footer,.ivory-footer,.midnight-footer) * {
    color: inherit !important;
}

/* Bootstrap notices retain semantic meaning while staying dark. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] .alert {
    color: var(--ink) !important;
    background-color: #1c2326 !important;
    border-color: var(--line-strong) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] .alert-success { box-shadow: inset 4px 0 #6eb78b !important; }
html[data-color-mode="dark"] body.public-site[class*="theme-"] .alert-danger { box-shadow: inset 4px 0 #c77474 !important; }

/* The mode switch itself stays legible above every theme. */
html[data-color-mode="dark"] .durnama-mode-toggle {
    color: var(--ink) !important;
    background: rgba(20,26,29,.96) !important;
    border-color: rgba(255,255,255,.24) !important;
}

/* Filled actions must remain unmistakably readable in dark mode. Search buttons
   use a darkened theme accent with a white label instead of light-accent/black text. */
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(
    .header-search button,.hero-search button,.classic-search button,.emerald-search button,.emerald-catalog-slip button,
    .ivory-nav button,.ivory-front-column button,.midnight-hero-search button,.search-primary button,
    .auth-form button,.btn-poetry.solid,.captcha-refresh:hover,.account-button:hover,.verse-focus-footer button
) {
    color: #ffffff !important;
    background-color: color-mix(in srgb,var(--wine-dark) 58%,#0b0f11) !important;
    border-color: color-mix(in srgb,var(--wine) 46%,rgba(255,255,255,.24)) !important;
    text-shadow: 0 1px 1px rgba(0,0,0,.28) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] :is(
    .header-search button,.hero-search button,.classic-search button,.emerald-search button,.emerald-catalog-slip button,
    .ivory-nav button,.ivory-front-column button,.midnight-hero-search button,.search-primary button
):hover {
    color: #ffffff !important;
    background-color: color-mix(in srgb,var(--wine-dark) 76%,#0b0f11) !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] .search-result-card mark {
    color: #f2dca8 !important;
    background: #493c22 !important;
}
html[data-color-mode="dark"] body.public-site[class*="theme-"] .captcha-challenge img {
    filter: invert(.88) hue-rotate(180deg) contrast(1.05) !important;
}
