/* Custom CSS for Lactuca documentation */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;1,400&family=Lato:ital,wght@0,300;0,400;0,700;1,400&display=swap');

/* Apply Open Sans to body text */
body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* Apply Lato to headings */
h1, h2, h3, h4, h5, h6,
.sidebar-brand-text {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-weight: 700;
}

/* Code blocks with better contrast */
pre, code {
    font-family: 'Fira Code', 'Source Code Pro', 'Courier New', monospace;
}

/* Actuarial notation styling */
.math {
    font-family: 'Latin Modern Math', 'STIX Two Math', 'Cambria Math', serif;
}

/* Improve table readability */
table.docutils {
    border-collapse: collapse;
    margin: 1em 0;
}

table.docutils th {
    background-color: #f8f9fa;
    font-weight: 600;
}

table.docutils td, table.docutils th {
    padding: 0.5em 0.75em;
    border: 1px solid #dee2e6;
}

/* Grid cards styling (for index page) */
.sd-card {
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    transition: box-shadow 0.2s ease-in-out;
}

.sd-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Version switcher button */
.version-switcher__button {
    font-weight: 600;
}

/* Admonition styling */
.admonition {
    border-left: 4px solid #007bff;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    background-color: #f8f9fa;
}

.admonition.note {
    border-left-color: #17a2b8;
}

.admonition.warning {
    border-left-color: #ffc107;
}

.admonition.danger {
    border-left-color: #dc3545;
}

/* Code block copy button */
.copybtn {
    opacity: 0.3;
    transition: opacity 0.2s;
}

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

/* Improve sidebar navigation */
.sidebar-tree {
    font-size: 0.9rem;
}

.sidebar-tree .reference.internal {
    color: #333;
    text-decoration: none;
}

.sidebar-tree .reference.internal:hover {
    color: #007bff;
    text-decoration: underline;
}

/* Actuarial formula blocks */
div.math {
    overflow-x: auto;
    padding: 0.5rem 0;
}

/* API reference styling */
dl.py.function, dl.py.class, dl.py.method {
    border-left: 3px solid #007bff;
    padding-left: 1rem;
    margin-bottom: 1.5rem;
}

dt.sig {
    background-color: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
}

/* Footer customization */
.footer {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Make external links distinguishable */
a.reference.external::after {
    content: " ↗";
    font-size: 0.8em;
    color: #6c757d;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        font-size: 0.95rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}

/* ============================================================
   Navbar: prevent items from wrapping to a second line.
   The theme uses flex-flow:wrap by default; override to nowrap
   and tighten spacing so all items fit on one row.
   ============================================================ */
.bd-header .navbar-header-items__start,
.bd-header .navbar-header-items__end {
    flex-wrap: nowrap !important;
    white-space: nowrap;
}

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

.bd-header .navbar-header-items__start {
    column-gap: 0.6rem !important;
}

.bd-header .navbar-header-items__center,
.bd-header .navbar-header-items__end {
    column-gap: 0.75rem !important;
}

.bd-header .navbar-item .nav-link {
    font-size: 0.88rem;
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
}

/* Align navbar logo column with the primary sidebar width (20%)
   so the nav items start at the same horizontal position as the
   page content — shifting them visually to the left. */
.bd-header .navbar-header-items__start {
    flex: 0 0 20% !important;
    max-width: 20% !important;
    width: 20% !important;
}

.bd-header .navbar-header-items {
    flex: 0 0 80% !important;
    max-width: 80% !important;
}

/* ============================================================
   Primary sidebar (Section Navigation): narrower width
   Default is 25%; reducing to 20% gives more space to content.
   ============================================================ */
.bd-sidebar-primary {
    width: 20% !important;
    min-width: 200px !important;
}

/* ============================================================
   Full-width content layout
   ============================================================ */
:root {
    --pst-content-width: min(100%, 1600px);
}

.bd-page-width {
    max-width: 100% !important;
}

.bd-main .bd-content .bd-article-container {
    max-width: 100% !important;
}

/* ============================================================
   Pages without secondary sidebar: constrain content width.
   When html_theme.sidebar_secondary.remove is set, .bd-content
   has no .bd-sidebar-secondary child → the article stretches
   to full width. Cap it at 860px and centre it so the layout
   remains balanced (equivalent to a normal two-sidebar page).
   ============================================================ */
.bd-main .bd-content:not(:has(.bd-sidebar-secondary)) .bd-article-container {
    max-width: 860px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ============================================================
   Source link sidebar: icon-only (replaces "This Page / Show Source" text)
   Font Awesome 6 Free is bundled by pydata-sphinx-theme.
   ============================================================ */
div[aria-label="source link"] h3 {
    display: none;
}

ul.this-page-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

ul.this-page-menu a {
    font-size: 0;
    color: transparent;
    display: inline-block;
    padding: 0.3rem;
    line-height: 1;
}

ul.this-page-menu a::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f121";   /* fa-code icon */
    font-size: 1rem;
    color: var(--pst-color-text-muted);
    display: inline-block;
}

ul.this-page-menu a:hover::before {
    color: var(--pst-color-primary);
}

