/* Portfolio Gallery Styles */
.portfolio-intro {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.portfolio-intro p {
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.8;
    font-style: italic;
}

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

/* Better sizing for different numbers of items */
.portfolio-gallery:has(.gallery-item:nth-child(1):last-child) {
    grid-template-columns: minmax(300px, 500px);
    justify-content: center;
}

.portfolio-gallery:has(.gallery-item:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(280px, 400px));
    justify-content: center;
}

.portfolio-gallery:has(.gallery-item:nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(260px, 350px));
    justify-content: center;
}

.gallery-item {
    position: relative;
    aspect-ratio: 4/5;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--window-bg);
    backdrop-filter: blur(10px);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.gallery-item.featured {
    grid-column: span 2;
    aspect-ratio: 16/10;
}

@media (max-width: 768px) {
    .portfolio-gallery {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
        padding: 1rem;
        max-width: 400px;
    }
    
    .gallery-item {
        aspect-ratio: 3/4;
    }
}

.gallery-image-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.1) 50%,
        rgba(0, 0, 0, 0.8) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-expand {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.gallery-expand:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.gallery-info {
    margin-top: auto;
}

.gallery-title {
    color: white;
    font-family: 'Italiana', serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.gallery-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Project Detail View Styles */
.portfolio-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.portfolio-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.project-detail-content {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    color: white;
}

.project-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-title {
    font-family: 'Italiana', serif;
    font-size: 2.5rem;
    margin: 0;
    color: white;
}

.project-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.project-category,
.project-year,
.project-client {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    display: inline-block;
    width: fit-content;
}

.project-description {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.9;
    margin: 0;
}

.project-images {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.main-image-container {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
}

.main-image {
    width: 100%;
    height: 60vh;
    object-fit: contain;
    display: block;
    background: rgba(0, 0, 0, 0.1);
}

.image-navigation {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    pointer-events: none;
}

.image-prev,
.image-next {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.image-prev:hover,
.image-next:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.image-thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    border: 2px solid transparent;
}

.thumbnail.active {
    opacity: 1;
    border-color: white;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-caption {
    text-align: center;
    font-style: italic;
    opacity: 0.8;
    font-size: 0.9rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    top: 2rem;
    right: 2rem;
}

.lightbox-prev {
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

@media (max-width: 768px) {
    .lightbox-container {
        padding: 1rem;
    }
    
    .project-detail-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .project-title {
        font-size: 2rem;
    }
    
    .main-image {
        height: 40vh;
    }
    
    .lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        top: 1rem;
        right: 1rem;
    }
    
    .image-prev,
    .image-next {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .thumbnail {
        width: 60px;
        height: 45px;
    }
}
