/* Expertise Gallery Styles - Premium Card Design */
.expertise-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    margin: 80px 0;
    position: relative;
    z-index: 1;
    padding: 0 40px;
}

.gallery-item {
    position: relative;
    height: 450px;
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 
        0 20px 60px rgba(0,0,0,0.1),
        0 8px 20px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.8);
    transform: translateZ(0);
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255,255,255,0.4) 0%, 
        rgba(255,255,255,0.1) 50%, 
        transparent 100%);
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gallery-item:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 
        0 35px 80px rgba(0,0,0,0.15),
        0 15px 35px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-image {
    width: 100%;
    height: 100%;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    border-radius: 24px;
    object-fit: cover;
    object-position: center;
}

.gallery-item:hover .gallery-image {
    transform: scale(1.08);
    filter: brightness(0.9) saturate(1.1);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(0,0,0,0.1) 0%, 
        rgba(0,0,0,0.3) 40%, 
        rgba(0,0,0,0.7) 80%, 
        rgba(0,0,0,0.85) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 60px 40px 50px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(12px);
    border-radius: 24px;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay-content {
    text-align: center;
    transform: translateY(25px);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0.05s;
    max-width: 90%;
}

.gallery-item:hover .gallery-overlay-content {
    transform: translateY(0);
}

.gallery-overlay h3 {
    color: #ffffff;
    font-size: 2.2em;
    font-weight: 900;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
    letter-spacing: 0.8px;
    line-height: 1.1;
    font-family: 'Poppins', sans-serif;
}

.gallery-overlay-text {
    color: rgba(255,255,255,0.95);
    font-size: 1em;
    font-weight: 500;
    margin-top: 12px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.4);
    line-height: 1.5;
    font-family: 'Poppins', sans-serif;
}

/* UNIQUE POP-OUT PREVIEW DESIGN */
.service-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    animation: modalFadeIn 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    backdrop-filter: blur(25px);
    margin: 0 auto;
    padding: 0;
    border-radius: 30px;
    width: 92%;
    max-width: 1000px;
    height: auto;
    max-height: 90vh;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: modalSlideIn 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: row;
    box-shadow: 
        0 50px 100px rgba(0, 0, 0, 0.3),
        0 25px 50px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    color: #333;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.15),
        0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.1) rotate(90deg);
    color: #cc0000;
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.2),
        0 6px 15px rgba(0, 0, 0, 0.15);
}

.service-modal-content {
    display: flex;
    flex-direction: row;
    min-height: 500px;
    max-height: 80vh;
    overflow: hidden;
    background: transparent;
}

.service-modal-image {
    flex: 0 0 45%;
    height: 100%;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
}

.service-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    filter: brightness(1.05);
    background: #f8f9fa;
}

/* Specific positioning for different images */
.service-modal-image img[src*="testingmachine.jpg"] {
    object-position: center 30%;
}

.service-modal-image img[src*="Agregate.jpg"] {
    object-position: center 40%;
}

.service-modal-image img[src*="Soil.jpg"] {
    object-position: center 35%;
}

.service-modal-image img[src*="Composite.jpg"] {
    object-position: center 45%;
}

.service-modal-image:hover img {
    transform: scale(1.05);
    filter: brightness(1.1) saturate(1.1);
}

.service-modal-info {
    flex: 0 0 55%;
    padding: 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: transparent;
    position: relative;
    height: 100%;
}

.service-modal-info h2 {
    color: #cc0000;
    font-size: 2.2em;
    font-weight: 900;
    margin-bottom: 20px;
    line-height: 1.1;
    position: relative;
    padding-bottom: 15px;
    font-family: 'Poppins', sans-serif;
    text-shadow: 0 2px 4px rgba(204, 0, 0, 0.1);
}

.service-modal-info h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #cc0000, #ff6b6b);
    border-radius: 2px;
    box-shadow: 0 2px 10px rgba(204, 0, 0, 0.3);
}

.service-description {
    color: #555;
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 25px;
    font-weight: 400;
}

.service-modal-info h3 {
    color: #333;
    font-size: 1.3em;
    font-weight: 700;
    margin-bottom: 15px;
    margin-top: 20px;
    font-family: 'Poppins', sans-serif;
}

.service-details {
    list-style: none;
    padding: 0;
    margin-bottom: 25px;
}

.service-details li {
    color: #666;
    font-size: 1em;
    margin-bottom: 12px;
    padding-left: 25px;
    position: relative;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.service-details li:hover {
    transform: translateX(5px);
    color: #333;
}

.service-details li:before {
    content: "\2713";
    color: #cc0000;
    font-weight: bold;
    position: absolute;
    left: 0;
    font-size: 1.1em;
    top: -2px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(20px);
    }
}

@keyframes modalSlideIn {
    from {
        transform: translate(-50%, -50%) scale(0.8) rotateX(15deg);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1) rotateX(0deg);
        opacity: 1;
    }
}

.service-modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
}

.btn-secondary {
    background-color: transparent;
    color: #cc0000;
    border: 2px solid #cc0000;
    padding: 12px 25px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1em;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
    min-width: 120px;
    flex-shrink: 0;
}

.btn-secondary:hover {
    background-color: #cc0000;
    color: white;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translate(-50%, -55%) scale(0.9);
        opacity: 0;
    }
    to { 
        transform: translate(-50%, -55%) scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .expertise-gallery {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
        margin: 60px 0;
        padding: 0 25px;
    }
    
    .gallery-item {
        height: 360px;
        border-radius: 20px;
    }
    
    .gallery-item:hover {
        transform: translateY(-8px) scale(1.01);
    }
    
    .gallery-overlay {
        padding: 50px 30px 40px;
    }
    
    .gallery-overlay h3 {
        font-size: 1.8em;
        margin-bottom: 12px;
    }
    
    .gallery-overlay-text {
        font-size: 0.95em;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
        max-width: 95%;
    }
    
    .close-modal {
        width: 50px;
        height: 50px;
        font-size: 32px;
        right: 15px;
        top: 15px;
        background-color: rgba(255, 255, 255, 0.95);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }
    
    .close-modal:hover {
        transform: scale(1.1);
    }
    
    .close-modal:active {
        transform: scale(0.9);
    }
    
    .service-modal-content {
        flex-direction: column;
    }
    
    .service-modal-image {
        flex: 1 1 100%;
        min-height: 200px;
    }
    
    .service-modal-image img {
        border-radius: 12px 12px 0 0;
    }
    
    .service-modal-info {
        flex: 1 1 100%;
        padding: 30px;
    }
    
    .service-modal-info h2 {
        font-size: 1.8em;
    }
    
    .service-modal-actions {
        flex-direction: column;
    }
    
    .btn-secondary {
        text-align: center;
        display: block;
    }
}

@media (max-width: 480px) {
    .expertise-gallery {
        grid-template-columns: 1fr;
        gap: 25px;
        margin: 50px 0;
        padding: 0 20px;
    }
    
    .gallery-item {
        height: 320px;
        border-radius: 18px;
    }
    
    .gallery-item:hover {
        transform: translateY(-6px) scale(1.01);
    }
    
    .gallery-overlay {
        padding: 45px 25px 35px;
    }
    
    .gallery-overlay h3 {
        font-size: 1.6em;
        margin-bottom: 10px;
        line-height: 1.1;
    }
    
    .gallery-overlay-text {
        font-size: 0.9em;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 98%;
        max-width: 98%;
    }
    
    .close-modal {
        width: 55px;
        height: 55px;
        font-size: 36px;
        right: 10px;
        top: 10px;
        background-color: rgba(255, 255, 255, 0.95);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .close-modal:hover {
        transform: scale(1.1);
    }
    
    .close-modal:active {
        transform: scale(0.85);
    }
    
    .service-modal-info {
        padding: 20px;
    }
    
    .service-modal-info h2 {
        font-size: 1.5em;
    }
}
