/* Flip Card styling for Portfolio/Previous Works */
.works-section {
    padding: 80px 0;
    background-color: #f9f9f9;
}

.works-subtitle {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 30px;
    font-size: 18px;
    color: #555;
    font-family: 'Raleway', sans-serif;
    font-weight: 500;
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
    margin-top: 40px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 15px;
}

/* Flip Card Container */
.flip-card {
    background-color: transparent;
    perspective: 1000px;
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s forwards;
    animation-delay: calc(0.1s * var(--card-index, 1));
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Inner container to handle the flip */
.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

/* Flip on hover */
.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

/* Position the front and back sides */
.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
}

/* Style front side */
.flip-card-front {
    background-color: #ffffff;
}

.flip-card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Style back side */
.flip-card-back {
    background-color: #1c7c54;
    color: white;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
}

.flip-card-back h3 {
    font-size: 22px;
    margin-bottom: 15px;
    font-weight: 600;
}

.flip-card-back p {
    margin-bottom: 20px;
    line-height: 1.6;
}

.works-cta {
    text-align: center;
    margin-top: 40px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .works-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .flip-card {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .works-grid {
        grid-template-columns: 1fr;
    }
}
