/* Modern Case Study Styles */
:root {
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-strong: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Prevent horizontal scrolling */
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.case-study-single {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

/* Hero Banner */
.hero-banner {
    width: 100%;
    height: 100vh;
    position: relative;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    color: var(--accent-color-1);
}

@media (max-width: 768px) {
    .hero-banner {
        background-attachment: scroll; /* Fix for mobile Safari */
        min-height: 60vh; /* Ensure minimum height on mobile */
    }
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, 
        rgba(0,0,0,0.3) 0%,
        rgba(0,0,0,0.6) 50%,
        rgba(0,0,0,0.8) 100%
    );
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    padding-top: calc(var(--navbar-height) + 20px); /* Match navbar height plus a small buffer */
}

.hero-content h1 {
    font-size: clamp(3rem, 8vw, 5rem);
    margin-bottom: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.project-meta {
    display: flex;
    gap: 3rem;
    font-size: 1.2rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-item i {
    font-size: 1.4rem;
    color: var(--accent-color-2);
}

/* Gallery Showcase */
.gallery-showcase {
    width: 100%;
    padding: 4rem 2rem;
    background: var(--accent-color-1);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 300px);
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 768px) {
    .gallery-showcase {
        padding: 2rem 1rem;
    }
    
    .gallery-grid {
        grid-template-columns: minmax(280px, 1fr);
        grid-template-rows: repeat(6, 280px);
        max-width: 500px;
        margin: 0 auto;
    }
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-strong);
}

.gallery-item.featured {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.view-all-btn {
    display: block;
    margin: 3rem auto 0;
    padding: 1.2rem 3rem;
    background: var(--secondary-color);
    color: var(--accent-color-1);
    border: none;
    border-radius: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-soft);
}

.view-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
    background: var(--accent-color-2);
}

/* Project Overview */
.project-overview {
    padding: 6rem 2rem;
    background: var(--accent-color-1);
    color: var(--secondary-color);
}

.overview-content {
    max-width: 800px;
    margin: 0 auto 4rem;
}

.overview-content h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

.project-stats {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-top: 4rem;
}

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

.stat-number {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--accent-color-2);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

/* Project Highlights */
.project-highlights {
    padding: 4rem 2rem;
    background: var(--secondary-color);
}

.highlight-block {
    display: flex;
    align-items: center;
    gap: 4rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 0;
    color: var(--accent-color-1);
}

.highlight-block:nth-child(even) {
    flex-direction: row-reverse;
}

.highlight-content {
    flex: 1;
}

.highlight-number {
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent-color-2);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.highlight-content h3 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.highlight-image {
    flex: 1;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-strong);
}

.highlight-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.highlight-block:hover .highlight-image img {
    transform: scale(1.05);
}

/* Project Features */
.project-features {
    padding: 8rem 2rem;
    background: var(--accent-color-1);
    color: var(--secondary-color);
    text-align: center;
}

.project-features h2 {
    font-size: 2.5rem;
    margin-bottom: 4rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 4rem;
    max-width: 1400px;
    margin: 0 auto;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    transition: var(--transition-smooth);
}

.feature-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
}

.feature-item i {
    font-size: 2.5rem;
    color: var(--accent-color-2);
    margin-bottom: 1.5rem;
    height: 60px;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.feature-item:hover i {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.15);
}

.feature-item h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--accent-color-2);
}

.feature-item p {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.9;
}

/* CTA Section */
.cta-section {
    padding: 8rem 2rem;
    background: var(--accent-color-1);
    text-align: center;
}

.cta-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.cta-content h2 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

.cta-button {
    margin-top: 2rem;
    padding: 1.2rem 3rem;
    background: var(--accent-color-2);
    color: var(--accent-color-1);
    border: none;
    border-radius: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-strong);
}

/* Gallery Modal */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    z-index: 10000; /* Higher than navbar */
    padding: 1rem;
}

.gallery-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1600px;
    margin: 0 auto;
}

.modal-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.modal-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, color 0.3s ease;
    z-index: 10001; /* Ensure it's above modal content */
}

.close-modal:hover {
    transform: scale(1.1);
    color: var(--accent-color-2);
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    z-index: 10001;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.nav-btn.prev {
    left: 20px;
}

.nav-btn.next {
    right: 20px;
}

.modal-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

@media (max-width: 768px) {
    .gallery-modal {
        padding: 0.5rem;
    }

    .modal-content {
        width: 100%;
        height: 100%;
    }

    .close-modal {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 40px;
        height: 40px;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
        padding: 0.5rem;
        font-size: 1.5rem;
    }

    .nav-btn.prev {
        left: 10px;
    }

    .nav-btn.next {
        right: 10px;
    }

    .modal-counter {
        bottom: 10px;
        font-size: 1rem;
    }
}

/* Reveal Animations */
.reveal-section {
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition-smooth);
}

.reveal-section.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .highlight-block {
        flex-direction: column;
        gap: 2rem;
    }
    
    .highlight-block:nth-child(even) {
        flex-direction: column;
    }
    
    .project-stats {
        flex-direction: column;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .hero-content {
        padding-top: calc(var(--navbar-height) + 30px); /* Slightly more buffer on mobile */
    }

    .hero-content h1 {
        font-size: clamp(2rem, 6vw, 3rem);
        margin-bottom: 1.5rem;
    }

    .project-meta {
        flex-direction: column;
        gap: 1rem;
        background: rgba(0, 0, 0, 0.5);
        padding: 1.5rem;
        border-radius: 12px;
        backdrop-filter: blur(10px);
        margin-top: 1rem;
    }

    .meta-item {
        font-size: 1rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(6, 250px);
        padding: 1rem;
    }
    
    .gallery-item.featured {
        grid-column: auto;
        grid-row: auto;
    }

    .highlight-block {
        padding: 2rem 0;
        gap: 2rem;
    }

    .highlight-content {
        padding: 0 1rem;
    }

    .highlight-image {
        height: 300px;
    }

    .feature-item {
        padding: 1.5rem;
    }

    .project-features h2 {
        font-size: 2rem;
        margin-bottom: 2rem;
    }

    .features-grid {
        gap: 2rem;
        padding: 0 1rem;
    }

    /* Improve modal navigation on mobile */
    .nav-btn {
        padding: 0.5rem;
        font-size: 1.5rem;
    }

    .nav-btn.prev {
        left: 10px;
    }

    .nav-btn.next {
        right: 10px;
    }

    .modal-counter {
        bottom: -30px;
        font-size: 1rem;
    }
}