/* Image styling */
img {
    border-radius: 8px;
}

.md-content__inner img {
    max-height: 700px;
    object-fit: contain;
}

/* Sidebar indentation + guide lines */
.md-nav__list .md-nav__list {
    border-left: 2px solid rgba(0, 0, 0, 0.1);
    margin-left: 0.5rem;
    padding-left: 0.75rem;
}

/* Dark mode sidebar lines */
[data-md-color-scheme="slate"] .md-nav__list .md-nav__list {
    border-left: 2px solid rgba(255, 255, 255, 0.1);
}

/* Active item highlight */
.md-nav__link--active {
    font-weight: bold;
}

/* ============================================
   IMAGE GALLERY GRID
   Use with: <div class="image-gallery" markdown>
   Each image becomes a clickable thumbnail.
   glightbox handles the lightbox/zoom.
   ============================================ */

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0 1.5rem;
}

/* Override the site-wide max-height inside galleries */
.image-gallery img {
    width: 100%;
    height: 160px;
    max-height: 160px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    border: 1px solid var(--md-default-fg-color--lightest);
}

.image-gallery img:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Larger thumbnails variant — for pages with fewer images */
.image-gallery--large {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.image-gallery--large img {
    height: 220px;
    max-height: 220px;
}

/* Caption support */
.image-gallery figure {
    margin: 0;
}

.image-gallery figcaption {
    font-size: 0.75rem;
    color: var(--md-default-fg-color--light);
    text-align: center;
    margin-top: 0.25rem;
}

/* ============================================
   DARK MODE — GALLERY
   ============================================ */

[data-md-color-scheme="slate"] .image-gallery img {
    border-color: rgba(255, 255, 255, 0.08);
}

[data-md-color-scheme="slate"] .image-gallery img:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* ============================================
   PRINT STYLES — for print-site PDF page
   ============================================ */

@media print {

    /* Constrain images for print */
    img {
        max-width: 100% !important;
        max-height: 400px !important;
        object-fit: contain !important;
    }

    .image-gallery {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px;
    }

    .image-gallery img {
        max-width: 45% !important;
        max-height: 200px !important;
        height: auto !important;
    }

    /* Page breaks */
    h1 {
        page-break-before: always;
    }

    h1, h2, h3, h4 {
        page-break-after: avoid;
    }

    table, .admonition, details {
        page-break-inside: avoid;
    }

    /* Show all details/tabs */
    details, details[open] {
        display: block !important;
    }
    details > *:not(summary) {
        display: block !important;
    }
    .tabbed-set .tabbed-content > div {
        display: block !important;
    }

}
