/* Academic Research Website Theme — Clean Scholarly Design */

:root {
    /* Primary colors — academic navy + cream */
    --primary: #0f172a;      /* Dark navy */
    --primary-light: #1e293b;
    --accent: #2563eb;       /* Royal blue */
    --accent-hover: #1d4ed8;
    --success: #059669;      /* Green for OA */
    --success-light: #d1fae5;
    --warning: #d97706;      /* Amber */
    
    /* Neutrals — warm cream background */
    --bg: #fafaf9;           /* Warm stone-50 */
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Text — high contrast for readability */
    --text: #0f172a;         /* Slate-900 */
    --text-secondary: #475569; /* Slate-600 */
    --text-muted: #94a3b8;   /* Slate-400 */
    
    /* Typography */
    --font-serif: 'Playfair Display', 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* Dark mode */
[data-theme="dark"] {
    --bg: #0b0f19;
    --bg-card: #111827;
    --bg-hover: #1f2937;
    --border: #1e293b;
    --border-light: #1f2937;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --success-light: #064e3b;
}

/* Base styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Header & Nav */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

[data-theme="dark"] .logo { color: #e2e8f0; }

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover { color: var(--accent); }

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.theme-toggle:hover { background: var(--bg-hover); }

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Sections */
.section {
    padding: 3rem 0;
}

.section-newsletter {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 2rem 0;
}

.section-newsletter h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.section-newsletter p {
    opacity: 0.85;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* Newsletter form */
.newsletter-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.newsletter-form input {
    flex: 1;
    min-width: 200px;
    padding: 0.625rem 0.875rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.newsletter-form input::placeholder { color: rgba(255,255,255,0.6); }
.newsletter-form input:focus { outline: none; border-color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.15); }

.btn-primary {
    padding: 0.625rem 1.25rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.form-note {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

/* Hero */
.hero {
    padding: 4rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.hero h1 {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

[data-theme="dark"] .hero h1 { color: #e2e8f0; }

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto 2rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

/* Hero Links (Google Scholar, CitationMap) */
.hero-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.gs-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.gs-link:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.gs-link i {
    font-size: 1.1rem;
}

.separator {
    color: var(--text-muted);
}

.stat {
    text-align: center;
    min-width: 100px;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Search */
.search-section {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}

.search-input:focus { outline: none; border-color: var(--accent); }

.search-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-filters select {
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
}

/* Section titles */
.section-title {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2rem;
}

[data-theme="dark"] .section-title { color: #e2e8f0; }

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.timeline-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 1.75rem;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--bg);
}

.timeline-item h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .timeline-item h3 { color: #e2e8f0; }

.timeline-item .year {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.timeline-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ==================== Tabs ==================== */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-weight: 500;
}

.tab:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-hover);
}

.tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* ==================== CitationMap ==================== */
.citationmap-section {
    padding: 3rem 0;
    background: var(--bg-secondary);
}

.citationmap-title {
    text-align: center;
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-family: var(--font-serif);
}

.citationmap-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1rem;
}

.citationmap-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 2rem;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--bg-card);
    min-height: 500px;
    position: relative;
}

.citationmap-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 500px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.citationmap-svg {
    width: 100%;
    height: 500px;
}

.citationmap-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.high {
    background: #ff3333;
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.6);
}

.legend-dot.medium {
    background: #ff8800;
    box-shadow: 0 0 8px rgba(255, 136, 0, 0.4);
}

.legend-dot.low {
    background: #ffcc00;
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.3);
}

/* Use case grid */
.usecase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.usecase-card {
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: default;
    transition: all 0.2s;
}

.usecase-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.usecase-card h3 {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .usecase-card h3 { color: #e2e8f0; }

.usecase-card .count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.usecase-card .desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Paper cards — academic style */
.paper-card {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.paper-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.paper-card h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

[data-theme="dark"] .paper-card h3 { color: #e2e8f0; }

.paper-card .meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.paper-card .tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tag.variant {
    background: #eff6ff;
    color: var(--accent);
}

.tag.oa {
    background: var(--success-light);
    color: var(--success);
}

.paper-card .abstract {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
}

.paper-card .links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.paper-card .links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.paper-card .links a:hover {
    border-bottom-color: var(--accent);
}

/* Repo cards */
.repo-card {
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.repo-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.repo-card h3 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.repo-card .desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.repo-card .stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.repo-card .links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.repo-card .links a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

/* No results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Footer */
.site-footer {
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-note {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Load more */
.load-more {
    text-align: center;
    margin-top: 2rem;
}

.load-more button {
    padding: 0.625rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.load-more button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .hero-stats { gap: 1rem; }
    .stat-number { font-size: 1.5rem; }
    .usecase-grid { grid-template-columns: 1fr; }
}
