/* Custom CSS for Surfaces documentation */
/* Blue-purple theme (matching Poincare disk logo) */

/* Cormorant Garamond for hero title */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300&display=swap');

/* ============================================
   PyData Theme Color Overrides (blue-purple)
   ============================================ */
html[data-theme="light"] {
    --pst-color-primary: #4a5a9f;
    --pst-color-primary-bg: #f2f3f8;
    --pst-color-secondary: #6a7ab8;
    --pst-color-accent: #9093bf;
    --pst-color-info: #4a5a9f;
    --pst-color-link: #4a5a9f;
    --pst-color-link-hover: #3a4580;
    --pst-color-target: rgba(74, 90, 159, 0.2);
}

html[data-theme="dark"] {
    --pst-color-primary: #9093bf;
    --pst-color-primary-bg: #1c1e2a;
    --pst-color-secondary: #a8acd0;
    --pst-color-accent: #b8bcd8;
    --pst-color-info: #9093bf;
    --pst-color-link: #a8acd0;
    --pst-color-link-hover: #b8bcd8;
    --pst-color-target: rgba(144, 147, 191, 0.2);
    --separator-color: #2f3350;
}

/* ============================================
   CSS Variables for consistent theming
   ============================================ */
:root {
    /* Blue-purple colors (matching Poincare disk logo) */
    --surfaces-primary: #4a5a9f;
    --surfaces-secondary: #6a7ab8;
    --surfaces-accent: #9093bf;
    --surfaces-dark: #3a4580;
    --surfaces-light: #f8f8fb;
    --surfaces-gradient: linear-gradient(135deg, #42238a 0%, #2b7cc0 100%);
    --surfaces-gradient-dark: linear-gradient(135deg, #341c6e 0%, #1f5f96 100%);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* Neutral separator color */
    --separator-color: #dee2e6;

    /* Function category colors */
    --math-color: #2b6eb0;
    --math-color-light: #5a9ad0;
    --ml-color: #542ba4;
    --ml-color-light: #7a5abe;
}

/* ============================================
   Top Navbar Styling
   ============================================ */
.bd-header.navbar {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: auto !important;
}

.bd-header .navbar-header-items {
    flex-wrap: nowrap !important;
}

.bd-header .navbar-header-items__center {
    flex-wrap: nowrap !important;
}

.bd-header .navbar-header-items__start {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.navbar-brand {
    padding: 0.25rem 0 !important;
    margin-right: 0.75rem !important;
    flex-shrink: 0 !important;
}

.navbar-brand .logo__image {
    height: 36px !important;
    width: auto !important;
    max-height: 36px !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.navbar-brand p,
.navbar-brand .logo__title {
    display: none !important;
}

.bd-navbar .navbar-nav {
    gap: 0.1rem;
    flex-wrap: nowrap !important;
}

.bd-navbar .nav-link {
    padding: 0.4rem 0.5rem !important;
    white-space: nowrap;
    font-size: 0.85rem;
}

.bd-navbar .dropdown-toggle {
    padding: 0.4rem 0.5rem !important;
    font-size: 0.85rem;
}

/* ============================================
   Right Sidebar - On This Page spacing
   ============================================ */
.bd-toc-nav.page-toc {
    margin-top: 1.25rem;
}

/* Remove vertical line from right sidebar */
.bd-sidebar-secondary .toc-entry,
.bd-sidebar-secondary nav.page-toc {
    border-left: none;
}

/* Right sidebar slide-in animation on page load */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.bd-sidebar-secondary {
    min-width: 200px;
    animation: slideInFromLeft 0.3s ease forwards;
}

.pst-page-navigation-heading {
    margin-bottom: 0.5rem;
}

/* ============================================
   Hero Section
   ============================================ */
.hero-section {
    background: var(--surfaces-gradient);
    padding: 3rem 2rem;
    margin: -1rem -1rem 2rem -1rem;
    border-radius: 0 0 20px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 3.5rem;
    font-weight: 300;
    color: #ffffff;
    margin: 0 0 3.5rem 0;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.hero-tagline {
    font-size: 1.25rem;
    font-weight: 400;
    color: rgba(210, 215, 225, 0.95);
    margin: 0 0 0.5rem 0;
    letter-spacing: 0.05em;
    font-style: italic;
}

/* ============================================
   Back to Top Link (in sidebar)
   ============================================ */
.back-to-top-sidebar {
    display: none;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--pst-color-border);
}

.back-to-top-sidebar.visible {
    display: block;
}

.back-to-top-sidebar a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--surfaces-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-to-top-sidebar a:hover {
    color: var(--surfaces-dark);
}

html[data-theme="dark"] .back-to-top-sidebar a {
    color: var(--surfaces-secondary);
}

html[data-theme="dark"] .back-to-top-sidebar a:hover {
    color: var(--surfaces-accent);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* ============================================
   Stats Strip (below hero)
   ============================================ */
.stats-strip {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0;
    margin: 0 0 2rem 0;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--pst-color-border);
    background: var(--pst-color-surface);
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    text-align: center;
    position: relative;
    transition: background 0.2s ease;
}

.stat-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: var(--pst-color-border);
}

.stat-item:hover {
    background: var(--pst-color-background);
}

a.stat-item {
    text-decoration: none;
    color: inherit;
}

/* Front content (number + label) */
.stat-front {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.stat-item:hover .stat-front {
    opacity: 0;
    transform: translateY(-8px);
}

/* Hover content (description) */
.stat-hover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.stat-item:hover .stat-hover {
    opacity: 1;
    transform: translateY(0);
}

.stat-hover-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--surfaces-primary);
    line-height: 1.4;
    text-align: center;
}

html[data-theme="dark"] .stat-hover-text {
    color: var(--surfaces-secondary);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--surfaces-primary);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

html[data-theme="dark"] .stat-value {
    color: var(--surfaces-secondary);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--pst-color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

/* Responsive: stack on mobile */
@media (max-width: 640px) {
    .stats-strip {
        flex-wrap: wrap;
    }

    .stat-item {
        flex: 1 1 50%;
        padding: 1rem 0.75rem;
        min-height: 75px;
    }

    .stat-item:not(:last-child)::after {
        display: none;
    }

    .stat-item:nth-child(1),
    .stat-item:nth-child(2) {
        border-bottom: 1px solid var(--pst-color-border);
    }

    .stat-item:nth-child(odd) {
        border-right: 1px solid var(--pst-color-border);
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-hover-text {
        font-size: 0.75rem;
    }
}

/* ============================================
   Badge Banner
   ============================================ */
.badge-banner {
    text-align: center;
    padding: 1rem 1rem 1.5rem;
    margin: 1rem 0;
}

.badge-items {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.badge-items a {
    display: inline-block;
    line-height: 0;
}

.badge-items img {
    height: 28px;
    vertical-align: middle;
    border-radius: 0 !important;
    image-rendering: crisp-edges;
}

/* ============================================
   Feature Cards
   ============================================ */
.feature-card {
    border: 1px solid #e9ecef !important;
    border-left: 3px solid var(--surfaces-primary) !important;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
    border-radius: 8px !important;
    overflow: hidden;
}

html[data-theme="dark"] .feature-card {
    border-color: #3d3d4d !important;
    border-left-color: var(--surfaces-secondary) !important;
}

.feature-card:hover {
    box-shadow: var(--card-shadow-hover);
    border-left-color: var(--surfaces-secondary) !important;
}

html[data-theme="dark"] .feature-card:hover {
    border-left-color: var(--surfaces-accent) !important;
}

.feature-card .sd-card-body {
    padding: 1.25rem;
}

.feature-card .sd-card-footer {
    font-size: 0.85rem;
    color: var(--surfaces-dark);
    padding: 0;
    background: #f0f1f3;
    border-top: 1px solid #e0e2e6;
}

.feature-card .sd-card-footer p {
    margin: 0;
}

.feature-card .sd-card-footer a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: var(--surfaces-dark);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.feature-card .sd-card-footer a::after {
    content: "...";
    margin-left: auto;
    padding-left: 1rem;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.2s ease;
}

.feature-card .sd-card-footer a:hover {
    background: #e4e6ea;
}

.feature-card .sd-card-footer a:hover::after {
    opacity: 0.6;
    transform: translateX(0);
}

html[data-theme="dark"] .feature-card .sd-card-footer {
    background: #2a2a3a;
    border-top-color: #3d3d4d;
    color: #c8c8d8;
}

html[data-theme="dark"] .feature-card .sd-card-footer a {
    color: #c8c8d8;
}

html[data-theme="dark"] .feature-card .sd-card-footer a:hover {
    background: #3a3a4a;
}

/* ============================================
   Category Cards (Mathematical, ML)
   ============================================ */
.category-card {
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    border: none !important;
    position: relative;
    background: var(--pst-color-surface);
}

/* Side accent bar using pseudo-element for multi-color support */
.category-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    border-radius: 8px 0 0 8px;
}

.category-card .sd-card-header {
    padding: 1.25rem 1.5rem 0.75rem;
    border-bottom: none;
    background: transparent;
}

.category-card .sd-card-header .sd-card-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.category-card .sd-card-header a {
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.category-card .sd-card-header a:hover {
    text-decoration: underline;
}

.category-card .sd-card-body {
    padding: 0.5rem 1.5rem 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.category-card .sd-card-body ul {
    margin: 0.75rem 0 0 0;
    padding-left: 1.25rem;
}

.category-card .sd-card-body li {
    margin-bottom: 0.4rem;
}

.category-card .sd-card-footer {
    padding: 0;
    border-top: 1px solid var(--pst-color-border);
    background: transparent;
    transition: background 0.2s ease;
}

.category-card .sd-card-footer a {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.category-card .sd-card-footer a::after {
    content: "...";
    margin-left: auto;
    padding-left: 1rem;
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.2s ease;
}

.category-card .sd-card-footer:hover {
    background: var(--pst-color-background);
}

.category-card .sd-card-footer a:hover::after {
    opacity: 0.6;
    transform: translateX(0);
}

/* Mathematical functions card: blue gradient */
.category-card-math::before {
    background: linear-gradient(to bottom, var(--math-color) 0%, var(--math-color-light) 100%);
}

/* ML functions card: purple gradient */
.category-card-ml::before {
    background: linear-gradient(to bottom, var(--ml-color) 0%, var(--ml-color-light) 100%);
}

/* ============================================
   Contents Navigation Cards (horizontal style)
   ============================================ */
.contents-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

@media (max-width: 992px) {
    .contents-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .contents-grid {
        grid-template-columns: 1fr;
    }
}

.contents-card {
    background: var(--pst-color-surface);
    border-radius: 8px;
    display: flex;
    align-items: stretch;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s ease;
}

.contents-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--surfaces-primary) 0%, var(--surfaces-secondary) 100%);
}

.contents-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.contents-card-inner {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem 1.25rem 1rem 1.5rem;
    transition: all 0.2s ease;
}

.contents-card:hover .contents-card-inner {
    background: var(--pst-color-background);
}

.contents-card-text {
    flex: 1;
}

.contents-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
}

.contents-card-desc {
    font-size: 0.85rem;
    opacity: 0.7;
    margin: 0;
    line-height: 1.3;
}

.contents-card-arrow {
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.2s ease;
    margin-left: 1rem;
    font-size: 1rem;
}

.contents-card:hover .contents-card-arrow {
    opacity: 0.6;
    transform: translateX(0);
}

/* ============================================
   Section Separators - Full Width Horizontal Lines
   ============================================ */
hr {
    border: none;
    height: 1px;
    background-color: var(--separator-color);
    margin: 2.5rem 0;
    width: 100%;
}

/* ============================================
   Section Headers - Subtle styling
   ============================================ */

/* Page titles (h1 from ===) - subtle background highlight */
/* Exclude home page by targeting pages with h1 that aren't in the hero */
article h1:not(.hero-title) {
    background-color: rgba(26, 24, 84, 0.2);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    width: fit-content;
}

/* Home page h1s get h2 styling (underline, not background) */
/* Target pages that contain .hero-section, but not the hero title itself */
article:has(.hero-section) h1:not(.hero-title) {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    width: auto;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--pst-color-border);
}

/* Remove headerlink from affecting h1 width */
article h1 a.headerlink {
    position: absolute;
    margin-left: 0.5rem;
}

/* Section titles (h2 from ---) - subtle underline */
article h2 {
    position: relative;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--pst-color-border);
}

/* Remove any pseudo-element underlines */
h2::after {
    display: none;
}

/* ============================================
   Button Enhancements
   ============================================ */
.sd-btn-primary {
    background: var(--surfaces-gradient) !important;
    border: none !important;
    transition: all 0.3s ease !important;
}

.sd-btn-primary:hover {
    background: var(--surfaces-gradient-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 24, 84, 0.4);
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 1rem;
        margin: -1rem -0.5rem 1.5rem -0.5rem;
    }

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

    .hero-tagline {
        font-size: 1.4rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .feature-icon {
        font-size: 2rem;
    }
}

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

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .hero-section {
        background: #f8f9fa !important;
        color: #000 !important;
    }

    .hero-title,
    .hero-tagline,
    .hero-subtitle {
        color: #000 !important;
    }
}

/* ============================================
   Code Blocks Enhancement
   ============================================ */
.highlight {
    border-radius: 8px;
    overflow: hidden;
}

.highlight pre {
    border-radius: 8px;
    padding: 1rem;
}

/* ============================================
   Tab Set Styling
   ============================================ */
.sd-tab-set {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.sd-tab-label {
    font-weight: 500;
    transition: all 0.2s ease;
}

.sd-tab-label:hover {
    background-color: rgba(26, 24, 84, 0.1);
}

input[name^="sd-tab-set"]:checked + label {
    border-bottom-color: var(--surfaces-primary) !important;
    color: var(--surfaces-primary);
}

/* ============================================
   Vertical Tabs Component
   ============================================ */
.vertical-tabs {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.vertical-tabs-nav {
    display: flex;
    flex-direction: column;
    width: 190px;
    flex-shrink: 0;
    background: var(--pst-color-background);
    border-radius: 10px;
    padding: 0.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--pst-color-border);
    align-self: flex-start;
}

.vertical-tab-btn {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 6px;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--pst-color-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    margin: 2px 0;
}

.vertical-tab-btn:hover {
    background: var(--pst-color-surface);
    color: var(--pst-color-text-base);
}

.vertical-tab-btn.active {
    border-left-color: var(--surfaces-primary);
    background: var(--pst-color-surface);
    color: var(--surfaces-primary);
}

html[data-theme="dark"] .vertical-tab-btn.active {
    border-left-color: var(--surfaces-secondary);
    color: var(--surfaces-secondary);
}

.vertical-tab-btn .tab-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--surfaces-primary);
    margin-right: 0.75rem;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.vertical-tab-btn.active .tab-indicator {
    opacity: 1;
    transform: scale(1);
}

html[data-theme="dark"] .vertical-tab-btn .tab-indicator {
    background: var(--surfaces-secondary);
}

.vertical-tabs-content {
    flex: 1;
    min-height: 200px;
    overflow: hidden;
}

.vertical-tab-panel {
    display: none;
}

.vertical-tab-panel.active {
    display: block;
    animation: revealVertical 0.35s ease-out;
}

@keyframes revealVertical {
    from {
        opacity: 0;
        clip-path: inset(0 0 100% 0);
    }
    to {
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

/* Code block styling within vertical tabs */
.vertical-tab-panel .highlight {
    margin: 0;
    border-radius: 4px;
    box-shadow: var(--card-shadow);
    height: 380px;
    overflow: hidden;
}

.vertical-tab-panel .highlight pre {
    margin: 0;
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    line-height: 1.5;
    height: 100%;
    overflow-y: auto;
    border-radius: 4px;
}

/* Responsive: Convert to horizontal on smaller screens */
@media (max-width: 768px) {
    .vertical-tabs {
        flex-direction: column;
        gap: 1rem;
    }

    .vertical-tabs-nav {
        flex-direction: row;
        min-width: 100%;
        overflow-x: auto;
        padding: 0.25rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .vertical-tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .vertical-tab-btn {
        flex-shrink: 0;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.625rem 1rem;
        white-space: nowrap;
        margin: 0 2px;
    }

    .vertical-tab-btn.active {
        border-left-color: transparent;
        border-bottom-color: var(--surfaces-primary);
    }

    html[data-theme="dark"] .vertical-tab-btn.active {
        border-bottom-color: var(--surfaces-secondary);
    }

    .vertical-tab-btn .tab-indicator {
        display: none;
    }
}

/* ============================================
   Segmented Control Tabs
   ============================================ */
.segmented-tabs {
    margin: 1.5rem 0;
}

.segmented-tabs-nav {
    display: inline-flex;
    background: var(--pst-color-background);
    border-radius: 10px;
    padding: 4px;
    gap: 2px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--pst-color-border);
}

.segmented-tab-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--pst-color-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.segmented-tab-btn:hover {
    color: var(--pst-color-text-base);
}

.segmented-tab-btn.active {
    background: var(--pst-color-surface);
    color: var(--surfaces-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

html[data-theme="dark"] .segmented-tab-btn.active {
    color: var(--surfaces-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.segmented-tabs-content {
    margin-top: 1rem;
}

.segmented-tab-panel {
    display: none;
    animation: segmentedFadeIn 0.2s ease;
}

.segmented-tab-panel.active {
    display: block;
}

@keyframes segmentedFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.segmented-tab-panel .highlight {
    border-radius: 8px;
    margin: 0;
}

.segmented-tab-panel .highlight pre {
    margin: 0;
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
}

/* Responsive: stack on very small screens */
@media (max-width: 540px) {
    .segmented-tabs-nav {
        flex-wrap: wrap;
        width: 100%;
    }

    .segmented-tab-btn {
        flex: 1 1 auto;
        text-align: center;
        padding: 0.5rem 0.75rem;
    }
}

/* ============================================
   Theme-Aware Diagrams
   ============================================ */

/* Container for theme-aware images */
.theme-aware-diagram {
    width: 100%;
    text-align: center;
}

.theme-aware-diagram img {
    max-width: 100%;
    height: auto;
}

/* Override pydata theme's white background for diagram images */
html[data-theme="dark"] .theme-aware-diagram img.only-dark {
    background-color: transparent !important;
}
