html {
    scroll-behavior: smooth;
}

:root {
    --primary-color: #743481;
    /* Academic Red */
    --accent-color: #801313;
    /* Darker Red */
    --bg-color: #ffffff;
    --text-color: #333;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --border-color: #dee2e6;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    padding-top: 52px;
    text-align: justify;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 40px;
}

.header-content {
    text-align: center;
}

h1 {
    font-size: 2.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    margin-top: 30px;
    line-height: 1.2;
    color: var(--text-color);
}

.authors {
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.affiliations {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
}

.authors a,
main a:not(.btn) {
    color: #3273dc;
    text-decoration: none;
}

.authors a:hover,
main a:not(.btn):hover {
    text-decoration: underline;
}

.links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    background-color: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
    border: none;
}

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

.btn i,
.btn-icon {
    margin-right: 8px;
}

.btn-icon {
    height: 20px;
    vertical-align: middle;
}

/* Main Content */
main {
    padding: 40px 0;
}

section {
    margin-bottom: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    scroll-margin-top: 52px;
}

section:first-of-type {
    border-top: none;
    padding-top: 20px;
}

h2 {
    font-size: 2rem;
    margin-top: 10px;
    margin-bottom: 1px;
    color: var(--primary-color);
}

h3 {
    font-size: 1.3rem;
    margin-top: 15px;
    margin-bottom: 15px;
    color: #444;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

h4 {
    font-size: 1.15rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #555;
    font-weight: 600;
}

/* Overview / Teaser */
.overview-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.teaser-images {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.teaser-images .teaser-item {
    flex: 1;
    min-width: 220px;
    max-width: 420px;
    text-align: center;
}

.teaser-images .teaser-item img {
    width: 100%;
    height: auto;
}

/* Images & Figures */
img {
    max-width: 100%;
    height: auto;
}

.method-image,
.failure-analysis {
    text-align: center;
    margin: 20px 0;
}

.caption {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
    text-align: center;
    font-style: italic;
}

.results-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 768px) {
    .results-group {
        flex-direction: row;
        align-items: flex-start;
    }

    .result-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .result-item img {
        object-fit: contain;
        width: 100%;
    }
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 30px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--text-color);
    border-bottom: 2px solid var(--text-color);
}

th,
td {
    padding: 12px 15px;
    text-align: center;
    border: 1px solid var(--border-color);
}

th {
    background-color: var(--light-gray);
    color: var(--text-color);
    font-weight: 700;
}

thead tr:last-child th {
    border-bottom: 1.5px solid var(--text-color);
}

.highlight-row {
    background-color: #fdf2f2;
}

.setting-row td {
    border-top: 1.5px solid var(--text-color);
}

/* Ablation figures */
.ablation-figures {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.ablation-figures .ablation-item {
    flex: 1;
    min-width: 220px;
    text-align: center;
}

.ablation-figures .ablation-item img {
    width: 100%;
    height: auto;
}

/* Citation */
.citation-block {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    border-radius: 5px;
    padding: 5px 8px;
    cursor: pointer;
    color: #555;
    font-size: 0.85rem;
    transition: background 0.15s ease, color 0.15s ease;
    z-index: 1;
}

.copy-btn:hover {
    background: rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85em;
    background-color: rgba(175, 184, 193, 0.2);
    border: 1px solid rgba(175, 184, 193, 0.35);
    border-radius: 4px;
    padding: 0.2em 0.4em;
}

pre {
    background-color: var(--light-gray);
    padding: 20px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

/* Footer */
footer a {
    color: #3273dc;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    color: #666;
    font-size: 0.9rem;
    background-color: var(--light-gray);
}

/* ============================================
   Navigation Bars
   ============================================ */

/* Global nav (visible before scrolling past header) */
.nav-global {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(251, 251, 253, 0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1001;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-global.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.nav-global-content {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
}

.nav-global-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-global-links a {
    font-size: 0.85rem;
    font-weight: 500;
    color: #444;
    text-decoration: none;
    padding: 5px 14px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.nav-global-links a:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
}

.nav-global-links a.active {
    background: rgba(0, 0, 0, 0.08);
    color: #743481;
    font-weight: 600;
}

/* Sticky nav (visible after scrolling past header) */
.nav-sticky-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(251, 251, 253, 0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-sticky-bar.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.nav-sticky-content {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.nav-sticky-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-sticky-links a {
    font-size: 0.875rem;
    font-weight: 500;
    color: #444;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.nav-sticky-links a:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
}

.nav-sticky-links a.active {
    background: rgba(0, 0, 0, 0.06);
    color: #743481;
    font-weight: 600;
}

/* Project title + dropdown */
.nav-title-wrapper {
    position: relative;
    flex-shrink: 0;
}

.nav-sticky-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s ease;
    cursor: pointer;
}

.nav-sticky-title:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
}

.nav-title-chevron {
    font-size: 0.7rem;
    transition: transform 0.25s ease;
    color: #888;
}

.nav-title-wrapper:hover .nav-title-chevron,
.nav-title-wrapper.open .nav-title-chevron {
    transform: rotate(180deg);
}

/* Dropdown panel */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 360px;
    background: rgba(251, 251, 253, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 12px 8px 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.nav-title-wrapper:hover .nav-dropdown,
.nav-title-wrapper.open .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown-header {
    font-size: 0.7rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 8px 8px;
}

.nav-project-card {
    display: block;
    padding: 8px 10px;
    border-radius: 7px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.nav-project-card:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nav-project-card-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.nav-project-card-title.active-project {
    color: #743481;
}

.nav-project-card-desc {
    font-size: 0.75rem;
    color: #777;
    line-height: 1.4;
}

/* Mobile nav toggle */
.nav-mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #444;
    padding: 4px 8px;
    transition: transform 0.3s ease;
}

.nav-mobile-toggle.active {
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .nav-mobile-toggle {
        display: block;
    }

    .nav-sticky-links {
        display: none;
        position: absolute;
        top: 52px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: rgba(251, 251, 253, 0.98);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        padding: 8px 0;
    }

    .nav-sticky-links.mobile-open {
        display: flex;
    }

    .nav-sticky-links a {
        padding: 10px 24px;
        border-radius: 0;
        font-size: 0.95rem;
    }
}

/* Back-to-top button */
.scroll-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #333;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: var(--primary-color);
    transform: translateY(-4px);
}
