/* ===== PROJECT DOMAIN CARDS ===== */
.project-domains-container {
    margin-bottom: 2rem;
    padding: 0.5rem 0;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.project-domains-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.domain-card {
    background: rgba(16, 16, 18, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--text-primary);
    border-radius: 24px;
    min-height: 165px;
    padding: 1.7rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.domain-card-icon {
    font-size: 1.4rem;
    color: var(--text-secondary);
}

.domain-card-title {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.2px;
}

.domain-card-meta {
    color: var(--text-secondary);
    font-size: 1rem;
}

.domain-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, rgba(74, 144, 226, 0.14), rgba(74, 144, 226, 0.02));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.domain-card:hover::before {
    opacity: 1;
}

.domain-card:hover {
    border-color: rgba(74, 144, 226, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(74, 144, 226, 0.23);
}

.domain-card.active {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2), rgba(74, 144, 226, 0.12));
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 1px rgba(74, 144, 226, 0.35), 0 0 26px rgba(74, 144, 226, 0.35);
}

.domain-card.active .domain-card-icon,
.domain-card.active .domain-card-title {
    color: #dcecff;
}

/* Animated filter transition */
.projects-carousel {
    transition: opacity 0.3s ease;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.project-card-large {
    display: block;
    min-width: 0;
    height: 100%;
    cursor: pointer;
}

.project-card-large:focus-visible {
    outline: 2px solid rgba(74, 144, 226, 0.7);
    outline-offset: 3px;
}

/* ===== ENHANCED PROJECT TAGS ===== */
.project-tag-enhanced {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border: 1px solid currentColor;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    animation: tagGlow 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.project-tag-enhanced::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
}

@keyframes tagGlow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* ===== PROJECT ACTIONS ===== */
.project-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.project-demo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(244, 114, 182, 0.2), rgba(236, 72, 153, 0.1));
    color: #f472b6;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    border: 1px solid rgba(244, 114, 182, 0.3);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.project-demo-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(244, 114, 182, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.project-demo-btn:hover::before {
    width: 300px;
    height: 300px;
}

.project-demo-btn:hover {
    background: linear-gradient(135deg, rgba(244, 114, 182, 0.3), rgba(236, 72, 153, 0.2));
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(244, 114, 182, 0.4);
}

.project-demo-btn i {
    position: relative;
    z-index: 1;
}

.project-demo-btn span {
    position: relative;
    z-index: 1;
}

/* ===== VIDEO MODAL ===== */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-modal.active {
    opacity: 1;
    pointer-events: all;
}

.video-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
}

.video-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    background: rgba(26, 26, 26, 0.95);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.video-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.video-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

/* ===== RESPONSIVE ENHANCEMENTS ===== */
@media (max-width: 768px) {
    .project-domains-grid {
        grid-template-columns: 1fr;
        gap: 0.9rem;
    }

    .projects-carousel {
        grid-template-columns: 1fr;
    }

    .domain-card {
        min-height: 130px;
        border-radius: 18px;
        padding: 1.1rem;
    }

    .domain-card-title {
        font-size: 1.25rem;
    }

    .domain-card-meta {
        font-size: 0.95rem;
    }
    
    .project-tag-enhanced {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
    }
    
    .project-actions {
        gap: 0.5rem;
    }
    
    .project-demo-btn {
        padding: 0.65rem 1.2rem;
        font-size: 0.85rem;
    }
    
    .video-modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .video-modal-close {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* Use GPU acceleration for animations */
.domain-card,
.project-tag-enhanced,
.project-demo-btn,
.video-modal-content {
    will-change: transform;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .domain-card,
    .project-tag-enhanced,
    .project-demo-btn,
    .video-modal,
    .video-modal-content,
    .projects-carousel {
        animation: none;
        transition: none;
    }
    
    .domain-card:hover,
    .project-demo-btn:hover {
        transform: none;
    }
}

@media (max-width: 520px) {
    .project-domains-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== LOADING STATES ===== */
.project-card-large img[loading="lazy"] {
    background: linear-gradient(135deg, #1e293b, #0f172a);
}

.project-screenshot img.image-fit-cover {
    object-fit: cover;
    object-position: center;
}

/* ===== DOMAIN PROJECTS VIEW ===== */
.projects-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.back-to-domains-btn {
    border: 1px solid rgba(74, 144, 226, 0.4);
    background: rgba(74, 144, 226, 0.12);
    color: #dcecff;
    border-radius: 999px;
    padding: 0.55rem 0.95rem;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.25s ease;
}

.back-to-domains-btn:hover {
    background: rgba(74, 144, 226, 0.2);
    transform: translateY(-1px);
}

.selected-domain-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .projects-view-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1rem;
    }
}

/* Skeleton loading animation */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.project-preview.loading {
    background: linear-gradient(
        90deg,
        #1e293b 0px,
        #2d3748 40px,
        #1e293b 80px
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
}
