/*
For licensing see accompanying LICENSE file.
Copyright (C) 2026 Apple Inc. All Rights Reserved.
*/

/* Custom CSS for Foundation Models Python SDK Documentation */
/* Matching CoreML Tools PyData Sphinx Theme styling */

/* Apple-style font stack */
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 2rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Code font */
code, pre, .highlight, kbd, samp {
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
    font-size: 0.9em;
}

/* Inline code */
code {
    background-color: rgba(175, 184, 193, 0.2);
    padding: 0.1em 0.4em;
    border-radius: 3px;
    color: inherit;
}

/* Code blocks */
.highlight {
    border-radius: 6px;
    margin: 1em 0;
}

.highlight pre {
    padding: 1em;
    overflow-x: auto;
    border-radius: 6px;
}

/* Links */
a {
    color: #007AFF;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #0051D5;
    text-decoration: underline;
}

/* Sidebar links */
.bd-sidebar a {
    color: inherit;
}

.bd-sidebar a:hover {
    color: #007AFF;
}

/* Active sidebar item */
.bd-sidebar .current > a {
    color: #007AFF;
    font-weight: 600;
}

/* Admonitions */
.admonition {
    border-radius: 6px;
    padding: 1em;
    margin: 1em 0;
    border-left: 4px solid;
}

.admonition.note {
    border-left-color: #007AFF;
    background-color: rgba(0, 122, 255, 0.1);
}

.admonition.warning {
    border-left-color: #FF9500;
    background-color: rgba(255, 149, 0, 0.1);
}

.admonition.tip {
    border-left-color: #34C759;
    background-color: rgba(52, 199, 89, 0.1);
}

.admonition-title {
    font-weight: 600;
    margin-bottom: 0.5em;
}

/* Tables */
table.docutils {
    border-radius: 6px;
    overflow: hidden;
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

table.docutils th {
    background-color: rgba(0, 0, 0, 0.05);
    font-weight: 600;
    padding: 0.75em;
    text-align: left;
}

table.docutils td {
    padding: 0.75em;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Search box */
.bd-search {
    border-radius: 6px;
}

/* Buttons */
.btn, button {
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-primary {
    background-color: #007AFF;
    border-color: #007AFF;
}

.btn-primary:hover {
    background-color: #0051D5;
    border-color: #0051D5;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

/* Navigation bar */
.navbar {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Content area */
.bd-content {
    padding: 2rem;
}

dt.sig {
    background-color: transparent;
    padding: 0.5em 0;
    font-weight: 600;
}

dd {
    margin-left: 2em;
    margin-top: 0.5em;
}

/* Parameter lists */
.field-list {
    margin: 1em 0;
}

.field-list dt {
    font-weight: 600;
    margin-top: 0.5em;
}

/* Version info */
.versionmodified {
    font-style: italic;
    color: #666;
}

/* Footnotes */
.footnote {
    font-size: 0.9em;
    color: #666;
}

/* Dark mode adjustments */
html[data-theme="dark"] code {
    background-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] table.docutils th {
    background-color: rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] table.docutils td {
    border-top-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] a {
    color: #0A84FF;
}

html[data-theme="dark"] a:hover {
    color: #409CFF;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .bd-content {
        padding: 1rem;
    }
}

/* Copy button styling */
.copybtn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.highlight:hover .copybtn {
    opacity: 1;
}

/* Improve spacing */
.bd-article {
    max-width: 900px;
}

/* Logo area */
.navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Hide the title text in sidebar, show only logo */
.sidebar-logo-container .sidebar-logo {
    max-width: 12em;
    height: auto;
}

/* Hide title text in sidebar */
.sidebar-logo-container p.sidebar-title {
    display: none;
}

/* Alternative selectors for different theme versions */
.bd-sidebar .navbar-brand-box p,
.bd-sidebar .sidebar-brand-text {
    display: none;
}

/* TOC styling */
.bd-toc {
    font-size: 0.9rem;
}

.bd-toc .nav > li > a {
    padding: 0.25rem 0.5rem;
}

.bd-toc .nav > li > a.active {
    color: #007AFF;
    font-weight: 600;
    border-left: 2px solid #007AFF;
}

/* Remove monospace font from TOC items */
.bd-toc code,
.bd-toc .reference code,
.toc-entry code,
nav.bd-links code {
    background-color: transparent;
    padding: 2px 4px;
    font-weight: 500;
    font-size: smaller;
    color: inherit;
}

/* Hide base classes that start with underscore (like _ManagedObject) */
dd > p:first-child {
    display: block;
}

/* Target the "Bases:" paragraph specifically and hide if it contains _ManagedObject */
dd > p:first-child:has(code:only-child) {
    display: none !important;
}

/* Alternative approach: hide any paragraph in dd that starts with "Bases:" and contains underscore classes */
dd > p:first-child:contains("Bases:") {
    display: none !important;
}
