/**
 * Projects Gallery Styles
 * Matches Gallery.pdf design
 */

/* Gallery Container */
.ts-projects-gallery {
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 20px;
}

/* Header */
.ts-gallery-header {
    text-align: center;
    margin-bottom: 40px;
}

.ts-gallery-title {
    font-size: 48px;
    font-weight: 700;
    color: #101828;
    margin-bottom: 16px;
}

.ts-gallery-intro {
    font-size: 18px;
    color: #4a5565;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Category Tabs */
.ts-gallery-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
}

.ts-tab {
    background: #f1f3f5;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    color: #4a5565;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ts-tab:hover {
    background: #e5e7eb;
}

.ts-tab.active {
    background: #1e40af;
    color: #ffffff;
}

/* Grid */
.ts-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    transition: opacity 0.3s ease;
}

.ts-gallery-grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Project Card - Consistent Heights */
.ts-project-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.ts-project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

/* Card Image */
.ts-card-image-wrap {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #f1f3f5;
    cursor: pointer;
}

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

.ts-project-card:hover .ts-card-image {
    transform: scale(1.05);
}

.ts-card-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e5e7eb 0%, #f1f3f5 100%);
}

.ts-card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #1e40af;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    z-index: 2;
}

/* Image Overlay */
.ts-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.3s ease;
    z-index: 1;
}

.ts-project-card:hover .ts-card-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.ts-card-zoom-icon {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    background: #ffffff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1e40af;
}

.ts-project-card:hover .ts-card-zoom-icon {
    opacity: 1;
    transform: scale(1);
}

.ts-card-image-count {
    opacity: 0;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.ts-project-card:hover .ts-card-image-count {
    opacity: 1;
}

/* Card Content - Fixed Heights */
.ts-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ts-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #101828;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 47px;
}

.ts-card-excerpt {
    font-size: 14px;
    color: #4a5565;
    margin: 0 0 12px 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 42px;
}

.ts-card-meta {
    min-height: 21px;
    margin-bottom: 12px;
}

.ts-card-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

.ts-card-location svg {
    flex-shrink: 0;
}

/* Card Actions */
.ts-card-actions {
    margin-top: auto;
    min-height: 40px;
}

.ts-view-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1e40af;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.3s ease;
}

.ts-view-details-btn:hover {
    background: #1e3a8a;
    color: #ffffff;
}

.ts-view-details-placeholder {
    display: block;
    height: 40px;
}

/* Load More / Footer */
.ts-gallery-footer {
    text-align: center;
    margin-top: 40px;
}

.ts-load-more {
    background: #1e40af;
    color: #ffffff;
    border: none;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.ts-load-more:hover {
    background: #1e3a8a;
}

.ts-load-more:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.ts-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #4a5565;
}

.ts-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #1e40af;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* No Projects */
.ts-no-projects {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHTBOX MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.ts-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.ts-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ts-lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ts-lightbox-image.loaded {
    opacity: 1;
}

.ts-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: background 0.3s ease;
    z-index: 10;
}

.ts-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ts-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: background 0.3s ease;
    z-index: 10;
}

.ts-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ts-lightbox-nav.disabled {
    opacity: 0.3;
    cursor: default;
}

.ts-lightbox-prev {
    left: 20px;
}

.ts-lightbox-next {
    right: 20px;
}

.ts-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

/* Hide nav buttons when single image */
.ts-lightbox.single-image .ts-lightbox-nav,
.ts-lightbox.single-image .ts-lightbox-counter {
    display: none;
}

/* Body scroll lock */
body.ts-lightbox-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 1024px) {
    .ts-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ts-gallery-title {
        font-size: 36px;
    }
}

@media (max-width: 640px) {
    .ts-gallery-grid {
        grid-template-columns: 1fr;
    }

    .ts-gallery-title {
        font-size: 28px;
    }

    .ts-gallery-intro {
        font-size: 16px;
    }

    .ts-gallery-tabs {
        gap: 8px;
    }

    .ts-tab {
        padding: 10px 16px;
        font-size: 13px;
    }

    .ts-projects-gallery {
        padding: 40px 16px;
    }

    .ts-lightbox-nav {
        width: 44px;
        height: 44px;
    }

    .ts-lightbox-prev {
        left: 10px;
    }

    .ts-lightbox-next {
        right: 10px;
    }

    .ts-lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
}
/* =======================================================================
   SINGLE PROJECT GALLERY GRID
   ======================================================================= */

.ts-project-gallery-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
}

.ts-project-gallery-item {
position: relative;
aspect-ratio: 4/3;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
}

.ts-project-gallery-item img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}

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

.ts-gallery-item-overlay {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0);
display: flex;
align-items: center;
justify-content: center;
transition: background 0.3s ease;
color: #ffffff;
}

.ts-gallery-item-overlay svg {
opacity: 0;
transform: scale(0.8);
transition: all 0.3s ease;
}

.ts-project-gallery-item:hover .ts-gallery-item-overlay {
background: rgba(0, 0, 0, 0.4);
}

.ts-project-gallery-item:hover .ts-gallery-item-overlay svg {
opacity: 1;
transform: scale(1);
}

.ts-project-content p {
font-size: 16px;
line-height: 1.8;
margin-bottom: 1em;
}

@media (max-width: 1024px) {
.ts-project-gallery-grid {
grid-template-columns: repeat(3, 1fr);
}
}

@media (max-width: 640px) {
.ts-project-gallery-grid {
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
}
