.main-container {
    display: flex;
    flex-direction: column;
    margin: var(--spacing-2xl) var(--padding-section);
    align-items: center;
    justify-content: center;
}

.text-area {
    margin-bottom: var(--spacing-xl);
    width: 100%;
}

.text-area h1 {
    margin: 0;
    padding: 0;
}

.text-area .text-container {
    display: flex;
    flex-direction: column;
}

.text-area .text-container p {
    line-height: var(--leading-body);
    font-size: 1.2rem;
    width: 100%;
}

.cards-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 95%;
}

.flip-container {
    perspective: 1000px;
    width: 45%;
    max-width: 35rem;
    aspect-ratio: 1 / 1;
    height: auto;
}

.flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s;
}

@media (hover: hover) {
    .flip-container:hover .flipper {
        transform: rotateY(180deg);
    }
}

.flip-container.hover .flipper {
    transform: rotateY(180deg);
}

.flip-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.front,
.back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--font-body);
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.front {
    background-color: #f9f9f9;
    /* place heading at the top so it doesn't overlap the image */
    justify-content: flex-start;
    padding: var(--spacing-sm) var(--spacing-md);
    gap: var(--spacing-sm);
    align-items: stretch;
    overflow: hidden; /* clip any accidental overflow */
}

.front h3 {
    color: #aa9183;
    margin: 0;
    text-align: center;
    padding: 0.25rem var(--spacing-sm);
    width: 100%;
    box-sizing: border-box;
    /* allow long headings to wrap instead of overflowing */
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    /* scale down on small screens and avoid large headings */
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.1;
    flex: 0 0 auto;
    /* allow at most two lines visually; wrap otherwise */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Ensure the image inside the .front occupies the remaining space below the heading */
.front > img {
    /* image occupies remaining space below the heading */
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* keep bottom corners rounded, keep top corners square to visually separate heading */
    border-radius: 0 0 10px 10px;
    align-self: stretch;
    display: block;
}

/* If image is wrapped in other markup, ensure the wrapper also doesn't overflow */
.front .image,
.front .contact-image img {
    max-width: 100%;
    display: block;
}

.back {
    background-color: #eaeaea;
    transform: rotateY(180deg);
    margin: 0;
    justify-content: flex-start;
    overflow-y: auto;
    padding: var(--spacing-md) 0;
}

.back p {
    margin-top: var(--spacing-md);
    font-weight: 700;
    font-size: 1.2rem;
    color: #aa9183;
}

.back ul {
    list-style-type: none;
    padding: 0;
}

.back ul li {
    margin-left: var(--spacing-md);
    margin-right: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.back span {
    font-weight: 700;
}

@media (max-width: 1200px) {
    .main-container {
        margin: var(--spacing-xl) var(--spacing-md);
    }

}


@media (max-width: 768px) {

    .text-area h1 {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .text-container {
        flex-direction: column;
    }

    .cards-area {
        flex-direction: column;
        gap: var(--spacing-xl);
        width: 100%;
        margin-bottom: var(--spacing-md);
    }

    .flip-container {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}