/* Override main content for project pages */
.project-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 40px 60px 40px;
    line-height: 1.7;
    color: #333333;
}

/* Custom scrollbar - hidden but functional */
.main-content::-webkit-scrollbar {
    display: none;
}

.main-content {
    -ms-overflow-style: none;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 80px 0 60px 0;
    margin-bottom: 40px;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: 4.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    letter-spacing: -1px;
    text-transform: none;
    opacity: 0;
    animation: fadeInTitle 1.2s ease-out 0.3s forwards;
}

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

/* Base Animation for All Content */
.content-section,
.photo-container,
.video-container {
    opacity: 0;
    animation: fadeInContent 0.8s ease-out forwards;
}

/* Staggered animation delays using CSS counter */
.project-content > * {
    counter-increment: element-counter;
}

.project-content > *:nth-child(2) { animation-delay: 0.6s; }
.project-content > *:nth-child(3) { animation-delay: 0.7s; }
.project-content > *:nth-child(4) { animation-delay: 0.8s; }
.project-content > *:nth-child(5) { animation-delay: 0.9s; }
.project-content > *:nth-child(6) { animation-delay: 1.0s; }
.project-content > *:nth-child(7) { animation-delay: 1.1s; }
.project-content > *:nth-child(8) { animation-delay: 1.2s; }
.project-content > *:nth-child(9) { animation-delay: 1.3s; }
.project-content > *:nth-child(10) { animation-delay: 1.4s; }
.project-content > *:nth-child(11) { animation-delay: 1.5s; }
.project-content > *:nth-child(12) { animation-delay: 1.6s; }
.project-content > *:nth-child(13) { animation-delay: 1.7s; }
.project-content > *:nth-child(14) { animation-delay: 1.8s; }
.project-content > *:nth-child(15) { animation-delay: 1.9s; }
.project-content > *:nth-child(16) { animation-delay: 2.0s; }
.project-content > *:nth-child(17) { animation-delay: 2.1s; }
.project-content > *:nth-child(18) { animation-delay: 2.2s; }
.project-content > *:nth-child(19) { animation-delay: 2.3s; }
.project-content > *:nth-child(20) { animation-delay: 2.4s; }

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

/* Content Sections - Flexible spacing */
.content-section {
    margin-bottom: 2rem;
    clear: none; /* Allow text to flow around vertical images */
}

/* When content section follows a horizontal image/video, add more space */
.photo-container[data-orientation="horizontal"] + .content-section,
.video-container + .content-section,
.photo-container:not([data-orientation]) + .content-section {
    margin-top: 2rem;
}

/* Typography */
.content-section p {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: #333333;
}

.opening-paragraph {
    font-size: 1.25rem !important;
    font-weight: 400;
    line-height: 1.9;
    color: #2c2c2c;
    margin-bottom: 2rem;
}

.closing-paragraph {
    font-size: 1.2rem !important;
    font-weight: 500;
    font-style: italic;
    text-align: center;
    color: #1a1a1a;
    margin-top: 2rem;
}

.closing {
    text-align: center;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #eaeaea;
}

/* Emphasis */
em {
    font-style: italic;
    color: #1a1a1a;
    font-weight: 500;
}

/* Photo Containers - Base Styles */
.photo-container {
    margin: 2rem 0;
    clear: both;
}

/* Vertical/Portrait Images - Float and integrate with text */
.photo-container[data-orientation="vertical"] {
    float: left;
    width: 320px;
    margin: 0.5rem 2rem 1.5rem 0;
    clear: none;
}

.photo-container[data-orientation="vertical"]:nth-of-type(even) {
    float: right;
    margin: 0.5rem 0 1.5rem 2rem;
}

/* Horizontal/Landscape Images - Full width with spacing */
.photo-container[data-orientation="horizontal"] {
    width: 100%;
    text-align: center;
    float: none;
    margin: 3rem 0;
    clear: both;
}

/* Default styling for images without orientation set */
.photo-container:not([data-orientation]) {
    width: 100%;
    text-align: center;
    float: none;
    margin: 3rem 0;
    clear: both;
}

/* Photo Placeholders */
.photo-placeholder {
    width: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

/* Vertical image placeholder - FIXED RESOLUTION ISSUE */
.photo-container[data-orientation="vertical"] .photo-placeholder {
    height: 400px;
    aspect-ratio: 3/4;
    /* Fix for resolution issue */
    min-height: 400px;
    min-width: 300px;
}

.photo-container[data-orientation="vertical"] .photo-placeholder img {
    /* Ensure images maintain quality at all zoom levels */
    image-rendering: -webkit-optimize-contrast;
    min-width: 100%;
    min-height: 100%;
}

/* Horizontal image placeholder */
.photo-container[data-orientation="horizontal"] .photo-placeholder {
    height: 400px;
    aspect-ratio: 4/3;
    min-height: 400px;
}

/* Default placeholder (horizontal) */
.photo-container:not([data-orientation]) .photo-placeholder {
    height: 400px;
    aspect-ratio: 4/3;
    min-height: 400px;
}

.photo-placeholder:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.photo-label {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 500;
    color: #6c757d;
    z-index: 1;
    position: relative;
}

/* Photo Captions - Always centered for vertical images */
.photo-caption {
    margin-top: 0.75rem;
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem;
    font-weight: 400;
    color: #666666;
    font-style: italic;
    line-height: 1.5;
    text-align: center; /* Always center captions */
    max-width: 100%;
}

/* Horizontal image captions */
.photo-container[data-orientation="horizontal"] .photo-caption {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* YouTube Video Container Styles */
.video-container {
    margin: 3rem 0;
    clear: both;
    width: 100%;
    text-align: center;
    float: none;
}

/* Video Wrapper for Responsive Aspect Ratio */
.video-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.video-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* YouTube iframe */
.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Video Captions */
.video-caption {
    margin-top: 0.75rem;
    font-family: 'Playfair Display', serif;
    font-size: 0.9rem;
    font-weight: 400;
    color: #666666;
    font-style: italic;
    line-height: 1.5;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Clear floats after content sections that might contain floating images */
.content-section::after {
    content: "";
    display: table;
    clear: both;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .project-content {
        padding: 0 30px 60px 30px;
    }
    
    .hero-title {
        font-size: 3.8rem;
    }
    
    .photo-container[data-orientation="vertical"] {
        width: 300px;
        margin-right: 1.5rem;
        margin-left: 1.5rem;
    }
}

@media (max-width: 768px) {
    .project-content {
        padding: 0 20px 40px 20px;
    }
    
    .hero-section {
        padding: 60px 0 40px 0;
        margin-bottom: 30px;
    }
    
    .hero-title {
        font-size: 3.2rem;
        letter-spacing: -0.5px;
    }
    
    .content-section p,
    .opening-paragraph {
        font-size: 1.05rem !important;
        line-height: 1.7;
    }
    
    .closing-paragraph {
        font-size: 1.1rem !important;
    }
    
    /* Mobile: All images become full width */
    .photo-container,
    .photo-container[data-orientation="vertical"],
    .photo-container[data-orientation="horizontal"] {
        float: none !important;
        width: 100% !important;
        margin: 2rem 0 !important;
        text-align: center;
        clear: both;
    }
    
    .photo-container[data-orientation="vertical"] .photo-placeholder {
        height: 350px;
        aspect-ratio: 3/4;
        min-height: 350px;
    }
    
    .photo-container[data-orientation="horizontal"] .photo-placeholder,
    .photo-container:not([data-orientation]) .photo-placeholder {
        height: 280px;
        aspect-ratio: 4/3;
        min-height: 280px;
    }
    
    .content-section {
        margin-bottom: 1.5rem;
        clear: both;
    }
    
    .video-container {
        margin: 2rem 0;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.8rem;
    }
    
    .project-content {
        padding: 0 15px 40px 15px;
    }
    
    .photo-container[data-orientation="vertical"] .photo-placeholder {
        height: 300px;
        min-height: 300px;
    }
    
    .photo-container[data-orientation="horizontal"] .photo-placeholder,
    .photo-container:not([data-orientation]) .photo-placeholder {
        height: 240px;
        min-height: 240px;
    }
    
    .video-wrapper {
        border-radius: 6px;
    }
    
    .video-wrapper iframe {
        border-radius: 6px;
    }
}

/* Print styles */
@media print {
    .photo-placeholder {
        height: 300px;
        border: 1px solid #ccc;
        background: #f9f9f9;
    }
    
    .hero-title {
        color: #000;
    }
    
    .video-wrapper {
        height: 300px;
        padding-bottom: 0;
        border: 1px solid #ccc;
        background: #f9f9f9;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .video-wrapper::after {
        content: "YouTube Video";
        font-family: 'Playfair Display', serif;
        font-size: 1.1rem;
        color: #666;
    }
    
    .video-wrapper iframe {
        display: none;
    }
}