/* ============================================================
 *  BLOG STYLES — China CNC Machining Co
 *  Loaded only on /blog/ pages via $page_styles.
 *  Reuses the site's design tokens (var(--primary), etc.).
 * ============================================================ */

/* ---------- Shared card bits ---------- */
.blog-card__cat,
.post-cat-badge {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--white);
    background: var(--primary);
    padding: 5px 12px;
    border-radius: 3px;
    line-height: 1.4;
}

.blog-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 0.82rem;
    color: var(--text-light);
    margin-top: auto;
}

.blog-card__meta i {
    color: var(--primary);
    margin-right: 4px;
}

/* ============================================================
 *  ARCHIVE / LISTING
 * ============================================================ */

/* Featured (newest) post — wide split card */
.blog-featured {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 40px;
    transition: var(--transition);
}

.blog-featured:hover {
    box-shadow: var(--omni-hover-shadow);
    transform: translateY(-2px);
}

.blog-featured__media {
    display: block;
    overflow: hidden;
}

.blog-featured__media img,
.blog-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.blog-featured:hover .blog-featured__media img,
.blog-card:hover .blog-card__media img {
    transform: scale(1.04);
}

.blog-featured__body {
    padding: 36px 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.blog-featured__title {
    font-size: 1.7rem;
    line-height: 1.25;
    margin: 4px 0 0;
}

.blog-featured__title a {
    color: var(--secondary);
    text-decoration: none;
    transition: var(--transition);
}

.blog-featured__title a:hover {
    color: var(--primary);
}

.blog-featured__excerpt {
    color: var(--text);
    line-height: 1.7;
    margin: 0;
}

.blog-featured__more {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95rem;
}

.blog-featured__more i {
    transition: transform 0.2s ease;
}

.blog-featured:hover .blog-featured__more i {
    transform: translateX(4px);
}

/* Grid of remaining posts */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.blog-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: var(--transition);
}

.blog-card:hover {
    box-shadow: var(--omni-hover-shadow);
    transform: translateY(-3px);
}

.blog-card__media {
    display: block;
    aspect-ratio: 5 / 3;
    overflow: hidden;
}

.blog-card__body {
    padding: 22px 24px 26px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.blog-card__title {
    font-size: 1.18rem;
    line-height: 1.3;
    margin: 2px 0 0;
}

.blog-card__title a {
    color: var(--secondary);
    text-decoration: none;
    transition: var(--transition);
}

/* Stretched link — whole card is clickable via the title */
.blog-card__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.blog-card__title a:hover {
    color: var(--primary);
}

.blog-card__excerpt {
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.65;
    margin: 0;
}

/* ---------- Empty state (no posts yet) ---------- */
.blog-empty {
    max-width: 620px;
    margin: 0 auto;
    text-align: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 56px 40px;
}

.blog-empty__icon {
    font-size: 2.6rem;
    color: var(--primary);
    margin-bottom: 18px;
}

.blog-empty__title {
    font-size: 1.5rem;
    color: var(--secondary);
    margin: 0 0 12px;
}

.blog-empty__text {
    color: var(--text);
    line-height: 1.7;
    margin: 0 0 28px;
}

.blog-empty__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

@media (max-width: 480px) {
    .blog-empty {
        padding: 40px 24px;
    }
    .blog-empty__actions .btn {
        width: 100%;
        text-align: center;
    }
}

/* ============================================================
 *  SINGLE POST
 * ============================================================ */

/* Hero extras */
.page-blog-single .post-cat-badge {
    margin-bottom: 16px;
}

.post-meta {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin: 20px 0 0;
    padding: 0;
}

.post-meta li {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.post-meta i {
    margin-right: 6px;
    opacity: 0.85;
}

/* Article shell — centered, readable measure */
.blog-single-section .post-shell {
    max-width: 820px;
    margin: 0 auto;
}

/* ---------- Post prose typography ---------- */
.post-prose {
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.75;
}

.post-prose > p {
    margin: 0 0 1.3rem;
}

.post-prose h2 {
    font-size: 1.6rem;
    color: var(--secondary);
    line-height: 1.3;
    margin: 2.5rem 0 1rem;
}

.post-prose h3 {
    font-size: 1.22rem;
    color: var(--secondary);
    line-height: 1.35;
    margin: 1.8rem 0 0.7rem;
}

.post-prose a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: var(--transition);
}

.post-prose a:hover {
    color: var(--primary-dark);
}

.post-prose ul,
.post-prose ol {
    margin: 0 0 1.4rem;
    padding-left: 1.4rem;
}

.post-prose li {
    margin: 0 0 0.7rem;
    line-height: 1.7;
}

.post-prose strong {
    color: var(--secondary);
}

/* Tables inside posts */
.post-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.6rem;
    font-size: 0.95rem;
}

.post-prose thead th {
    background: var(--secondary);
    color: var(--white);
    text-align: left;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 12px 16px;
}

.post-prose tbody td {
    border: 1px solid var(--border);
    padding: 11px 16px;
    vertical-align: top;
}

.post-prose tbody tr:nth-child(even) td {
    background: var(--light-bg);
}

/* In-content image + caption */
.post-figure {
    margin: 2rem 0;
}

.post-figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.post-figure figcaption {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
    text-align: center;
    font-style: italic;
}

/* Callout / key-takeaway box */
.post-callout {
    background: var(--light-bg);
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    padding: 20px 24px;
    margin: 2rem 0;
}

.post-callout p {
    margin: 0;
    color: var(--secondary);
    line-height: 1.7;
}

/* ---------- Post FAQ ---------- */
.post-faq {
    margin-top: 56px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.post-faq > h2 {
    font-size: 1.6rem;
    color: var(--secondary);
    margin: 0 0 24px;
}

/* ---------- In-article CTA box ---------- */
.post-cta-box {
    margin-top: 48px;
    background: var(--secondary);
    color: var(--white);
    border-radius: 12px;
    padding: 34px 36px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.post-cta-box__text {
    flex: 1 1 320px;
}

.post-cta-box__text h2 {
    color: var(--white);
    font-size: 1.5rem;
    margin: 0 0 8px;
}

.post-cta-box__text p {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.65;
}

.post-cta-box__actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
}

.post-cta-phone {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-family: var(--font-heading);
    font-weight: 600;
    text-decoration: none;
    font-size: 1.05rem;
}

.post-cta-phone i {
    color: var(--primary-light);
}

.post-cta-phone:hover {
    color: var(--primary-light);
}

/* ---------- Related posts ---------- */
.related-posts-section {
    padding-top: 64px;
}

/* ============================================================
 *  RESPONSIVE
 * ============================================================ */
@media (max-width: 992px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .blog-featured {
        grid-template-columns: 1fr;
    }
    .blog-featured__media {
        aspect-ratio: 16 / 9;
    }
    .blog-featured__body {
        padding: 30px 28px;
    }
}

@media (max-width: 640px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
    .blog-featured__title {
        font-size: 1.4rem;
    }
    .post-prose {
        font-size: 1rem;
    }
    .post-prose h2 {
        font-size: 1.4rem;
    }
    .post-cta-box {
        padding: 28px 24px;
    }
    .post-cta-box__actions {
        width: 100%;
    }
    .post-cta-box__actions .btn {
        width: 100%;
        text-align: center;
    }
    /* Let post tables scroll instead of breaking layout */
    .post-prose table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
