/* ================================================================= */
/* PAGE-SPECIFIC STYLES: BLOG (blog.css) */
/* Contains styles for blog index and single post layouts. */
/* ================================================================= */

/* --- 1. Blog Index Page Styles --- */
/* ------------------------------------------------------------- */

/* Hero section specific to blog index */
.blog-hero {
    padding: var(--spacing-lg) 0;
    text-align: center;

    /* --- Styles copied from .solution-section in home.css --- */
    background-color: var(--color-accent-highlight);
    --grid-line-color: rgba(255, 255, 255, 0.02);
    /* Faint light lines */
    background-image:
        linear-gradient(var(--grid-line-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line-color) 1px, transparent 1px);
    background-size: 40px 40px;
    /* Size of the grid squares */
}

.blog-hero .page-headline {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
    color: #fff;
    /* Ensures text is readable on the dark background */
}

.blog-hero .page-subheadline {
    font-size: var(--font-size-lg);
    color: rgba(255, 255, 255, 0.85);
    /* Lighter text for dark background */
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* Grid layout section */
.blog-grid-section {
    padding: var(--spacing-lg) 0;
}

/* Blog Post Grid */
.blog-post-grid {
    display: grid;
    /* Use auto-fit for responsive columns */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-md);
}

/* Styling for blog cards, extending .media-card */
.blog-card {
    /* Base styles inherited from .media-card (components.css) */
    background-color: var(--color-bg-secondary);
    /* Ensure bg color */
    display: flex;
    /* Ensure flex layout */
    flex-direction: column;
    /* Stack image and content */
}

.blog-card-content {
    padding: var(--spacing-sm);
    /* Add padding inside */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Allow content to fill space */
}

.blog-card-meta {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xs);
    text-transform: normal;
    letter-spacing: 0.5px;
}

.blog-card-category {
    color: var(--color-text-secondary);
}

.blog-card-title {
    /* Inherits from .media-card-title */
    margin-top: 0;
    margin-bottom: var(--spacing-xs);
}

.blog-card-link {
    margin-bottom: 0;
}


/* --- 2. Single Blog Post Page Styles --- */
/* ------------------------------------------------------------- */
.blog-post-main {
    padding: var(--spacing-lg) 0;
    /* Add padding around main content */
}

.blog-post-layout {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    /* Main content wider than sidebar */
    gap: var(--spacing-lg);
    align-items: flex-start;
    /* Align top of sidebar to top of content */
}

/* Header within the article */
.blog-post-header {
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-bg-secondary);
    padding-bottom: var(--spacing-md);
}

.post-meta {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.post-category {
    font-weight: var(--font-weight-bold);
    color: var(--color-accent-primary);
    /* Blue category */
}

.post-title {
    /* Inherits h1 styles */
    font-size: 3rem;
    /* Larger title for posts */
    margin-top: 0;
    margin-bottom: var(--spacing-xs);
}

.post-author {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

/* Main body content styles */
.post-body {
    font-size: var(--font-size-lg);
    /* Slightly larger for readability */
    line-height: 1.8;
    /* More line height for reading */
    color: var(--color-text-primary);
}

.post-body p {
    margin-bottom: var(--spacing-md);
    /* More space between paragraphs */
}

.post-body h2 {
    font-size: 2rem;
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--color-bg-secondary);
}

.post-body h3 {
    font-size: 1.5rem;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.post-body ul,
.post-body ol {
    margin-bottom: var(--spacing-md);
    padding-left: 30px;
    /* Indent lists */
}

.post-body li {
    margin-bottom: var(--spacing-xs);
}

.post-body blockquote {
    font-family: var(--font-family-header);
    font-style: italic;
    font-size: 1.2em;
    color: var(--color-text-secondary);
    border-left: 3px solid var(--color-accent-primary);
    /* Blue accent */
    padding-left: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.post-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: var(--spacing-md) 0;
    border-radius: var(--border-radius-base);
}

/* Sidebar Styles */
.blog-sidebar {
    position: sticky;
    /* Adjust top offset based on your header height + desired gap */
    top: 120px;
}

.sidebar-sticky-content {
    background-color: var(--color-bg-secondary);
    border-radius: var(--border-radius-img);
    padding: var(--spacing-md);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-sticky-content h4 {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.sidebar-headshot {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto var(--spacing-sm) auto;
    display: block;
}

.sidebar-sticky-content p {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-md);
}

.sidebar-cta {
    margin-top: 0;
    /* Remove default button margin */
    display: block;
    /* Make button full width */
}

/* --- Responsive Video Embed --- */
/* Add this to the bottom of the file */

.video-embed-container {
    position: relative;
    /* 16:9 aspect ratio */
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    /* Use spacing variable from _variables.css */
    margin: 0 0 var(--spacing-md, 1.5rem);
}

.video-embed-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


/* --- 3. Responsive Styles for Blog --- */
/* ------------------------------------------------------------- */

@media (max-width: 950px) {

    /* Stack single post layout */
    .blog-post-layout {
        grid-template-columns: 1fr;
        /* Single column */
    }

    .blog-sidebar {
        position: static;
        /* Un-stick sidebar */
        top: auto;
        margin-top: var(--spacing-lg);
        /* Add space above when stacked */
        max-width: 500px;
        /* Constrain width */
        margin-left: auto;
        margin-right: auto;
    }

    .post-title {
        font-size: 2.5rem;
        /* Slightly smaller */
    }
}

@media (max-width: 600px) {
    .blog-post-grid {
        grid-template-columns: 1fr;
        /* Force single column earlier */
    }

    .post-title {
        font-size: 2rem;
        /* Even smaller */
    }

    .post-body {
        font-size: var(--font-size-base);
        /* Standard body size */
    }
}

/* --- Blog Tables --- */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: var(--spacing-md) 0;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    border: 1px solid var(--color-bg-secondary);
    /* Optional: hints at scrollable area */
    border-radius: var(--border-radius-base);
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    min-width: 600px;
    /* Force table to maintain width so it triggers scroll */
}

.post-body th,
.post-body td {
    border: 1px solid var(--color-border);
    padding: var(--spacing-sm);
    text-align: left;
}

.post-body th {
    background-color: var(--color-bg-secondary);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
}

.post-body tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.post-body tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

@media (max-width: 600px) {

    /* STACKED "CARD" TABLE STYLE */
    .post-body table,
    .post-body thead,
    .post-body tbody,
    .post-body th,
    .post-body td,
    .post-body tr {
        display: block;
    }

    /* Hide headers (they will be labels) */
    .post-body thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .post-body tr {
        margin-bottom: var(--spacing-md);
        border: 1px solid var(--color-border);
        border-radius: var(--border-radius-base);
        background-color: var(--color-bg-secondary);
        padding: var(--spacing-md);
    }

    .post-body tr:nth-child(even) {
        /* Keep consistent bg in card mode */
        background-color: var(--color-bg-secondary);
    }

    .post-body td {
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        /* Subtle separator */
        position: relative;
        padding-left: 0;
        padding-right: 0;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        text-align: right;
        /* Value on right */
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: transparent !important;
        /* Override hover/stripe */
    }

    .post-body td:last-child {
        border-bottom: none;
    }

    .post-body td::before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--color-text-secondary);
        margin-right: 1rem;
        text-align: left;
    }

    /* Allow the scroll wrapper to just fit content */
    .table-wrapper {
        border: none;
        overflow-x: visible;
        /* No scroll needed now */
        border-radius: 0;
    }

    .post-body table {
        min-width: 0;
        /* Unset min-width constraint */
    }
}