/* Custom styles for PySNT documentation */

/* Import Font Awesome */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');

/* PyData Sphinx Theme fonts */
:root {
  /* Base system font stack */
  --pst-font-family-base-system: -apple-system, BlinkMacSystemFont, Segoe UI,
    Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
  
  /* Monospace system font stack */
  --pst-font-family-monospace-system: SFMono-Regular, Menlo, Monaco, Consolas,
    Liberation Mono, Courier New, monospace;
}

/* Apply to body text */
body {
  font-family: var(--pst-font-family-base-system) !important;
}

/* Apply to headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--pst-font-family-base-system) !important;
}

/* Apply to code blocks */
code, pre, .rst-content code, .rst-content pre {
  font-family: var(--pst-font-family-monospace-system) !important;
}

/* Hide "Show Source" and other unwanted elements */
.bd-header-article .btn-source,
.bd-header-article .btn-edit,
.bd-header-article .btn-fullscreen {
    display: none !important;
}

/* Compact API documentation styling */
/* Target Python autodoc elements directly */

/* Compact function/class signatures */
dl.py dt {
    font-size: 0.85rem !important;
    padding: 0.4rem 0.6rem !important;
    margin-bottom: 0.3rem !important;
    line-height: 1.3 !important;
}

/* Reduce spacing between API items */
dl.py {
    margin-bottom: 1rem !important;
    font-size: 0.9rem;
}

dl.py dd {
    margin-bottom: 0.5rem !important;
    margin-left: 1.5rem !important;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Compact parameter lists */
.sig-param {
    margin-right: 0.3rem !important;
}

/* Compact docstring content */
dl.py dd p {
    margin-bottom: 0.5rem !important;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Compact field lists (Parameters, Returns, etc.) */
dl.py .field-list {
    font-size: 0.85rem !important;
    margin: 0.5rem 0 !important;
}

dl.py .field-list dt {
    font-weight: 600 !important;
    margin-bottom: 0.2rem !important;
}

dl.py .field-list dd {
    margin-left: 1rem !important;
    margin-bottom: 0.3rem !important;
}

/* Compact code blocks in docstrings */
dl.py .highlight pre {
    font-size: 0.8rem !important;
    padding: 0.5rem !important;
    line-height: 1.3 !important;
    margin: 0.5rem 0 !important;
}

/* Compact section headings on API pages */
/* Target headings that are likely on API pages */
.bd-article-container h1:first-child {
    font-size: 1.8rem !important;
    margin-bottom: 1rem !important;
}

/* Submodule headings */
.bd-article-container h2 {
    font-size: 1.4rem !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.8rem !important;
}

.bd-article-container h3 {
    font-size: 1.2rem !important;
    margin-top: 1.2rem !important;
    margin-bottom: 0.6rem !important;
}

/* Compact table of contents for pages with Python docs */
.bd-toc .nav>li>a {
    font-size: 0.85rem !important;
    padding: 0.25rem 0.5rem !important;
    line-height: 1.2 !important;
}

/* Reduce overall line height for API content */
.bd-article-container {
    line-height: 1.4;
}

/* Apply compact styling to API landing page (api.md) */
/* Use JavaScript to add a class to the API landing page */
.api-landing-page .bd-article-container,
.api-landing-page .bd-content {
    line-height: 1.4;
}

/* Compact headings on API landing page */
.api-landing-page .bd-article-container h1:first-child {
    font-size: 1.8rem !important;
    margin-bottom: 1rem !important;
}

.api-landing-page .bd-article-container h2 {
    font-size: 1.4rem !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.8rem !important;
}

.api-landing-page .bd-article-container h3 {
    font-size: 1.2rem !important;
    margin-top: 1.2rem !important;
    margin-bottom: 0.6rem !important;
}

/* Compact text content on API landing page */
.api-landing-page .bd-article-container p {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.8rem !important;
}

/* Compact code blocks on API landing page */
.api-landing-page .highlight pre {
    font-size: 0.8rem !important;
    padding: 0.5rem !important;
    line-height: 1.3 !important;
    margin: 0.5rem 0 !important;
}

/* Compact tables on API landing page */
.api-landing-page table {
    font-size: 0.85rem !important;
}

.api-landing-page table th,
.api-landing-page table td {
    padding: 0.4rem 0.6rem !important;
    line-height: 1.3 !important;
}

/* Compact lists on API landing page */
.api-landing-page ul,
.api-landing-page ol {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
}

.api-landing-page li {
    margin-bottom: 0.3rem !important;
}

/* API Overview link styling */
.api-overview-link {
    margin-bottom: 1rem !important;
    padding: 0.5rem 0 !important;
    border-bottom: 1px solid #e9ecef !important;
}

.api-overview-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.4rem 0.8rem !important;
    background-color: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 0.375rem !important;
    color: #495057 !important;
    text-decoration: none !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
    width: 100% !important;
    justify-content: center !important;
}

.api-overview-btn:hover {
    background-color: #e9ecef !important;
    border-color: #adb5bd !important;
    color: #212529 !important;
    text-decoration: none !important;
}

/* Dark theme support for API Overview link */
html[data-mode="dark"] .api-overview-link {
    border-bottom-color: #404040 !important;
}

html[data-mode="dark"] .api-overview-btn {
    background-color: #2d2d2d !important;
    border-color: #404040 !important;
    color: #e0e0e0 !important;
}

html[data-mode="dark"] .api-overview-btn:hover {
    background-color: #404040 !important;
    border-color: #64b5f6 !important;
    color: #64b5f6 !important;
}

/* Hide "Section Navigation" heading in left sidebar */
.bd-links__title {
    display: none !important;
}

/* Note: Index page toctree is already hidden via :hidden: directive in RST */

/* Automatically add external link icons to all external links (except source code links) */
a[href^="http"]:not([href*="localhost"]):not([href*="127.0.0.1"]):not(.viewcode-link)::before,
a[href^="https"]:not([href*="localhost"]):not([href*="127.0.0.1"]):not(.viewcode-link)::before {
    content: "\f35d";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 0.3rem;
    font-size: 0.8em;
    opacity: 0.7;
    vertical-align: baseline;
    text-decoration: none !important;
}

/* Exclude external link icons from header/navbar/toolbar areas and source code links */
.bd-navbar a[href^="http"]::before,
.bd-navbar a[href^="https"]::before,
.bd-header a[href^="http"]::before,
.bd-header a[href^="https"]::before,
.navbar a[href^="http"]::before,
.navbar a[href^="https"]::before,
.bd-header-article a[href^="http"]::before,
.bd-header-article a[href^="https"]::before,
a.reference.external[href*="github.com/morphonets/pysnt/blob"]::before,
a.reference.external[href*="/blob/main/src/"]::before {
    display: none !important;
}

/* Style external link icons */
a[href^="http"]:not([href*="localhost"]):not([href*="127.0.0.1"]):not(.viewcode-link):hover::before,
a[href^="https"]:not([href*="localhost"]):not([href*="127.0.0.1"]):not(.viewcode-link):hover::before {
    opacity: 1;
}

/* Don't add icons to links that already have FontAwesome icons */
a:has(i.fa)::before,
a:has(i.fas)::before,
a:has(i.fab)::before {
    display: none !important;
}

/* Alternative fallback for browsers that don't support :has() */
.fa+a::before,
.fas+a::before,
.fab+a::before,
a .fa~*::before,
a .fas~*::before,
a .fab~*::before {
    display: none !important;
}

/* Dark theme support for external link icons */
html[data-mode="dark"] a[href^="http"]:not([href*="localhost"]):not([href*="127.0.0.1"]):not(.viewcode-link)::before,
html[data-mode="dark"] a[href^="https"]:not([href*="localhost"]):not([href*="127.0.0.1"]):not(.viewcode-link)::before {
    color: #b0b0b0;
    opacity: 0.6;
}

html[data-mode="dark"] a[href^="http"]:not([href*="localhost"]):not([href*="127.0.0.1"]):not(.viewcode-link):hover::before,
html[data-mode="dark"] a[href^="https"]:not([href*="localhost"]):not([href*="127.0.0.1"]):not(.viewcode-link):hover::before {
    color: #64b5f6;
    opacity: 1;
}





/* Front page hero section styling */
.hero-section {
    display: flex;
    align-items: center;
    gap: 4rem;
    margin: 3rem 0 4rem 0;
    min-height: 60vh;
    padding: 2rem 0;
}

.hero-content {
    flex: 1;
    max-width: 500px;
}

.hero-title {
    font-size: 4rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: #34495e;
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.hero-description {
    font-size: 1.1rem;
    color: #5a6c7d;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary-custom {
    background-color: #2980b9;
    color: white;
    padding: 0.75rem 2rem;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary-custom:hover {
    background-color: #21618c;
    color: white;
    text-decoration: none;
}

.btn-secondary-custom {
    background-color: transparent;
    color: #2980b9;
    padding: 0.75rem 2rem;
    text-decoration: none;
    border: 2px solid #2980b9;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary-custom:hover {
    background-color: #2980b9;
    color: white;
    text-decoration: none;
}

.hero-gallery {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 600px;
}

.gallery-card {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.gallery-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.gallery-card-large {
    grid-column: span 2;
}

.gallery-card-large img {
    height: 180px;
}

/* API reference link styling */
.api-link {
    color: #2980b9;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.api-link:hover {
    color: #21618c;
    text-decoration: none;
}

/* Let the PyData theme handle navbar layout - minimal custom styling */

@media (max-width: 768px) {
    .hero-section {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-gallery {
        grid-template-columns: repeat(2, 1fr);
        max-width: 400px;
    }

    .gallery-card-large {
        grid-column: span 2;
    }


}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-gallery {
        grid-template-columns: 1fr;
    }

    .gallery-card-large {
        grid-column: span 1;
    }
}

/* Dark theme support for custom elements only */
html[data-mode="dark"] .hero-title {
    color: #e0e0e0;
}

html[data-mode="dark"] .hero-subtitle {
    color: #b0b0b0;
}

html[data-mode="dark"] .hero-description {
    color: #a0a0a0;
}

html[data-mode="dark"] .gallery-card {
    background: #2d2d2d;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

html[data-mode="dark"] .btn-primary-custom {
    background-color: #64b5f6;
    color: #1a1a1a;
}

html[data-mode="dark"] .btn-secondary-custom {
    color: #64b5f6;
    border-color: #64b5f6;
}

html[data-mode="dark"] .btn-secondary-custom:hover {
    background-color: #64b5f6;
    color: #1a1a1a;
}

html[data-mode="dark"] .api-link {
    color: #64b5f6;
}

/* Custom styling for card images */
.sd-card-img-top {
    height: 200px;
    object-fit: cover;
    border-radius: 0.375rem 0.375rem 0 0;
}

/* Custom
 infobox styles */
.custom-info {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 1rem;
    margin: 1rem 0;
}

.custom-info .admonition-title {
    color: #1976d2;
    font-weight: 600;
}

/* Enhanced admonitions with icons */
.admonition.note .admonition-title::before {
    content: "\f05a";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 0.5rem;
}

.admonition.tip .admonition-title::before {
    content: "\f0eb";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 0.5rem;
}

.admonition.warning .admonition-title::before {
    content: "\f071";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 0.5rem;
}

/* Dark theme support for custom infoboxes */
html[data-mode="dark"] .custom-info {
    background-color: #1e3a5f;
    border-left-color: #64b5f6;
}

html[data-mode="dark"] .custom-info .admonition-title {
    color: #64b5f6;
}

/* Copy b
utton styling */
.copybtn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.7rem;
    height: 1.7rem;
    opacity: 0;
    transition: opacity 0.3s, color 0.3s, background-color 0.3s;
    border: none;
    background-color: transparent;
    color: #6c757d;
    cursor: pointer;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copybtn:hover {
    color: #2980b9;
    background-color: rgba(41, 128, 185, 0.1);
}

.copybtn.success {
    color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
}

/* Show copy button on hover */
.highlight:hover .copybtn,
div[class*="highlight-"]:hover .copybtn {
    opacity: 1;
}

/* Dark theme copy button */
html[data-mode="dark"] .copybtn {
    color: #adb5bd;
}

html[data-mode="dark"] .copybtn:hover {
    color: #64b5f6;
    background-color: rgba(100, 181, 246, 0.1);
}

html[data-mode="dark"] .copybtn.success {
    color: #20c997;
    background-color: rgba(32, 201, 151, 0.1);
}

/* Ensure code blocks have relative positioning for absolute copy button */
.highlight,
div[class*="highlight-"] {
    position: relative;
}

/* Add some padding to code blocks to make room for copy button */
.highlight pre,
div[class*="highlight-"] pre {
    padding-right: 3rem;
}

/* -- Source code links styling -------------------------------------------- */

/* Style the source code links added by sphinx.ext.linkcode */
.viewcode-link {
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    color: #6c757d !important;
    text-decoration: none !important;
    padding: 0.2rem 0.5rem !important;
    border-radius: 0.25rem !important;
    background-color: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    margin-left: 0.5rem !important;
}

.viewcode-link:hover {
    color: #2980b9 !important;
    background-color: #e3f2fd !important;
    border-color: #2980b9 !important;
    text-decoration: none !important;
}

/* Add GitHub icon to source links */
.viewcode-link::before {
    content: "\f09b";
    font-family: "Font Awesome 6 Brands";
    font-weight: 400;
    font-size: 0.75rem;
    margin-right: 0.3rem;
}

/* Dark theme support for source links */
html[data-mode="dark"] .viewcode-link {
    color: #adb5bd !important;
    background-color: #2d2d2d !important;
    border-color: #404040 !important;
}

html[data-mode="dark"] .viewcode-link:hover {
    color: #64b5f6 !important;
    background-color: #1e3a5f !important;
    border-color: #64b5f6 !important;
}

/* Position source links nicely in function/class signatures */
dt .viewcode-link {
    float: right !important;
    margin-top: 0.1rem !important;
    margin-left: 1rem !important;
}

/* Ensure source links don't interfere with signature layout */
dt {
    position: relative !important;
}

/* Style source links in the signature line */
.sig .viewcode-link {
    font-size: 0.7rem !important;
    padding: 0.15rem 0.4rem !important;
    margin-left: 0.5rem !important;
    vertical-align: middle !important;
}

/* Make source links more subtle but discoverable */
.viewcode-link {
    opacity: 0.7;
}

.viewcode-link:hover,
dt:hover .viewcode-link,
.sig:hover .viewcode-link {
    opacity: 1;
}

/* Responsive behavior for source links */
@media (max-width: 768px) {
    .viewcode-link {
        font-size: 0.7rem !important;
        padding: 0.15rem 0.3rem !important;
        margin-left: 0.3rem !important;
    }

    dt .viewcode-link {
        float: none !important;
        display: inline-block !important;
        margin-left: 0.5rem !important;
        margin-top: 0 !important;
    }
}

/* Built-in theme switcher styling */
.theme-switcher {
    margin-left: 0.5rem;
}

/* Style the built-in theme switcher button */
.theme-switcher .btn {
    color: #485A6B !important;
    border-color: transparent !important;
    background-color: transparent !important;
    opacity: 1 !important;
    transition: all 0.2s ease !important;
}

.theme-switcher .btn:hover {
    color: #2980b9 !important;
    border-color: transparent !important;
    background-color: rgba(41, 128, 185, 0.1) !important;
    opacity: 1 !important;
}

/* Dark theme support for built-in theme switcher */
html[data-mode="dark"] .theme-switcher .btn {
    color: #adb5bd !important;
    opacity: 1 !important;
}

html[data-mode="dark"] .theme-switcher .btn:hover {
    color: #64b5f6 !important;
    background-color: rgba(100, 181, 246, 0.1) !important;
    opacity: 1 !important;
}/* Do
wnload button styling for notebooks */
.article-header-buttons {
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.article-header-buttons .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.article-header-buttons .btn-outline-primary {
    color: #2980b9;
    border-color: #2980b9;
    background-color: transparent;
}

.article-header-buttons .btn-outline-primary:hover {
    color: white;
    background-color: #2980b9;
    border-color: #2980b9;
    text-decoration: none;
}

/* Dark theme support for download buttons */
html[data-mode="dark"] .article-header-buttons .btn-outline-primary {
    color: #64b5f6;
    border-color: #64b5f6;
}

html[data-mode="dark"] .article-header-buttons .btn-outline-primary:hover {
    color: #1a1a1a;
    background-color: #64b5f6;
    border-color: #64b5f6;
}

/* Responsive behavior for download buttons */
@media (max-width: 768px) {
    .article-header-buttons {
        justify-content: center;
        margin-bottom: 1.5rem;
    }
    
    .article-header-buttons .btn {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
}