/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Outfit:wght@500;700&display=swap');

:root {
    /* Color Palette */
    --bg-color: #FAFAFA;
    --card-bg: #FFFFFF;
    --text-main: #1D1D1F;
    --text-secondary: #86868B;
    --accent-color: #2563EB;
    /* Vibrant Blue */
    --accent-gradient: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --radius-lg: 24px;
    --radius-md: 16px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

/* Utilities */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

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

.mb-2 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

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

/* Hero Section */
.hero {
    padding: 100px 0 60px;
    text-align: center;
}

.title {
    font-size: 2.75rem;
    line-height: 1.1;
    font-weight: 700;
    margin-bottom: 20px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.publication-venue {
    font-size: 1.25rem;
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 24px;
}

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

.author-block {
    display: inline-block;
    margin: 0 10px;
}

.author-block a {
    color: var(--text-main);
    font-weight: 500;
}

.author-block a:hover {
    color: var(--accent-color);
}

.affiliations {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

/* Link Buttons */
.publication-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--card-bg);
    border: 1px solid #E5E7EB;
    border-radius: 100px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

.icon {
    font-size: 1.1rem;
}

/* Section Cards */
.paper-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 60px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    /* For animation */
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.paper-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Teaser */
.teaser-container {
    width: 100%;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.teaser-video,
.teaser-img {
    width: 100%;
    display: block;
}

.caption {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 16px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Abstract */
.abstract-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: justify;
    font-size: 1.1rem;
    color: #4B5563;
}

/* Method */
.method-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    margin-top: 30px;
}

.method-step {
    text-align: center;
}

.method-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-main);
}

.method-image {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
}

.method-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: left;
    max-width: 880px;
    margin: 0 auto;
}

/* Lightbox */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.lightbox-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 1400px;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

.method-image {
    cursor: zoom-in;
    /* Indicate clickable */
    transition: transform 0.2s;
}

.method-image:hover {
    transform: scale(1.01);
}

@keyframes zoomIn {
    from {
        transform: scale(0)
    }

    to {
        transform: scale(1)
    }
}

/* Slider Section */
.slider-container {
    position: relative;
    max-width: 1100px;
    /* Use full container width */
    margin: 0 auto;
    overflow: hidden;
    /* Removed card styling (bg, shadow, radius) to blend in */
}

.slides-wrapper {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.slide {
    min-width: 100%;
    box-sizing: border-box;
    padding: 0 10px;
    /* Minimal padding */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slide-content-wrapper {
    width: 100%;
    text-align: center;
}

.slider-image-container {
    width: 100%;
    /* JS will set height */
    overflow: hidden;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    background: transparent;
    /* display: flex; Set by JS */
    /* justify-content: center; */
}

.slider-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    cursor: zoom-in;
    /* Indicate clickable */
    transition: transform 0.2s;
}

.slider-img:hover {
    transform: scale(1.01);
}

.img-crop-container {
    overflow: hidden;
    width: 100%;
    border-radius: var(--radius-md);
    position: relative;
    display: flex;
    /* Flex to handle inner absolute/transform */
    justify-content: flex-start;
    /* Ensure left alignment for math */
    /* Height set by JS */
}

/* For Slide 3 (Left Part) */
.img-pos-left {
    transform: none;
    max-width: none;
    margin: 0;
    display: block;
}

/* For Slide 4 (Right Part) */
.img-pos-right {
    display: block;
    margin-left: 0;
    transform: translateX(-63%);
    max-width: none;
}

.img-pos-left:hover {
    transform: translateX(0) scale(1.01);
}

.img-pos-right:hover {
    transform: translateX(-63%) scale(1.01);
}

/* Controls */
.slider-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding-bottom: 10px;
}

.control-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    transition: color 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.control-btn:hover {
    background: #f3f4f6;
    color: var(--accent-color);
}

/* Progress Bar */
.progress-container {
    height: 4px;
    background: #f3f4f6;
    width: 100%;
    position: relative;
    margin-top: 10px;
    opacity: 0.8;
}

.progress-bar {
    height: 100%;
    background: var(--accent-color);
    width: 0%;
    transition: width 0.1s linear;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

/* Pagination Tabs */
.slider-pagination {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px 0 5px;
    width: 100%;
}

@media (min-width: 768px) {
    .slider-pagination {
        grid-template-columns: repeat(4, 1fr);
    }
}

.nav-btn {
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    padding: 12px 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center;
    line-height: 1.3;
}

.nav-btn:hover {
    background-color: #e5e7eb;
    color: var(--text-main);
}

.nav-btn.active {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.result-item img {
    width: 100%;
    border-radius: var(--radius-md);
    transition: transform 0.3s ease;
}

.result-item:hover img {
    transform: scale(1.02);
}

/* BibTeX */
.bibtex-wrapper {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.bibtex-container {
    background: #F3F4F6;
    padding: 30px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #374151;
    border: 1px solid #E5E7EB;
    margin: 0;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
}

.copy-btn:hover {
    background: #f9fafb;
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Footer */
footer {
    padding: 60px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --radius-lg: 16px;
        --radius-md: 8px;
    }

    .title {
        font-size: 2.5rem;
    }

    .paper-section {
        padding: 30px;
    }

    .link-btn {
        width: 100%;
        justify-content: center;
    }

    /* Method Slider Mobile Optimizations */
    .slider-pagination {
        grid-template-columns: 1fr;
        /* Stack buttons vertically */
        gap: 8px;
    }

    .nav-btn {
        padding: 10px;
        font-size: 0.9rem;
        text-align: left;
        /* Align text left for list-like feel */
    }

    .slider-controls {
        gap: 30px;
        /* More space between controls for touch */
    }

    .control-btn {
        width: 48px;
        /* Larger touch targets */
        height: 48px;
        background-color: #f3f4f6;
        /* Visible background for easier tapping */
    }

    /* Fix Image Scaling */
    .slider-image-container {
        height: auto !important;
        /* Override JS if needed, though JS clears it */
        min-height: 200px;
    }

    .img-pos-left,
    .img-pos-right {
        width: 190%;
        /* Zoom in to match desktop crop feel */
        max-width: none;
        height: auto;
    }

    .img-pos-left {
        /* Align left side */
        margin-left: 0;
    }

    .img-pos-right {
        /* Shift to show right side */
        transform: translateX(-61%);
        margin-left: 0;
    }
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid #E5E7EB;
    background: #fff;
}

table.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    white-space: nowrap;
    background: #fff;
}

table.results-table th,
table.results-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
    border-right: 1px solid #f9fafb;
}

table.results-table th:last-child,
table.results-table td:last-child {
    border-right: none;
}

table.results-table th {
    font-weight: 600;
    color: var(--text-main);
    background-color: #FAFAFA;
}

table.results-table th.header-group {
    border-bottom: 2px solid #e5e7eb;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

table.results-table td {
    color: var(--text-secondary);
}

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

table.results-table .method-col {
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    position: sticky;
    left: 0;
    z-index: 10;
    border-right: 2px solid #f3f4f6;
}

/* Ensure sticky header has solid background */
table.results-table th.method-col {
    background-color: #FAFAFA;
}

/* Ensure sticky cells have solid background */
table.results-table td.method-col {
    background-color: #fff;
}

table.results-table .best-result {
    font-weight: 700;
    color: var(--text-main);
}

table.results-table tr:hover td {
    background-color: #fafbfc;
}

/* Ensure sticky cell also updates on hover */
table.results-table tr:hover td.method-col {
    background-color: #fafbfc;
}

/* Video Slider Specifics */
#video-slider {
    margin-left: -30px;
    margin-right: -30px;
    width: calc(100% + 60px);
}

.video-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    grid-template-columns: none !important;
    /* Override generic grid */
}

.video-nav-btn {
    width: 60px;
    /* Standard width for numbers */
    padding: 12px 0;
    /* Center vertically */
    flex: 0 0 auto;
    text-align: center;
}

.video-nav-btn.narrated-btn {
    width: auto;
    padding: 12px 20px;
    flex: 0 0 auto;
    min-width: 140px;
}

/* Fix video size by removing slide padding in video slider */
.video-slide {
    padding: 0 30px;
}

@media (max-width: 768px) {
    #video-slider {
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
    }

    .video-slide {
        padding: 0 15px;
    }

    .video-pagination {
        flex-wrap: nowrap;
        overflow-x: auto;
        /* justify-content: flex-start; Removed to let margins center content */
        padding-bottom: 10px;
        /* Space for scrollbar if visible */
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll on iOS */
    }

    /* Centering trick for scrollable flex container */
    .video-pagination::after,
    .video-pagination::before {
        content: '';
        margin: auto;
        flex: 0 0 auto;
    }

    /* Hide scrollbar for cleaner look */
    .video-pagination::-webkit-scrollbar {
        height: 0px;
        background: transparent;
    }

    .video-nav-btn {
        width: 45px;
        /* Smaller on mobile */
        flex-shrink: 0;
        /* Prevent shrinking */
    }

    .video-nav-btn.narrated-btn {
        width: auto;
        /* Reset full width */
        margin-bottom: 0;
        /* margin-right removed for consistent spacing */
    }
}