/* ========================================
   StreamAvatar - Academic Project Website
   ======================================== */

:root {
    /* Color Palette - Deep Ocean Theme */
    --primary: #1a365d;
    --primary-light: #2c5282;
    --primary-dark: #0f2942;
    --accent: #ed8936;
    --accent-light: #f6ad55;
    --accent-dark: #c05621;
    
    /* Neutral Colors */
    --bg-primary: #f7fafc;
    --bg-secondary: #edf2f7;
    --bg-dark: #0f172a;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-light: #a0aec0;
    
    /* Borders and Shadows */
    --border: #e2e8f0;
    --border-light: #edf2f7;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
    
    /* Spacing */
    --section-padding: clamp(3rem, 8vw, 6rem);
    --container-max: 1200px;
    
    /* Typography */
    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-serif);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* ========================================
   Layout
   ======================================== */

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
}

section {
    padding: var(--section-padding) 0;
}

.alt-bg {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

/* ========================================
   Top Navigation Bar
   ======================================== */

.topnav {
    position: relative;
    z-index: 1000;
    background: var(--primary-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 2rem);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.5;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.dropdown-toggle svg {
    transition: transform var(--transition-fast);
}

.dropdown:hover .dropdown-toggle svg {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 180px;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

/* ========================================
   Hero Section
   ======================================== */

.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: clamp(4rem, 12vw, 8rem) 0 clamp(3rem, 8vw, 5rem);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(237, 137, 54, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(44, 82, 130, 0.3) 0%, transparent 50%);
    pointer-events: none;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    max-width: 800px;
    margin: 0 auto 2rem;
    line-height: 1.5;
}

.authors {
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.8;
}

.author {
    display: inline-block;
    margin: 0 0.4rem;
    white-space: nowrap;
}

.author a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.4);
    transition: all var(--transition-fast);
}

.author a:hover {
    color: var(--accent-light);
    border-bottom-color: var(--accent-light);
}

.author sup {
    font-size: 0.7em;
    margin-left: 0.1em;
}

.affiliations {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.5rem;
}

.affiliations span {
    display: inline-block;
    margin: 0 0.75rem;
    white-space: nowrap;
}

.author-notes {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2rem;
}

.author-notes span {
    display: inline-block;
    margin: 0 0.75rem;
}

/* Buttons */
.links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 500;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    transform: translateY(-2px);
}

/* ========================================
   Teaser Section
   ======================================== */

.teaser {
    padding: var(--section-padding) 0;
    background: var(--bg-primary);
}

.teaser-image {
    width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    margin-bottom: 1.5rem;
}

.teaser-caption {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.8;
}

/* ========================================
   Abstract Section
   ======================================== */

.abstract {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.abstract-content {
    max-width: 850px;
    margin: 0 auto;
    text-align: justify;
    font-size: 1.1rem;
}

.abstract-content p {
    margin-bottom: 1.25rem;
}

.abstract-content p:last-child {
    margin-bottom: 0;
}

/* ========================================
   Section Titles
   ======================================== */

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
    margin: 0.75rem auto 0;
    border-radius: 2px;
}

.section-description {
    text-align: center;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 2.5rem;
    font-size: 1.05rem;
}

/* ========================================
   Subsections
   ======================================== */

.subsection {
    margin-bottom: 3rem;
}

.subsection:last-child {
    margin-bottom: 0;
}

.subsection-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-left: 1rem;
    border-left: 4px solid var(--accent);
}

.subsection-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ========================================
   Video Components
   ======================================== */

.video-wrapper {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: #000;
}

.video-wrapper video {
    width: 100%;
    display: block;
}

.main-video {
    max-width: 900px;
    margin: 0 auto;
}

.comparison-video {
    max-width: 1000px;
    margin: 0 auto;
}

/* YouTube/Video Embed */
.video-wrapper iframe {
    display: block;
}

/* Video Grid */
.video-grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 1024px) {
    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-5, .grid-4, .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .grid-5, .grid-4, .grid-3, .grid-2 {
        grid-template-columns: 1fr;
    }
}

.video-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.video-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.video-item video {
    width: 100%;
    display: block;
    cursor: pointer;
}

.video-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 70%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.video-item:hover::after {
    opacity: 1;
}

/* More Samples Dropdown */
.more-samples {
    margin-top: 1.5rem;
}

.more-samples summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    list-style: none;
}

.more-samples summary::-webkit-details-marker {
    display: none;
}

.more-samples summary::before {
    content: '▶';
    font-size: 0.7em;
    transition: transform var(--transition-fast);
}

.more-samples[open] summary::before {
    transform: rotate(90deg);
}

.more-samples summary:hover {
    background: var(--border);
    color: var(--text-primary);
}

.more-samples .video-grid {
    margin-top: 1.5rem;
}

/* ========================================
   Results Section
   ======================================== */

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

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

.results-stack {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.result-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.result-card .subsection-title {
    padding-left: 0;
    border-left: none;
    text-align: center;
    margin-bottom: 0.5rem;
}

.result-card .subsection-description {
    text-align: center;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.result-image {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.result-image-narrow {
    max-width: 500px;
    display: block;
    margin: 0 auto;
}

.metrics-table {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 1rem;
}

.metrics-table th,
.metrics-table td {
    padding: 0.75rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.metrics-table thead th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary);
}

.metrics-table tbody tr:hover {
    background: var(--bg-secondary);
}

.metrics-table tbody td:first-child {
    font-weight: 500;
}

/* ========================================
   Method Section
   ======================================== */

.method {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.pipeline-wrapper {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2.5rem;
}

.pipeline-image {
    width: 100%;
}

.method-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

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

.method-stage {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    border-top: 4px solid var(--accent);
}

.method-stage h4 {
    font-size: 1.15rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.method-stage p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.method-figure {
    margin-top: 2.5rem;
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.method-figure-image {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    display: block;
    border-radius: 8px;
}

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

/* ========================================
   BibTeX Section
   ======================================== */

.bibtex {
    background: var(--bg-dark);
    color: #fff;
}

.bibtex .section-title {
    color: #fff;
}

.bibtex .section-title::after {
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
}

.bibtex .section-description {
    color: var(--text-light);
}

.bibtex-wrapper {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.bibtex-wrapper pre {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.5rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-light);
}

.bibtex-wrapper code {
    font-family: inherit;
}

.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-serif);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ========================================
   Footer
   ======================================== */

.footer {
    background: var(--primary-dark);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 2rem 0;
    font-size: 0.95rem;
}

.footer p {
    margin-bottom: 0.25rem;
}

.footer-note {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   Utility Classes
   ======================================== */

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

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ========================================
   Animations
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero .title,
.hero .subtitle,
.hero .authors,
.hero .links {
    animation: fadeInUp 0.6s ease-out backwards;
}

.hero .subtitle { animation-delay: 0.1s; }
.hero .authors { animation-delay: 0.2s; }
.hero .links { animation-delay: 0.3s; }

/* ========================================
   Scrollbar Styling
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========================================
   Selection
   ======================================== */

::selection {
    background: var(--accent);
    color: #fff;
}

/* ========================================
   Focus States
   ======================================== */

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .hero {
        background: var(--primary) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .btn, .copy-btn, .more-samples summary {
        display: none !important;
    }
    
    video {
        display: none !important;
    }
    
    .video-item::before {
        content: '[Video]';
        display: flex;
        align-items: center;
        justify-content: center;
        height: 150px;
        background: var(--bg-secondary);
        color: var(--text-muted);
    }
}

