/* TSERA Portfolio Modern Frontend Styles */

:root {
    --tsera-primary: #007cba;
    --tsera-primary-dark: #005a87;
    --tsera-secondary: #f8f9fa;
    --tsera-accent: #e74c3c;
    --tsera-text: #2c3e50;
    --tsera-text-light: #6c757d;
    --tsera-border: #e9ecef;
    --tsera-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --tsera-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
    --tsera-radius: 12px;
    --tsera-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container and Layout */
.tsera-portfolio-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Category Filter Buttons */
.tsera-portfolio-categories {
    display: flex !important; /* Force display to ensure visibility */
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 3rem;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--tsera-radius);
    box-shadow: var(--tsera-shadow);
    visibility: visible !important; /* Ensure visibility */
    opacity: 1 !important; /* Ensure opacity */
}

.tsera-portfolio-category-btn {
    background: white;
    border: 2px solid var(--tsera-border);
    color: var(--tsera-text);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--tsera-transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.tsera-portfolio-category-btn::before {
    content: 	erase;
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.tsera-portfolio-category-btn:hover::before {
    left: 100%;
}

.tsera-portfolio-category-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--tsera-shadow-hover);
    border-color: var(--tsera-primary);
    color: var(--tsera-primary);
}

.tsera-portfolio-category-btn.active {
    background: linear-gradient(135deg, var(--tsera-primary) 0%, var(--tsera-primary-dark) 100%);
    border-color: var(--tsera-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--tsera-shadow-hover);
}

/* Portfolio Grid - Bento Style */
.tsera-portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Portfolio Items */
.tsera-portfolio-item {
    background: white;
    border-radius: var(--tsera-radius);
    overflow: hidden;
    box-shadow: var(--tsera-shadow);
    transition: var(--tsera-transition);
    position: relative;
    cursor: pointer;
    border: none !important; /* Removed border */
}

.tsera-portfolio-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--tsera-shadow-hover);
    border-color: transparent !important; /* Ensure no border on hover */
}

/* Portfolio Image */
.tsera-portfolio-image {
    position: relative;
    overflow: hidden;
    height: 300px; /* Increased height for better visibility */
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.tsera-portfolio-image img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    object-position: center !important; /* Center the image for better composition */
    transition: var(--tsera-transition);
    image-rendering: -webkit-optimize-contrast; /* Improve image sharpness */
    image-rendering: crisp-edges; /* Improve image sharpness */
}

.tsera-portfolio-item:hover .tsera-portfolio-image img {
    transform: scale(1.1);
}







/* Portfolio Content - Hidden on home page to show only thumbnails */
.tsera-portfolio-content {
    display: none; /* Hide content section to show only clean thumbnails */
}

.tsera-portfolio-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tsera-text);
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
}

.tsera-portfolio-description {
    color: var(--tsera-text-light);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tsera-portfolio-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--tsera-border);
}

.tsera-portfolio-categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tsera-portfolio-category-tag {
    background: linear-gradient(135deg, var(--tsera-primary) 0%, var(--tsera-primary-dark) 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tsera-portfolio-website-link {
    color: var(--tsera-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--tsera-transition);
}

.tsera-portfolio-website-link:hover {
    color: var(--tsera-primary-dark);
    transform: translateX(3px);
}

.tsera-portfolio-website-link::after {
    content: 	'→';
    transition: var(--tsera-transition);
}

.tsera-portfolio-website-link:hover::after {
    transform: translateX(3px);
}

/* Modal/Lightbox for Website Preview */
.tsera-portfolio-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Dark overlay for lightbox */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--tsera-transition);
}

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

.tsera-portfolio-modal-content {
    background: transparent; /* Removed white background */
    border-radius: var(--tsera-radius);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.8);
    transition: var(--tsera-transition);
}

.tsera-portfolio-modal.active .tsera-portfolio-modal-content {
    transform: scale(1);
}

.tsera-portfolio-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--tsera-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tsera-portfolio-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tsera-text);
    margin: 0;
}

.tsera-portfolio-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--tsera-text-light);
    transition: var(--tsera-transition);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tsera-portfolio-modal-close:hover {
    background: var(--tsera-secondary);
    color: var(--tsera-text);
}

.tsera-portfolio-modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Loading Animation */
.tsera-portfolio-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.tsera-portfolio-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--tsera-border);
    border-top: 4px solid var(--tsera-primary);
    border-radius: 50%;
    animation: tsera-spin 1s linear infinite;
}

@keyframes tsera-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade In Animation */
@keyframes tsera-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tsera-portfolio-item {
    animation: tsera-fadeIn 0.6s ease-out forwards;
}

.tsera-portfolio-item:nth-child(1) { animation-delay: 0.1s; }
.tsera-portfolio-item:nth-child(2) { animation-delay: 0.2s; }
.tsera-portfolio-item:nth-child(3) { animation-delay: 0.3s; }
.tsera-portfolio-item:nth-child(4) { animation-delay: 0.4s; }
.tsera-portfolio-item:nth-child(5) { animation-delay: 0.5s; }
.tsera-portfolio-item:nth-child(6) { animation-delay: 0.6s; }

/* Responsive Design */
@media (max-width: 768px) {
    .tsera-portfolio-container {
        padding: 1rem 0.5rem;
    }
    
    .tsera-portfolio-categories {
        padding: 1rem;
        margin-bottom: 2rem;
    }
    
    .tsera-portfolio-category-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .tsera-portfolio-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .tsera-portfolio-image {
        height: 250px; /* Adjusted for mobile */
    }
    
    .tsera-portfolio-content {
        display: none; /* Keep content hidden on mobile too */
    }
    
    .tsera-portfolio-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .tsera-portfolio-modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .tsera-portfolio-modal-header {
        padding: 1rem;
    }
    
    .tsera-portfolio-modal-body {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .tsera-portfolio-categories {
        flex-direction: column;
        align-items: center;
    }
    
    .tsera-portfolio-category-btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --tsera-text: #e9ecef;
        --tsera-text-light: #adb5bd;
        --tsera-secondary: #343a40;
        --tsera-border: #495057;
    }
    
    .tsera-portfolio-item {
        background: #2c3e50;
        border-color: var(--tsera-border);
    }
    
    .tsera-portfolio-categories {
        background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    }
    
    .tsera-portfolio-category-btn {
        background: #495057;
        border-color: var(--tsera-border);
        color: var(--tsera-text);
    }
    
    .tsera-portfolio-modal-content {
        background: #2c3e50;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .tsera-portfolio-item {
        border-width: 2px;
    }
    
    .tsera-portfolio-category-btn {
        border-width: 2px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Featherlight overrides for full-view image and no grey area */
.featherlight {
    background: rgba(0, 0, 0, 0.9) !important; /* Ensure dark overlay for lightbox */
    overflow: hidden !important; /* Remove scroll */
}

.featherlight .featherlight-content {
    background: transparent !important; /* Remove grey background */
    padding: 0 !important; /* Remove padding */
    border: none !important; /* Remove border */
    max-width: 95vw !important; /* Ensure content fits within viewport */
    max-height: 95vh !important; /* Ensure content fits within viewport */
    overflow: hidden !important; /* Remove scroll */
}

.featherlight .featherlight-image {
    width: auto !important; /* Allow image to take natural width */
    max-width: 95vw !important; /* Ensure image fits within viewport */
    height: auto !important; /* Allow image to take natural height */
    max-height: 95vh !important; /* Ensure image fits within viewport height */
    display: block !important; /* Remove extra space below image */
    margin: 0 auto !important; /* Center the image */
    object-fit: contain !important; /* Ensure full image is visible without cropping */
}

.featherlight .featherlight-close-icon {
    top: 15px;
    right: 15px;
    font-size: 24px;
    line-height: 24px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7) !important; /* Darker background for better visibility */
    color: white !important;
    border-radius: 50%;
    text-align: center;
    cursor: pointer;
    z-index: 9999;
    position: fixed !important; /* Fixed positioning to stay in place */
}

.featherlight .featherlight-close-icon:hover {
    background: rgba(0, 0, 0, 0.9) !important;
    transform: scale(1.1) !important;
}

.featherlight-loading .featherlight-content {
    background: transparent !important; /* Ensure no grey background during loading */
}

/* Ensure lightbox content is centered and properly sized */
.featherlight .featherlight-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}






/* Portfolio Filtering Classes - CRITICAL FOR FUNCTIONALITY */
.tsera-portfolio-item.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

.tsera-portfolio-item.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
}

/* Ensure grid items display correctly when visible */
.tsera-portfolio-grid .tsera-portfolio-item.visible {
    display: block !important;
}

/* Override any potential flex or grid display conflicts */
.tsera-portfolio-container .tsera-portfolio-item.visible {
    display: block !important;
}

/* Animation for filtered items - optional, can be disabled if causing issues */
.tsera-portfolio-item:not(.hidden) {
    animation: tsera-filterIn 0.3s ease-out forwards;
}

@keyframes tsera-filterIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure smooth transitions during filtering */
.tsera-portfolio-grid {
    transition: all 0.3s ease;
}

