/* Custom CSS to match Jekyll Cayman theme for API documentation */

/* Import Google Fonts to match main site */
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,700&display=swap');

/* ========================================
   Fix inline math vertical alignment
   ======================================== */

/* Target inline math spans created by MyST */
span.math.notranslate.nohighlight {
    vertical-align: baseline !important;
    position: relative !important;
    top: 0 !important;
}

/* Fix MathJax container alignment - MORE SPECIFIC */
/* Inline math containers */
mjx-container[jax="CHTML"][display="false"],
mjx-container[jax="CHTML"]:not([display="true"]),
mjx-container.MathJax {
    display: inline-block !important;
    vertical-align: middle !important;
    position: relative !important;
    top: -0.1em !important; /* Slightly lower to align with text baseline */
    margin: 0 0.15em !important;
}

/* Even more specific for inline math */
p mjx-container[display="false"],
li mjx-container[display="false"],
td mjx-container[display="false"],
.rst-content mjx-container[display="false"] {
    vertical-align: middle !important;
    position: relative !important;
    top: -0.1em !important;
}

/* Display math containers (keep centered) */
mjx-container[jax="CHTML"][display="true"],
div.math mjx-container {
    display: block !important;
    margin: 1em auto !important;
    text-align: center !important;
    position: static !important;
    top: auto !important;
}

/* Fix for math spans inside paragraphs */
p > span.math,
li > span.math,
td > span.math {
    vertical-align: middle !important;
    position: relative !important;
    top: 0 !important;
}

/* Fix MathJax output specifically */
.MathJax_Display {
    margin: 1em 0 !important;
}

.MathJax {
    vertical-align: middle !important;
    display: inline-block !important;
    position: relative !important;
    top: -0.1em !important;
}

/* Ensure proper line height for paragraphs with math */
p:has(span.math),
p:has(mjx-container) {
    line-height: 1.6;
}

/* Override ReadTheDocs theme colors to match Cayman */
:root {
    --cayman-primary: #157878;
    --cayman-secondary: #159957;
    --cayman-text: #606c71;
    --cayman-bg: #fff;
    --cayman-code-bg: #f3f6fa;
    --cayman-border: #dce6f0;
}

/* Body and main content */
body {
    font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: var(--cayman-text) !important;
}

/* Headers styling to match Cayman */
h1, h2, h3, h4, h5, h6 {
    font-weight: normal !important;
    color: var(--cayman-secondary) !important;
}

h1 {
    font-size: 2.25rem !important;
}

h2 {
    font-size: 1.75rem !important;
}

h3 {
    font-size: 1.5rem !important;
}

/* Links */
a {
    color: #1e6bb8 !important;
    text-decoration: none !important;
}

a:hover {
    text-decoration: underline !important;
}

/* Navigation sidebar - light theme for better readability */
.wy-nav-side {
    background: #f8f9fa !important;  /* Light gray background */
    color: #2c3e50 !important;  /* Dark text */
}

.wy-side-nav-search {
    background: linear-gradient(120deg, var(--cayman-secondary) 0%, var(--cayman-primary) 100%) !important;
    padding: 1rem !important;
}

.wy-side-nav-search > a {
    color: #fff !important;
    font-size: 1.5rem !important;
    font-weight: bold !important;
}

.wy-side-nav-search input[type="text"] {
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

.wy-side-nav-search input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Sidebar menu items - IMPROVED VISIBILITY */
.wy-menu-vertical a {
    color: #2c3e50 !important;  /* Dark blue-gray for better readability on light background */
    font-size: 14px !important;
    font-weight: 400 !important;
}

.wy-menu-vertical a:hover {
    background: rgba(21, 153, 87, 0.1) !important;  /* Light green tint on hover */
    color: #157878 !important;  /* Cayman primary color on hover */
}

.wy-menu-vertical li.current > a {
    background: rgba(21, 153, 87, 0.15) !important;  /* Light green background for current */
    border-left: 3px solid var(--cayman-primary) !important;
    color: #157878 !important;  /* Cayman primary for current item */
    font-weight: 600 !important;
}

/* Nested menu items - better hierarchy visibility */
.wy-menu-vertical li.toctree-l2 a {
    color: #516575 !important;  /* Slightly lighter than parent but still readable */
    padding-left: 2.5em !important;  /* Better indentation */
    font-weight: 400 !important;
}

.wy-menu-vertical li.toctree-l3 a {
    color: #627385 !important;  /* Progressively lighter but still readable */
    padding-left: 3.5em !important;
    font-weight: 400 !important;
}

.wy-menu-vertical li.toctree-l4 a {
    color: #738495 !important;  /* Lightest nested level but still readable */
    padding-left: 4.5em !important;
    font-weight: 400 !important;
}

/* Active/current nested items */
.wy-menu-vertical li.current li.toctree-l2.current > a {
    color: #157878 !important;  /* Primary color when current */
    font-weight: 500 !important;
}

.wy-menu-vertical li.current li.toctree-l3.current > a {
    color: #157878 !important;  /* Primary color when current */
    font-weight: 500 !important;
}

/* Section headers in sidebar - MORE VISIBLE */
.wy-menu-vertical p.caption {
    color: #157878 !important;  /* Use primary color for section headers */
    font-size: 13px !important;  /* Slightly larger */
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;  /* Less spacing for readability */
    margin: 25px 14px 12px !important;
    font-weight: 700 !important;  /* Bolder for emphasis */
    border-bottom: 1px solid #d0d4d8 !important;  /* Visible separator */
    padding-bottom: 5px !important;
}

/* Main content area */
.wy-nav-content-wrap {
    background: var(--cayman-bg) !important;
}

.wy-nav-content {
    max-width: 1200px !important;
}

/* Add header gradient similar to main site */
.rst-content > div:first-child {
    position: relative;
    padding: 2rem 2rem;
    color: #fff;
    text-align: center;
    background-color: var(--cayman-secondary);
    background-image: linear-gradient(120deg, var(--cayman-secondary), var(--cayman-primary));
    margin: -2rem -2rem 2rem -2rem;
}

/* Code blocks styling */
.highlight {
    background: var(--cayman-code-bg) !important;
    border: 1px solid var(--cayman-border) !important;
    border-radius: 0.3rem !important;
}

.highlight pre {
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 1rem !important;
}

code, .rst-content tt, .rst-content code {
    background: var(--cayman-code-bg) !important;
    border: 1px solid var(--cayman-border) !important;
    border-radius: 0.3rem !important;
    padding: 2px 5px !important;
    font-size: 85% !important;
    color: #567482 !important;
}

/* Tables */
.wy-table-responsive table td, .wy-table-responsive table th {
    white-space: normal !important;
}

table.docutils {
    border: 1px solid var(--cayman-border) !important;
}

table.docutils thead {
    background: var(--cayman-code-bg) !important;
}

/* Admonitions (notes, warnings, etc.) */
.admonition {
    border-radius: 0.3rem !important;
    border-left: 4px solid var(--cayman-primary) !important;
}

.admonition.note {
    background: #e7f3ff !important;
    border-left-color: #2196F3 !important;
}

.admonition.warning {
    background: #fff3e0 !important;
    border-left-color: #ff9800 !important;
}

/* Buttons */
.btn {
    display: inline-block;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.7);
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    border-style: solid;
    border-width: 1px;
    border-radius: 0.3rem;
    transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

.btn:hover {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Footer */
footer {
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: solid 1px var(--cayman-border);
    font-size: 0.875rem;
    color: var(--cayman-text);
}

/* ========================================
   Mobile Responsive Fixes
   ======================================== */

/* Mobile hamburger menu toggle state - COMPREHENSIVE FIX */
@media screen and (max-width: 768px) {
    /* Hide sidebar completely off-screen */
    .wy-nav-side {
        position: fixed !important;
        left: -300px !important;
        width: 85% !important;
        max-width: 300px !important;
        top: 0 !important;  /* Start from top of viewport */
        bottom: 0 !important;
        height: 100% !important;
        overflow-y: auto !important;  /* Allow sidebar to scroll */
        overflow-x: hidden !important;
        z-index: 2000 !important;  /* Above everything */
        padding-top: 0 !important;  /* Remove top padding */
    }

    /* When menu is open */
    .wy-nav-side.shift,
    nav.wy-nav-side.shift {
        width: 85% !important;
        left: 0 !important;
    }

    /* Hide the search area header when menu is open to avoid overlap */
    .wy-nav-side .wy-side-nav-search {
        margin-top: 0 !important;
        padding-top: 3rem !important;  /* Add space for hamburger menu */
    }

    /* CRITICAL: Remove ALL left margins and make content full width */
    .wy-nav-content-wrap {
        margin-left: 0 !important;
        padding: 0 !important;
        left: 0 !important;
        position: relative !important;
    }

    /* Ensure the main content wrapper uses full width */
    .wy-nav-content {
        max-width: none !important;
        width: 100% !important;
        padding: 1rem !important;
        margin: 0 !important;
    }

    /* When sidebar is showing, DON'T shift content (overlay instead) */
    .wy-nav-content-wrap.shift {
        left: 0 !important;  /* Don't shift content, let sidebar overlay */
        position: relative !important;
    }

    /* Top navigation bar with hamburger menu - HIGHER Z-INDEX */
    .wy-nav-top {
        display: block !important;
        position: fixed !important;
        width: 100% !important;
        z-index: 2001 !important;  /* Above sidebar */
        background: linear-gradient(120deg, var(--cayman-secondary), var(--cayman-primary)) !important;
        top: 0 !important;
        left: 0 !important;
        height: auto !important;
    }

    /* Main grid container */
    .wy-grid-for-nav {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Body wrapper */
    .wy-body-for-nav {
        background: white !important;
    }

    /* Add top padding to account for fixed header */
    section.wy-nav-content-wrap {
        margin-top: 2.4rem !important;
    }

    /* Override any desktop-specific margins */
    .rst-content {
        max-width: none !important;
        width: 100% !important;
    }

    /* Ensure hamburger icon is visible and clickable */
    .wy-nav-top i {
        display: inline-block !important;
        cursor: pointer !important;
    }

    /* Dark overlay behind sidebar when open */
    body.shift::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1999;  /* Below sidebar, above content */
    }
}

/* API documentation specific styles */
.class, .function, .method {
    margin-bottom: 2rem !important;
    padding-bottom: 1rem !important;
    border-bottom: 1px solid var(--cayman-border) !important;
}

.sig-name {
    color: var(--cayman-primary) !important;
    font-weight: bold !important;
}

.sig-param {
    color: #567482 !important;
}

/* Version selector */
.rst-versions {
    background: #2c3e50 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.rst-versions .rst-current-version {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--cayman-primary) !important;
}

/* Search results */
#search-results h2 {
    color: var(--cayman-primary) !important;
}

/* Breadcrumbs */
.wy-breadcrumbs {
    font-size: 0.875rem !important;
    color: rgba(255, 255, 255, 0.7) !important;  /* Light color for separators on green background */
}

.wy-breadcrumbs a {
    color: rgba(255, 255, 255, 0.9) !important;  /* White with slight transparency for links */
    font-weight: 500 !important;  /* Slightly bolder for better readability */
}

.wy-breadcrumbs a:hover {
    color: #fff !important;  /* Pure white on hover */
    text-decoration: underline !important;
}

/* Module index */
.modindex-jumpbox {
    border: 1px solid var(--cayman-border) !important;
    background: var(--cayman-code-bg) !important;
}

/* Python signatures */
.py {
    border-left: 3px solid var(--cayman-primary) !important;
    padding-left: 1rem !important;
    margin: 1rem 0 !important;
}

/* Make the theme more cohesive with main site - DESKTOP ONLY */
@media screen and (min-width: 769px) {
    .wy-nav-content-wrap {
        margin-left: 300px !important;
    }
}

.wy-nav-top {
    background: linear-gradient(120deg, var(--cayman-secondary), var(--cayman-primary)) !important;
}

/* Ensure proper spacing */
.rst-content .section {
    margin-bottom: 2rem !important;
}

.rst-content p {
    margin-bottom: 1rem !important;
    line-height: 1.6 !important;
}

/* Style definition lists */
dl.field-list > dt {
    font-weight: bold !important;
    color: var(--cayman-primary) !important;
}

/* Page title header - similar to main site */
.rst-content h1:first-of-type {
    color: var(--cayman-primary) !important;
    font-size: 2.5rem !important;
    margin-bottom: 1.5rem !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 1px solid var(--cayman-border) !important;
}

/* Sidebar expand/collapse indicators - MORE VISIBLE */
.wy-menu-vertical li.toctree-l1 > a:before,
.wy-menu-vertical li.toctree-l2 > a:before,
.wy-menu-vertical li.toctree-l3 > a:before {
    font-family: "FontAwesome";
    display: inline-block;
    margin-right: 0.5em;
    color: #ecf0f1 !important;
    opacity: 0.8 !important;
}

/* Closed folder icon */
.wy-menu-vertical li.toctree-l1.has-children:not(.current) > a:before,
.wy-menu-vertical li.toctree-l2.has-children:not(.current) > a:before {
    content: "\f0da" !important;  /* Right arrow */
}

/* Open folder icon */
.wy-menu-vertical li.toctree-l1.current.has-children > a:before,
.wy-menu-vertical li.toctree-l2.current.has-children > a:before {
    content: "\f0d7" !important;  /* Down arrow */
}

/* Hide duplicate toctree entries if they exist */
.wy-menu-vertical li.toctree-l1 ul li.toctree-l1 {
    display: none !important;  /* Hide nested duplicate entries */
}

/* Better visual separation between sections */
.wy-menu-vertical > ul > li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.wy-menu-vertical > ul > li:last-child {
    border-bottom: none !important;
}

/* Improve visibility of hidden items */
.wy-menu-vertical li ul {
    margin-left: 0 !important;
}

/* Make current page more prominent */
.wy-menu-vertical li.current > a {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%) !important;
}

/* Better hover effects for all levels */
.wy-menu-vertical li a:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transition: background 0.2s ease !important;
}

/* MathJax equation styling */
.math, .MathJax_Display, .MathJax {
    font-size: 1.1em !important;
    margin: 1em 0 !important;
}

/* Inline math */
.math.inline, span.math {
    font-size: 1em !important;
    margin: 0 0.2em !important;
    overflow: visible !important;  /* Prevent scrollbars on inline math containers */
    display: inline-block !important;
    max-width: none !important;
}

/* Display math blocks */
div.math {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    padding: 1rem;
    background: var(--cayman-code-bg);
    border-radius: 0.3rem;
    margin: 1.5rem 0;
}

/* Equation numbering */
.eqno {
    float: right;
    color: var(--cayman-text);
    font-size: 0.9em;
}

/* MathJax container adjustments */
.MathJax_Display {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-width: 100% !important;
}

/* Fix inline math - NO SCROLLBARS for inline equations */
mjx-container[display="false"],
mjx-container[jax="CHTML"][display="false"],
span.math mjx-container,
p mjx-container[display="false"],
li mjx-container[display="false"],
td mjx-container[display="false"] {
    display: inline-block !important;
    overflow: visible !important;  /* No scrollbars for inline math */
    max-width: none !important;  /* Allow inline math to take the space it needs */
    vertical-align: middle !important;
    margin: 0 0.2em !important;
}

/* Block/display math can have scrollbars if needed */
mjx-container[display="true"],
mjx-container[display="block"],
div.math mjx-container {
    display: block !important;
    margin: 1em 0 !important;
    text-align: center !important;
    overflow-x: auto !important;  /* Keep scrollbars for large display equations */
    overflow-y: hidden !important;
    max-width: 100% !important;
}

/* Fix for mobile responsiveness */
@media screen and (max-width: 768px) {
    div.math {
        font-size: 0.9em !important;
        padding: 0.5rem;
    }

    .MathJax_Display {
        font-size: 0.9em !important;
    }
}

/* ========================================
   Additional Mobile & Tablet Responsive Improvements
   ======================================== */

/* Small mobile devices (portrait) */
@media screen and (max-width: 480px) {
    /* Smaller font sizes for mobile */
    body {
        font-size: 14px !important;
    }

    h1 {
        font-size: 1.75rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    /* Reduce padding on mobile */
    .wy-nav-content {
        padding: 0.5rem !important;
    }

    /* Make code blocks scrollable horizontally */
    .highlight pre {
        font-size: 12px !important;
        padding: 0.5rem !important;
    }

    /* Adjust table font size */
    table {
        font-size: 12px !important;
    }

    /* Reduce margins */
    .rst-content .section {
        margin-bottom: 1rem !important;
    }
}

/* Tablets and small laptops */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    /* Adjust sidebar width for tablets */
    .wy-nav-side {
        width: 250px !important;
    }

    .wy-nav-content-wrap {
        margin-left: 250px !important;
    }

    /* When sidebar is toggled on tablets */
    .wy-nav-content-wrap.shift {
        left: 250px !important;
    }

    /* Slightly smaller fonts for tablets */
    body {
        font-size: 15px !important;
    }
}

/* Landscape orientation on mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    /* Reduce vertical spacing in landscape */
    .wy-nav-top {
        padding: 0.5rem 1rem !important;
    }

    .wy-grid-for-nav {
        padding-top: 2rem !important;
    }

    /* Smaller headers in landscape */
    h1 {
        font-size: 1.8rem !important;
        margin-bottom: 0.5rem !important;
    }

    h2 {
        font-size: 1.4rem !important;
        margin-bottom: 0.5rem !important;
    }
}

/* Fix for ReadTheDocs theme mobile navigation behavior - AGGRESSIVE OVERRIDE */
@media screen and (max-width: 768px) {
    /* Override RTD theme's default behavior */
    .wy-body-for-nav {
        background: var(--cayman-bg) !important;
    }

    /* Ensure navigation toggle works properly */
    .wy-nav-side {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        z-index: 1000 !important;
        transition: left 0.3s ease-in-out !important;
    }

    /* MOST IMPORTANT FIX - Override all possible margin/padding sources */
    .wy-nav-content-wrap,
    section.wy-nav-content-wrap,
    .wy-nav-content-wrap.shift,
    section.wy-nav-content-wrap.shift {
        margin-left: 0 !important;
        padding-left: 0 !important;
        left: 0 !important;
        transform: none !important;
        transition: none !important;
        position: static !important;
    }

    /* Additional override for the content area itself */
    .wy-nav-content,
    .rst-content {
        margin-left: 0 !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Remove any box shadows on mobile */
    .wy-nav-side {
        box-shadow: 2px 0 10px rgba(0,0,0,0.1) !important;
    }

    /* Dark overlay when menu is open */
    .wy-nav-side.shift ~ .wy-nav-content-wrap::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 999;
    }
}

/* ========================================
   Additional Mobile Navigation Fixes
   ======================================== */
@media screen and (max-width: 768px) {
    /* Make the sidebar menu scrollable independently */
    .wy-nav-side .wy-menu-vertical {
        max-height: calc(100vh - 4rem) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;  /* iOS smooth scrolling */
        padding-bottom: 2rem !important;
    }

    /* Prevent body from scrolling when menu is open */
    body.shift {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }

    /* Fix z-index stacking to ensure hamburger menu stays on top */
    .wy-nav-top {
        z-index: 10000 !important;  /* Highest z-index */
    }

    .wy-nav-side {
        z-index: 9999 !important;  /* Below hamburger menu */
    }

    /* Dark overlay when menu is open - updated z-index */
    body.shift::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;  /* Below sidebar */
    }

    /* Ensure the sidebar header doesn't overlap with hamburger */
    .wy-side-nav-search {
        margin-top: 3rem !important;  /* Space for hamburger menu */
    }

    /* Better visual separation */
    .wy-nav-side.shift {
        border-right: 1px solid rgba(0, 0, 0, 0.1);
    }

    /* Clickable area for closing menu when clicking overlay */
    body.shift::after {
        cursor: pointer;
    }
}

/* ========================================
   Quick Links Section - Override theme styles
   ======================================== */

/* Target Quick Links section specifically */
.rst-content .quicklinks-section h3,
.rst-content div[style*="border"] h3 {
    color: inherit !important;  /* Use the inline style color */
}

.rst-content .quicklinks-section a,
.rst-content div[style*="border"] a {
    color: inherit !important;  /* Use the inline style color */
    text-decoration: none !important;
}

.rst-content .quicklinks-section a:hover,
.rst-content div[style*="border"] a:hover {
    text-decoration: underline !important;
    opacity: 0.8;
}

/* More specific selectors for the Quick Links boxes */
.rst-content div[style*="border: 2px solid"] h3[style*="color"] {
    color: inherit !important;
}

.rst-content div[style*="border: 2px solid"] a[style*="color"] {
    color: inherit !important;
    text-decoration: none !important;
}

/* Even more specific - target by the actual color values */
.rst-content h3[style*="#E91E63"] { color: #E91E63 !important; }
.rst-content h3[style*="#4CAF50"] { color: #4CAF50 !important; }
.rst-content h3[style*="#FF9800"] { color: #FF9800 !important; }
.rst-content h3[style*="#2196F3"] { color: #2196F3 !important; }
.rst-content h3[style*="#9C27B0"] { color: #9C27B0 !important; }
.rst-content h3[style*="#795548"] { color: #795548 !important; }

.rst-content a[style*="#E91E63"] { color: #E91E63 !important; }
.rst-content a[style*="#4CAF50"] { color: #4CAF50 !important; }
.rst-content a[style*="#FF9800"] { color: #FF9800 !important; }
.rst-content a[style*="#2196F3"] { color: #2196F3 !important; }
.rst-content a[style*="#9C27B0"] { color: #9C27B0 !important; }
.rst-content a[style*="#795548"] { color: #795548 !important; }

/* ========================================
   Print Styles - Full page width, no sidebar
   ======================================== */
@media print {
    /* Hide navigation sidebar completely */
    .wy-nav-side,
    .wy-side-nav-search,
    .wy-menu-vertical,
    .rst-versions,
    .wy-nav-top {
        display: none !important;
    }

    /* Make content use full page width */
    .wy-nav-content-wrap {
        margin-left: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    .wy-nav-content {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Remove any left margins/paddings from main content */
    .rst-content {
        margin: 0 !important;
        padding: 20px !important;
        max-width: 100% !important;
    }

    /* Hide other non-essential elements */
    .wy-breadcrumbs,
    .wy-breadcrumbs-extra,
    .rst-footer-buttons,
    footer,
    .copybutton,
    .headerlink,
    [role="navigation"] {
        display: none !important;
    }

    /* Optimize text and spacing for print */
    body {
        font-size: 11pt !important;
        line-height: 1.5 !important;
        color: black !important;
        background: white !important;
    }

    /* Ensure headers are visible */
    h1, h2, h3, h4, h5, h6 {
        color: black !important;
        page-break-after: avoid !important;
        margin-top: 1em !important;
    }

    /* Links should be black in print */
    a {
        color: black !important;
        text-decoration: none !important;
    }

    /* Code blocks should have a light background */
    .highlight, code, pre {
        background: #f5f5f5 !important;
        border: 1px solid #ddd !important;
    }

    /* Avoid page breaks inside important elements */
    pre, blockquote, table, figure {
        page-break-inside: avoid !important;
    }

    /* Tables should be readable */
    table {
        border-collapse: collapse !important;
        width: 100% !important;
    }

    table td, table th {
        border: 1px solid #ddd !important;
        padding: 8px !important;
    }

    /* Math equations should be black */
    .math, mjx-container {
        color: black !important;
    }

    /* Remove any gradients or backgrounds */
    .rst-content > div:first-child {
        background: none !important;
        background-image: none !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Admonitions should be simple */
    .admonition {
        border: 1px solid #ddd !important;
        background: #f9f9f9 !important;
        page-break-inside: avoid !important;
    }
}
