.twin-gallery-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 5px;
    max-width: 100%;
    margin: 0 auto;
}

.twin-gallery-item {
    position: relative;
    flex-basis: calc(33.333% - 20px);
    margin-bottom: 20px;
}

.twin-gallery-link {
    display: block;
    position: relative;
    overflow: hidden;
}

.twin-gallery-item img {
    display: block;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.twin-gallery-item:hover img {
    transform: scale(1.05);
}

.twin-text {
    position: absolute;
    padding: 10px 15px;
    max-width: 90%;
    transition: all 0.3s ease;
}

.twin-text-top-left {
    top: 20px;
    left: 20px;
}

.twin-text-top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.twin-text-top-right {
    top: 20px;
    right: 20px;
    text-align: right;
}

.twin-text-middle-left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

.twin-text-middle-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.twin-text-middle-right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    text-align: right;
}

.twin-text-bottom-left {
    bottom: 20px;
    left: 20px;
}

.twin-text-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.twin-text-bottom-right {
    bottom: 20px;
    right: 20px;
    text-align: right;
}

/* Responsive styles */
@media screen and (max-width: 992px) {
    .twin-gallery-item {
        flex-basis: calc(50% - 15px);
    }
}

@media screen and (max-width: 576px) {
    .twin-gallery-container {
        flex-direction: column;
    }
    
    .twin-gallery-item {
        flex-basis: 100%;
    }
}