/* style.css */
/* Define colors */
:root {
    --distill-gray: rgb(107, 114, 128);
    --distill-gray-light: rgb(185, 185, 185);
    --distill-gray-lighter: rgb(228, 228, 228);
    --distill-gray-lightest: rgb(245, 245, 245);
    --distill-blue: #007BFF;
    --ukraine-blue: #005BBB;
    --ukraine-yellow: #FED600;
    
    /* Light theme variables */
    --background-color: #ffffff;
    --text-color: #333333;
    --heading-color: #000000;
    --link-color: #0366d6;
    --code-background: #f6f8fa;
    --blockquote-background: #f5f5f5;
    --border-color: #e1e4e8;
    --tooltip-background: #f6f8fa;
    --tooltip-color: #24292e;
    --card-background: #ffffff;
    --pre-background: rgba(0, 0, 0, 0.02);
    --pre-color: rgba(150, 150, 150, 1);
}

/* Dark theme variables */
[data-theme="dark"] {
    --background-color: #1A1A1A;
    --text-color: #c9d1d9;
    --heading-color: #e6edf3;
    --link-color: #58a6ff;
    --code-background: #1f2937;
    --blockquote-background: #1f2937;
    --border-color: #30363d;
    --tooltip-background: #1f2937;
    --tooltip-color: #c9d1d9;
    --card-background: #1f2937;
    --pre-background: rgba(255, 255, 255, 0.05);
    --pre-color: rgba(200, 200, 200, 1);
}

/* Move both switchers to the top left, side by side */
#switcher-container {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1000;
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
}
#language-switcher {
    position: static;
    display: flex;
    gap: 4px;
}
#theme-switcher {
    position: static;
}

#theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: white;
    border: 2px solid var(--distill-blue);
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: var(--distill-blue);
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    outline: none;
}

#theme-toggle:hover {
    background-color: var(--distill-blue);
    color: white;
}

[data-theme="dark"] #theme-toggle {
    background-color: #1f2937;
    color: #f0f0f0;
    border-color: #f0f0f0;
}

[data-theme="dark"] #theme-toggle:hover {
    background-color: #f0f0f0;
    color: #1f2937;
}

[data-theme="dark"] #theme-toggle i.fa-moon {
    display: none;
}

[data-theme="dark"] #theme-toggle::before {
    content: "";
    font-style: normal;
}

.language-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: white;
    border: 2px solid var(--ukraine-blue);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--ukraine-blue);
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-decoration: none;
    outline: none;
    font-family: inherit;
}

#language-toggle-en {
    border-color: var(--distill-blue);
    color: var(--distill-blue);
}

#language-toggle-en:hover,
#language-toggle-en.active {
    background-color: var(--distill-blue);
    color: white;
}

#language-toggle-uk {
    border-color: var(--ukraine-blue);
    color: var(--ukraine-blue);
}

#language-toggle-uk:hover,
#language-toggle-uk.active {
    background-color: var(--ukraine-blue);
    color: var(--ukraine-yellow);
}

.language-toggle:hover {
    background-color: var(--ukraine-blue);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.language-toggle.active {
    background-color: var(--ukraine-blue);
    color: white;
}

.language-toggle i {
    font-size: 16px;
}

.flag-icon {
    width: 20px;
    height: 12px;
    margin-right: 4px;
    display: inline-block;
    vertical-align: middle;
}

.language-toggle:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.hidden-lang {
    display: none;
}

/* Container for the controls */
[id^="plot-"] {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* Adjust the gap between controls as needed */
}
[id^="plot-"] figure {
    margin-bottom: 0px;
    margin-top: 0px;
    padding: 0px;
}
.plotly_caption {
    font-style: italic;
    margin-top: 10px;
}

figcaption {
    color: var(--text-color); /* Use the theme's text color variable */
}

.plotly_controls {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
}


.plotly_input_container {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 10px;
}

/* Style for the select dropdown */
.plotly_input_container > select {
    padding: 2px 4px;
    /* border: 1px solid #ccc; */
    line-height: 1.5em;
    text-align: center;
    border-radius: 4px;
    font-size: 12px;
    background-color: var(--distill-gray-lightest);
    outline: none;
}

/* Style for the range input */

.plotly_slider {
    display: flex;
    align-items: center;
    gap: 10px;
}

.plotly_slider > input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 2px;
    background: var(--distill-gray-light);
    border-radius: 5px;
    outline: none;
}

.plotly_slider > span {
    font-size: 14px;
    line-height: 1.6em;
    min-width: 16px;
}

.plotly_slider > input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--distill-blue);
    cursor: pointer;
}

.plotly_slider > input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--distill-blue);
    cursor: pointer;
}

/* Style for the labels */
.plotly_input_container > label {
    font-size: 14px;
    font-weight: bold;
}

.main-plot-container {
    margin-top: 21px;
    margin-bottom: 35px;
}

.main-plot-container > figure {
    display: block !important;
    /* Let this be handled by graph-container */
    margin-bottom: 0px;
    margin-top: 0px;
}
.main-plot-container > div {
    display: none !important;
}


@media (min-width: 768px) {
    .main-plot-container > figure {
        display: none !important;
    }
    .main-plot-container > div {
        display: flex !important;
    }
}

d-byline .byline {
  grid-template-columns: 1fr;
  grid-column: text;
  font-size: 0.9rem;
  line-height: 1.8em;
}

@media (min-width: 768px) {
  d-byline .byline {
    grid-template-columns: 5fr 1fr 1fr;
  }
}

#title-plot {
    margin-top: 0px;
    margin-bottom: 0px;
}

.center-title-image {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100%;
    margin-bottom: 10px;
}

.title-thumbnail {
    max-width: 400px;
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    display: block;
    margin: 0 auto;
}


d-contents > nav a.active {
    text-decoration: underline;
}

@media (max-width: 1199px) {
    d-contents {
        display: none;
        background: white;
        justify-self: start;
        align-self: start;
        padding-bottom: 0.5em;
        margin-bottom: 1em;
        padding-left: 0.25em;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        border-bottom-width: 1px;
        border-bottom-style: solid;
        border-bottom-color: rgba(0, 0, 0, 0.1);
        overflow-y: scroll;
        height: calc(100vh - 40px);
        scrollbar-width: none;
        z-index: -100;
    }
}

d-contents a:hover {
    border-bottom: none;
}

toc-title {
    font-weight: bold;
    font-size: 1.2em;
    color: #333;
}

toggle-icon {
    transition: transform 0.3s;
}

toggle-icon.collapsed {
    transform: rotate(90deg);
}

.toc-content {
    margin-top: 15px;
    overflow: hidden;
    /* max-height: 1000px; */
    transition: max-height 0.3s ease-out;
}

.toc-content.collapsed {
    max-height: 0;
    margin-top: 0;
}

@media (min-width: 1200px) {
    d-article {
        /* Ensure d-article does not prevent sticky positioning */
        overflow: visible;
    }

    d-contents {
        align-self: start;
        background: white;
        grid-column-start: 1 !important;
        grid-column-end: 4 !important;
        grid-row: auto / span 6;
        justify-self: end;
        margin-top: 0em;
        padding-right: 3em;
        padding-left: 2em;
        /* border-right: 1px solid rgba(0, 0, 0, 0.1);
        border-right-width: 1px;
        border-right-style: solid;
        border-right-color: rgba(0, 0, 0, 0.1); */
        position: -webkit-sticky; /* For Safari */
        position: sticky;
        top: 10px; /* Adjust this value if needed */
        overflow-y: auto;
        height: calc(100vh - 40px);
        scrollbar-width: none;
        transition: max-height 0.3s ease-out;
        z-index: -100;
    }

    [data-theme="dark"] d-contents {
        background: var(--background-color);
    }
}

d-contents nav h3 {
    margin-top: 0;
    margin-bottom: 1em;
}

d-contents nav div div {
    color: rgba(0, 0, 0, 0.8);
    font-weight: bold;
}

d-contents nav a {
    color: rgba(0, 0, 0, 0.8);
    border-bottom: none;
    text-decoration: none;
}

d-contents li {
    list-style-type: none;
}

d-contents ul, d-article d-contents ul {
    padding-left: 1em;
}

d-contents nav ul li {
    margin-bottom: .25em;
}

d-contents nav a:hover {
    text-decoration: underline solid rgba(0, 0, 0, 0.6);
}

d-contents nav ul {
    margin-top: 0;
    margin-bottom: 6px;
}


d-contents nav > div {
    display: block;
    outline: none;
    margin-bottom: 0.5em;
}

d-contents nav > div > a {
    font-size: 13px;
    font-weight: 600;
}

d-article aside {
    margin-bottom: 1em;
}

d-article img {
    max-width: 100%;
}

@media (min-width: 768px) {
    d-article aside {
        margin-bottom: 0;
    }
}

d-contents nav > div > a:hover,
d-contents nav > ul > li > a:hover {
    text-decoration: none;
}

.note-box {
    background-color: #f6f8fa;
    border-left: 4px solid #444444;
    padding: 1rem;
    margin: 1rem 0;  /* Keep this modest margin */
    border-radius: 6px;
    /* Add this to ensure the box only takes up needed space */
    display: inline-block;
    width: 100%;
}

.note-box-title {
    margin: 0;
    color: #444444;
    font-weight: 600;
    font-size: 1em;
}

.note-box-content {
    margin-top: 0.5rem;
    margin-bottom: 0;  /* Ensure no bottom margin */
    color: #24292f;
    font-size: 0.9em;
    line-height: 1.5em;
}

/* For dark mode support */
@media (prefers-color-scheme: dark) {
    .note-box {
        background-color: #1A1A1A;
        border-left-color: #888888;
    }
    .note-box-title {
        color: #888888;
    }
    .note-box-content {
        color: #d4d4d4;
    }
}

d-article {
    font-size: 1.0em;
}

.figure-legend {
    font-size: 0.9em;
    font-style: italic;
    color: var(--distill-gray);
    line-height: 1.5em;
}

d-code {
    font-size: 12px;
}

.large-image-background {
        width: 100vw;
        padding-top: 10px;
        padding-bottom: 10px;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
        background: white;
        height: fit-content; /* This will make it match the image height */
        display: flex;
        justify-content: center; /* This will center your image */
}

.large-image-background-transparent {
    /* width: 100vw; */
    padding-top: 10px;
    padding-bottom: 10px;
    /* margin-left: calc(-50vw + 50%); */
    margin-left:-100px;
    margin-right: -100px;
    /* margin-right: calc(-50vw + 50%); */
    /* background: white; */
    height: fit-content; /* This will make it match the image height */
    display: flex;
    justify-content: center; /* This will center your image */
}

.boxed-image {
    padding: 0.5rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

d-article li {
    margin-bottom: 0.0em;
}

d-article ul ul {
    margin-bottom: 0.0em;
}

d-article ol ol {
    margin-bottom: 0.0em;
}

d-article hr {
    grid-column: text;
}

/* Memory visualization */
#graph-all {
    min-width: 500px;
    margin-right: 10px;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}


/* Main container styles */
#controls {
    max-width: 1200px;
    /* margin: 2rem auto; */
    margin-bottom: 2rem;
    margin-left: 10px;
    padding: 0.6rem;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Grid layout */
#controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* gap: 2rem; */
}

/* Cell styles */
.cell {
    margin-bottom: 0.2rem;
}

/* Label styles */
label {
    display: block;
    /* margin-bottom: 0.5rem; */
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
}

/* Input container for range + number combination */
.input-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Range input styling */
input[type="range"] {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    appearance: none;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #2563eb;
}

/* Number input styling */
input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #374151;
}

/* Select styling */
select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    color: #374151;
    cursor: pointer;
}

/* Checkbox styling */
input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    margin-right: 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
}

/* Column specific styles */
.column-1 {
    padding-right: 0.5rem;
}

.column-2 {
    padding-left: 0.5rem;
}

/* Checkbox container */
.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

/* Memory visualization styles */
.memory-block {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.memory-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.memory-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #3b82f6;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #controls {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .column-1, .column-2 {
        padding: 0;
    }
}

/* Hover states and transitions */
input:hover, select:hover {
    border-color: #3b82f6;
}

input:focus, select:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Add smooth transitions */
input, select, button {
    transition: all 0.15s ease;
}

/* Preset dropdown special styling */
select[name="presets"] {
    background-color: #f3f4f6;
    font-weight: 500;
}

/* Table of Contents */
d-contents {
    position: relative;
    /* border-radius: 8px;
    border: 1px solid var(--distill-gray-lighter); */
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px 15px;
    background-color: var(--distill-gray-lightest);
    border-radius: 8px 8px 0 0;
    transition: background-color 0.2s ease;
}

.toc-header:hover {
    background-color: var(--distill-gray-lighter);
}

.toc-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.toc-content {
    padding: 10px 15px;
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

.toc-content.collapsed {
    max-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
}

.toc-content a {
    color: #444;
    text-decoration: none;
    transition: color 0.2s ease;
    display: block;
    padding: 4px 0;
}

.toc-content a:hover {
    color: var(--ukraine-blue);
    text-decoration: underline;
}

.toc-content a.active {
    color: var(--ukraine-blue);
    font-weight: 600;
}

.toc-content div, .toc-content li {
    margin: 5px 0;
}

.toc-content ul {
    padding-left: 20px;
    margin: 5px 0;
}

.memory-box {
    background: #dbeafe;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.gradient-memory {
    background: #ede9fe;
    padding: 1rem;
    border-radius: 8px;
}

/* Dark mode versions of memory boxes */
[data-theme="dark"] .memory-box {
    background: #1A1A1A;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .gradient-memory {
    background: #1A1A1A;
    border: 1px solid var(--border-color);
}

/* Language transition effect */
d-article h1, d-article h2, d-article h3, d-article h4, d-article p, d-title h1, .toc-title, d-article li {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

body[data-language-changing="true"] d-article h1,
body[data-language-changing="true"] d-article h2,
body[data-language-changing="true"] d-article h3,
body[data-language-changing="true"] d-article h4,
body[data-language-changing="true"] d-article p,
body[data-language-changing="true"] d-title h1,
body[data-language-changing="true"] .toc-title,
body[data-language-changing="true"] d-article li {
    opacity: 0;
    transform: translateY(10px);
}

/* Dark mode styles */
/* Apply theme variables to elements */
body {
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Aside styling */
d-article aside {
    font-size: 0.8em;
    /* font-style: italic; */
    color: var(--distill-gray);
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

[data-theme="dark"] d-article aside {
    color: var(--text-color);
}

/* Dark mode for elements */
[data-theme="dark"] d-title h1,
[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5, 
[data-theme="dark"] h6 {
    color: var(--heading-color);
}

[data-theme="dark"] p,
[data-theme="dark"] li,
[data-theme="dark"] d-article p,
[data-theme="dark"] d-article li {
    color: var(--text-color);
}

[data-theme="dark"] a {
    color: var(--link-color);
}

[data-theme="dark"] pre {
    background-color: var(--pre-background);
    color: var(--pre-color);
}

[data-theme="dark"] code {
    background-color: var(--code-background);
}

[data-theme="dark"] blockquote {
    background-color: var(--blockquote-background);
    border-left-color: var(--border-color);
}

[data-theme="dark"] table {
    border-color: var(--border-color);
}

[data-theme="dark"] th, 
[data-theme="dark"] td {
    border-color: var(--border-color);
}

[data-theme="dark"] hr {
    background-color: var(--border-color);
}

[data-theme="dark"] .citation {
    background-color: var(--pre-background);
    color: var(--pre-color);
}

[data-theme="dark"] d-appendix {
    border-top-color: var(--border-color);
    color: var(--text-color);
    background-color: var(--background-color);
}

/* Make citation numbers white in dark mode */
[data-theme="dark"] d-cite,
[data-theme="dark"] d-cite .citation-number,
[data-theme="dark"] .citation .citation-number,
[data-theme="dark"] .citation-number {
    color: #FFFFFF !important;
}

[data-theme="dark"] d-footnote-list {
    background-color: var(--background-color);
}

[data-theme="dark"] d-cite-list {
    background-color: var(--background-color);
}

[data-theme="dark"] d-contents {
    color: var(--text-color);
    background-color: var(--background-color);
    border-color: var(--border-color);
}

[data-theme="dark"] d-contents nav div div {
    color: var(--text-color);
}

[data-theme="dark"] d-contents nav a {
    color: var(--text-color);
}

[data-theme="dark"] .toc-header {
    background-color: var(--card-background);
    color: var(--text-color);
}

[data-theme="dark"] toc-title {
    color: var(--heading-color);
}

[data-theme="dark"] aside,
[data-theme="dark"] d-article aside {
    color: var(--text-color);
    border-left-color: var(--border-color);
}

[data-theme="dark"] .toc-title {
    color: var(--heading-color);
}

[data-theme="dark"] .toc-content a {
    color: var(--link-color);
}

[data-theme="dark"] .note-box {
    background-color: var(--pre-background);
    border-left-color: var(--border-color);
}

[data-theme="dark"] .note-box-title {
    color: var(--heading-color);
}

[data-theme="dark"] .note-box-content {
    color: var(--text-color);
}

/* Language toggle visibility in dark mode */
[data-theme="dark"] .language-toggle {
    background-color: #1f2937;
    color: #f0f0f0;
    border-color: #f0f0f0;
}

[data-theme="dark"] .language-toggle:hover,
[data-theme="dark"] .language-toggle.active {
    background-color: #f0f0f0;
    color: #1f2937;
}

[data-theme="dark"] #language-toggle-en {
    border-color: #58a6ff;
    color: #58a6ff;
}

[data-theme="dark"] #language-toggle-en:hover,
[data-theme="dark"] #language-toggle-en.active {
    background-color: #58a6ff;
    color: #0d1117;
}

[data-theme="dark"] #language-toggle-uk {
    border-color: var(--ukraine-yellow);
    color: var(--ukraine-yellow);
}

[data-theme="dark"] #language-toggle-uk:hover,
[data-theme="dark"] #language-toggle-uk.active {
    background-color: var(--ukraine-yellow);
    color: var(--ukraine-blue);
}

[data-theme="dark"] .large-image-background {
    background-color: var(--background-color);
}

[data-theme="dark"] .boxed-image {
    background-color: var(--card-background);
    border-color: var(--border-color);
}

[data-theme="dark"] .figure-legend {
    color: var(--text-color);
}

/* Citation hover box in dark mode - force white background with black text */
[data-theme="dark"] d-hover-box,
[data-theme="dark"] d-hover-box *:not(a) {
    background-color: #FFFFFF !important;
    color: #000000 !important;
    border-color: #e1e4e8 !important;
}

[data-theme="dark"] d-hover-box .panel {
    background-color: #FFFFFF !important;
    border-color: #e1e4e8 !important;
    color: #000000 !important;
    box-shadow: 0 0 7px rgba(0, 0, 0, 0.4) !important;
}

/* Links inside hover box */
[data-theme="dark"] d-hover-box a {
    color: #0366d6 !important;
    background-color: transparent !important;
}

/* Border colors for list items */
[data-theme="dark"] d-hover-box ul li {
    border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}

/* Controls and visualization in dark mode */
[data-theme="dark"] #controls,
[data-theme="dark"] #graph-all {
    background-color: var(--pre-background);
    border-color: var(--border-color);
}

[data-theme="dark"] label {
    color: var(--text-color);
}

[data-theme="dark"] input[type="range"] {
    background-color: var(--border-color);
}

[data-theme="dark"] input[type="range"]::-webkit-slider-thumb {
    background-color: var(--link-color);
}

[data-theme="dark"] input[type="number"],
[data-theme="dark"] select {
    background-color: var(--background-color);
    color: var(--text-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .memory-title {
    color: var(--heading-color);
}

[data-theme="dark"] .memory-value {
    color: var(--link-color);
}

/* Plotly elements in dark mode */
[data-theme="dark"] .plotly_input_container > select {
    background-color: var(--pre-background);
    color: var(--text-color);
}

[data-theme="dark"] .plotly_slider > input[type="range"] {
    background: var(--border-color);
}

[data-theme="dark"] .plotly_slider > input[type="range"]::-webkit-slider-thumb {
    background: var(--link-color);
}

/* Dark mode for citations */
[data-theme="dark"] d-cite {
    color: white;
}

[data-theme="dark"] d-citation-list .citation {
    background-color: var(--pre-background);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-theme="dark"] d-citation-list a {
    color: var(--link-color);
}
