/**
 * KB Article Frontend Styles
 *
 * Styles for single-mmi_kb_article.php. Designed to work with Bricks
 * Builder's global typography/colour variables when available.
 *
 * @package MannMade\BricksChild
 */

/* ── Reset / Base ────────────────────────────────────────────────────────── */

.mmi-kb-article {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* ── Badges (shared with admin) ─────────────────────────────────────────── */

.mmi-kb-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.8;
}

.mmi-kb-badge--plugin       { background: #e8f4fd; color: #0073aa; }
.mmi-kb-badge--beginner     { background: #d7edff; color: #00609c; }
.mmi-kb-badge--intermediate { background: #fff3cd; color: #7a5800; }
.mmi-kb-badge--advanced     { background: #fde8e8; color: #b00000; }

/* ── Hero ────────────────────────────────────────────────────────────────── */

.mmi-kb-hero {
    padding: 36px 0 28px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 32px;
}

.mmi-kb-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 14px;
}

.mmi-kb-hero__reading-time {
    font-size: 12px;
    color: #767676;
    margin-left: 4px;
}

.mmi-kb-hero__title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 16px;
}

.mmi-kb-hero__bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #767676;
}

.mmi-kb-hero__bar a {
    color: #0073aa;
    text-decoration: none;
}

.mmi-kb-hero__verified {
    color: #1a7a2a;
}

/* ── Two-column Layout ───────────────────────────────────────────────────── */

.mmi-kb-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 768px) {
    .mmi-kb-layout {
        grid-template-columns: 1fr;
    }

    .mmi-kb-sidebar {
        order: 2;
    }

    .mmi-kb-content {
        order: 1;
    }
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.mmi-kb-sidebar {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* TOC */
.mmi-kb-sidebar__toc {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px 18px;
}

.mmi-kb-sidebar__toc-heading {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #767676;
    margin: 0 0 10px;
}

#mmi-kb-toc-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#mmi-kb-toc-nav > ul > li {
    margin-bottom: 4px;
}

#mmi-kb-toc-nav a {
    font-size: 13px;
    color: #1a1a1a;
    text-decoration: none;
    line-height: 1.4;
    display: block;
    padding: 2px 0;
    border-left: 2px solid transparent;
    padding-left: 8px;
    transition: border-color 0.15s, color 0.15s;
}

#mmi-kb-toc-nav a:hover,
#mmi-kb-toc-nav a.is-active {
    color: #0073aa;
    border-left-color: #0073aa;
}

#mmi-kb-toc-nav ul ul {
    padding-left: 12px;
    list-style: none;
    margin: 2px 0 2px;
}

#mmi-kb-toc-nav ul ul a {
    font-size: 12px;
    color: #646970;
}

/* Plugin card */
.mmi-kb-sidebar__plugin-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #0073aa;
    border-radius: 4px;
    padding: 12px 14px;
}

.mmi-kb-sidebar__plugin-card-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #767676;
    margin: 0 0 2px;
}

.mmi-kb-sidebar__plugin-card-name {
    font-weight: 600;
    font-size: 14px;
    margin: 0;
}

/* Related (sidebar) */
.mmi-kb-sidebar__related-heading {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #767676;
    margin: 0 0 8px;
}

.mmi-kb-sidebar__related ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mmi-kb-sidebar__related li {
    border-bottom: 1px solid #f0f0f0;
    padding: 5px 0;
}

.mmi-kb-sidebar__related a {
    font-size: 13px;
    color: #1a1a1a;
    text-decoration: none;
}

.mmi-kb-sidebar__related a:hover {
    color: #0073aa;
}

/* ── Content Area ────────────────────────────────────────────────────────── */

.mmi-kb-content {
    min-width: 0; /* prevent grid blowout */
}

.mmi-kb-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.mmi-kb-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
}

/* Screenshot placeholder */
.mmi-kb-content figure.mmi-kb-screenshot {
    margin: 24px 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #f8f9fa;
}

.mmi-kb-content figure.mmi-kb-screenshot figcaption {
    padding: 8px 12px;
    font-size: 12px;
    color: #646970;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

/* Step blocks */
.mmi-kb-content .mmi-kb-step {
    display: flex;
    gap: 16px;
    margin: 20px 0;
    padding: 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.mmi-kb-content .mmi-kb-step__number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #0073aa;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

/* Callout blocks */
.mmi-kb-content .mmi-kb-callout {
    padding: 14px 18px;
    border-radius: 4px;
    margin: 20px 0;
    font-size: 14px;
}

.mmi-kb-content .mmi-kb-callout--info    { background: #e8f4fd; border-left: 4px solid #0073aa; }
.mmi-kb-content .mmi-kb-callout--warning { background: #fff3cd; border-left: 4px solid #e65f00; }
.mmi-kb-content .mmi-kb-callout--tip     { background: #edf7ed; border-left: 4px solid #1a7a2a; }

/* ── Product CTA ─────────────────────────────────────────────────────────── */

.mmi-kb-cta {
    margin: 48px 0 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mmi-kb-cta__card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    background: #f0f6fc;
    border: 1px solid #c3daea;
    border-radius: 8px;
}

@media (max-width: 600px) {
    .mmi-kb-cta__card {
        flex-direction: column;
        align-items: flex-start;
    }
}

.mmi-kb-cta__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #767676;
    margin: 0 0 2px;
}

.mmi-kb-cta__name {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px;
}

.mmi-kb-cta__desc {
    font-size: 14px;
    color: #646970;
    margin: 0;
}

.mmi-kb-cta__btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── Related Grid ────────────────────────────────────────────────────────── */

.mmi-kb-related-grid {
    border-top: 1px solid #e0e0e0;
    padding-top: 32px;
    margin-top: 40px;
}

.mmi-kb-related-grid__heading {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.mmi-kb-related-grid__cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.mmi-kb-related-grid__card {
    padding: 16px 18px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
}

.mmi-kb-related-grid__card h3 {
    font-size: 15px;
    margin: 8px 0 6px;
}

.mmi-kb-related-grid__card h3 a {
    color: #1a1a1a;
    text-decoration: none;
}

.mmi-kb-related-grid__card h3 a:hover {
    color: #0073aa;
}

.mmi-kb-related-grid__card p {
    font-size: 13px;
    color: #646970;
    margin: 0;
}

/* ── WooCommerce product tab — Documentation ─────────────────────────────── */

.mmi-kb-product-docs {
    padding: 20px 0;
}

.mmi-kb-product-docs h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.mmi-kb-product-docs__intro {
    color: #646970;
    margin-bottom: 20px;
}

.mmi-kb-product-docs__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.mmi-kb-product-docs__card {
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mmi-kb-product-docs__card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
}

.mmi-kb-product-docs__card-title a {
    color: #1a1a1a;
    text-decoration: none;
}

.mmi-kb-product-docs__card-title a:hover {
    color: #0073aa;
}

.mmi-kb-product-docs__card-excerpt {
    font-size: 13px;
    color: #646970;
    margin: 0;
    flex: 1;
}

.mmi-kb-product-docs__card-link {
    font-size: 13px;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none;
}

.mmi-kb-product-docs__card-link:hover {
    text-decoration: underline;
}
