/* ======================================
   BLOG FRONTEND STYLES
   Modular — inherits from host site CSS vars
   ====================================== */

/* Blog Header */
.blog-header {
    padding: 12rem 0 4rem;
    text-align: center;
    background: var(--bg-concrete, #0f0f0f);
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.blog-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 0.75rem;
}

.blog-header p {
    color: var(--text-secondary, #999);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* Tag Filters */
.blog-filters {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.tag-filter-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag-btn {
    padding: 0.4rem 1rem;
    background: transparent;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 20px;
    color: var(--text-secondary, #999);
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-btn:hover {
    border-color: var(--accent-oxide, #ef4444);
    color: var(--text-primary, #f0f0f0);
}

.tag-btn.active {
    background: var(--accent-oxide, #ef4444);
    border-color: var(--accent-oxide, #ef4444);
    color: white;
}

/* Blog Grid */
.blog-grid-section {
    padding: 4rem 0;
    min-height: 50vh;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

.blog-card {
    background: var(--bg-card, #141414);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-oxide, #ef4444);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.blog-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.blog-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.blog-card-date {
    font-family: var(--font-mono, monospace);
    font-size: 0.7rem;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.blog-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.blog-card-excerpt {
    color: var(--text-secondary, #999);
    font-size: 0.9rem;
    line-height: 1.6;
    flex: 1;
}

.blog-card-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.blog-card-tag {
    font-family: var(--font-mono, monospace);
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    color: var(--text-muted, #666);
}

/* Pagination */
.blog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    padding: 3rem 0;
}

.btn-page {
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    color: var(--text-secondary, #999);
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-page:hover:not(:disabled) {
    border-color: var(--accent-oxide, #ef4444);
    color: var(--text-primary, #f0f0f0);
}

.btn-page:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    color: var(--text-muted, #666);
}

/* Loading / Empty */
.blog-loading,
.blog-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted, #666);
    font-size: 1rem;
}

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

.blog-post {
    padding: 10rem 0 6rem;
}

.post-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.back-link {
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    color: var(--text-muted, #666);
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--accent-oxide, #ef4444);
}

.post-meta {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.post-date,
.post-author {
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    color: var(--text-muted, #666);
}

.post-featured-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.blog-post h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.2;
    margin-bottom: 1rem;
    max-width: 800px;
}

.post-tags-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.post-tag {
    font-family: var(--font-mono, monospace);
    font-size: 0.7rem;
    padding: 0.25rem 0.7rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    color: var(--accent-oxide, #ef4444);
    text-decoration: none;
}

/* Post Body — Rich Content */
.post-body {
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--text-secondary, #ccc);
    max-width: 750px;
}

.post-body h2 {
    font-size: 1.6rem;
    color: var(--text-primary, #f0f0f0);
    margin-top: 3rem;
    margin-bottom: 1rem;
}

.post-body h3 {
    font-size: 1.3rem;
    color: var(--text-primary, #f0f0f0);
    margin-top: 2.5rem;
}

.post-body p {
    margin-bottom: 1.5rem;
}

.post-body a {
    color: var(--accent-oxide, #ef4444);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-body a:hover {
    text-decoration: none;
}

.post-body img {
    max-width: 100%;
    border-radius: 12px;
    margin: 2rem 0;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.post-body blockquote {
    border-left: 3px solid var(--accent-oxide, #ef4444);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: var(--text-muted, #999);
    font-style: italic;
}

.post-body pre {
    background: #0f0f0f;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 2rem 0;
    font-family: var(--font-mono, monospace);
    font-size: 0.85rem;
}

.post-body code {
    font-family: var(--font-mono, monospace);
    background: rgba(255, 255, 255, 0.06);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}

.post-body ul,
.post-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.post-body li {
    margin-bottom: 0.5rem;
}

/* Post CTA */
.post-cta {
    margin-top: 4rem;
    padding: 3rem;
    background: var(--bg-card, #141414);
    border: 1px solid var(--accent-oxide, #ef4444);
    border-radius: 16px;
    text-align: center;
    max-width: 600px;
}

.post-cta h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.post-cta p {
    color: var(--text-secondary, #999);
    margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 600px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }

    .post-meta-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Image Wrapper for CLS Prevention */
.blog-card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: var(--bg-card);
    overflow: hidden;
    border-bottom: 1px solid var(--border-subtle);
}

.blog-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-bottom: none;
    /* Override previous */
    transition: transform 0.5s ease;
}

.blog-card:hover .blog-card-image {
    transform: scale(1.05);
}

/* Single Post Featured Image Wrapper */
.post-featured-wrapper {
    width: 100%;
    aspect-ratio: 21 / 9;
    background-color: var(--bg-card);
    margin-bottom: 2.5rem;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    position: relative;
}

.post-featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin-bottom: 0;
    /* Reset */
    border: none;
    /* Reset */
    border-radius: 0;
    /* Reset */
}