/* Portfolio Section Styles */

/* Portfolio Grid - 2 per row for web */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

/* Project Card */
.project-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Progressive reveal for projects - Updated for web 2-per-row showing first 4 */
.desktop-row-2 {
    display: none; /* Hide initially on desktop too */
}

.desktop-row-3 {
    display: none; /* Hide initially */
}

.hidden-projects {
    display: none;
}

/* Interactive Slider - Optimized for 3:4 aspect ratio */
.slider-container {
    position: relative;
    height: 677px; /* Optimized for 3:4 aspect ratio */
    overflow: hidden;
    cursor: grab;
    background: #f5f5f5;
}

.slider-container:active {
    cursor: grabbing;
}

.slider-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Smart orientation handling for sliders */
.slider-container img[data-orientation="portrait"] {
    object-fit: cover; /* Changed from contain to cover for better presentation */
}

.slider-divider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: var(--secondary-color);
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.slider-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: var(--secondary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.slider-divider::after {
    content: '⟷';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 16px;
}

/* Before image clipping */
.before-image {
    z-index: 2;
}

.after-image {
    z-index: 1;
}

/* Image Caption */
.image-caption {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.8), transparent);
    color: white;
    padding: 1rem 1rem 2rem;
    font-size: 0.9rem;
    line-height: 1.4;
    z-index: 4;
}

/* Standalone Image - Optimized for 3:4 aspect ratio */
.standalone-image {
    position: relative;
    height: 677px; /* Optimized for 3:4 aspect ratio */
    overflow: hidden;
    background: #f5f5f5;
}

.standalone-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Smart orientation handling for standalone */
.standalone-image img[data-orientation="portrait"] {
    object-fit: cover; /* Changed from contain to cover */
}


/* Project Info */
.project-info {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 0.5rem;
    z-index: 5;
}

.detail-item {
    background: var(--light-bg);
    color: var(--primary-color);
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(44, 62, 80, 0.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Projects button container */
.projects-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 3rem;
}

/* Enhanced See More Projects Button */
.see-more-projects-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #d4a190 100%);
    color: var(--white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--button-shadow);
    position: relative;
    overflow: hidden;
}

.see-more-projects-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
    transition: left 0.3s ease;
}

.see-more-projects-btn:hover::before {
    left: 0;
}

.see-more-projects-btn:hover {
    background: linear-gradient(135deg, #d4a190 0%, #c19080 100%);
    transform: translateY(-2px);
    box-shadow: var(--button-hover-shadow);
}

.see-more-projects-btn:active {
    transform: translateY(0);
    box-shadow: var(--button-shadow);
}

.button-arrow {
    transition: transform 0.3s ease;
}

.see-more-projects-btn:hover .button-arrow {
    transform: translateX(3px);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.lightbox-image {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
}

.lightbox-info {
    padding: 1.5rem;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Maintain 3:4 aspect ratio on mobile too */
    .slider-container,
    .standalone-image {
        height: 477px;
        aspect-ratio: 3 / 4; /* Keep native ratio on mobile */
    }

    .detail-item {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
    }

    /* Mobile: Hide rows 2+ initially */
    .desktop-row-2,
    .desktop-row-3 {
        display: none;
    }

    .see-more-projects-btn {
        font-size: 1rem;
        padding: 0.8rem 1.5rem;
    }
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
    .project-card {
        transition: none;
    }

    .standalone-image img {
        transition: none;
    }

    .see-more-projects-btn {
        transition: none;
    }

    .see-more-projects-btn::before {
        transition: none;
    }
}

/* Focus styles for better accessibility */
.project-card:focus-within {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

.see-more-projects-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.slider-divider:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .see-more-projects-btn {
        border: 1px solid currentColor;
    }

    .project-card {
        border: 1px solid currentColor;
    }

    .detail-item {
        border: 1px solid currentColor;
    }
}

/* Additional mobile optimizations for smaller screens like iPhone */
@media (max-width: 480px) {
    .portfolio-grid {
        gap: 1rem;
        padding: 0 0.5rem;
    }

    .project-card {
        margin: 0 auto;
        max-width: 100%;
        overflow: hidden;
    }

    /* Enhanced mobile image caption positioning */
    .image-caption {
        font-size: 0.75rem;
        padding: 1rem 0.6rem 0.6rem;
        line-height: 1.25;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
        max-height: 40%;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
    }

    /* Improved mobile project info positioning */
    .project-info {
        right: 35px;
        gap: 0.25rem;
        max-width: calc(100% - 12px);
        flex-wrap: wrap;
    }

    .detail-item {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
        border-radius: 10px;
        white-space: nowrap;
        max-width: fit-content;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(5px);
    }

    /* Optimize slider for mobile touch */
    .slider-divider {
        width: 2px;
    }

    .slider-divider::before {
        width: 30px;
        height: 30px;
    }

    .slider-divider::after {
        font-size: 12px;
    }

    /* Ensure proper touch handling */
    .slider-container {
        touch-action: pan-x;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}