/* --- Masonry Carousel Section --- */
.masonry-wrapper {
    max-width: 1400px; /* The "focal point" container */
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.masonry-carousel-section {
    background-color: var(--background-color);
    margin: 0;
    padding: var(--space-2xl) 0; /* Use a larger vertical space to separate from other sections */
}

.masonry-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: var(--space-2xl) 0; /* Increased vertical padding for more breathing room */
}
 
.masonry-row--reverse {
    flex-direction: row-reverse;
}
 
.masonry-carousel__container {
    width: 50%; /* Changed from 50vw to 50% of the parent .masonry-row */
    position: relative;
    padding: 0 var(--space-md); /* Adjust padding */
}

/* The outer container is now just for positioning */
.masonry-carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3; /* Use aspect-ratio for responsive height */
    margin: 0;
}

.masonry-carousel__window {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 12px;
}

.masonry-carousel .masonry-carousel__track {
    display: flex;
    width: 300%; /* For 3 slides */
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.masonry-carousel .masonry-carousel__slide {
    /* Each slide is 1/3 of the track's width, which is 100% of the viewport */
    flex: 0 0 33.3333%;
    /* RATIONALIZED REMEDY: Add padding to the slide itself to create space between images. */
    padding: 0 var(--space-sm);
    box-sizing: border-box; /* CRITICAL: Include padding in the flex-basis calculation. */
    position: relative;
}

.masonry-carousel__image-link {
    width: 100%;
    height: 100%;
    border-radius: 12px; /* Apply border-radius to the link container */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--background-color);
}

.masonry-carousel img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover; /* Changed to 'cover' to allow images to fill width, potentially cropping vertically */
    border-radius: inherit; /* Inherit the border-radius from the parent link */
    transition: transform 0.6s ease;
}

.masonry-carousel__image-link:hover img {
    transform: scale(1.02);
}

.masonry-row__text-container {
    width: 50%; /* Changed from 50vw to 50% of the parent .masonry-row */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-2xl); /* Adjust padding */
}

.masonry-row__text-content {
    max-width: 450px;
    text-align: left;
}

.masonry-row__title {
    font-family: 'Avril Fatface', sans-serif; /* Changed font family */
    font-size: 1.5rem;
    font-weight: 200; /* Changed to lightweight */
    color: var(--color-silver-700);
    margin-bottom: 1rem;
}

.masonry-row__text {
    color: var(--color-silver-600);
    font-family: 'Source Serif Pro', serif;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    /* --- Content Clamping Logic --- */
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.masonry-row__link {
    font-family: 'Avril Fatface', sans-serif;
    font-weight: 400; /* Reduce weight for a lighter feel */
    color: var(--color-silver-600);
    text-decoration: none;
    transition: color 0.3s ease;
}
.masonry-row__link:hover {
    color: #1e293b;
}

.masonry-carousel__dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-sm);
    padding: 6px; /* Slightly smaller padding for a tighter look */
    background-color: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(5px); /* Safari */
    backdrop-filter: blur(5px);
    border-radius: 12px;
    z-index: 10;
}

.masonry-carousel__dot {
    width: 6px; /* Miniature version of hero dots */
    height: 6px; /* Miniature version of hero dots */
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.25s cubic-bezier(.2, .9, .2, 1);
    cursor: pointer;
}

.masonry-carousel__dot.active {
    background: rgba(255, 255, 255, 0.9); /* Match hero active dot */
}

.masonry-carousel__dot:hover {
    background: rgba(255, 255, 255, 0.7);
}

/* Large screens (1024px+): Enhance carousel layout and spacing */
@media (min-width: 1024px) {
    .masonry-carousel__container {
        width: 55%; /* Slightly wider for better balance */
        padding: 0 var(--space-lg);
    }

    .masonry-row__text-container {
        width: 45%; /* Adjust text container width to match */
        padding: 0 var(--space-3xl);
    }
}

/* Small screens (below 768px): Prevent carousel images from getting too small */
@media (max-width: 768px) {
    .masonry-row {
        flex-direction: column; /* Stack carousel and text vertically for a clean mobile view */
        padding: var(--space-lg) 0;
    }

    .masonry-carousel__container {
        width: 100%; /* Full width for carousel */
        padding: 0 var(--space-md); /* Maintain some side padding */
    }

    .masonry-row__text-container {
        width: 100%; /* Full width for text */
        padding: var(--space-xl) var(--space-md) 0 var(--space-md); /* Add top padding to separate from carousel */
        text-align: center; /* Center text on mobile */
    }
    .masonry-row__text-content {
        text-align: center; /* Ensure content inside is also centered */
        max-width: 100%;
    }
}
