/* Blog Page Specific Styles - Premium Editorial Redesign */
/* Aesthetic: "Modern Editorial" - High contrast, serif headers, clean sans-serif body, elegant spacing */

:root {
    /* Color Palette - Premium & High Contrast */
    --text-primary: #0f172a;
    /* Deep Navy/Black for stark contrast */
    --text-secondary: #475569;
    /* Cool Slate Grey */
    --text-tertiary: #94a3b8;
    /* Muted Grey */
    --accent-color: #ef4444;
    /* Sharp modernized red accent */
    --bg-page: #fafafa;
    /* Off-white paper feel */
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    /* Light Slate Border */

    /* Typography - Google Fonts */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, system-ui, sans-serif;

    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    /* Soft premium shadow */
    --radius-lg: 12px;
}

/* Global Reset & Overflow Fix */
/* Global Reset & Overflow Fix */
body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
}

.blog_main_wrapper {
    background-color: var(--bg-page);
    min-height: 80vh;
}

.blog_container {
    display: flex;
    align-items: flex-start;
    /* Fix for sticky sidebar */
    gap: 5rem;
    padding-top: 5rem;
    padding-bottom: 8rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    /* Ensure it fits */
}

/* --- Main Content Area --- */
.blog_article {
    flex: 2;
    overflow: hidden;
    background: transparent;
    min-width: 0;
    /* Critical for flex child overflow */
}

/* Header Redesign: Title > Meta */
.blog_header {
    margin-bottom: 3rem;
    text-align: left;
}

.blog_title {
    font-family: var(--font-heading);
    font-size: 3.8rem;
    /* Large, editorial headline */
    line-height: 1.15;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.blog_meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-family: var(--font-body);
    font-size: 1.4rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-wrap: wrap;
}

.meta_item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.meta_icon {
    color: var(--text-tertiary);
}

.blog_dot {
    color: var(--border-color);
}

.header_separator {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, var(--border-color), transparent);
    margin: 0 0 4rem 0;
}

/* Content Typography */
.blog_content {
    font-family: var(--font-body);
    font-size: 1.8rem;
    /* Larger, readable body size */
    line-height: 1.8;
    color: #334155;
    /* Slightly softer than black */
    overflow-wrap: break-word;
    word-wrap: break-word;
    /* Backwards compatibility */
}

/* Prevent overflow for all media and code blocks */
.blog_content img,
.blog_content video,
.blog_content iframe,
.blog_content pre,
.blog_content table {
    max-width: 100%;
    height: auto;
}

/* Specific fix for tables which can be tricky */
.blog_content table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
}

/* Headings inside content */
.blog_content h1,
.blog_content h2,
.blog_content h3,
.blog_content h4 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    line-height: 1.3;
    font-weight: 600;
}

.blog_content h2 {
    font-size: 2.8rem;
    border-bottom: 1px solid transparent;
}

.blog_content h3 {
    font-size: 2.2rem;
}

.blog_content p {
    margin-bottom: 2rem;
}

/* Blockquotes */
.blog_content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 2rem;
    margin: 3rem 0;
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 2rem;
    color: var(--text-secondary);
    background: transparent;
}

/* Code Blocks */
.blog_content pre {
    background: #1e293b;
    /* Dark theme for code */
    color: #f1f5f9;
    padding: 2rem;
    border-radius: var(--radius-lg);
    overflow-x: auto;
    margin: 2.5rem 0;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 1.4rem;
    border: 1px solid #334155;
    white-space: pre-wrap;
    /* Wrap long focus lines */
    box-shadow: var(--shadow-soft);
}

.blog_content code {
    background: #e2e8f0;
    color: #0f172a;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: monospace;
}

/* --- Sidebar (Sticky & Styled) --- */
.blog_sidebar {
    width: 360px;
    flex-shrink: 0;
    position: sticky;
    top: 10rem;
    /* Increased top offset to clear header */
    height: fit-content;
    max-height: calc(100vh - 12rem);
    /* Ensure it fits in viewport */
    overflow-y: auto;
    /* Allow internal scrolling if content is too tall */
    scrollbar-width: none;
    /* Hide scrollbar for cleaner look */
}

.blog_sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar_widget {
    margin-bottom: 4rem;
}

.widget_title {
    font-family: var(--font-body);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* Stylized Recommendations List */
.ranking_list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.rec_item_li {
    list-style: none;
}

.rec_sidebar_card {
    display: block;
    text-decoration: none;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.rec_sidebar_card:hover {
    border-color: #cbd5e1;
    border-left-color: var(--accent-color);
    box-shadow: var(--shadow-soft);
    transform: translateX(4px);
}

.rec_sidebar_card.active {
    background: #fff1f2;
    /* Very light red/pink tint */
    border-color: #fecdd3;
    border-left-color: var(--accent-color);
}

.rec_sidebar_title {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

/* --- Breadcrumbs --- */
.blog_breadcrumbs {
    margin-bottom: 2rem;
    font-size: 1.4rem;
    color: var(--text-secondary);
}

.blog_breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.8rem;
    align-items: center;
}

.blog_breadcrumbs li {
    display: inline-flex;
    align-items: center;
}

.blog_breadcrumbs li:not(:last-child)::after {
    content: "/";
    margin-left: 0.8rem;
    color: var(--text-tertiary);
    font-weight: 300;
}

.blog_breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

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

.breadcrumb_active {
    color: var(--text-primary);
    font-weight: 600;
}

.rec_sidebar_meta {
    display: block;
    font-size: 1.2rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* Download Widget (2 Columns) */
.download_widget {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
    align-items: center;
}

.download_widget a {
    display: block;
    transition: transform 0.2s;
    width: 100%;
}

.download_widget a:hover {
    transform: translateY(-2px);
}

.download_widget img {
    /* Make images responsive to sidebar width, but not larger than intrinsic */
    width: 100%;
    max-width: none;
    /* Allow full width in grid cell */
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

/* --- Bottom Recommend --- */
.bottom_recs {
    border-top: 1px solid var(--border-color);
    padding: 6rem 0;
    background-color: #fff;
    margin-top: 4rem;
}

.section_title {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--text-primary);
    text-align: center;
}

.recs_grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    /* Match container */
    margin: 0 auto;
}

.rec_card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: white;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    /* For when it's an <a> tag */
    color: inherit;
    cursor: pointer;
}

.rec_card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
}

.rec_content {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.rec_tag {
    font-size: 1.1rem;
    text-transform: uppercase;
    color: var(--accent-color);
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.rec_content h3 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    line-height: 1.3;
}

.rec_content p {
    font-size: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
    flex-grow: 1;
}

.read_more {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid transparent;
    transition: border 0.2s;
}

.read_more span {
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.read_more:hover {
    border-bottom-color: var(--text-primary);
}

.read_more:hover span {
    transform: translateX(4px);
}

/* --- Download Icons --- */
.dl_icon_img {
    width: 3.2rem;
    height: 3.2rem;
    object-fit: contain;
    flex-shrink: 0;
}

/* --- Responsive Layout --- */
@media screen and (max-width: 1024px) {
    .blog_container {
        flex-direction: column;
        padding: 4rem 3rem;
        gap: 4rem;
        width: 100%;
        /* Ensure container fits */
    }

    .blog_sidebar {
        width: 100%;
        position: relative;
        top: 0;
        margin-top: 2rem;
        display: grid;
        grid-template-columns: 1fr 1fr;
        /* Side by side widgets on tablet? */
        gap: 3rem;
    }

    .sidebar_widget {
        margin-bottom: 0;
        /* Reset margin since we use grid gap */
    }
}

@media screen and (max-width: 768px) {
    .blog_container {
        padding: 3rem 2rem;
    }

    .blog_title {
        font-size: 2.8rem;
    }

    .blog_sidebar {
        grid-template-columns: 1fr;
        /* Stack widgets on mobile */
    }

    .recs_grid {
        grid-template-columns: 1fr;
    }

    .blog_article {
        overflow: visible;
        /* Prevent clipping */
    }

    /* Force 2-column download widget even on mobile */
    .download_widget {
        grid-template-columns: 1fr 1fr;
    }
}