/*
 * NF Services - Main Layout
 * Flexbox Layout System
 */

/* =========================================
   1. MAIN SITE LAYOUT
========================================= */

.site-content {
    width: 100%;
}

.nf-layout {
    display: flex;
    align-items: flex-start;
    gap: 25px;
    width: 100%;
    max-width: var(--nf-container-width);
    margin: 0 auto;
    padding: 30px var(--nf-container-padding);
}

/* =========================================
   2. MAIN CONTENT
========================================= */

.nf-main {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
}

/* =========================================
   3. SIDEBARS
========================================= */

.nf-sidebar-group {
    display: flex;
    flex: 0 0 250px;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.nf-sidebar-group .site-sidebar {
    width: 100%;
    min-width: 0;
}

.nf-sidebar-group:empty {
    display: none;
}

/* =========================================
   4. SIDEBAR LAYOUTS
========================================= */

/* Left Sidebar */
.nf-layout--left {
    flex-direction: row;
}

/* Right Sidebar */
.nf-layout--right {
    flex-direction: row;
}

/* Both Sidebars */
.nf-layout--both {
    flex-direction: row;
}

/* Full Width */
.nf-layout--full {
    display: block;
}

.nf-layout--full .nf-main {
    width: 100%;
}

/* Two Sidebars on the Left */
.nf-layout--double-left {
    flex-direction: row;
}

.nf-layout--double-left .nf-sidebar-group--left {
    flex-direction: row;
    flex: 0 0 525px;
}

/* Two Sidebars on the Right */
.nf-layout--double-right {
    flex-direction: row;
}

.nf-layout--double-right .nf-sidebar-group--left {
    flex-direction: row;
    flex: 0 0 525px;
    order: 3;
}

.nf-layout--double-right .nf-main {
    order: 1;
}

.nf-layout--double-right .nf-sidebar-group--left .site-sidebar {
    flex: 1 1 0;
    width: 50%;
}

/* =========================================
   5. CONTENT WIDTH
========================================= */

.nf-layout--left .nf-main,
.nf-layout--right .nf-main,
.nf-layout--double-left .nf-main,
.nf-layout--double-right .nf-main {
    flex: 1 1 0;
}

.nf-layout--both .nf-main {
    flex: 1 1 0;
}

/* =========================================
   6. RESPONSIVE LAYOUT
========================================= */

@media (max-width: 1024px) {

    .nf-sidebar-group {
        flex-basis: 220px;
    }

    .nf-layout {
        gap: 18px;
    }

}

@media (max-width: 768px) {

    .nf-layout,
    .nf-layout--left,
    .nf-layout--right,
    .nf-layout--both,
    .nf-layout--double-left,
    .nf-layout--double-right {
        flex-direction: column;
    }

    .nf-sidebar-group {
        flex: 1 1 auto;
        width: 100%;
    }

    .nf-main {
        width: 100%;
    }

    .nf-layout--double-left .nf-sidebar-group--left,
    .nf-layout--double-right .nf-sidebar-group--left {
        flex-direction: row;
        flex: 1 1 auto;
    }

}

@media (max-width: 480px) {

    .nf-layout {
        padding: 20px 15px;
        gap: 20px;
    }

}

/* Mobile: content first, sidebars below */
@media (max-width: 768px) {

    .nf-layout>.nf-main {
        order: 1;
    }

    .nf-layout>.nf-sidebar-group {
        order: 2;
    }

}

/* CATEGORY ARCHIVE GRID */

.nf-archive-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
}

.nf-archive-card {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    background: var(--nf-card);
    border: 1px solid var(--nf-border);
    border-radius: var(--nf-card-radius, 9px);
    box-shadow: var(--nf-shadow-card, none);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nf-archive-card:hover {
    border-color: var(--nf-primary);
    box-shadow: var(--nf-shadow-hover, none);
}

.nf-archive-card__thumbnail {
    display: block;
    width: 100%;
    height: 125px;
    overflow: hidden;
}

.nf-archive-card__thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nf-archive-card__body {
    padding: 12px;
}

.nf-archive-card__title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.4;
}

.nf-archive-card__title a {
    color: var(--nf-text-light);
    text-decoration: none;
}

.nf-archive-card__excerpt {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    color: var(--nf-text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.nf-archive-card__readmore {
    display: inline-block;
    margin-top: 10px;
    color: var(--nf-primary);
    font-size: 12px;
    text-decoration: none;
}

@media (max-width: 1200px) {
    .nf-archive-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .nf-archive-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .nf-archive-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .nf-archive-card__thumbnail {
        height: 105px;
    }

    .nf-archive-card__body {
        padding: 9px;
    }
}

@media (max-width: 380px) {
    .nf-archive-grid {
        grid-template-columns: 1fr;
    }
}

/* Container width: avoid nested width restrictions */
.nf-container>.nf-layout {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 30px 0;
}