/* whitepapers.xyz — Airy Minimalist Magazine */

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ===== BASE ===== */
body {
    background: #FAFAFA;
    color: #1A1A1A;
    font-family: 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
}

/* ===== TYPOGRAPHY ===== */
/* Headings: Playfair Display** at 600/700 weight, 32px/24px/20px */
/* Body: Source Sans Pro** at 400 weight, 16px with 1.7 line-height */
/* Meta: Inter** at 400 weight, 13px — active section tracking via IntersectionObserver` */
.section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #1A1A1A;
    margin-bottom: 1.25rem;
}

.author {
    font-variant: small-caps;
}

.cat-pill {
    display: inline-block;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.75rem;
    color: #888888;
    font-family: 'Inter', sans-serif;
}

/* ===== HERO ZONE ===== */
.hero {
    padding: 4rem 2rem 2.5rem;
    text-align: center;
    border-bottom: 1px solid #E5E7EB;
    background: #FFFFFF;
}

.hero-inner {
    max-width: 640px;
    margin: 0 auto;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 2.5rem;
    color: #1A1A1A;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.hero-subtitle {
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 1.05rem;
    color: #555555;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.search-bar {
    margin-bottom: 1.25rem;
    position: relative;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 0.95rem;
    font-family: 'Source Sans Pro', sans-serif;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    background: #FFFFFF;
    color: #1A1A1A;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-input::placeholder {
    color: #888888;
}

.category-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.cat-link {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #888888;
    text-decoration: none;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.cat-link:hover {
    color: #555555;
}

.cat-link.active {
    color: #2563EB;
    border-bottom-color: #2563EB;
}

/* ===== FEATURED PAPER ===== */
.featured {
    max-width: 760px;
    margin: 0 auto;
    padding: 2.5rem 2rem 0;
}

.featured-inner {
    background: #FFFFFF;
    padding: 2rem;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    transition: box-shadow 0.3s ease;
}

.featured-inner:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.featured-badge {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #2563EB;
    background: #EEF2FF;
    padding: 0.25rem 0.7rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.featured-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 2rem;
    color: #1A1A1A;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    cursor: pointer;
    transition: color 0.2s ease;
}

.featured-title:hover {
    color: #2563EB;
}

.featured-meta {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #888888;
    margin-bottom: 0.75rem;
}

.featured-abstract {
    font-size: 1rem;
    color: #555555;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.featured-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.download-stat {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #888888;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.dl-icon {
    color: #888888;
}

.save-btn {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #888888;
    background: none;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.save-btn:hover {
    color: #2563EB;
    border-color: #2563EB;
}

.save-btn[data-saved="true"] {
    color: #2563EB;
    background: #EEF2FF;
    border-color: #2563EB;
}

.save-btn[data-saved="true"] .bookmark-icon path {
    fill: #2563EB;
    stroke: #2563EB;
}

/* ===== RECENT PAPERS GRID ===== */
.listings {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem;
}

.paper-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.paper-card {
    background: #FFFFFF;
    padding: 1.25rem;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.paper-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.paper-card.hidden {
    display: none;
}

.paper-title {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: #1A1A1A;
    margin-bottom: 0.35rem;
    line-height: 1.35;
    cursor: pointer;
    transition: color 0.2s ease;
}

.paper-title:hover {
    color: #2563EB;
}

.paper-meta {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #888888;
    margin-bottom: 0.5rem;
}

.paper-abstract {
    font-size: 0.9rem;
    color: #555555;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== TRENDING ===== */
.trending {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.trending-list {
    /* list container */
}

.trending-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px solid #E5E7EB;
    position: relative;
    transition: background 0.2s ease;
}

.trending-item:hover {
    background: #EEF2FF;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: 4px;
}

.trending-item.hidden {
    display: none;
}

.rank-num {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 48px; /* Playfair Display at 48px, Archive Blue at 15% opacity */
    color: rgba(37, 99, 235, 0.15);
    line-height: 1;
    min-width: 2.5rem;
    user-select: none;
}

.trending-content {
    flex: 1;
    padding-top: 0.25rem;
}

.trending-title {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.05rem;
    color: #1A1A1A;
    margin-bottom: 0.2rem;
}

.trending-meta {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #888888;
}

/* ===== READING LIST ===== */
.reading-list {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.reading-list-inner {
    background: #FFFFFF;
    padding: 1.5rem;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
}

.reading-list-empty {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #888888;
    text-align: center;
    padding: 1rem 0;
}

.reading-list-items {
    /* populated by JS */
}

.reading-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid #E5E7EB;
}

.reading-list-item:last-child {
    border-bottom: none;
}

.rl-title {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1A1A1A;
}

.rl-remove {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #888888;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.rl-remove:hover {
    color: #EF4444;
}

/* ===== READER VIEW (modal overlay) ===== */
.reader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reader-overlay.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2rem;
    opacity: 1;
}

.reader-container {
    background: #FFFFFF;
    width: 90%;
    max-width: 960px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 8px;
    position: relative;
    padding: 2rem;
}

.reader-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.75rem;
    color: #888888;
    background: none;
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}

.reader-close:hover {
    background: #EEF2FF;
    color: #1A1A1A;
}

.reader-layout {
    display: flex;
    gap: 2rem;
}

.reader-toc {
    position: sticky;
    top: 0;
    width: 180px;
    min-width: 180px;
    padding-top: 0.5rem;
}

.toc-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.toc-link {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #888888;
    text-decoration: none;
    padding: 0.3rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.toc-link:hover {
    color: #555555;
}

.toc-link.active {
    color: #2563EB;
    border-left-color: #2563EB;
}

.reader-body {
    flex: 1;
    max-width: 680px;
}

.reader-paper-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.75rem;
    color: #1A1A1A;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.reader-paper-meta {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #888888;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

.reader-section {
    margin-bottom: 2rem;
}

.reader-section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.25rem;
    color: #1A1A1A;
    margin-bottom: 0.75rem;
}

.reader-section p {
    font-size: 1rem;
    color: #555555;
    line-height: 1.8;
    margin-bottom: 0.75rem;
}

.citation {
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 0.9rem;
    color: #555555;
    padding-left: 1.5rem;
    text-indent: -1.5rem;
    margin-bottom: 0.4rem;
}

/* ===== CITATION GRAPH ===== */
.citation-section {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.citation-inner {
    background: #FFFFFF;
    padding: 1.5rem;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
}

.citation-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #888888;
    margin-bottom: 1rem;
}

.citation-graph {
    width: 100%;
    overflow: hidden;
}

#citationCanvas {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== AUTHOR DIRECTORY ===== */
.authors {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.authors-inner {
    /* no card wrapper, matches airy style */
}

.author-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.author-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #FFFFFF;
    padding: 1rem;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    transition: box-shadow 0.2s ease;
}

.author-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #EEF2FF;
    color: #2563EB;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.author-info {
    min-width: 0;
}

.author-name {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1A1A1A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.author-stats {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #888888;
}

/* ===== PUBLICATION TRENDS ===== */
.trends {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.trends-inner {
    background: #FFFFFF;
    padding: 1.5rem;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
}

.trends-chart {
    width: 100%;
    overflow: hidden;
    margin-bottom: 1rem;
}

#trendsCanvas {
    width: 100%;
    height: auto;
    display: block;
}

.trends-legend {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    flex-wrap: wrap;
}

.legend-item {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #555555;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

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

/* ===== FOOTER ===== */
.footer {
    border-top: 1px solid #E5E7EB;
    padding: 2.5rem 2rem;
    background: #FFFFFF;
}

.footer-inner {
    max-width: 760px;
    margin: 0 auto;
}

.footer-cols {
    display: flex;
    gap: 3rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.footer-col {
    min-width: 120px;
}

.footer-col-title {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    color: #1A1A1A;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.flink {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #888888;
    text-decoration: none;
    margin-bottom: 0.25rem;
    transition: color 0.2s ease;
}

.flink:hover {
    color: #2563EB;
}

.footer-copy {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: #888888;
}

/* ===== FADE-IN ANIMATION ===== */
.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .paper-grid {
        grid-template-columns: 1fr;
    }

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

    .reader-layout {
        flex-direction: column;
    }

    .reader-toc {
        position: static;
        width: 100%;
        min-width: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
        border-bottom: 1px solid #E5E7EB;
    }

    .toc-title {
        width: 100%;
    }

    .toc-link {
        border-left: none;
        padding-left: 0;
        padding: 0.2rem 0.5rem;
        border-radius: 4px;
    }

    .toc-link.active {
        background: #EEF2FF;
        border-left: none;
    }

    .footer-cols {
        gap: 1.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .author-grid {
        grid-template-columns: 1fr;
    }

    .category-nav {
        gap: 0.75rem;
    }

    .featured-title {
        font-size: 1.5rem;
    }

    .trends-legend {
        gap: 0.75rem;
    }
}
