/*
*/

main {
    padding-top: 50px;
}

main::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -20%;
    width: 130vw;
    height: 130vw;
    background: radial-gradient(ellipse at center,
        rgba(14, 116, 144, 0.38) 0%,
        rgba(14, 116, 144, 0.18) 30%,
        rgba(14, 116, 144, 0.05) 60%,
        transparent 80%);
    pointer-events: none;
    z-index: -1;
}
.container h1.title-text {
    font-size: 3rem;
    margin-bottom: 20px;
    text-align: center;
}

.container p.title-text {
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto 0;
    text-align: center;
    margin-bottom: 40px;
}
.no-images {
    padding: 60px 20px;
    background: var(--secondary-bg);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    text-align: center;
}
.no-images p {
    color: var(--text-secondary);
    font-size: 1.1rem; margin: 0;
}
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}
.portfolio-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 300px;
    background-color: #111;

    background-image: url('/img/img-loader.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 80px;

    border: 1px solid var(--glass-border);
    cursor: pointer;
    opacity: 0;
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.portfolio-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.15);
}
.project-image-wrap {
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.project-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.portfolio-item:hover .project-image-wrap img {
    transform: scale(1.04);
}
.project-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
    transition: background 0.3s ease;
}
.portfolio-item:hover .project-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 75%, transparent 100%);
}
.project-overlay h3 {
    margin-bottom: 5px;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 700;
}
.project-overlay p {
    font-size: 0.9rem;
    margin: 0;
}

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

/* Fullscreen Lightbox Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Stops scrollbars from flickering during slide transitions */
    background-color: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(15px);
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
    touch-action: none; 
}
.modal.show {
    display: flex;
    opacity: 1;
}
/* Ensure the content wrap masks overflowing horizontal slides cleanly */
.modal-content-wrap {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden; /* Clips the adjacent panels */
}

/* The master flex track carrying your three image panes */
#modalSliderStage {
    position: relative;
    width: 100%;
    height: calc(100% - 50px);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(0px);
    will-change: transform;
}

#modalSliderStage.smooth-slide {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); /* Snappier custom curve eliminates the rubber-band snap bounce */
}

.modal-pane-img {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    background-color: #111;
    will-change: transform;
}

/* Set up coordinates for side-by-side positioning */
#panePrev {
    /* Explicitly push the image out to the left margin, regardless of how wide the desktop monitor is */
    transform: translateX(-100vw); 
}

#paneCurrent {
    transform: translateX(0);
}

#paneNext {
    /* Explicitly push the image out to the right margin, regardless of how wide the desktop monitor is */
    transform: translateX(100vw); 
}

.modal.show .modal-image {
    transform: scale(1);
}
.modal-nav {
    position: fixed; /* Ensures tracking coordinates map against viewport screen, not the flexbox data */
    top: 50%;
    transform: translateY(-50%);
    color: #f1f1f1;
    font-size: 50px; /* Enhanced visibility for easy thumb-tapping */
    font-weight: bold;
    padding: 0px;
    cursor: pointer;
    user-select: none;
    z-index: 2100; /* Forces arrows to hover above the hidden sliding image panes */
}

/* Snap Left Arrow to the absolute left margin */
.modal-prev {
    width: 60px;
    height: 60px;
    left: 40px;
}

/* Snap Right Arrow to the absolute right margin */
.modal-next {
    width: 60px;
    height: 60px;
    right: 40px;
}

/* Hover and active micro-feedback effects */
.modal-nav svg {
    fill: white;
    transition: fill 0.2s ease, transform 0.2s ease;
}

.modal-nav svg:hover {
    fill: var(--accent-color);
    transform: scale(1.10);
}

.modal-nav svg:active {
    transform: scale(1);
}

/* Keep close button floating pinned cleanly over top right */
.modal-close {
    position: fixed;
    top: 30px;
    right: 40px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 2100;
}
.modal-close:hover,
.modal-close:focus {
    color: var(--accent-color);
    text-decoration: none;
    cursor: pointer;
}

@media (max-width: 1200px) {
    .modal-nav {
        padding: 0;
        transform: none;
        top: auto;
        bottom: 4%;
    }
    .modal-nav:hover {
        color: var(--accent-color);
        transform: scale(1.15);
    }
    .modal-nav.prev {
        left: 0px;
    }
    .modal-nav.next {
        right: 0px;
    }
}

@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .modal-close {
        top: 20px;
        right: 20px;
        font-size: 30px;
    }
}