/**
 * KFM CATE
 * Container width is injected inline by the plugin.
 */

:root {
    --kfmc-accent: var(--nv-primary-accent, #2f5aae);
    --kfmc-fallback-bg: #000000;
    --kfmc-fallback-color: #2ecc71;
}

/* ---------- Force full width (themes often cap archive content) ---------- */
body.kfmc-active .content-area,
body.kfmc-active main#main,
body.kfmc-active .nv-index-posts,
body.kfmc-active .nv-single-post-wrap,
body.kfmc-active #primary,
body.kfmc-active .kfmc-main {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* ---------- Wrapper ---------- */
body.kfmc-active .kfmc-wrap {
    width: 100%;
    max-width: var(--kfmc-container-width, 900px);
    margin: 0 auto;
    padding: 0 16px 28px;
}

/* ---------- Centered archive title ---------- */
body.kfmc-active .kfmc-header,
body.kfmc-active .page-header {
    margin: 10px 0 18px;
    text-align: center;
}

body.kfmc-active .kfmc-title {
    font-family: inherit;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin: 15px auto 10px;
    text-align: center;
}

body.kfmc-active .kfmc-archive-desc {
    margin: 0 auto 18px;
    max-width: 700px;
    text-align: center;
    opacity: .85;
}

/* ---------- List ---------- */
body.kfmc-active .kfmc-list,
body.kfmc-active .kfmc-excerpt,
body.kfmc-active .kfmc-excerpt p,
body.kfmc-active .kfmc-content .entry-summary,
body.kfmc-active .kfmc-content .entry-summary p {
    margin: 0;
    padding: 0;
}

body.kfmc-active .kfmc-item {
    position: relative;
    display: grid !important;
    align-items: start;
    margin: 0;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    transition: background-color .15s ease;
}

body.kfmc-active .kfmc-item:hover {
    background: rgba(0, 0, 0, .02);
}

/* ---------- Thumbnail ---------- */
body.kfmc-active .kfmc-thumb {
    display: block;
    line-height: 0;
    text-decoration: none;
    background: #f3f5f7;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

body.kfmc-active .kfmc-thumb img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 382 / 255;
    object-fit: cover;
    border-radius: 4px;
}

/* ---------- No featured image: title on a solid panel ---------- */
body.kfmc-active .kfmc-thumb-fallback {
    background: var(--kfmc-fallback-bg, #000);
    aspect-ratio: 382 / 255;
    line-height: normal;
}

body.kfmc-active .kfmc-fallback-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
}

body.kfmc-active .kfmc-fallback-text {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--kfmc-fallback-color, #2ecc71);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: .2px;
    word-break: break-word;
}

/* ---------- Text ---------- */
body.kfmc-active .kfmc-content {
    min-width: 0;
    position: relative;
    z-index: 2;
}

body.kfmc-active .kfmc-content .entry-title,
body.kfmc-active .kfmc-content h2,
body.kfmc-active .kfmc-entry-title {
    margin: 0 0 8px;
    line-height: 1.28;
    text-align: left;
}

body.kfmc-active .kfmc-entry-title a {
    text-decoration: none;
    position: static;
    color: inherit;
}

body.kfmc-active .kfmc-entry-title a:hover {
    color: var(--kfmc-accent);
}

/* Makes the whole row clickable */
body.kfmc-active .kfmc-entry-title a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* ---------- Category label ---------- */
body.kfmc-active .kfmc-meta {
    margin: 0 0 6px;
    line-height: 1;
}

body.kfmc-active .kfmc-cat {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 5px;
    background: #000;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    text-transform: uppercase;
    text-decoration: none;
    position: relative;
    z-index: 3;
}

body.kfmc-active .kfmc-cat:hover {
    background: var(--kfmc-accent);
    color: #fff;
}

/* ---------- Button ---------- */
body.kfmc-active .kfmc-cta {
    display: inline-block;
    margin-top: 10px;
    padding: 7px 12px;
    border: 1px solid var(--kfmc-accent);
    border-radius: 4px;
    color: var(--kfmc-accent);
    text-decoration: none;
    line-height: 1.2;
    position: relative;
    z-index: 3;
}

body.kfmc-active .kfmc-cta:hover {
    background: rgba(0, 0, 0, .03);
    color: var(--kfmc-accent);
}

/* ---------- Pagination ---------- */
body.kfmc-active .kfmc-pagination {
    padding-top: 18px;
    text-align: center;
}

body.kfmc-active .kfmc-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    margin: 0 3px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 2px;
    text-decoration: none;
}

body.kfmc-active .kfmc-pagination .current {
    background: var(--kfmc-accent);
    color: #fff;
    border-color: transparent;
}

/* ---------- Desktop ---------- */
@media (min-width: 769px) {
    body.kfmc-active .kfmc-item {
        grid-template-columns: 220px minmax(0, 1fr) !important;
        gap: 20px;
        padding: 22px 0;
    }

    body.kfmc-active .kfmc-content .entry-title,
    body.kfmc-active .kfmc-content h2,
    body.kfmc-active .kfmc-entry-title {
        font-size: 23px;
    }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
    body.kfmc-active .kfmc-wrap {
        max-width: 100%;
        padding: 0 12px 22px;
    }

    body.kfmc-active .kfmc-title {
        font-size: 27px;
        margin: 10px auto;
    }

    body.kfmc-active .kfmc-item {
        grid-template-columns: 145px minmax(0, 1fr) !important;
        gap: 12px;
        padding: 14px 0;
    }

    body.kfmc-active .kfmc-content .entry-title,
    body.kfmc-active .kfmc-content h2,
    body.kfmc-active .kfmc-entry-title {
        margin: 0 0 1px;
        font-size: 18px;
        line-height: 1.32;
    }

    body.kfmc-active .kfmc-content .entry-summary,
    body.kfmc-active .kfmc-excerpt {
        display: none !important;
    }

    body.kfmc-active .kfmc-fallback-text {
        -webkit-line-clamp: 3;
        line-clamp: 3;
        font-size: 12px;
        line-height: 1.2;
    }

    body.kfmc-active .kfmc-fallback-inner {
        padding: 6px;
    }

    body.kfmc-active .kfmc-meta {
        margin: 0 0 5px;
    }

    body.kfmc-active .kfmc-cat {
        padding: 2px 6px;
        font-size: 11px;
    }

    body.kfmc-active .kfmc-cta {
        margin-top: 8px;
        padding: 6px 10px;
        font-size: 14px;
    }
}

/* ---------- Homepage ---------- */
body.kfmc-home .kfmc-header {
    margin: 10px 0 14px;
}

/* Sidebar / widget column is not part of this layout */
body.kfmc-active .nv-sidebar-wrap,
body.kfmc-active #secondary,
body.kfmc-active .widget-area.nv-sidebar-wrap {
    display: none !important;
}
