/* Portfolio Section */
.portfolio-section {
    position: relative;
    z-index: var(--z-content);
}

.portfolio-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* Portfolio Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

/* Portfolio Item - Creative Card Design */
.portfolio-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-normal), opacity 0.5s ease, transform 0.5s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Initial state for animation */
    opacity: 0;
    transform: translateY(20px);
}

/* Animated state */
.portfolio-item.animated {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item.animated:hover {
    border-color: rgba(34, 141, 255, 0.3);
    box-shadow: 
        0 25px 50px rgba(34, 141, 255, 0.2),
        0 15px 35px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

/* Portfolio Image Container */
.portfolio-image {
    position: relative;
    min-height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
}

/* Hero Image Overlay */
.portfolio-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.portfolio-thumbnail {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform var(--transition-slow);
    filter: brightness(0.8) saturate(1.1);
    display: block;
    position: relative;
    z-index: 1;
}

.portfolio-item.animated:hover .portfolio-thumbnail {
    filter: brightness(0.9) saturate(1.2);
}

/* Year Badge */
.portfolio-year {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: rgba(0, 0, 0, 0.8);
    color: var(--color-light);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5;
    pointer-events: none;
}

/* Portfolio Content */
.portfolio-content {
    padding: var(--space-lg);
    background: rgba(0, 0, 0, 0.4);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-md);
    gap: var(--space-sm);
}

.portfolio-title {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    flex: 1;
}

.portfolio-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.portfolio-tag {
    background: rgba(34, 141, 255, 0.15);
    color: #70b3ff;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid rgba(34, 141, 255, 0.25);
    transition: all var(--transition-fast);
}

.portfolio-tag:hover {
    background: rgba(34, 141, 255, 0.25);
    color: #90c5ff;
    border-color: rgba(34, 141, 255, 0.4);
}

.portfolio-description {
    font-size: 0.95rem;
    line-height: 1.5;
    opacity: 0.8;
    margin-bottom: var(--space-md);
    flex: 1;
}

.portfolio-cta {
    color: var(--color-accent);
    font-weight: 500;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-normal);
}

.portfolio-item.animated:hover .portfolio-cta {
    opacity: 1;
    transform: translateY(0);
}

/* Project Modal - Inherits from unified modal system */
.project-modal {
    /* Inherits base modal styles from base.css */
}

/* Modal Content Styles */
.project-header {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.project-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 0 auto var(--space-md);
    border-radius: 12px;
}

.project-header h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: var(--space-sm);
    background: linear-gradient(135deg, var(--color-light), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.project-header .lead {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: var(--space-md);
}

.project-meta {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-md);
}

.project-meta .project-tag {
    padding: 8px 16px;
    background: rgba(34, 141, 255, 0.12);
    border: 1px solid rgba(34, 141, 255, 0.25);
    border-radius: 20px;
    font-size: 0.9rem;
    color: #7ab8ff;
    transition: all var(--transition-fast);
}

.project-meta .project-tag:hover {
    background: rgba(34, 141, 255, 0.2);
    border-color: rgba(34, 141, 255, 0.4);
    color: #95cbff;
}

.project-showcase {
    text-align: center;
    margin: var(--space-xl) 0;
}

.project-showcase img {
    max-width: 100%;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.project-content {
    line-height: 1.8;
}

.project-content img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin: var(--space-md) 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.project-content h3,
.project-content h4,
.project-content h5,
.project-content h6 {
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    color: var(--color-accent);
}

.project-content h3:first-of-type {
    margin-top: var(--space-lg);
}

.project-content .row {
    display: flex;
    gap: var(--space-lg);
    margin-top: var(--space-lg);
    flex-direction: row;
}

.project-content .col-lg-8 {
    flex: 2;
    order: 2;
}

.project-content .col-lg-4 {
    flex: 1;
    order: 1;
}

.project-sidebar {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: var(--space-lg);
    position: sticky;
    top: var(--space-md);
}

.project-sidebar h6 {
    color: var(--color-accent);
    margin-bottom: var(--space-sm);
    margin-top: var(--space-lg);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-sidebar h6:first-child {
    margin-top: 0;
}

.project-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.project-sidebar li {
    padding: 4px 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

.project-sidebar a {
    color: var(--color-accent);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.project-sidebar a:hover {
    opacity: 0.8;
}

.store-badges {
    display: flex;
    gap: var(--space-sm);
    margin-top: 0;
    padding: 4px 0;
}

.store-badges img {
    margin: 0 !important;
}

.store-badge {
    width: 120px;
    height: auto;
    transition: transform var(--transition-fast);
    border-radius: 0 !important;
}

.store-badge:hover {
    transform: scale(1.05);
}


/* Portfolio Show More Button */
.portfolio-show-more-container {
    text-align: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
}

.portfolio-show-more-btn {
    background: rgba(34, 141, 255, 0.08);
    border: 2px solid rgba(34, 141, 255, 0.4);
    color: var(--color-accent);
    padding: var(--space-sm) var(--space-lg);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.portfolio-show-more-btn:hover {
    background: rgba(34, 141, 255, 0.15);
    border-color: rgba(34, 141, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(34, 141, 255, 0.2);
}

/* Portfolio Disclaimer */
.portfolio-disclaimer-container {
    text-align: center;
    margin-top: var(--space-lg);
    padding: var(--space-md) 0;
}

.portfolio-disclaimer {
    max-width: 500px;
    margin: 0 auto;
}

.disclaimer-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    margin: 0;
    opacity: 0.7;
}

/* Project Image Gallery Styles */
.project-image-gallery {
    display: grid;
    gap: 12px;
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    min-height: 300px; /* Maintain consistent height like placeholders */
}

.project-image-gallery.four-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    min-height: 500px; /* Much larger minimum height */
    height: auto; /* Allow natural height */
}

.project-image-gallery.single-image {
    grid-template-columns: 1fr;
    height: 200px; /* Fixed height for single image */
}

.project-image-gallery img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: rgba(255,255,255,0.02);
}

.project-image-gallery img:hover {
    box-shadow: 0 4px 16px rgba(34, 141, 255, 0.2);
}

/* Single image in gallery */
.project-image-gallery.single-image img {
    object-fit: contain !important; /* For single images, contain instead of cover */
    background: rgba(0,0,0,0.05);
    height: auto !important; /* Allow natural height */
    max-height: 100%;
}

/* Image Carousel Styles */
.project-image-carousel {
    position: relative;
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0,0,0,0.05);
    min-height: 300px;
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 450px;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    height: 100%;
}

.carousel-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.carousel-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.7);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.carousel-nav:hover {
    background: rgba(34, 141, 255, 0.8);
    transform: translateY(-50%) scale(1.1);
}

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

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

.carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.carousel-nav:disabled:hover {
    background: rgba(0,0,0,0.7);
    transform: translateY(-50%) scale(1);
}

.carousel-indicators {
    position: static;
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    padding: 0 15px;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-indicator.active {
    background: var(--color-accent);
    transform: scale(1.2);
}

/* Mobile responsive for galleries */
@media (max-width: 768px) {
    .project-image-gallery.four-grid {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, 1fr);
        height: auto;
        min-height: 400px;
    }
    
    .project-image-gallery.single-image {
        height: 180px;
    }
    
    .carousel-container {
        height: 300px;
    }
    
    .carousel-nav {
        width: 35px;
        height: 35px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }
    
    .portfolio-item {
        /* Remove fixed aspect ratio to allow natural height */
        aspect-ratio: unset;
    }
    
    .portfolio-image {
        /* Allow flexible height on mobile */
        min-height: 180px;
        height: auto;
    }
    
    .portfolio-thumbnail {
        /* Ensure full image is visible */
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    .portfolio-description {
        /* Make sure description is visible */
        opacity: 1;
        font-size: 0.9rem;
    }
    
    /* Project modal mobile optimizations - inherits from base.css */
    
    .portfolio-tags {
        /* Make sure tags are visible */
        opacity: 1;
    }
    
    .portfolio-cta {
        /* Show CTA on mobile */
        opacity: 1;
        transform: translateY(0);
    }
    
    /* Project modal responsive fixes */
    .project-content .row {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .project-content .col-lg-8,
    .project-content .col-lg-4 {
        order: unset;
        flex: 1;
    }
    
    .project-content .col-lg-4 {
        order: -1; /* Put sidebar on top on mobile */
    }
    
    .project-sidebar {
        position: static;
        margin-bottom: var(--space-md);
    }
    
}