/* Container for the row */
.row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.row.reverse {
    flex-direction: row-reverse;
}

/* Ensure figure behaves correctly in the flex container */
.row figure {
    margin: 0 ;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%; /* ✅ Enables override by .w-50 */
    max-width: 100% ;
}

/* Fix image size inside figures while keeping aspect ratio */
.row figure img {
    max-width: 100%; /* Image fills the figure container */
    height: auto;    /* Keeps aspect ratio */
}

/* Prevent captions from stretching too wide */
figure figcaption {
    font-size: 20px;
    color: #555;
    text-align: center;
    width: 100%;
    margin-top: 4px;  /* Space between image and caption */
    margin-bottom:30px;
}


/* Paragraph inside the row */
.row > p {
    flex: 2;
    margin: 0;
}

/* Paragraph below the row */
.flex-container > p {
    margin-top: 16px;
}

/* Apply 33% width **only to images that are NOT inside figures** */
.row img:not(figure img) {
    max-width: 50%;
    height: auto; /* Maintain aspect ratio */
}

/* Text inside the row */
.row p {
    flex: 1; /* Allow the text to grow and fill the remaining space */
    margin: 0; /* Remove default margins */
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .row {
        flex-direction: column; /* Stack elements vertically */
        gap: 10px; /* Adjust spacing */
    }
    
    .row img {
        max-width: 100%; /* Ensure the image takes full width */
        margin: 30px auto; /* Center the image */
    }
    
    .row > p {
        flex: 1 1 100%; /* Ensure text spans full width */
    }
}

@media (min-width: 769px) {

    .w-75 {
        width: 75%;
        max-width: 75%;
    }

    .w-67 {
        width: 67%;
        max-width: 67%;
    }

    .w-50 {
        width: 50%;
        max-width: 50%;
    }

    .w-33 {
        width: 33.333%;
        max-width: 33.333%;
    }

}