/* =====================================================================
   Blog Engine — shared styles for blog.php (listing) & blog-single.php
   Design language matched to the site's existing dark navy / cyan brand.
   Mobile-first, fully responsive.
   ===================================================================== */

:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #baeafb;
    --accent-dark: #0ea5e9;
    --text-main: #475569;
    --text-dark: #1e293b;
    --bg-light: #f8fafc;
    --white: #ffffff;
    --code-bg: #0f172a;
    --border: #e2e8f0;
}

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

body.blog-engine {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-light);
    color: var(--text-main);
    line-height: 1.8;
    scroll-behavior: smooth;
}

img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* PROGRESS BAR */
.progress-container { position: fixed; top: 0; z-index: 2000; width: 100%; height: 4px; background: #e2e8f0; }
.progress-bar { height: 4px; background: var(--accent-dark); width: 0%; border-radius: 0 5px 5px 0; transition: width .1s; }

/* NAVIGATION */
.blog-nav {
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(15px);
    color: white;
    padding: 14px 6%;
    display: flex; justify-content: space-between; align-items: center;
    position: fixed; top: 0; width: 100%; z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.blog-nav .logo-wrapper img { height: 42px; width: auto; display: block; }
.blog-nav .nav-links { display: flex; align-items: center; gap: 30px; }
.blog-nav .nav-links a { color: #cbd5e1; text-decoration: none; font-size: 14px; font-weight: 500; transition: .3s; }
.blog-nav .nav-links a:hover, .blog-nav .nav-links a.active { color: var(--accent); }
.blog-nav .nav-toggle {
    display: none; background: none; border: none; color: white; font-size: 22px; cursor: pointer;
}

@media (max-width: 820px) {
    .blog-nav .nav-links {
        position: fixed; top: 68px; right: 0; left: 0;
        background: rgba(15, 23, 42, 0.98);
        flex-direction: column; align-items: flex-start; gap: 0;
        max-height: 0; overflow: hidden; transition: max-height .3s ease;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .blog-nav .nav-links.open { max-height: 400px; }
    .blog-nav .nav-links a { width: 100%; padding: 16px 6%; border-top: 1px solid rgba(255,255,255,.06); }
    .blog-nav .nav-toggle { display: block; }
}

/* HERO (listing page) */
.blog-hero {
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    color: white;
    padding: 150px 6% 90px;
    text-align: center;
}
.blog-hero .badge {
    background: rgba(186, 234, 251, 0.1); color: var(--accent);
    padding: 8px 20px; border-radius: 50px; font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px; border: 1px solid rgba(186, 234, 251, 0.2);
    display: inline-block;
}
.blog-hero h1 {
    font-size: clamp(2rem, 6vw, 3.6rem); font-weight: 800; margin: 24px 0 16px;
    line-height: 1.15; letter-spacing: -1.5px;
}
.blog-hero p { max-width: 720px; margin: 0 auto; font-size: clamp(1rem, 2vw, 1.2rem); color: #94a3b8; }

/* CATEGORY FILTER TABS */
.category-filter {
    display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
    max-width: 1100px; margin: -30px auto 0; padding: 0 20px 10px; position: relative; z-index: 5;
}
.category-filter a {
    background: var(--white); color: var(--text-dark); padding: 10px 20px;
    border-radius: 50px; font-size: 13px; font-weight: 700; border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,.05); transition: .2s;
    white-space: nowrap;
}
.category-filter a:hover { border-color: var(--accent-dark); color: var(--accent-dark); }
.category-filter a.active { background: var(--primary); color: var(--accent); border-color: var(--primary); }

/* BLOG GRID (listing) */
.blog-grid-wrap { max-width: 1200px; margin: 50px auto 0; padding: 0 20px 100px; }
.blog-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px;
}
@media (max-width: 992px) { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .blog-grid { grid-template-columns: 1fr; } }

.blog-card {
    background: var(--white); border-radius: 22px; overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,.05); border: 1px solid #f1f5f9;
    display: flex; flex-direction: column; transition: transform .25s, box-shadow .25s;
}
.blog-card:hover { transform: translateY(-6px); box-shadow: 0 20px 40px rgba(0,0,0,.1); }
.blog-card-img { position: relative; aspect-ratio: 16/10; overflow: hidden; background: #e2e8f0; }
.blog-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.blog-card:hover .blog-card-img img { transform: scale(1.06); }
.blog-card-cat {
    position: absolute; top: 14px; left: 14px; padding: 6px 14px; border-radius: 50px;
    font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
    color: white; backdrop-filter: blur(4px);
}
.blog-card-body { padding: 26px; display: flex; flex-direction: column; flex: 1; }
.blog-card-meta { font-size: 12px; color: #94a3b8; margin-bottom: 10px; display: flex; gap: 14px; flex-wrap: wrap; }
.blog-card-title { font-size: 1.2rem; font-weight: 800; color: var(--text-dark); line-height: 1.35; margin-bottom: 12px; }
.blog-card-title a { color: inherit; }
.blog-card-title a:hover { color: var(--accent-dark); }
.blog-card-excerpt { font-size: .92rem; color: var(--text-main); flex: 1; margin-bottom: 18px; }
.blog-card-readmore { font-size: 13px; font-weight: 700; color: var(--accent-dark); display: inline-flex; align-items: center; gap: 6px; }
.blog-card-readmore .arrow { transition: transform .2s; }
.blog-card:hover .blog-card-readmore .arrow { transform: translateX(4px); }

.blog-empty { text-align: center; padding: 80px 20px; color: #94a3b8; }

/* PAGINATION */
.blog-pagination { display: flex; justify-content: center; gap: 10px; margin-top: 50px; flex-wrap: wrap; }
.blog-pagination a, .blog-pagination span {
    min-width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
    border-radius: 12px; background: var(--white); border: 1px solid var(--border);
    font-weight: 700; font-size: 14px; color: var(--text-dark);
}
.blog-pagination a:hover { border-color: var(--accent-dark); color: var(--accent-dark); }
.blog-pagination .current { background: var(--primary); color: var(--accent); border-color: var(--primary); }

/* SINGLE POST HERO */
.post-hero {
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    color: white; padding: 150px 6% 90px; text-align: center;
}
.post-hero .badge { background: rgba(186,234,251,.1); color: var(--accent); padding: 8px 20px; border-radius: 50px;
    font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px;
    border: 1px solid rgba(186,234,251,.2); display: inline-block; }
.post-hero h1 { font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 800; margin: 24px 0 18px; line-height: 1.2; letter-spacing: -1px; max-width: 900px; margin-left: auto; margin-right: auto; }
.post-hero .post-meta-top { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; color: #94a3b8; font-size: 14px; }
.post-hero .post-meta-top span { display: flex; align-items: center; gap: 6px; }

/* SINGLE POST LAYOUT */
.post-container { max-width: 1100px; margin: -60px auto 0; padding: 0 20px 100px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; }
@media (max-width: 992px) { .post-container { grid-template-columns: minmax(0, 1fr); } .post-sidebar { order: 2; } }

.post-content-area { min-width: 0; background: var(--white); padding: 50px; border-radius: 26px; box-shadow: 0 25px 50px -12px rgba(0,0,0,.08); border: 1px solid #f1f5f9; }
@media (max-width: 640px) { .post-content-area { padding: 28px 20px; } }

.post-content-area h2 { font-size: clamp(1.4rem, 3vw, 2rem); color: var(--text-dark); margin: 46px 0 20px; font-weight: 800; letter-spacing: -.5px; }
.post-content-area h3 { font-size: clamp(1.1rem, 2.4vw, 1.4rem); color: var(--text-dark); margin: 30px 0 14px; font-weight: 700; }
.post-content-area p { margin-bottom: 22px; font-size: clamp(1rem, 1.6vw, 1.1rem); color: var(--text-main); overflow-wrap: break-word; word-break: break-word; }
.post-content-area ul, .post-content-area ol { margin: 0 0 22px 22px; }
.post-content-area li { margin-bottom: 10px; font-size: 1.02rem; overflow-wrap: break-word; word-break: break-word; }
.post-content-area strong { color: var(--text-dark); }
.post-content-area code { background: #f1f5f9; padding: 2px 7px; border-radius: 6px; font-family: 'IBM Plex Mono', monospace; font-size: .9em; color: #db2777; }
.featured-img { width: 100%; border-radius: 18px; margin: 18px 0 36px; box-shadow: 0 15px 35px rgba(0,0,0,.1); }

.callout { background: #f0f9ff; padding: 26px; border-radius: 18px; border-left: 6px solid var(--accent-dark); margin: 36px 0; }
.callout h4 { color: #0369a1; margin-bottom: 10px; font-size: 1.1rem; }

.code-container { margin: 28px 0; border-radius: 14px; overflow: hidden; background: var(--code-bg); }
.code-header { background: #1e293b; padding: 12px 20px; color: #94a3b8; font-family: monospace; font-size: 12px; display: flex; justify-content: space-between; }
.code-body { padding: 22px; color: #38bdf8; font-family: 'IBM Plex Mono', monospace; font-size: 13px; overflow-x: auto; white-space: pre; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 24px 0; }
@media (max-width: 560px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-box { background: #f1f5f9; padding: 16px 10px; border-radius: 12px; text-align: center; font-size: 12.5px; }
.stat-box span { display: block; font-size: 20px; font-weight: 800; color: var(--accent-dark); }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.tag-list span { background: #f1f5f9; padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-dark); }

/* SIDEBAR */
.post-sidebar { position: sticky; top: 100px; height: fit-content; }
.author-card { background: var(--primary); color: white; padding: 30px; border-radius: 24px; text-align: center; }
.author-card img { width: 90px; height: 90px; border-radius: 50%; border: 4px solid var(--accent); margin: 0 auto 18px; object-fit: cover; }
.author-card h3 { color: #fff; margin: 8px 0; font-size: 1.15rem; }
.author-card p { font-size: .88rem; color: #94a3b8; margin-bottom: 18px; }
.btn-contact { background: var(--accent); color: var(--primary); padding: 12px 25px; border-radius: 12px; text-decoration: none; font-weight: 700; display: inline-block; transition: .3s; font-size: 14px; }
.btn-contact:hover { opacity: .85; }

.related-box { margin-top: 26px; padding: 22px; background: #fff; border-radius: 20px; border: 1px solid var(--border); }
.related-box h4 { margin-bottom: 16px; color: var(--text-dark); font-size: 1rem; }
.related-item { display: flex; gap: 12px; margin-bottom: 14px; align-items: flex-start; }
.related-item img { width: 60px; height: 60px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.related-item a { font-size: .85rem; font-weight: 700; color: var(--text-dark); line-height: 1.35; }
.related-item a:hover { color: var(--accent-dark); }

/* FOOTER */
.blog-footer { background: var(--primary); color: #64748b; padding: 60px 6% 34px; text-align: center; margin-top: 80px; }
.blog-footer p { font-size: 13px; }
.blog-footer .footer-links { margin-bottom: 16px; display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
.blog-footer .footer-links a { color: #cbd5e1; font-size: 13px; }
.blog-footer .footer-links a:hover { color: var(--accent); }

/* BREADCRUMB */
.blog-breadcrumb { max-width: 1100px; margin: 0 auto; padding: 0 20px; font-size: 13px; color: #94a3b8; }
.blog-breadcrumb a { color: #94a3b8; }
.blog-breadcrumb a:hover { color: var(--accent); }
