.md-typeset img {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 10px;
}

/* ==========================================================================
   Project Lesson Grid (Folder Landing Pages) - Image Cards
   ========================================================================== */

.lesson-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    margin: 28px 0;
}

.lesson-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--md-default-bg-color);
    text-decoration: none !important;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
                box-shadow 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
                border-color 0.3s ease;
}

.lesson-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.08);
    border-color: var(--md-primary-color);
}

.lesson-card-image {
    width: 100%;
    height: 190px;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.03);
}

.lesson-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    border-radius: 0 !important; /* Override global img border radius */
}

.lesson-card:hover .lesson-card-image img {
    transform: scale(1.06);
}

.lesson-card-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--md-primary-color);
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    z-index: 2;
}

.lesson-card-content {
    padding: 20px 24px 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.lesson-card-content h4 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 10px 0 !important;
    color: var(--md-default-foreground-color);
    line-height: 1.35;
}

.lesson-card-content p {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--md-default-foreground-color--light);
    margin: 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.lesson-card-action {
    margin-top: 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--md-primary-color);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.2s ease;
}

.lesson-card:hover .lesson-card-action {
    gap: 8px;
}

/* ==========================================================================
   Dark Mode Slate Overrides
   ========================================================================== */

[data-md-color-scheme="slate"] .lesson-card {
    border-color: rgba(255, 255, 255, 0.08);
    background: #1e293b; /* Sleek slate background */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-md-color-scheme="slate"] .lesson-card:hover {
    border-color: var(--md-primary-color);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

[data-md-color-scheme="slate"] .lesson-card-icon {
    background: rgba(30, 41, 59, 0.95);
    color: var(--md-primary-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

[data-md-color-scheme="slate"] .lesson-card-image {
    background: rgba(255, 255, 255, 0.01);
}

/* ==========================================================================
   Back Navigation Button (Lesson Pages → Version Landing Page)
   ========================================================================== */

.back-nav-bar {
    margin-bottom: 28px;
}

.md-typeset .back-nav-btn,
.back-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: 50px;
    /* Use Material's primary fg colour (indigo) as the button background,
       with a hard-coded indigo fallback in case the variable is unavailable. */
    background: var(--md-primary-fg-color, #3f51b5);
    /* Material's primary bg colour is the high-contrast colour (white)
       used for text that sits on the primary background. */
    color: var(--md-primary-bg-color, #ffffff) !important;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none !important;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    transition: background 0.25s ease,
                box-shadow 0.25s ease,
                transform 0.2s ease,
                gap 0.2s ease;
}

.md-typeset .back-nav-btn:hover,
.back-nav-btn:hover {
    background: var(--md-primary-fg-color--dark, #303f9f);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    transform: translateX(-3px);
    gap: 12px;
    color: var(--md-primary-bg-color, #ffffff) !important;
}

.back-nav-arrow {
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.back-nav-btn:hover .back-nav-arrow {
    transform: translateX(-2px);
}

/* Dark mode */
[data-md-color-scheme="slate"] .back-nav-btn {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

[data-md-color-scheme="slate"] .back-nav-btn:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

/* Mobile */
@media (max-width: 600px) {
    .back-nav-btn {
        padding: 8px 16px;
        font-size: 0.82rem;
    }
}

/* ==========================================================================
   OpenVINO-inspired Documentation Portal Styles
   ========================================================================== */

:root {
    --portal-primary: #1066c3;
    --portal-primary-hover: #0d54a3;
    --portal-bg-card: var(--md-default-bg-color, #ffffff);
    --portal-border: rgba(0, 0, 0, 0.07);
    --portal-text-mute: var(--md-default-foreground-color--light, #5c6f84);
}

[data-md-color-scheme="slate"] :root {
    --portal-primary: #3b82f6;
    --portal-primary-hover: #60a5fa;
    --portal-border: rgba(255, 255, 255, 0.08);
}

/* Portal Hero Section */
.portal-hero {
    background: linear-gradient(135deg, rgba(16, 102, 195, 0.05) 0%, rgba(59, 130, 246, 0.02) 100%);
    border: 1px solid var(--portal-border);
    border-radius: 16px;
    padding: 40px 32px;
    margin: 24px 0 32px 0;
    position: relative;
    overflow: hidden;
}

.portal-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(16, 102, 195, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.portal-hero-content h1 {
    font-size: 2.2rem !important;
    font-weight: 800 !important;
    color: var(--md-default-foreground-color, #1e293b);
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    line-height: 1.2;
}

.portal-hero-subtitle {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--portal-text-mute);
    max-width: 800px;
    margin-bottom: 20px !important;
}

.portal-search-guidance {
    display: inline-flex;
    align-items: center;
    background: rgba(16, 102, 195, 0.08);
    border: 1px solid rgba(16, 102, 195, 0.15);
    border-radius: 30px;
    padding: 6px 16px;
}

[data-md-color-scheme="slate"] .portal-search-guidance {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.25);
}

.search-tip {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--portal-primary);
}

/* Documentation Statistics Grid */
.portal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--portal-bg-card);
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.01);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
}

.stat-num {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--portal-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--portal-text-mute);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Quick Start Grid */
.quickstart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: 20px 0 40px 0;
}

.quick-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--portal-border);
    background: var(--portal-bg-card);
    text-decoration: none !important;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1),
                box-shadow 0.3s cubic-bezier(0.25, 1, 0.5, 1),
                border-color 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.quick-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
    border-color: var(--portal-primary);
}

.quick-card-icon {
    font-size: 1.8rem;
    line-height: 1;
    background: linear-gradient(135deg, rgba(16, 102, 195, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
    border-radius: 8px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-card-content h3 {
    font-size: 0.98rem !important;
    font-weight: 700 !important;
    margin: 0 0 6px 0 !important;
    color: var(--md-default-foreground-color, #1e293b);
}

.quick-card-content p {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--portal-text-mute);
    margin: 0 !important;
}

/* Learning Paths & Section Cards */
.paths-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin: 24px 0 40px 0;
}

.path-card {
    background: var(--portal-bg-card);
    border: 1px solid var(--portal-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
}

.path-header {
    padding: 20px 24px;
    color: white;
}

.path-foundation { background: linear-gradient(135deg, #1066c3 0%, #3b82f6 100%); }
.path-beginner { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.path-intermediate { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.path-advanced { background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); }

.path-header h3 {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    color: white !important;
    letter-spacing: 0.02em;
}

.path-body {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.path-body p {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--portal-text-mute);
    margin: 0 0 20px 0 !important;
}

.path-body ul {
    margin: 0 0 24px 0 !important;
    padding-left: 20px !important;
    flex-grow: 1;
}

.path-body li {
    font-size: 0.85rem;
    margin-bottom: 10px !important;
}

.path-body li a {
    color: var(--md-default-foreground-color, #1e293b);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}

.path-body li a:hover {
    color: var(--portal-primary);
    text-decoration: underline;
}

.path-action {
    display: block;
    text-align: center;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(16, 102, 195, 0.06);
    color: var(--portal-primary) !important;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none !important;
    transition: background 0.2s ease, color 0.2s ease;
}

.path-action:hover {
    background: var(--portal-primary);
    color: white !important;
}

[data-md-color-scheme="slate"] .path-action {
    background: rgba(59, 130, 246, 0.12);
}

/* Component Categories Grid */
.components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 20px 0 40px 0;
}

.comp-card {
    background: var(--portal-bg-card);
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.01);
}

.comp-card h4 {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    margin: 0 0 6px 0 !important;
    color: var(--md-default-foreground-color, #1e293b);
}

.comp-card p {
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--portal-text-mute);
    margin: 0 0 14px 0 !important;
}

.comp-card a {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--portal-primary);
    text-decoration: none;
}

.comp-card a:hover {
    text-decoration: underline;
}

/* Featured Projects List */
.featured-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0 40px 0;
}

.featured-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-radius: 10px;
    border: 1px solid var(--portal-border);
    background: var(--portal-bg-card);
    text-decoration: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.featured-item:hover {
    border-color: var(--portal-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transform: translateX(3px);
}

.badge {
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    border-radius: 30px;
    flex-shrink: 0;
    letter-spacing: 0.05em;
}

.badge-beg { background: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-int { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.badge-adv { background: rgba(139, 92, 246, 0.1); color: #6d28d9; }

.featured-item-text h4 {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    margin: 0 0 4px 0 !important;
    color: var(--md-default-foreground-color, #1e293b);
}

.featured-item-text p {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--portal-text-mute);
    margin: 0 !important;
}

/* Quick Reference Links Bar */
.references-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 20px 0 40px 0;
}

.references-nav a {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--portal-bg-card);
    border: 1px solid var(--portal-border);
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--md-default-foreground-color, #1e293b) !important;
    text-decoration: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.references-nav a:hover {
    border-color: var(--portal-primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   Navigation Collapse - Desktop View
   Collapse all main sections by default, user can expand them
   ========================================================================== */

/* Hide nested lists by default (collapsed state) */
.md-nav__list > .md-nav__item > .md-nav__list {
    display: none;
}

/* Show nested lists when parent section is expanded (checked) */
.md-nav__item input:checked ~ .md-nav__list {
    display: block;
}

/* Ensure the checkbox for expanding/collapsing is visible */
.md-nav__toggle {
    cursor: pointer;
}
