/* Zibaldone — dark theme overrides (active when body has .theme-dark) */

body.theme-dark {
    /* Core palette (overrides base.css :root usage via inheritance) */
    --background-color: #0a0606;
    --highlight-accent: #232323;
    --secondary-bg: #3a3a3a;
    --accent-gray: #4a4a4a;
    --border-light: #333333;
    --border-color: #333333;
    --text-primary: #e8e0d0;
    --text-secondary: #b8ad9e;
    --text-medium: #8a8070;
    --text-color: #e8e0d0;
    --primary-color: #e8e0d0;
    --hover-color: #3a3a3a;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.55);
    /* Mauve / dusty rose accent (mockup): borders, CTAs, in-content headings, links */
    --gold-accent: #a79682;
    --post-title-color: #e2dccc;
    --post-title-hover: #f2ede6;
    --tag-bg: #2c2c2c;
    --tag-text: #8a8070;
    --btn-bg: #1a1a1a;
    --card-bg: #232323;
    --error-color: #e87070;

    background-color: #0a0606;
    color: var(--text-primary);
    scrollbar-color: #3a3a3a #0a0606;
    scrollbar-width: thin;
}

/* Journal main shell: fractal noise + shifting neutral greys (mockup) */
body.theme-dark.journal-page .journal-wrapper {
    background-color: #1a1a1a;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='gc'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23gc)' opacity='0.24'/%3E%3C/svg%3E"),
        linear-gradient(
            122deg,
            #1f1f1f 0%,
            #1e1e1e 14%,
            #191919 28%,
            #181818 42%,
            #161616 55%,
            #1a1a1a 68%,
            #1e1e1e 82%,
            #1f1f1f 100%
        );
    background-blend-mode: overlay, normal;
    background-attachment: local, local;
    background-size: 300px 300px, auto;
}

@supports not (background-image: url("data:image/svg+xml,<svg/>")) {
    body.theme-dark.journal-page .journal-wrapper {
        background-image: linear-gradient(
            122deg,
            #1f1f1f 0%,
            #1e1e1e 14%,
            #191919 28%,
            #181818 42%,
            #161616 55%,
            #1a1a1a 68%,
            #1e1e1e 82%,
            #1f1f1f 100%
        );
    }
}

body.theme-dark .right-column {
    background: #1e1e1e;
    border-left: 1px solid #2a2a2a;
}

body.theme-dark .right-column img {
    filter: brightness(0.55) saturate(0.4) sepia(0.2);
    opacity: 0.9;
    mix-blend-mode: luminosity;
}

body.theme-dark .right-column .blog-title {
    color: var(--post-title-color);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

body.theme-dark .right-column .blog-subtitle {
    color: #d4cdc0;
    opacity: 0.92;
}

@media (min-width: 801px) {
    body.theme-dark .right-column .blog-subtitle {
        font-size: 0.95rem;
    }
}

body.theme-dark.journal-page.locked .journal-content.blurred .right-column {
    background: #1e1e1e;
}

body.theme-dark .toolbar {
    background: transparent;
    border-right: 1px solid rgba(167, 150, 130, 0.18);
}

body.theme-dark .toolbar-btn {
    border-color: #333333;
    color: #b8ad9e;
}

body.theme-dark .toolbar-btn:hover,
body.theme-dark .toolbar-btn:focus {
    background-color: rgba(167, 150, 130, 0.14);
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark .toolbar-btn:hover svg,
body.theme-dark .toolbar-btn:focus svg {
    color: var(--gold-accent) !important;
}

body.theme-dark .toolbar-btn span {
    background: rgba(12, 6, 6, 0.96);
    color: var(--gold-accent);
    border: 1px solid #333333;
}

@media (max-width: 800px) {
    /* Bottom bar: opaque so content scrolling behind stays readable */
    body.theme-dark .toolbar {
        background: rgba(10, 6, 6, 0.97);
        border-top: 1px solid #1f1818;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    body.theme-dark .right-column {
        background: #1e1e1e;
        border-bottom: 1px solid #333333;
    }

    body.theme-dark .right-column::before,
    body.theme-dark .right-column::after {
        background: var(--gold-accent);
        opacity: 0.4;
    }

    /* Strip quote (::after): readable on dark bar (responsive/layout hides text, shows ::after) */
    body.theme-dark .right-column .blog-subtitle::after {
        font-size: 0.72rem;
        color: #d4cdc0;
    }
}

body.theme-dark footer {
    color: var(--text-secondary);
    border-top: 1px solid var(--accent-gray);
}

body.theme-dark footer a {
    color: var(--text-secondary);
}

body.theme-dark footer a:hover {
    color: var(--gold-accent);
}

/* Post cards */
body.theme-dark .blog-post {
    background: var(--card-bg) !important;
    border-color: #333333;
    border-left: 4px solid var(--gold-accent);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

body.theme-dark .blog-post:hover {
    background: #2a2a2a !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

body.theme-dark .blog-post h2,
body.theme-dark .post-title-link h2 {
    color: var(--post-title-color);
    border-bottom-color: #333333 !important;
}

body.theme-dark .post-title-link:hover h2 {
    color: var(--post-title-hover);
}

body.theme-dark .blog-post-meta {
    color: var(--text-secondary);
}

body.theme-dark .vertical-date {
    color: var(--text-medium);
    border-left-color: #333333;
}

body.theme-dark .vertical-date .v-part-day span {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    body.theme-dark .vertical-date-wrap {
        border-bottom-color: #333333;
    }
}

body.theme-dark .blog-post-content {
    color: var(--text-primary);
}

body.theme-dark .blog-post-content h1,
body.theme-dark .blog-post-content h2,
body.theme-dark .blog-post-content h3 {
    color: var(--gold-accent);
}

body.theme-dark .blog-post-content a {
    color: var(--gold-accent);
    text-decoration-color: rgba(167, 150, 130, 0.45);
}

body.theme-dark .blog-post-content a:hover {
    color: #c4b5a5;
    text-decoration-color: #c4b5a5;
}

body.theme-dark .blog-post-content strong {
    color: #e8e2d8;
}

body.theme-dark .blog-post-content blockquote {
    border-left-color: var(--gold-accent);
    color: var(--text-secondary);
    background: rgba(167, 150, 130, 0.06);
}

body.theme-dark .blog-post-content code {
    background: #2c2c2c;
    color: #d4c4b0;
    border: 1px solid #333333;
}

body.theme-dark .blog-post-content pre {
    background: #161616;
    border: 1px solid #333333;
}

body.theme-dark .blog-post-content hr {
    border-color: #333333;
}

body.theme-dark .post-tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    border: 1px solid #333333;
}

body.theme-dark .post-tag:hover {
    background: #353535;
    color: #b8ad9e;
    border-color: var(--gold-accent);
}

body.theme-dark .edit-link {
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark .edit-link:hover,
body.theme-dark .edit-link:focus {
    background-color: rgba(167, 150, 130, 0.12);
    color: #c4b5a5;
    border-color: #c4b5a5;
}

/* Solid pill (mockup): gold fill, dark label, defined edge — not outline-only */
body.theme-dark .read-more-btn {
    background: var(--gold-accent);
    color: #1c1814;
    border: 1px solid rgba(28, 24, 20, 0.45);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

body.theme-dark .read-more-btn:hover,
body.theme-dark .read-more-btn:focus {
    background: #b8a892;
    color: #1c1814;
    border-color: rgba(28, 24, 20, 0.55);
}

body.theme-dark .view-mode-card .read-more {
    background: var(--gold-accent);
    color: #1c1814;
    border: 1px solid rgba(28, 24, 20, 0.45);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

body.theme-dark .view-mode-card .read-more:hover,
body.theme-dark .view-mode-card .read-more:focus {
    background: #b8a892;
    color: #1c1814;
    border-color: rgba(28, 24, 20, 0.55);
}

body.theme-dark .blog-post-images img,
body.theme-dark .illustration-image img {
    filter: brightness(0.9) saturate(0.85);
}

body.theme-dark .view-mode-card .blog-post {
    background: #232323 !important;
    border: 1px solid #333333;
}

body.theme-dark .view-mode-card .card-footer {
    background: #1e1e1e;
    border-top-color: #333333;
}

/* Search */
body.theme-dark .search-field {
    background: rgba(30, 30, 30, 0.92);
    border-color: #333333;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

body.theme-dark .search-field svg {
    color: var(--text-medium);
}

body.theme-dark .search-input {
    color: var(--text-primary);
}

body.theme-dark .search-input::placeholder {
    color: var(--text-medium);
}

body.theme-dark .search-clear {
    color: var(--text-medium);
}

body.theme-dark .search-clear:hover {
    color: var(--text-primary);
}

body.theme-dark .search-suggestions {
    background: #222222;
    border-color: #333333;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

body.theme-dark .search-suggestion {
    color: var(--text-primary);
}

body.theme-dark .search-suggestion:hover,
body.theme-dark .search-suggestion:focus-visible {
    background: rgba(167, 150, 130, 0.1);
}

body.theme-dark .suggestion-title {
    color: var(--post-title-color);
}

body.theme-dark .suggestion-snippet {
    color: var(--text-secondary);
}

body.theme-dark .suggestion-date {
    color: var(--text-medium);
}

body.theme-dark .suggestion-snippet mark {
    background: rgba(167, 150, 130, 0.25);
    color: #e8d898;
}

/* Admin: same shell as index .journal-wrapper (body margins show behind main otherwise) */
body.theme-dark.admin-page {
    /* Unified admin buttons (used by .admin-btn-* + fallbacks below) */
    --admin-btn-primary-bg: var(--gold-accent);
    --admin-btn-primary-fg: #1c1814;
    --admin-btn-primary-border: rgba(28, 24, 20, 0.45);
    --admin-btn-primary-bg-hover: #b8a892;
    --admin-btn-primary-border-hover: rgba(28, 24, 20, 0.55);
    --admin-btn-secondary-bg: transparent;
    --admin-btn-secondary-fg: var(--gold-accent);
    --admin-btn-secondary-border: var(--gold-accent);
    --admin-btn-secondary-bg-hover: rgba(167, 150, 130, 0.14);
    --admin-btn-secondary-fg-hover: #c4b5a5;
    --admin-btn-secondary-border-hover: #c4b5a5;

    background-color: #1a1a1a;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='gc'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23gc)' opacity='0.24'/%3E%3C/svg%3E"),
        linear-gradient(
            122deg,
            #1f1f1f 0%,
            #1e1e1e 14%,
            #191919 28%,
            #181818 42%,
            #161616 55%,
            #1a1a1a 68%,
            #1e1e1e 82%,
            #1f1f1f 100%
        );
    background-blend-mode: overlay, normal;
    background-attachment: local, local;
    background-size: 300px 300px, auto;
}

@supports not (background-image: url("data:image/svg+xml,<svg/>")) {
    body.theme-dark.admin-page {
        background-image: linear-gradient(
            122deg,
            #1f1f1f 0%,
            #1e1e1e 14%,
            #191919 28%,
            #181818 42%,
            #161616 55%,
            #1a1a1a 68%,
            #1e1e1e 82%,
            #1f1f1f 100%
        );
    }
}

body.theme-dark .admin-tab {
    color: var(--text-secondary);
    border-bottom-color: transparent;
}

body.theme-dark .admin-tab:hover {
    color: var(--text-primary);
}

body.theme-dark .admin-tab.active {
    color: var(--gold-accent);
    border-bottom-color: var(--gold-accent);
}

body.theme-dark .admin-tabs-left {
    border-bottom-color: #333333;
}

body.theme-dark input[type="text"],
body.theme-dark input[type="email"],
body.theme-dark input[type="password"],
body.theme-dark input[type="date"],
body.theme-dark input[type="search"],
body.theme-dark input[type="number"],
body.theme-dark textarea,
body.theme-dark select {
    background: #1e1e1e;
    color: var(--text-primary);
    border-color: #333333;
}

body.theme-dark input:focus,
body.theme-dark textarea:focus,
body.theme-dark select:focus {
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 2px rgba(167, 150, 130, 0.15);
    outline: none;
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
    color: var(--text-medium);
}

body.theme-dark label {
    color: var(--text-secondary);
}

body.theme-dark button,
body.theme-dark .btn {
    background: transparent;
    color: var(--text-primary);
    border-color: #333333;
}

body.theme-dark button:hover,
body.theme-dark .btn:hover {
    background: #2c2c2c;
    border-color: var(--gold-accent);
    color: var(--gold-accent);
}

/* Submit fallback on non-admin dark pages (contact uses .submit-btn-standard; login uses .login-page rule) */
body.theme-dark:not(.admin-page) button[type="submit"],
body.theme-dark .btn-primary {
    background: #333333;
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark:not(.admin-page) button[type="submit"]:hover,
body.theme-dark:not(.admin-page) button[type="submit"]:focus,
body.theme-dark .btn-primary:hover,
body.theme-dark .btn-primary:focus {
    background: rgba(167, 150, 130, 0.15);
}

/* Admin — primary: gold pill (publish, add tag, etc.) */
body.theme-dark.admin-page .admin-btn-primary,
body.theme-dark.admin-page #submit-post,
body.theme-dark.admin-page .add-tag-container button,
body.theme-dark.admin-page .tags-management-add button {
    background: var(--admin-btn-primary-bg);
    color: var(--admin-btn-primary-fg);
    border: 1px solid var(--admin-btn-primary-border);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

body.theme-dark.admin-page .admin-btn-primary:hover,
body.theme-dark.admin-page .admin-btn-primary:focus,
body.theme-dark.admin-page #submit-post:hover,
body.theme-dark.admin-page #submit-post:focus,
body.theme-dark.admin-page .add-tag-container button:hover,
body.theme-dark.admin-page .add-tag-container button:focus,
body.theme-dark.admin-page .tags-management-add button:hover,
body.theme-dark.admin-page .tags-management-add button:focus {
    background: var(--admin-btn-primary-bg-hover);
    color: var(--admin-btn-primary-fg);
    border-color: var(--admin-btn-primary-border-hover);
}

/* Admin — secondary: outline (draft, contact/SMTP actions, .btn-secondary) */
body.theme-dark.admin-page .admin-btn-secondary,
body.theme-dark.admin-page #save-draft,
body.theme-dark.admin-page .btn-secondary {
    background: var(--admin-btn-secondary-bg);
    color: var(--admin-btn-secondary-fg);
    border: 1px solid var(--admin-btn-secondary-border);
    box-shadow: none;
}

body.theme-dark.admin-page .admin-btn-secondary:hover,
body.theme-dark.admin-page .admin-btn-secondary:focus,
body.theme-dark.admin-page #save-draft:hover,
body.theme-dark.admin-page #save-draft:focus,
body.theme-dark.admin-page .btn-secondary:hover,
body.theme-dark.admin-page .btn-secondary:focus {
    background: var(--admin-btn-secondary-bg-hover);
    color: var(--admin-btn-secondary-fg-hover);
    border-color: var(--admin-btn-secondary-border-hover);
}

body.theme-dark .published-posts table {
    border-color: #333333;
}

body.theme-dark .published-posts th {
    background: #1e1e1e;
    color: var(--text-secondary);
    border-color: #333333;
}

body.theme-dark .published-posts td {
    border-color: #333333;
    color: var(--text-primary);
}

body.theme-dark .published-posts tr:nth-child(even) td {
    background: #1e1e1e;
}

body.theme-dark .published-posts tr:hover td {
    background: #2e2e2e;
}

body.theme-dark .EasyMDEContainer .CodeMirror {
    background: #141414;
    color: var(--text-primary);
    border-color: #333333;
}

body.theme-dark .EasyMDEContainer .CodeMirror-cursor {
    border-left-color: var(--gold-accent);
}

body.theme-dark .EasyMDEContainer .editor-toolbar {
    background: #1e1e1e;
    border-color: #333333;
}

body.theme-dark .EasyMDEContainer .editor-toolbar button {
    color: var(--text-secondary) !important;
}

body.theme-dark .EasyMDEContainer .editor-toolbar button:hover,
body.theme-dark .EasyMDEContainer .editor-toolbar button.active {
    background: #2e2e2e;
    color: var(--gold-accent) !important;
}

body.theme-dark .EasyMDEContainer .editor-toolbar i.separator {
    border-color: #333333;
}

body.theme-dark .editor-preview {
    background: #1e1e1e;
    color: var(--text-primary);
}

body.theme-dark .editor-preview-side {
    background: #141414;
    border-left-color: #333333;
}

body.theme-dark .markdown-btn {
    background: transparent;
    color: var(--text-primary);
    border-color: #333333;
}

body.theme-dark .markdown-btn:hover,
body.theme-dark .markdown-btn:focus {
    background: var(--gold-accent);
    color: #0a0606;
    border-color: var(--gold-accent);
}

body.theme-dark .markdown-toolbar {
    background: rgba(10, 6, 6, 0.85);
    border: 1px solid #333333;
}

body.theme-dark .markdown-toolbar .separator {
    border-color: #333333;
}

body.theme-dark .settings-group {
    background: #1e1e1e;
    border: 1px solid #333333;
    border-radius: var(--border-radius);
}

body.theme-dark .toggle-option,
body.theme-dark .segment-option {
    background: transparent;
    color: var(--text-secondary);
    border-color: #333333;
}

body.theme-dark .toggle-option.active,
body.theme-dark .segment-option.active {
    background: #333333;
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark .card-option {
    background: #1e1e1e;
    border-color: #333333;
    color: var(--text-secondary);
}

body.theme-dark .card-option.active {
    border-color: var(--gold-accent);
    color: var(--gold-accent);
    background: rgba(167, 150, 130, 0.06);
}

/* Dropzone */
body.theme-dark .dropzone {
    background: #1e1e1e;
    border-color: #333333;
}

body.theme-dark .dropzone:hover {
    border-color: var(--gold-accent);
    background: rgba(167, 150, 130, 0.04);
}

body.theme-dark .dropzone.dz-drag-hover {
    border-color: var(--gold-accent);
    background: rgba(167, 150, 130, 0.08);
}

body.theme-dark .upload-icon {
    color: #333333;
}

body.theme-dark .dropzone:hover .upload-icon {
    color: var(--gold-accent);
}

body.theme-dark .upload-text {
    color: var(--text-primary);
}

body.theme-dark .upload-hint {
    color: var(--text-medium);
}

body.theme-dark .dropzone .dz-preview .dz-image {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Toasts */
body.theme-dark #toast-container > .toast {
    background: #222222 !important;
    border-left-color: var(--gold-accent);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

body.theme-dark #toast-container > .toast .toast-title {
    color: var(--text-primary);
}

body.theme-dark #toast-container > .toast .toast-message {
    color: var(--text-secondary);
}

body.theme-dark #toast-container > .toast-success {
    background: linear-gradient(135deg, #1d231d 0%, #1a201a 100%) !important;
    border-left-color: #6b8e6b;
}

body.theme-dark #toast-container > .toast-error {
    background: linear-gradient(135deg, #231d1d 0%, #201a1a 100%) !important;
    border-left-color: #8e6b6b;
}

body.theme-dark #toast-container > .toast-warning {
    background: linear-gradient(135deg, #23201a 0%, #201d17 100%) !important;
    border-left-color: #8e7e5b;
}

body.theme-dark #toast-container > .toast-info {
    background: linear-gradient(135deg, #1a1e23 0%, #171a20 100%) !important;
    border-left-color: #6b7b8e;
}

body.theme-dark #toast-container > .toast .toast-close-button {
    color: var(--text-medium);
}

body.theme-dark #toast-container > .toast .toast-close-button:hover {
    color: var(--text-primary);
}

/* Contact */
body.theme-dark .author-section {
    background: #1e1e1e;
    border-color: #333333;
}

body.theme-dark .author-bio h3,
body.theme-dark .contact-form-section h3 {
    color: var(--gold-accent);
}

body.theme-dark .author-bio p {
    color: var(--text-secondary);
}

body.theme-dark .author-photo {
    border-color: var(--gold-accent);
    filter: brightness(0.9) saturate(0.8);
}

body.theme-dark .social-links a {
    background: #2c2c2c;
    border-color: #333333;
    color: var(--text-secondary);
}

body.theme-dark .social-links a:hover {
    background: var(--gold-accent);
    color: #0a0606;
    border-color: var(--gold-accent);
}

body.theme-dark .form-group input,
body.theme-dark .form-group textarea {
    background: #1e1e1e;
    border-color: #333333;
    color: var(--text-primary);
}

body.theme-dark .form-group input:focus,
body.theme-dark .form-group textarea:focus {
    border-color: var(--gold-accent);
    box-shadow: 0 0 4px rgba(167, 150, 130, 0.3);
}

body.theme-dark .form-group label {
    color: var(--text-secondary);
}

body.theme-dark .security-question-container {
    background: #1e1e1e;
    border-color: #333333;
}

body.theme-dark .math-question {
    color: var(--text-primary);
}

/* Chained selector beats body.theme-dark button[type="submit"] (same element) */
body.theme-dark button[type="submit"].submit-btn-standard {
    background: var(--gold-accent);
    color: #1c1814;
    border: 1px solid rgba(28, 24, 20, 0.45);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

body.theme-dark button[type="submit"].submit-btn-standard:hover:not(:disabled) {
    background: #b8a892;
    color: #1c1814;
    border-color: rgba(28, 24, 20, 0.55);
}

body.theme-dark .field-error {
    color: var(--error-color);
}

body.theme-dark .input-error {
    border-color: var(--error-color) !important;
}

/* Gallery & lightbox */
body.theme-dark .gallery-card {
    background: #1e1e1e;
    border: 1px solid #333333;
}

body.theme-dark .gallery-card:hover {
    border-color: var(--gold-accent);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

body.theme-dark .gallery-card img {
    filter: brightness(0.9);
}

body.theme-dark .gallery-card:hover img {
    filter: brightness(1);
}

body.theme-dark .gallery-pagination a,
body.theme-dark .gallery-pagination span {
    color: var(--text-secondary);
    border-color: #333333;
    background: transparent;
}

body.theme-dark .gallery-pagination a:hover {
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark .gallery-pagination .active {
    color: var(--gold-accent);
    border-color: var(--gold-accent);
    background: rgba(167, 150, 130, 0.1);
}

body.theme-dark .glightbox-clean .gslide-description {
    background: rgba(20, 18, 12, 0.92) !important;
}

body.theme-dark .desc-title {
    color: var(--post-title-color);
}

body.theme-dark .desc-meta {
    color: #7a7268;
}

body.theme-dark .desc-excerpt {
    color: #b8ad9e;
}

/* GLightbox / responsive use high-specificity rules; force readable pill on warm background */
body.theme-dark .glightbox-clean .gslide-description a.desc-link,
body.theme-dark .glightbox-clean .gslide-description .desc-link,
body.theme-dark .gdesc-inner .gallery-desc .desc-link,
body.theme-dark .gallery-desc .desc-link,
body.theme-dark .desc-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.35rem;
    padding: 0.5rem 1.25rem;
    border-radius: var(--border-radius);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-sm);
    text-decoration: none !important;
    background: var(--gold-accent) !important;
    color: #1c1814 !important;
    border: 2px solid rgba(28, 24, 20, 0.45) !important;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    transition: background-color var(--transition-default), color var(--transition-default), border-color var(--transition-default), transform var(--transition-default), box-shadow var(--transition-default);
}

body.theme-dark .glightbox-clean .gslide-description a.desc-link:hover,
body.theme-dark .glightbox-clean .gslide-description a.desc-link:focus,
body.theme-dark .glightbox-clean .gslide-description .desc-link:hover,
body.theme-dark .glightbox-clean .gslide-description .desc-link:focus,
body.theme-dark .gdesc-inner .gallery-desc .desc-link:hover,
body.theme-dark .gdesc-inner .gallery-desc .desc-link:focus,
body.theme-dark .gallery-desc .desc-link:hover,
body.theme-dark .gallery-desc .desc-link:focus,
body.theme-dark .desc-link:hover,
body.theme-dark .desc-link:focus {
    background: #b8a892 !important;
    color: #1c1814 !important;
    border-color: rgba(28, 24, 20, 0.55) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

/* Markdown figures, footnotes, back-to-top */
body.theme-dark .md-figure figcaption {
    color: var(--text-medium);
}

body.theme-dark .md-figure img {
    filter: brightness(0.9);
}

body.theme-dark .md-figure img:hover {
    filter: brightness(1);
}

body.theme-dark .footnotes {
    border-top-color: #333333;
    color: var(--text-secondary);
}

body.theme-dark .footnotes a,
body.theme-dark sup.footnote-ref a::before,
body.theme-dark a.footnote-ref::before {
    color: var(--text-medium);
}

body.theme-dark .footnotes a:hover,
body.theme-dark sup.footnote-ref a:hover::before {
    color: var(--gold-accent);
}

body.theme-dark .back-to-top {
    background: #2e2e2e;
    color: var(--gold-accent);
    border: 1px solid var(--gold-accent);
}

body.theme-dark .back-to-top:hover {
    background: rgba(167, 150, 130, 0.15);
}

body.theme-dark .language-flag {
    color: var(--text-secondary);
}

body.theme-dark .language-flag:hover {
    background: #2e2e2e;
}

body.theme-dark .language-flag.active {
    background: #333333;
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark .content-header .language-flags .lang-btn:hover {
    background-color: #2e2e2e;
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark .content-header .language-flags .lang-btn.active {
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark .markdown-toolbar .language-flags .lang-btn:hover {
    background-color: #2e2e2e;
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark .markdown-toolbar .language-flags .lang-btn.active {
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

body.theme-dark .admin-tab-action {
    color: var(--text-secondary);
    border-color: #333333;
}

body.theme-dark .admin-tab-action:hover {
    background-color: #2e2e2e;
    color: var(--gold-accent);
    border-color: var(--gold-accent);
}

/* Login template uses inline button styles; .login-page raises specificity over those rules */
body.theme-dark.login-page {
    background-color: #1b1b1b;
}

body.theme-dark.login-page .login-container button[type="submit"] {
    background: var(--gold-accent);
    color: #1c1814;
    border: 1px solid rgba(28, 24, 20, 0.45);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

body.theme-dark.login-page .login-container button[type="submit"]:hover {
    background: #b8a892;
    color: #1c1814;
    border-color: rgba(28, 24, 20, 0.55);
}

/* Scrollbar (WebKit) */
body.theme-dark ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.theme-dark ::-webkit-scrollbar-track {
    background: #0a0606;
}

body.theme-dark ::-webkit-scrollbar-thumb {
    background: #333333;
    border-radius: 4px;
}

body.theme-dark ::-webkit-scrollbar-thumb:hover {
    background: var(--gold-accent);
}

body.theme-dark ::selection {
    background: rgba(167, 150, 130, 0.3);
    color: #e8e0d0;
}

@media print {
    body.theme-dark {
        background: white !important;
        color: black !important;
    }

    body.theme-dark * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
    }
}
