/* Modern variables for light theme */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #06b6d4;
    --accent-color: #10b981;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-header: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 50%, #cbd5e1 100%);
    --gradient-secondary: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --gradient-accent: linear-gradient(135deg, #06d6a0 0%, #10b981 100%);
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-header: #2d3748;
    --border-light: #e2e8f0;
    --border-lighter: #f1f5f9;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --header-accent: #3b82f6;
    --header-accent-light: rgba(59, 130, 246, 0.1);
}

/* Performance optimization: minimal GPU acceleration */
* {
    box-sizing: border-box;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

.page-content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Modern animated header */
header {
    position: relative;
    background: var(--gradient-header);
    color: var(--text-header);
    padding: 5rem 0 4rem;
    text-align: center;
    margin-bottom: 0;
    overflow: hidden;
    border-bottom: 1px solid var(--border-light);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        var(--header-accent-light) 50%,
        transparent 70%
    );
    animation: shimmer 8s ease-in-out infinite;
    pointer-events: none;
}

header .container {
    position: relative;
    z-index: 2;
}

/* Floating geometric decorations */
header::after {
    content: '';
    position: absolute;
    top: 20%;
    right: 10%;
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, var(--header-accent), var(--secondary-color));
    border-radius: 50% 20% 50% 20%;
    opacity: 0.1;
    animation: floatRight 8s ease-in-out infinite;
    z-index: 1;
}

.geometric-decoration {
    position: absolute;
    z-index: 1;
}

.geometric-decoration::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 8%;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    border-radius: 20% 50% 20% 50%;
    opacity: 0.08;
    animation: floatLeft 10s ease-in-out infinite;
}

.geometric-decoration::after {
    content: '';
    position: absolute;
    bottom: 20%;
    right: 15%;
    width: 30px;
    height: 30px;
    background: linear-gradient(225deg, var(--header-accent), var(--primary-color));
    border-radius: 30%;
    opacity: 0.12;
    animation: floatBottom 6s ease-in-out infinite reverse;
}

@keyframes floatRight {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
        opacity: 0.1;
    }
    50% { 
        transform: translateY(-20px) rotate(180deg); 
        opacity: 0.15;
    }
}

@keyframes floatLeft {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
        opacity: 0.08;
    }
    50% { 
        transform: translateY(-15px) rotate(-180deg); 
        opacity: 0.12;
    }
}

@keyframes floatBottom {
    0%, 100% { 
        transform: translateY(0px) scale(1); 
        opacity: 0.12;
    }
    50% { 
        transform: translateY(-10px) scale(1.2); 
        opacity: 0.18;
    }
}

header h1 {
    margin: 0 0 2rem 0;
    font-size: clamp(2.2rem, 4.5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    color: var(--text-header);
    text-shadow: 0 2px 20px rgba(59, 130, 246, 0.15);
    animation: titleFloat 6s ease-in-out infinite;
    position: relative;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--header-accent), var(--secondary-color));
    border-radius: 2px;
    animation: underlineGlow 3s ease-in-out infinite alternate;
}

/* Light theme sections with minimal animations */
.section {
    background: var(--bg-card);
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.section:hover {
    box-shadow: var(--shadow-medium);
}

.section.visible {
    opacity: 1;
    transform: translateY(0);
}

h2 {
    color: var(--primary-color);
    margin-top: 0;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 600;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--border-lighter);
}

/* Enhanced samples section with minimal animations */
.samples .sample {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.samples .sample:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.samples .sample-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.samples .sample-content {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
}

.samples .media-item {
    flex: 0 0 auto;
    width: calc(25% - 0.75rem);
    aspect-ratio: 16/9;
}

.samples .media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    border-radius: 8px;
}

.samples .sample-info {
    display: flex;
    gap: 2rem;
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.samples .shot-narrative {
    flex: 5;
}

.samples .shot-narrative p {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
}

.samples .shot-descriptions {
    line-height: 1.6;
    font-size: 0.95rem;
    margin: 0;
}

.samples .reference-image {
    flex: 1;
    max-width: 200px;
    width: auto;
    height: 160px;
    object-fit: contain;
    border-radius: 8px;
}

/* Custom scrollbar for sample content */
.samples .sample-content::-webkit-scrollbar {
    height: 6px;
}

.samples .sample-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.samples .sample-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.samples .sample-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .samples .sample-info {
        flex-direction: column;
    }
    
    .samples .reference-image {
        max-width: 160px;
        margin-top: 1rem;
    }
}

@media (max-width: 992px) {
    .samples .sample-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 2rem;
    }

    .samples .media-item {
        width: calc(50% - 1rem);
    }
}

@media (max-width: 768px) {
    .samples .media-item {
        width: 100%;
    }
    
    .samples .sample-info {
        padding: 1rem;
    }
}

/* Dataset structure with light theme */
.dataset-structure .structure-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 12px;
}

.dataset-structure h4 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.dataset-structure .field-entry {
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-card);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    border: 1px solid var(--border-lighter);
}

.dataset-structure .field-name {
    color: var(--primary-color);
    font-weight: 600;
}

.dataset-structure .field-type {
    color: var(--secondary-color);
    font-weight: 500;
    background: rgba(139, 92, 246, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Simplified navigation */
#table-of-contents {
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
}

#table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#table-of-contents li a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
    font-size: 0.9rem;
}

#table-of-contents li a:hover,
#table-of-contents li a.active {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

#table-of-contents li a.active {
    border-left: 3px solid var(--primary-color);
}

.main-content-area {
    margin: 0 auto;
    padding: 1rem;
    max-width: 100%;
}

/* Enhanced iframe */
iframe {
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
    width: 100%;
    min-height: 600px;
    background: var(--bg-card);
}

/* Footer */
footer {
    text-align: center;
    padding: 2.5rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    background: var(--bg-secondary);
    margin-top: 3rem;
    border-top: 1px solid var(--border-light);
}

/* Enhanced author info styling */
.author-list-header {
    margin-top: 2rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    animation: authorFadeIn 1s ease-out 0.5s both;
    line-height: 1.6;
}

.author-list-header span {
    margin: 0 0.4em;
    display: inline-block;
    transition: color 0.3s ease, transform 0.3s ease;
    position: relative;
}

.author-list-header span:hover {
    color: var(--header-accent);
    transform: translateY(-2px);
}

.author-list-header sup {
    font-size: 0.7em;
    color: var(--header-accent);
    font-weight: 600;
}

.affiliations-header {
    margin-top: 1.5rem;
    font-size: 1rem;
    color: var(--text-muted);
    animation: affiliationFadeIn 1s ease-out 1s both;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.affiliations-header span {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    font-weight: 500;
}

.affiliations-header sup {
    font-size: 0.8em;
    color: var(--header-accent);
    font-weight: 600;
    margin-right: 0.3em;
}

.external-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    animation: linksFadeIn 1s ease-out 1.5s both;
}

.external-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1.2rem;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.1);
    border-radius: 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 160px;
    justify-content: center;
    font-size: 1rem;
}

.external-link .icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.external-link span {
    line-height: 1;
}

.external-link:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

/* Keyframe animations */
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

@keyframes titleFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

@keyframes underlineGlow {
    0% { 
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.3);
        transform: translateX(-50%) scaleX(1);
    }
    100% { 
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
        transform: translateX(-50%) scaleX(1.2);
    }
}

@keyframes authorFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes affiliationFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes linksFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Simplified expand buttons */
.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 0.5rem;
    padding: 0;
    font-size: 0.8rem;
    color: var(--primary-color);
    transition: color 0.2s ease, transform 0.2s ease;
}

.expand-btn:hover {
    color: var(--primary-dark);
}

.expand-btn::before {
    content: '▶';
    display: inline-block;
    transition: transform 0.2s ease;
}

.expand-btn.expanded::before {
    transform: rotate(90deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 0;
}

.collapsible-content.show {
    max-height: 2000px;
}

/* Responsive design */
@media (max-width: 1200px) {
    .main-content-area {
        margin: 0 auto;
        padding: 1rem;
    }
    
    #table-of-contents {
        position: static;
        transform: none;
        margin-bottom: 2rem;
        width: 100%;
    }
    
    #table-of-contents ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .page-content-wrapper {
        padding: 1rem;
    }
}

@media (max-width: 992px) {
    .samples .media-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    header {
        padding: 2rem 0 1.5rem;
    }
    
    .section {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .samples .sample {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .samples .reference-image-container {
        height: 180px;
    }
    
    .samples .media-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Abstract section specific styling */
.abstract p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    text-align: justify;
}

/* Dataset viewer specific styling */
.dataset-viewer iframe {
    background: var(--bg-card);
    transition: none; /* Remove hover effect for performance */
}

.teaser-image-container {
    margin: 3rem auto;
    text-align: center;
    max-width: 1200px;
    padding: 0 20px;
}

.teaser-image {
    width: auto;
    max-width: 80%;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-light);
    transition: transform 0.3s ease;
}

.teaser-image:hover {
    transform: scale(1.02);
}

/* Architecture video styling */
.architecture-video-container {
    margin: 2rem auto;
    max-width: 1200px;
    width: 100%;
    padding: 0 20px;
}

.architecture-video {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-light);
    background: #000;
}

.multi-shot-player {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-soft);
}

.video-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    margin-bottom: 1.5rem;
}

.main-video {
    width: 100%;
    height: 500px;
    object-fit: contain;
}

.shot-controls {
    display: grid;
    gap: 1.5rem;
}

.shot-buttons {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-behavior: smooth; /* Smooth scrolling animation */
    white-space: nowrap; /* Prevent button wrapping */
    margin-bottom: 1rem;
}

.shot-btn {
    padding: 0.8rem 1.2rem;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex: 0 0 auto; /* Prevent button shrinking */
    min-width: fit-content; /* Ensure button fits content */
}

/* Custom scrollbar styling */
.shot-buttons::-webkit-scrollbar {
    height: 6px;
}

.shot-buttons::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.shot-buttons::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.shot-buttons::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.shot-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.shot-btn.active {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
}

.current-shot {
    text-align: left;
    color: var(--text-secondary);
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.shot-info h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
}

.shot-details {
    display: grid;
    gap: 1rem;
}

.shot-details > div {
    padding: 0.8rem;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border-lighter);
}

.shot-details p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.95rem;
    text-align: left;
    margin-bottom: 0.5rem;
}

.shot-details b {
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 0.5rem;
}

.story-level-annotation {
    text-align: left;
    color: var(--text-secondary);
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    margin-bottom: 1rem;
}

.story-info h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
}

.story-details {
    display: grid;
    gap: 1rem;
}

.story-details > div {
    padding: 0.8rem;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border-lighter);
}

.story-details p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.95rem;
    text-align: left;
    margin-bottom: 0.5rem;
}

.story-details b {
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 0.5rem;
}

.story-list {
    margin-top: 0.5rem;
}

.story-list-item {
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--border-lighter);
}

.story-list-item .item-id {
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.story-list-item .item-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Make story-level and shot-level consistent */
.story-details > div,
.shot-details > div {
    padding: 0.8rem;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border-lighter);
}

.story-details p,
.shot-details p {
    margin: 0 0 0.5rem 0;
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.95rem;
    text-align: left;
}

.story-details b,
.shot-details b {
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 0.5rem;
}

.story-info h3,
.shot-info h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
}

.story-level-annotation,
.current-shot {
    text-align: left;
    color: var(--text-secondary);
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    margin-bottom: 1rem;
}

.story-list-item {
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--border-lighter);
}

.story-list-item .item-id {
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.story-list-item .item-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.story-characters {
    display: flex !important;
    gap: 1.5rem;
    align-items: flex-start;
}

.story-characters-text {
    flex: 2;
}

.story-characters-images {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: flex-start;
    max-width: 400px;
    margin-top: 2rem;
}

.character-image {
    width: calc(50% - 0.25rem);
    height: 160px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.section#citation pre {
    text-align: left;
    margin: 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    overflow-x: auto;
}

.section#citation pre code {
    display: block;
    font-family: monospace;
    white-space: pre;
    padding: 0;
    margin: 0;
    text-align: left;
}

.section#citation .container {
    padding: 0;
}