:root {
  /* DARK THEME (Default) */
  --bg-body: #050505;
  --bg-card: #0d0d0d;
  --navy-deep: #00095d;      /* Your signature color */
  --text-main: #ffffff;      /* Pure white for dark mode */
  --text-dim: #a0a0a0;       /* Grey for secondary text */
  --border-color: rgba(255, 255, 255, 0.1);
  --table-zebra: rgba(255, 255, 255, 0.03);
  --tip-bg: rgba(0, 9, 93, 0.1);
}

.light-theme {
  /* LIGHT THEME (Triggered by JS) */
  --bg-body: #ffffff;
  --bg-card: #f8f9fa;
  --navy-deep: #00095d;      /* Keeps the professional navy */
  --text-main: #00095d;      /* Navy text for high contrast */
  --text-dim: #444444;       /* Dark grey for readability */
  --border-color: rgba(0, 9, 93, 0.1);
  --table-zebra: rgba(0, 9, 93, 0.03);
  --tip-bg: #f0f4ff;
}


/* =========================================================
   1. VARIABLES & TYPOGRAPHY
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;800&display=swap');

:root {
    /* Professional Dark Palette (Default) */
    --bg-body: #050505;
    --bg-nav: rgba(5, 5, 5, 0.9);
    --navy-deep: #00095d;
    --text-main: #ffffff;
    --text-dim: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-hover: rgba(0, 9, 93, 0.4);
    --transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.light-theme {
    --bg-body: #ffffff;
    --bg-nav: rgba(255, 255, 255, 0.9);
    --text-main: #00095d;
    --text-dim: #444444;
    --border-color: rgba(0, 9, 93, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease;
}

/* =========================================================
   2. NAVIGATION (Centered Menu, Logo Left)
   ========================================================= */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 2000;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.nav-extra {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0; /* Prevents the whole block from being squashed */
}

.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.nav-logo {
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -1px;
}

.nav-logo a {
    color: var(--text-main);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-main);
}


/* --- Mobile Menu Toggle --- */
.menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2100;
}

@media (max-width: 992px) {
    .menu-toggle {
        display: block; /* Show only on mobile/tablet */
    }

    .nav-links {
        display: none; /* Keep hidden by default */
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        width: 250px;
        height: 100vh;
        background: var(--bg-nav);
        backdrop-filter: blur(20px);
        padding: 80px 2rem;
        gap: 2rem;
        border-left: 1px solid var(--border-color);
        transform: translateX(100%);
        transition: var(--transition);
        left: auto; /* Reset the 'absolute left 50%' from desktop */
    }

    /* Class added by JS to show the menu */
    .nav-links.mobile-active {
        display: flex;
        transform: translateX(0);
    }

    .nav-links a {
        font-size: 0.9rem;
        width: 100%;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 10px;
    }
}


/* =========================================================
   3. HERO SLIDER (Fullscreen & Dark)
   ========================================================= */
.hero-slider {
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease-in-out;
}

.slide.active { opacity: 1; }

.slide::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2), rgba(0,0,0,0.8));
}

.slide-content {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 900px;
    padding: 20px;
}

.slide-content h1 {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.slide-content p {
    font-size: 1rem;
    letter-spacing: 4px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--navy-deep);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 1px solid var(--navy-deep);
    transition: var(--transition);
}

.button:hover {
    background: transparent;
    border-color: #fff;
}

/* =========================================================
   4. WORK GRID (3 Columns, No Gaps)
   ========================================================= */
#fh5co-work {
    background: var(--bg-body);
}

.work-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
}

.work {
    height: 450px;
    position: relative;
    overflow: hidden;
    display: block;
    background-size: cover;
    background-position: center;
    border: 0.5px solid var(--border-color);
}

.desc {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2.5rem;
    transition: var(--transition);
    opacity: 1; /* Visible by default in professional themes */
}

.work:hover .desc {
    background: var(--card-hover);
}

.desc h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.5rem;
}

.desc span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
}

/* =========================================================
   5. DOCUMENTATION CONTENT (SIDEBAR LAYOUT)
   ========================================================= */
.layout {
    display: flex;
    max-width: 1400px;
    margin: 80px auto 0;
}

.sidebar {
    width: 300px;
    padding: 40px 20px;
    height: calc(100vh - 80px);
    position: sticky;
    top: 80px;
    border-right: 1px solid var(--border-color);
}

.content {
    flex: 1;
    padding: 40px 60px;
}

.content img {
    max-width: 100%;
    border-radius: 4px;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
}

/* =========================================================
   6. RESPONSIVE DESIGN
   ========================================================= */
@media (max-width: 1024px) {
    .work-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-links { gap: 1.5rem; }
}

@media (max-width: 768px) {
    .nav-links { display: none; } /* Recommended: Add a mobile toggle */
    .work-grid { grid-template-columns: 1fr; }
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; top: 0; }
    .content { padding: 20px; }
    .slide-content h1 { font-size: 2.8rem; }
}

/* =========================================================
   7. FOOTER
   ========================================================= */
footer {
    padding: 4rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: #000;
}

footer p {
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

footer a {
    color: var(--text-main);
    text-decoration: underline;
}

/* Search Bar Styling */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: white;
    padding: 5px 10px 5px 25px;
    border-radius: 4px;
    font-family: 'Montserrat';
    font-size: 0.8rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--navy-deep);
    background: rgba(255, 255, 255, 0.1);
}

.search-container i {
    position: absolute;
    left: 12px;
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* Back to Top Arrow */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: var(--navy-deep);
    color: white;
    border: none;
    border-radius: 4px;
    display: none; /* Hidden by default */
    cursor: pointer;
    z-index: 3000;
    transition: var(--transition);
}

#backToTop:hover { transform: translateY(-5px); }

/* Tutorial Cards */
.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 40px 0;
}

.tut-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 15px; /* Filleted look */
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tut-card:hover {
    border-color: var(--navy-deep);
    transform: translateY(-5px);
}

.tut-icon { font-size: 2rem; color: var(--navy-deep); }
.tut-info h4 { color: var(--text-main); font-weight: 700; margin-bottom: 5px; }
.tut-info p { color: var(--text-dim); font-size: 0.85rem; }

/* Lazy Load State */
.work {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.work.visible {
    opacity: 1;
    transform: translateY(0);
}


/* --- Documentation Kit Additions --- */

/* Final Result Banner */
.result-banner {
    height: 40vh;
    width: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
    margin-top: 60px; /* Below Nav */
}

.banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-body), transparent);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 40px 10%;
}

.status-badge {
    background: var(--navy-deep);
    color: white;
    padding: 4px 12px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    width: fit-content;
    border-radius: 20px;
    margin-bottom: 10px;
}

/* Sidebar TOC Styling */
.toc { border-left: 1px solid var(--border-color); padding-left: 20px; }
.toc-link { display: block; padding: 5px 0; font-size: 0.85rem; color: var(--text-dim); text-decoration: none; transition: 0.3s; }
.toc-link:hover, .toc-link.active { color: var(--text-main); font-weight: 600; transform: translateX(5px); }

/* Auto-Adjusting Images */
.image-container {
    width: 100%;
    margin: 30px 0;
}

.image-container img {
    width: 100%;       /* Fills container */
    max-width: 100%;   /* Responsive */
    height: auto;      /* Aspect ratio preservation */
    border: 1px solid var(--border-color);
    display: block;
}

/* Target tables specifically within the md-block component */
md-block table, 
.doc-table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 35px 0 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

md-block th,
.doc-table th {
    background-color: var(--navy-deep) !important;
    color: #ffffff !important;
    padding: 15px 20px !important;
    text-transform: uppercase !important;
    font-size: 0.75rem !important;
    letter-spacing: 1.5px !important;
    text-align: left !important;
}

md-block td,
.doc-table td {
    padding: 14px 20px !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-dim) !important;
    background: transparent !important; /* Reset any default styles */
}

/* Zebra Striping for MD tables */
md-block tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03) !important;
}

/* Group Work Box */
.group-work-box {
    border: 1px solid var(--navy-deep);
    padding: 30px;
    position: relative;
    margin-top: 20px;
    background: rgba(0, 9, 93, 0.05);
}

.box-label {
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--navy-deep);
    color: white;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 800;
}

/* Sidebar Social/Timestamp */
.sidebar-footer { margin-top: 40px; border-top: 1px solid var(--border-color); padding-top: 20px; }
.sidebar-footer p { font-size: 0.7rem; color: var(--text-dim); }
.social-share { margin-top: 10px; display: flex; gap: 15px; font-size: 1rem; }
.social-share a { color: var(--text-dim); }
.social-share a:hover { color: var(--navy-deep); }


/* --- FIXED NEAT MODAL --- */
.lightbox {
    display: none; /* Hidden by default */
    position: fixed; /* Stays in place even when scrolling */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95); /* Darker backdrop for focus */
    backdrop-filter: blur(10px); /* Blurs the background documentation */
    z-index: 9999; /* Higher than navbar and everything else */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.lightbox-content {
    max-width: 85%;
    max-height: 75vh;
    object-fit: contain; /* Prevents image distortion */
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease; /* Smooth entrance */
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.lightbox-caption {
    margin-top: 20px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 1px;
    text-align: center;
    max-width: 80%;
}

/* Navigation Buttons */
.close-lightbox, .prev-lightbox, .next-lightbox {
    position: absolute;
    background: none;
    border: none;
    color: white;
    font-size: 35px;
    cursor: pointer;
    padding: 20px;
    transition: 0.3s;
    z-index: 10000;
}

.close-lightbox { top: 10px; right: 20px; }
.prev-lightbox { left: 20px; top: 50%; transform: translateY(-50%); }
.next-lightbox { right: 20px; top: 50%; transform: translateY(-50%); }

.close-lightbox:hover, .prev-lightbox:hover, .next-lightbox:hover {
    color: var(--navy-deep);
    transform: scale(1.1);
}

/* Hide navigation if there is only one image */
.hidden { display: none !important; }


/* --- ENHANCED TIP BOX --- */
.tip {
    background: rgba(0, 9, 93, 0.04); /* Very subtle navy tint */
    border-left: 5px solid var(--navy-deep);
    padding: 25px 30px;
    margin: 40px 0;
    position: relative;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.tip strong {
    display: block;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: var(--navy-deep);
    margin-bottom: 10px;
}

.tip p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.6;
}

/* Light mode override for better visibility */
.light-theme .tip {
    background: #f0f4ff;
    border-left-color: #00095d;
}

/* --- ENHANCED DATA TABLE --- */
.doc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 35px 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden; /* Clips corners of the first/last rows */
}

.doc-table th {
    background-color: var(--navy-deep);
    color: #ffffff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    padding: 15px 20px;
    text-align: left;
}

.doc-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-dim);
    transition: background 0.2s ease;
}

/* Zebra Striping */
.doc-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Hover effect for row tracking */
.doc-table tr:hover td {
    background: rgba(0, 9, 93, 0.1);
    color: var(--text-main);
}

/* Monospace for units/numbers (Optional) */
.doc-table td:nth-child(2), 
.doc-table td:nth-child(3) {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
}

.doc-table tr:last-child td {
    border-bottom: none;
}
.divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, var(--navy-deep), transparent);
    margin: 50px 0;
    opacity: 0.5;
}

/* --- AUTOMATIC SECTION NUMBERING --- */
article.content {
    counter-reset: h2counter;
}

article.content h2 {
    counter-reset: h3counter;
}

article.content h2::before {
    counter-increment: h2counter;
    content: counter(h2counter) ".0 ";
    color: var(--navy-deep);
    font-weight: 800;
    margin-right: 10px;
    font-size: 0.8em;
}

article.content h3::before {
    counter-increment: h3counter;
    content: counter(h2counter) "." counter(h3counter) " ";
    color: var(--navy-deep);
    font-weight: 600;
    margin-right: 10px;
    font-size: 0.8em;
}

/* Exclude the Group Assignment Box from numbering if desired */
.group-work-box h2::before {
    content: "" !important;
    counter-increment: none;
}


/* Media Containers */
.video-container, .embed-container {
    width: 100%;
    margin: 30px 0;
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.doc-video {
    width: 100%;
    display: block;
}

.embed-container iframe {
    width: 100%;
    height: 500px; /* Standard height for 3D viewers */
    display: block;
}

/* Ensure captions are consistent for all media */
.caption {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
    border-top: 1px solid var(--border-color);
}


/* --- TABS SYSTEM --- */
/* =========================================================
   9. LECTURE NOTES & TABS STYLING
   ========================================================= */

/* Tab Content Visibility */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Lecture Notes Specific UI */
#lecture md-block h2 {
    border-bottom: 2px solid var(--navy-deep);
    padding-bottom: 10px;
    margin-bottom: 30px;
}

#lecture md-block ul {
    list-style: none;
    padding-left: 0;
}

#lecture md-block li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 12px;
    color: var(--text-dim);
}

/* Custom Bullet for Lecture Points */
#lecture md-block li::before {
    content: "\f058"; /* FontAwesome Check Circle */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 0;
    color: var(--navy-deep);
    font-size: 0.85rem;
}

/* Lecture Header Tints */
#lecture md-block h3 {
    background: var(--tip-bg);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 4px;
    font-size: 1.1rem;
    color: var(--text-main);
}

/* --- REFINED RESOURCE CARDS (References) --- */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 40px;
}

.resource-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
}

.resource-card:hover {
    border-color: var(--navy-deep);
    box-shadow: 0 10px 30px rgba(0, 9, 93, 0.1);
}

.card-header {
    background: var(--navy-deep);
    color: #ffffff;
    padding: 12px 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.clean-list {
    list-style: none;
}

.clean-list li {
    border-bottom: 1px solid var(--border-color);
}

.clean-list li:last-child {
    border-bottom: none;
}

.clean-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.clean-list a:hover {
    background: rgba(0, 9, 93, 0.05);
    padding-left: 25px; /* Subtle slide effect on hover */
}

.clean-list a small {
    color: var(--text-dim);
    font-size: 0.7rem;
    background: var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- RESOURCE CARDS (NEAT REFS) --- */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.resource-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    background: var(--navy-deep);
    color: white;
    padding: 10px 15px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.clean-list {
    list-style: none;
    padding: 0;
}

.clean-list li {
    border-bottom: 1px solid var(--border-color);
}

.clean-list li:last-child {
    border-bottom: none;
}

.clean-list a {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.2s;
}

.clean-list a span {
    color: var(--navy-deep);
    font-size: 0.8rem;
}

.clean-list a:hover {
    background: rgba(0, 9, 93, 0.05);
}

/* =========================================================
   10. REFINED TABS UI
   ========================================================= */

.tabs-container {
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 60px; /* Aligns right under your fixed navbar */
    z-index: 100;
    backdrop-filter: blur(10px);
}

.tabs-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 60px; /* Aligns with your .content padding */
    display: flex;
    gap: 40px;
}

.tab-btn {
    background: none;
    border: none;
    outline: none;
    padding: 20px 0;
    color: var(--text-dim);
    font-family: 'Montserrat', sans-serif; /* Forces Montserrat */
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

/* Hover Effect */
.tab-btn:hover {
    color: var(--text-main);
}

/* Active State with Navy Underline */
.tab-btn.active {
    color: var(--text-main);
}

.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -1px; /* Sits exactly on the container border */
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--navy-deep);
    border-radius: 2px 2px 0 0;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { width: 0; left: 50%; }
    to { width: 100%; left: 0; }
}

/* Light Theme Adjustments */
.light-theme .tab-btn.active {
    color: var(--navy-deep);
}

/* Responsive Tabs */
@media (max-width: 768px) {
    .tabs-wrapper {
        gap: 20px;
        padding: 0 20px;
        overflow-x: auto; /* Allows swiping on mobile */
    }
    .tab-btn {
        font-size: 0.65rem;
        white-space: nowrap;
    }
}   

/* =========================================================
   12. THUMBNAIL ROW UI
   ========================================================= */

.thumb-row {
    display: flex;
    gap: 15px;
    margin: 30px 0;
    width: 100%;
    flex-wrap: wrap; /* Wraps on small screens */
}

.thumb-container {
    flex: 1;
    min-width: 150px; /* Prevents thumbnails from getting too tiny */
    max-width: 250px; /* Keeps them "standard small" */
    display: flex;
    flex-direction: column;
}

.thumb-container img {
    width: 100%;
    height: 150px; /* Standardized height for all thumbnails */
    object-fit: cover; /* Crops image to fill box without stretching */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: zoom-in;
    transition: var(--transition);
    margin: 0 !important; /* Overrides default content img margins */
}

.thumb-container img:hover {
    border-color: var(--navy-deep);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 9, 93, 0.2);
}

.thumb-container .caption {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    font-style: italic;
    background: none;
    border: none;
}

/* Mobile Adjustment */
@media (max-width: 600px) {
    .thumb-container {
        max-width: 48%; /* Shows 2 per row on mobile */
    }
}


/* =========================================================
   8. ADAPTIVE ARDUINO CODE BLOCK
   ========================================================= */

.code-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin: 2rem 0;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.code-header {
    background: var(--bg-nav); /* Uses your nav's blurred/transparent bg */
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.file-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Scrollbar Styling to match your theme */
.code-wrapper pre::-webkit-scrollbar {
    height: 8px;
}
.code-wrapper pre::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* --- Arduino Syntax Colors (Universal for Light/Dark) --- */
pre[class*="language-"] {
    background: transparent !important; /* Let wrapper handle bg */
    margin: 0 !important;
    padding: 1.5rem !important;
    font-size: 0.9rem;
}

/* Base text color matches your theme */
.token.plain-text, .token.punctuation, .token.operator { 
    color: var(--text-main) !important; 
}

.token.keyword { color: #d35400 !important; font-weight: bold; } /* Arduino Orange */
.token.function { color: #00979c !important; }                  /* Arduino Teal */
.token.string { color: #005c5f !important; }                    /* Dark Teal */
.token.comment { color: #95a5a6 !important; font-style: italic; }
.token.number { color: #8a7b0f !important; }

/* --- Theme-Aware Copy Button --- */
.copy-button {
    background: var(--navy-deep);
    color: #ffffff;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: var(--transition);
}

.copy-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.copy-button.success {
    background: #27ae60; /* Success green */
}


.pdf-readable-container {
    width: 100%;
    max-width: 900px; /* Optional: limits width on large screens */
    margin: 20px auto;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pdf-readable-container object {
    display: block; /* Removes bottom spacing */
}



/* Ensure the component itself acts like a block */
md-block {
    display: block;
    margin-bottom: 2.5rem;
}

/* Headers: Large break above, small break below */
md-block h1, md-block h2, md-block h3, md-block h4 {
    display: block;
    margin-top: 2rem !important;
    margin-bottom: 1rem !important;
    line-height: 1.2;
}

/* Paragraphs and Lists: Consistent standard break */
md-block p, 
md-block ul, 
md-block ol, 
md-block dl,
md-block blockquote {
    display: block;
    margin-bottom: 1.5rem !important;
    line-height: 1.6;
}

/* List Items: Space between bullets */
md-block li {
    margin-bottom: 0.5rem;
}

/* Nested lists: Remove bottom margin to avoid double-spacing */
md-block li > ul, 
md-block li > ol {
    margin-bottom: 0;
}

/* Code blocks and Tables */
md-block pre, 
md-block table {
    display: block;
    margin-bottom: 2rem !important;
    overflow-x: auto; /* Prevents layout breaking on mobile */
}

/* Horizontal lines */
md-block hr {
    margin: 3rem 0 !important;
    border: 0;
    border-top: 1px solid #ddd;
}

/* 1. Target the list container */
md-block ul, 
md-block ol {
    padding-left: 1.2rem !important; /* Adjust this until the text lines up with your H3 */
    margin-left: 0;
    list-style-position: outside; /* Keeps bullets in the gutter, text aligned */
}

/* 2. Optional: If you want the BULLET to align with the H3 text, use this instead */
/*
md-block ul, 
md-block ol {
    padding-left: 0 !important;
    list-style-position: inside; 
}
*/

/* 3. Ensure the list items have that "break" you wanted */
md-block li {
    margin-bottom: 0.5rem;
}

/* 4. Align the Header to ensure no weird offsets */
md-block h1, md-block h2, md-block h3 {
    padding-left: 0;
    margin-left: 0;
}