/* Research papers — listing + article. Dark headers: brand navy. */

:root {
    --research-sticky-offset: 120px;
}

html {
    scroll-padding-top: calc(var(--research-sticky-offset) + 1.25rem);
}

.research-subtitle {
    color: #8b9cb3;
    font-size: 1.05rem;
    line-height: 1.55;
    max-width: 42rem;
    margin: 0;
}

.research-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    max-width: 720px;
}

.research-meta-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #2d3a4f;
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.research-meta-item dt {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8b9cb3;
    margin: 0 0 0.25rem;
}

.research-meta-item dd {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: #e6edf3;
}

.research-meta-item dd a {
    color: #93c5fd;
    text-decoration: none;
}

.research-meta-item dd a:hover {
    text-decoration: underline;
}

.research-meta-item .is-emphasis {
    color: #fca5a5;
}

.research-layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 0 4rem;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2.5rem;
    align-items: start;
}

.research-toc {
    position: sticky;
    top: var(--research-sticky-offset);
    align-self: start;
    font-size: 0.85rem;
    background: #fff;
    z-index: 2;
    padding-bottom: 0.5rem;
}

.research-toc h2 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
    margin: 0 0 0.75rem;
    padding-top: 0.25rem;
}

.research-toc-scroll {
    max-height: calc(100vh - var(--research-sticky-offset) - 3rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.25rem;
}

.research-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 2px solid #e9ecef;
}

.research-toc a {
    display: block;
    padding: 0.35rem 0 0.35rem 1rem;
    color: #6c757d;
    text-decoration: none;
    border-left: 2px solid transparent;
    margin-left: -2px;
}

.research-toc a:hover,
.research-toc a.is-active {
    color: #1e3370;
    border-color: #1e3370;
}

.research-toc .is-h2 {
    padding-left: 1rem;
    font-size: 0.82rem;
}

.research-toc .is-h3 {
    padding-left: 1.6rem;
    font-size: 0.8rem;
}

.research-article {
    min-width: 0;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #495057;
}

.research-article h1,
.research-article .research-h1,
.research-prose h1 {
    font-size: 1.85rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 2.75rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
    letter-spacing: -0.01em;
    scroll-margin-top: calc(var(--research-sticky-offset) + 1.25rem);
}

.research-article h2,
.research-article .research-h2,
.research-prose h2 {
    font-size: 1.55rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
    letter-spacing: -0.01em;
    scroll-margin-top: calc(var(--research-sticky-offset) + 1.25rem);
}

.research-article h1:first-child,
.research-article .research-h1:first-child,
.research-article h2:first-child,
.research-article .research-h2:first-child,
.research-article > .research-prose:first-child h1:first-child,
.research-article > .research-prose:first-child h2:first-child {
    margin-top: 0;
}

.research-stage-section {
    margin-bottom: 0.25rem;
}

.research-article h3,
.research-article .research-h3,
.research-prose h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1e3370;
    margin: 1.75rem 0 0.75rem;
    scroll-margin-top: calc(var(--research-sticky-offset) + 1.25rem);
}

.research-article p {
    margin: 0 0 1rem;
}

.research-article ul,
.research-article ol {
    padding-left: 1.35rem;
    margin: 0 0 1.25rem;
}

.research-article li {
    margin-bottom: 0.4rem;
}

.research-article hr {
    border: 0;
    border-top: 1px solid #e9ecef;
    margin: 2rem 0;
}

.research-stage {
    display: inline-block;
    background: #1e3370;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    margin-right: 0.5rem;
    vertical-align: middle;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.research-prose {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #495057;
    margin-bottom: 1rem;
}

.research-prose p {
    margin: 0 0 1rem;
}

.research-prose p:last-child {
    margin-bottom: 0;
}

.research-article a {
    color: #1e3370;
}

.research-article code {
    font-family: var(--font-family-mono);
    font-size: 0.88em;
    background: #f4f6f9;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    color: #1a1a1a;
}

.research-code,
.research-diagram {
    margin: 0 0 1.25rem;
}

.research-article pre,
.research-code pre,
.research-ascii,
.research-diagram .mermaid,
.research-article pre.mermaid {
    background: #0d1117;
    color: #e6edf3;
    border: 1px solid #2d3a4f;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-size: 0.82rem;
    line-height: 1.5;
    margin: 0 0 1.25rem;
}

.research-article pre code,
.research-code code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.research-code figcaption,
.research-diagram figcaption,
.research-figure figcaption,
.research-table-wrap figcaption {
    padding: 0.65rem 0 0;
    font-size: 0.85rem;
    color: #6c757d;
}

.research-figure {
    margin: 1.25rem 0 1.75rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.research-figure img {
    display: block;
    width: 100%;
    height: auto;
}

.research-figure figcaption {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e9ecef;
    background: #fff;
}

.research-table-wrap {
    margin: 0 0 1.25rem;
    overflow-x: auto;
}

.research-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.research-table th,
.research-table td {
    padding: 0.65rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.research-table th {
    background: #f4f6f9;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
}

.research-table tr:last-child td {
    border-bottom: none;
}

.research-table td p {
    margin: 0;
}

.research-callout {
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
    border: 1px solid;
    border-left-width: 4px;
}

.research-callout p {
    margin: 0.35rem 0 0;
}

.research-callout p:first-of-type {
    margin-top: 0.35rem;
}

.research-callout-title {
    display: block;
    margin-bottom: 0.15rem;
}

.research-prose + .research-prose {
    margin-top: 0;
}

.research-callout-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.35);
    border-left-color: #f59e0b;
}

.research-callout-info {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
    border-left-color: #3b82f6;
}

.research-callout-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
    border-left-color: #ef4444;
}

.research-callout-success {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.3);
    border-left-color: #22c55e;
}

.research-highlight {
    background: linear-gradient(90deg, rgba(30, 51, 112, 0.08), rgba(61, 229, 189, 0.08));
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0 1.5rem;
}

.research-highlight p:last-child {
    margin-bottom: 0;
}

.research-list {
    padding-left: 1.35rem;
    margin: 0 0 1.25rem;
    color: #495057;
}

.research-list li {
    margin-bottom: 0.4rem;
}

.research-list p {
    margin: 0;
}

.research-quote {
    border-left: 4px solid #1e3370;
    padding: 1rem 1.25rem;
    margin: 0 0 1.25rem;
    background: #f8f9fa;
    border-radius: 0 10px 10px 0;
    color: #495057;
}

.research-quote cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #6c757d;
}

.research-refs {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
}

.research-refs li {
    margin-bottom: 0.5rem;
}

.research-refs a {
    word-break: break-all;
}

.research-footer-note {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
    color: #6c757d;
    font-size: 0.85rem;
}

.research-tags {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.research-tag {
    padding: 6px 14px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #495057;
    font-size: 0.85rem;
    font-weight: 500;
}

.research-back {
    margin-top: 2.5rem;
    text-align: center;
}

.research-back a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #1e3370;
    color: #fff;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
}

.research-back a:hover {
    background: #2a4a9e;
    color: #fff;
    text-decoration: none;
}

/* Index listing */

.research-index-intro {
    max-width: 720px;
}

.research-index-section {
    padding: 48px 0 60px;
    background: #fff;
}

.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.research-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow 0.3s ease;
}

.research-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
}

.research-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.research-card-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #0a1929 0%, #1a1a2e 50%, #16213e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3de5bd;
    font-size: 2.5rem;
}

.research-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.research-card-cve {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #1e3370;
    background: #eef2ff;
    padding: 4px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    text-decoration: none;
}

.research-card-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
    line-height: 1.35;
}

.research-card-title a {
    color: inherit;
    text-decoration: none;
}

.research-card-title a:hover {
    color: #1e3370;
}

.research-card-excerpt {
    color: #495057;
    line-height: 1.65;
    flex: 1;
    margin-bottom: 16px;
}

.research-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    font-size: 0.85rem;
    color: #6c757d;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.research-severity {
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.research-severity-high,
.research-severity-critical {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.research-severity-medium {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.research-severity-low,
.research-severity-none {
    background: #f1f5f9;
    color: #475569;
}

.research-sidebar-widget {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.research-sidebar-widget h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.research-topic-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.research-topic-list a {
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 0.85rem;
}

.research-topic-list a:hover,
.research-topic-list a.is-active {
    background: #1e3370;
    color: #fff;
}

.research-related {
    background: #f8f9fa;
    padding: 60px 0;
}

.research-related h3 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 40px;
}

@media (max-width: 860px) {
    .research-layout {
        grid-template-columns: 1fr;
    }

    .research-toc {
        position: static;
    }

    .research-toc-scroll {
        max-height: none;
        overflow: visible;
    }
}

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