.grid-item-card .card-img-top {
    height: 100%;
    object-fit: cover;
    width: 100%;
    background-color: slategrey;
}

/* Make all cards with this class use flexbox for vertical layout */
.card-with-bottom-text {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* Style the card content areas */
.card-with-bottom-text .sd-card-body {
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
}

/* Make images not grow or shrink */
.card-with-bottom-text img {
    flex-shrink: 0 !important;
    margin-bottom: 0.5rem !important;
}

/* Push the last paragraph to the bottom */
.card-with-bottom-text .sd-card-body > p:last-child {
    margin-top: auto !important;
    padding-top: 0.5rem !important;
    text-align: center !important;
}

.img-container img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.right-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e1e4e5;
}

.right-toc-title {
    font-weight: 600;
    font-size: 1.1em;
    color: #2980b9;
}

.right-toc-buttons {
    display: flex;
    align-items: center;
}

.right-toc-toggle-btn {
    background: none;
    border: none;
    color: #2980b9;
    font-size: 16px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    padding: 0;
    transition: background-color 0.2s;
}

.right-toc-toggle-btn:hover {
    background-color: rgba(41, 128, 185, 0.1);
}

.right-toc-content {
    padding: 15px 15px 15px 20px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.right-toc-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.right-toc-link {
    display: block;
    padding: 5px 0;
    text-decoration: none;
    color: #404040;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-bottom: 3px;
}

.right-toc-link:hover {
    background-color: rgba(41, 128, 185, 0.1);
    padding-left: 5px;
    color: #2980b9;
}

.right-toc-level-h1 {
    font-weight: 600;
    font-size: 1em;
}

.right-toc-level-h2 {
    padding-left: 1.2em;
    font-size: 0.95em;
}

.right-toc-level-h3 {
    padding-left: 2.4em;
    font-size: 0.9em;
    color: #606060;
}

.right-toc-subtoggle {
    background: none;
    border: none;
    color: #2980b9;
    cursor: pointer;
    font-size: 0.9em;
    margin-right: 0.3em;
    padding: 0;
}

.right-toc-sublist {
    list-style-type: none;
    margin: 0.2em 0 0.4em 0;
    padding-left: 1.2em;
}

/* Active TOC item highlighting */
.right-toc-link.active {
    background-color: rgba(41, 128, 185, 0.15);
    color: #2980b9;
    font-weight: 500;
    padding-left: 5px;
}

/* Collapsed state */
.right-toc-collapsed {
    width: auto;
    border-left-width: 0;
}

.right-toc-collapsed .right-toc-header {
    border-bottom: none;
    padding: 8px 12px;
}

/* Scrollbar styling */
.right-toc-content::-webkit-scrollbar {
    width: 5px;
}

.right-toc-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.right-toc-content::-webkit-scrollbar-thumb {
    background: #cdcdcd;
    border-radius: 10px;
}

.right-toc-content::-webkit-scrollbar-thumb:hover {
    background: #9e9e9e;
}

.toc-wrapper {
    position: relative;
    display: flex;
    max-width: 1100px; /* match .rst-content if needed */
    margin: 0 auto;
    gap: 20px;
}

.rst-content {
    flex: 1;
}
.right-toc {
    position: fixed;
    top: 90px;
    width: 280px;
    left: 1125px;
    font-size: 0.9em;
    background-color: #f8f9fa;
    z-index: 100;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-left: 3px solid #2980b9;
    transition: all 0.3s ease;
    max-height: calc(100vh - 150px);
}

.gallery-filter-controls {
    margin: 1rem 0 2rem;
    padding: 1rem 1.2rem;
    border-radius: 16px;
    background: linear-gradient(
        135deg,
        rgba(41, 128, 185, 0.08),
        rgba(41, 128, 185, 0.02)
    );
    box-shadow:
        0 10px 24px rgba(41, 128, 185, 0.18),
        0 2px 6px rgba(41, 128, 185, 0.08);
}

.gallery-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.gallery-filter-button {
    border: 1px solid #c5c5c5;
    background-color: #ffffff;
    color: #333333;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.9em;
    cursor: pointer;
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

.gallery-filter-button.is-active {
    background-color: #2980b9;
    border-color: #2980b9;
    color: #ffffff;
}

.gallery-section-hidden {
    display: none;
}

body.gallery-filter-active .sphx-glr-thumbnails:not(.gallery-unified) {
    display: none;
}

body.gallery-filter-active .gallery-section-header,
body.gallery-filter-active .gallery-section-description {
    display: none;
}

body.whats_new .wy-menu-vertical li.toctree-l1.current > ul {
    display: none;
}

body.whats_new .wy-menu-vertical li.toctree-l2,
body.whats_new .wy-menu-vertical li.toctree-l3,
body.whats_new .wy-menu-vertical li.toctree-l4 {
    display: none;
}

body.whats_new .wy-menu-vertical a[href^="#"] {
    display: none;
}

body.whats_new .wy-menu-vertical li:has(> a[href^="#"]) {
    display: none;
}

/* Hide gallery subsections from left TOC */
body.wy-body-for-nav
    .wy-menu-vertical
    .wy-menu-vertical-2
    a:is(
        [href="#layouts"],
        [href="#legends-and-colorbars"],
        [href="#geoaxes"],
        [href="#plot-types"],
        [href="#colors-and-cycles"]
    ),
body.wy-body-for-nav
    .wy-menu-vertical
    .wy-menu-vertical-2
    a:is(
        [href="#layouts"],
        [href="#legends-and-colorbars"],
        [href="#geoaxes"],
        [href="#plot-types"],
        [href="#colors-and-cycles"]
    )
    + ul,
body.wy-body-for-nav
    .wy-menu-vertical
    .wy-menu-vertical-2
    li[class*="toctree-l1"]:has(
        :is(
            a[href="#layouts"],
            a[href="#legends-and-colorbars"],
            a[href="#geoaxes"],
            a[href="#plot-types"],
            a[href="#colors-and-cycles"]
        )
    ) {
    display: none !important;
}

/* Hide the section containers themselves */
.gallery-section {
    margin: 1.5em 0;
}

:is(
        section#layouts,
        section#legends-and-colorbars,
        section#geoaxes,
        section#plot-types,
        section#colors-and-cycles
    )
    > :is(h1, p) {
    display: none;
}

/* Style for gallery section headers */
.gallery-section-header {
    font-size: 1.5em;
    font-weight: bold;
    display: block;
    margin: 1.5em 0 0.5em 0;
    border-bottom: 2px solid #2980b9;
    padding-bottom: 0.3em;
    color: #2980b9;
}

.gallery-section-description {
    margin: 0 0 1em 0;
    color: #555;
}

/* Responsive adjustments */
@media screen and (max-width: 1200px) {
    .right-toc {
        width: 230px;
    }
}

@media screen and (max-width: 992px) {
    .right-toc {
        display: none; /* Hide on smaller screens */
    }
}

.output_area.docutils.container {
    text-align: center; /* Centers inline or inline-block children horizontally */
}

/* Optional: Ensure image respects container boundaries */
.output_area.docutils.container img {
    width: 100%;
    height: auto;
    display: block;
}
