:root {
    --bg-paper: #f9f8f4;
    --bg-white: #ffffff;
    --border-subtle: #e1e1de;
    --border-strong: #2c3e50;
    --text-primary: #1a1a1a;
    --text-secondary: #5a5a5a;
    --academic-green: #34495e;
    /* Actually a deep slate blue/green */
    --academic-accent: #8c7b6c;
    /* Earthy taupe */
    --news-color: #2c3e50;
    --social-color: #7f8c8d;
    --pillar-e: #4e6e5d;
    /* Muted Green */
    --pillar-s: #a67c52;
    /* Muted Gold/Brown */
    --pillar-g: #6c5b7b;
    /* Muted Purple */
    --radius: 4px;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.03);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Lora:ital,wght@0,400;0,600;0,700;1,400&display=swap');

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

body {
    background-color: var(--bg-paper);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    padding: 3rem 1.5rem;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

header {
    border-bottom: 2px solid var(--border-strong);
    padding-bottom: 2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.header-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

h1 {
    font-family: 'Lora', serif;
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.meta-info {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-subtle);
    padding-top: 0.5rem;
    display: inline-block;
}

/* Academic Tabs - Sticky Navigation */
.tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    background-color: var(--bg-paper);
    z-index: 1000;
    padding: 0.75rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

/* Add a subtle border when sticking (optional but recommended) */
.tabs.active-sticky {
    border-bottom-color: var(--border-subtle);
    box-shadow: var(--shadow-soft);
}

.tab-btn {
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--border-strong);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.active {
    display: block;
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 4rem;
}

.stat-card {
    background: var(--bg-white);
    padding: 2rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    text-align: center;
}

.stat-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.stat-value {
    font-family: 'Lora', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--academic-green);
}

.stat-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    font-style: italic;
}

/* Charts and Layout */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.charts-row.news-specific {
    grid-template-columns: 2fr 1fr;
}

.charts-row-full {
    grid-template-columns: 1fr;
    margin-bottom: 2rem;
}

.charts-row-2-1 {
    grid-template-columns: 2fr 1fr;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg-white);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 2rem;
}

.chart-card.limited-height canvas {
    height: 300px !important;
    max-height: 300px;
}

.chart-title {
    font-family: 'Lora', serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--border-strong);
    padding-left: 1rem;
}

.chart-caption {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.chart-caption strong {
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-row {
    display: flex;
    gap: 1rem;
}

.section-header {
    margin: 4rem 0 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.section-header h3 {
    font-family: 'Lora', serif;
    font-size: 1.5rem;
    color: var(--academic-green);
    margin: 0;
}

.section-header span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

/* News Explorer Table */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 3rem;
    margin-top: 3rem;
}

.card-title {
    font-family: 'Lora', serif;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.card-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.filter-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 1.25rem;
    margin-bottom: 2rem;
    background: var(--bg-paper);
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow-x: auto;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
    min-width: 140px;
}

.filter-group:first-child {
    flex: 2;
    /* Give search more space */
    min-width: 200px;
}

.filter-group label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    display: block;
}

.filter-group select,
.filter-group input {
    padding: 0.5rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    background: white;
    min-width: 150px;
}

.table-container {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg-paper);
    text-align: left;
    padding: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-subtle);
}

td {
    padding: 1.25rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
}

tr:hover {
    background-color: #fcfcfc;
}

.company-pill {
    font-weight: 600;
    color: #7f8c8d;
}

.news-title-cell {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.news-title-cell:hover {
    text-decoration: underline;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
}

.page-btn {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    cursor: pointer;
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-paper);
    border-color: var(--border-strong);
}

/* Methodology */
.method-flow {
    max-width: 800px;
    margin: 3rem auto;
}

.method-step {
    display: flex;
    gap: 3rem;
    margin-bottom: 4rem;
}

.method-icon {
    width: 3rem;
    height: 3rem;
    background: var(--border-strong);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Lora', serif;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
    border-radius: var(--radius);
}

.method-card h3 {
    font-family: 'Lora', serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.method-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.method-tags {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.method-tag {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-paper);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    text-transform: uppercase;
}

.tech-highlight {
    color: var(--text-primary);
    font-weight: 600;
    background: #fff8e1;
    /* Subtle highlight */
    padding: 0 0.2rem;
}

/* Footer Styles */
footer {
    margin-top: 6rem;
    padding-top: 4rem;
    padding-bottom: 2rem;
    border-top: 2px solid var(--border-strong);
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-brand {
    font-family: 'Lora', serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.footer-text strong {
    color: var(--text-primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-right: 0.3rem;
}

.footer-bottom {
    border-top: 1px solid var(--border-subtle);
    padding-top: 2rem;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* Tablet and Mobile Optimization */
@media (max-width: 1024px) {
    .container {
        max-width: 900px;
    }

    .stats-grid {
        gap: 1.5rem;
    }

    .charts-row,
    .charts-row.news-specific,
    .charts-row-full,
    .charts-row-2-1 {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    canvas {
        max-width: 100% !important;
    }

    .footer-grid {
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1.5rem 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .tabs {
        gap: 1.5rem;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0.75rem 1.5rem;
        margin: 0 -1.5rem 2rem;
        width: calc(100% + 3rem);
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid var(--border-subtle);
        background-color: var(--bg-paper);
    }

    .tabs::-webkit-scrollbar {
        height: 3px;
    }

    .tabs::-webkit-scrollbar-thumb {
        background: var(--border-subtle);
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        margin-bottom: 2.5rem;
    }

    .stat-card {
        padding: 1.5rem;
    }

    .chart-card {
        padding: 1.25rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .filter-bar {
        flex-wrap: wrap;
        padding: 1rem;
    }

    .filter-group {
        min-width: calc(50% - 0.75rem);
    }

    .filter-group:first-child {
        min-width: 100%;
    }

    .filter-row {
        flex-wrap: wrap;
    }

    .flex-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-container {
        overflow-x: auto;
        border: none;
        margin: 0 -1.5rem;
        padding: 0 1.5rem;
    }

    table {
        min-width: 600px;
        /* Force scroll for table content */
    }

    .method-step {
        gap: 1.5rem;
        margin-bottom: 3rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }

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

    .header-top {
        gap: 0.5rem;
    }

    .tab-btn {
        font-size: 0.75rem;
    }

    .chart-card {
        padding: 1.25rem;
    }

    .filter-group {
        min-width: 100%;
    }

    .page-info {
        font-size: 0.7rem;
    }

    .footer-col {
        text-align: center;
    }

    .footer-header::after {
        content: '';
        display: block;
        width: 30px;
        height: 1px;
        background: var(--border-strong);
        margin: 0.5rem auto 0;
    }
}