/* ===== Research Page ===== */

/* Hero */
.r-hero {
    position: relative;
    padding: 180px 0 80px;
    overflow: hidden;
}

.r-hero-glow {
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 500px;
    background: radial-gradient(ellipse at center, rgba(124, 58, 237, 0.12) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

.r-hero-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin-bottom: 72px;
}

.r-hero-title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: clamp(3.5rem, 8vw, 5.5rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 24px;
    background: linear-gradient(180deg, #fff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.r-hero-desc {
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 640px;
}

/* Teams Grid */
.r-teams-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    position: relative;
    z-index: 1;
}

.r-team-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.r-team-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.r-team-card[data-filter="tcp"]::before { background: linear-gradient(90deg, transparent, #7c3aed, transparent); }
.r-team-card[data-filter="kernel"]::before { background: linear-gradient(90deg, transparent, #0ea5e9, transparent); }
.r-team-card[data-filter="perf"]::before { background: linear-gradient(90deg, transparent, #10b981, transparent); }
.r-team-card[data-filter="security"]::before { background: linear-gradient(90deg, transparent, #f43f5e, transparent); }

.r-team-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.r-team-card:hover::before { opacity: 1; }

.r-team-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.r-team-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Featured Grid */
.r-featured {
    padding: 80px 0;
    border-top: 1px solid var(--border-subtle);
}

.r-featured-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
}

.r-card-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.r-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.r-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.r-card-large {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 380px;
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.06) 0%, var(--bg-card) 100%);
}

.r-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.r-card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.r-card-title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
}

.r-card-large .r-card-title { font-size: 1.6rem; }
.r-card-small .r-card-title { font-size: 1.1rem; }

.r-card-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Category Pills */
.r-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.r-pill-tcp { background: rgba(124, 58, 237, 0.15); color: #a78bfa; border: 1px solid rgba(124, 58, 237, 0.25); }
.r-pill-kernel { background: rgba(14, 165, 233, 0.15); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.25); }
.r-pill-perf { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); }
.r-pill-security { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.25); }

/* Publications Section */
.r-publications {
    padding: 80px 0;
    border-top: 1px solid var(--border-subtle);
}

.r-section-header {
    margin-bottom: 32px;
}

.r-section-header h2 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Filters */
.r-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.r-filter-pill {
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.r-filter-pill:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}

.r-filter-pill.active {
    background: var(--text-primary);
    color: var(--bg-base);
    border-color: var(--text-primary);
}

/* Publication List */
.r-pub-list {
    display: flex;
    flex-direction: column;
}

.r-pub-row {
    display: grid;
    grid-template-columns: 100px 160px 1fr;
    gap: 20px;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.r-pub-row:first-child { border-top: 1px solid var(--border-subtle); }

.r-pub-row:hover {
    background: rgba(255,255,255,0.02);
    padding-left: 12px;
    padding-right: 12px;
    margin-left: -12px;
    margin-right: -12px;
    border-radius: var(--radius-md);
}

.r-pub-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.r-pub-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    transition: color 0.2s;
}

.r-pub-row:hover .r-pub-title { color: #a78bfa; }

/* Paper Modal */
.r-paper-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 3000;
    display: none;
    opacity: 0;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 24px;
    overflow-y: auto;
    transition: opacity 0.3s ease;
}

.r-paper-overlay.show {
    display: flex;
    opacity: 1;
}

.r-paper-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    max-width: 820px;
    width: 100%;
    position: relative;
    padding: 48px 56px;
    margin: 40px auto;
    box-shadow: 0 40px 100px rgba(0,0,0,0.5);
    transform: scale(0.96);
    transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}

.r-paper-overlay.show .r-paper-modal { transform: scale(1); }

.r-paper-close {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 3001;
}

.r-paper-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Paper Content */
.r-paper-body h1 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.r-paper-body .r-paper-authors {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.r-paper-body .r-paper-date-full {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-subtle);
}

.r-paper-body .r-paper-abstract {
    background: rgba(124,58,237,0.06);
    border: 1px solid rgba(124,58,237,0.15);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 32px;
}

.r-paper-body .r-paper-abstract strong {
    display: block;
    color: #a78bfa;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.r-paper-body .r-paper-abstract p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.r-paper-body h2 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 1.35rem;
    font-weight: 600;
    margin: 40px 0 16px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.r-paper-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 28px 0 12px;
    color: var(--text-primary);
}

.r-paper-body p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.r-paper-body ul, .r-paper-body ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

.r-paper-body li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 6px;
}

.r-paper-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    padding: 2px 6px;
    border-radius: 4px;
    color: #a78bfa;
}

.r-paper-body pre {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.r-paper-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-secondary);
}

.r-paper-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9rem;
}

.r-paper-body th {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-strong);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.r-paper-body td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.r-paper-body .r-figure {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    margin: 24px 0;
    text-align: center;
}

.r-paper-body .r-figure-caption {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 12px;
    font-style: italic;
}

.r-paper-body .r-figure-chart {
    height: 160px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.r-bar {
    width: 36px;
    border-radius: 4px 4px 0 0;
    transition: height 0.6s cubic-bezier(0.16,1,0.3,1);
    position: relative;
}

.r-bar::after {
    content: attr(data-label);
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 992px) {
    .r-teams-grid { grid-template-columns: repeat(2, 1fr); }
    .r-featured-grid { grid-template-columns: 1fr; }
    .r-card-large { min-height: 260px; }
    .r-paper-modal { padding: 32px 28px; }
}

@media (max-width: 768px) {
    .r-hero { padding: 140px 0 60px; }
    .r-teams-grid { grid-template-columns: 1fr; }
    .r-pub-row { grid-template-columns: 80px 120px 1fr; gap: 12px; }
    .r-featured, .r-publications { padding: 60px 0; }
    .r-paper-modal { padding: 24px 20px; margin: 20px auto; }
    .r-paper-body h1 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .r-pub-row { grid-template-columns: 1fr; gap: 6px; }
    .r-pub-date { order: 2; }
    .r-pill { order: 1; }
    .r-pub-title { order: 0; }
}
