/**
 * INSIGHTS PAGE STYLES
 * Medium-style editorial layout, typography, and code highlighting
 */

/* ========================================
   HERO
   ======================================== */
.insights-hero {
    background: linear-gradient(135deg, var(--bg-soft) 0%, var(--bg-white) 100%);
    text-align: center;
}

.insights-hero-content {
    max-width: 700px;
    margin: 0 auto;
}

.topic-hero {
    background: linear-gradient(135deg, rgba(44, 109, 242, 0.05), var(--bg-white));
}

/* ========================================
   TOPIC FILTER BAR
   ======================================== */
.topic-bar {
    background: var(--bg-white);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: var(--space-md) 0;
    position: sticky;
    top: 48px;
    /* Below navbar */
    z-index: 100;
}

.topic-filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
}

.topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: var(--bg-soft);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-primary);
}

.topic-chip:hover {
    background: var(--accent-light);
    color: var(--accent-main);
}

.topic-chip.active {
    background: var(--accent-main);
    color: white;
}

.topic-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ========================================
   TOPIC TAGS (Colored)
   ======================================== */
.topic-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
}

.topic-tag-lg {
    padding: 8px 20px;
    font-size: 0.85rem;
}

/* Topic color map */
.topic-epidemiology {
    background: rgba(44, 109, 242, 0.1);
    color: #2c6df2;
}

.topic-clinical-ai {
    background: rgba(24, 164, 168, 0.1);
    color: #18a4a8;
}

.topic-sleep-medicine {
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

.topic-machine-learning {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.topic-data-engineering {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.topic-biostatistics {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

/* ========================================
   FEATURED GRID
   ======================================== */
.featured-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

@media (min-width: 768px) {
    .featured-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.featured-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    border-radius: var(--radius-soft);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    text-decoration: none;
    transition: transform var(--duration-fast) var(--ease-primary),
        box-shadow var(--duration-fast) var(--ease-primary);
}

.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.featured-image {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-soft);
}

.featured-image-placeholder {
    background: linear-gradient(135deg, var(--accent-light), var(--bg-soft));
}

.featured-content {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.featured-title {
    font-size: 1.2rem;
    margin: var(--space-sm) 0;
    color: var(--text-primary);
}

.featured-summary {
    font-size: 0.95rem;
    color: var(--text-secondary);
    flex-grow: 1;
    margin-bottom: var(--space-md);
}

/* ========================================
   POSTS GRID
   ======================================== */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
}

@media (min-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.post-card {
    display: block;
    background: var(--bg-white);
    border-radius: var(--radius-soft);
    padding: var(--space-lg);
    box-shadow: var(--shadow-soft);
    text-decoration: none;
    transition: transform var(--duration-fast) var(--ease-primary),
        box-shadow var(--duration-fast) var(--ease-primary);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.post-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-sm);
}

.post-title {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    line-height: 1.4;
}

.post-summary {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    line-height: 1.6;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* ========================================
   ARTICLE PAGE (Medium-style)
   ======================================== */
.article-header {
    background: var(--bg-soft);
    text-align: center;
    padding-bottom: var(--space-2xl);
}

.article-header-content {
    max-width: 720px;
    margin: 0 auto;
}

.article-title {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

.article-summary {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.article-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-tertiary);
    font-size: 0.95rem;
}

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

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

/* ========================================
   ARTICLE CONTENT (Prose Styling)
   ======================================== */
.article-body {
    padding: var(--space-2xl) 0;
}

.article-content {
    max-width: 720px;
    margin: 0 auto;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
}

/* Headings */
.article-content h2 {
    font-size: 1.75rem;
    margin: var(--space-2xl) 0 var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.article-content h3 {
    font-size: 1.4rem;
    margin: var(--space-xl) 0 var(--space-md);
}

.article-content h4 {
    font-size: 1.15rem;
    margin: var(--space-lg) 0 var(--space-sm);
}

/* Paragraphs */
.article-content p {
    margin-bottom: var(--space-lg);
}

/* Links */
.article-content a {
    color: var(--accent-main);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Lists */
.article-content ul,
.article-content ol {
    margin: var(--space-lg) 0;
    padding-left: 1.5em;
}

.article-content li {
    margin-bottom: var(--space-sm);
}

/* Blockquotes */
.article-content blockquote {
    margin: var(--space-xl) 0;
    padding: var(--space-lg);
    background: var(--bg-soft);
    border-left: 4px solid var(--accent-main);
    border-radius: 0 var(--radius-soft) var(--radius-soft) 0;
    font-style: italic;
    color: var(--text-secondary);
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Images */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-soft);
    margin: var(--space-xl) 0;
    box-shadow: var(--shadow-soft);
}

/* Tables */
.article-content table {
    width: 100%;
    margin: var(--space-xl) 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.article-content th,
.article-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.article-content th {
    background: var(--bg-soft);
    font-weight: 600;
}

.article-content tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Code (Inline) */
.article-content code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Code Blocks (Pygments / CodeHilite) */
.article-content .codehilite {
    margin: var(--space-xl) 0;
    border-radius: var(--radius-soft);
    overflow-x: auto;
    background: #1e1e2e;
    padding: var(--space-lg);
}

.article-content .codehilite pre {
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #cdd6f4;
}

.article-content .codehilite code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* Horizontal rules */
.article-content hr {
    border: none;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: var(--space-2xl) 0;
}

/* ========================================
   RELATED POSTS
   ======================================== */
.related-posts {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    padding: var(--space-2xl);
    background: var(--bg-soft);
    border-radius: var(--radius-soft);
}

/* ========================================
   SECTION TITLE
   ======================================== */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}