.container {
    max-width: 1120px;
    margin: 0 auto;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.5rem 2.5rem;
    margin-bottom: 56px;
}

.btnx {
    color: white;
    font-size: 0.875rem;
    border-radius: 9999px;
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    background-image: linear-gradient(to right, #166534, #f59e0b);
    border: none;
    transition: background-image 0.3s ease;
    white-space: nowrap;
}

.btn:nth-child(1) {
    background-image: linear-gradient(to right, #166534, #f59e0b);
}

.btn:nth-child(n+2) {
    background-image: linear-gradient(to right, #f59e0b, #166534);
}

.btn:nth-child(3) {
    padding-left: 2rem;
    padding-right: 2rem;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 1120px;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.flip-card {
    perspective: 1000px;
    width: 100%;
    height: 256px;
    position: relative;
    /* Prevent collapsing by setting transform-style and preserve 3d */
    transform-style: preserve-3d;
    /* Add margin-bottom to avoid overlap on flip */
    margin-bottom: 1.5rem;
    /* Add isolation to create new stacking context */
    isolation: isolate;
}

@media (min-width: 640px) {
    .flip-card {
        height: 224px;
    }
}

@media (min-width: 1024px) {
    .flip-card {
        height: 256px;
    }
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    will-change: transform;
}

.flip-card:hover .flip-inner {
    transform: rotateY(180deg);
    z-index: 10;
    position: relative;
}

.flip-front,
.flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    backface-visibility: hidden;
    top: 0;
    left: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
}

.flip-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0.5rem;
}

.flip-back {
    background-color: #f9fafb;
    color: #111827;
    transform: rotateY(180deg);
    padding: 1rem;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
}
 
.portfolio-container .portfolio-item {
  position: static !important;
  left: auto !important;
  top: auto !important;
} 