/* --- 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%;
    position: relative;
}

.masonry-carousel__image-link {
    width: 100%;
    height: 100%;
    box-sizing: border-box; /* CRITICAL: Include padding inside the width calculation */
    padding: 0 var(--space-xl); /* Padding is now on the link, not the slide */
    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: contain; /* Use 'contain' to ensure the whole image is visible */
    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);
    backdrop-filter: blur(5px); /* Corrected from sbackdrop-filter */
    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-wrapper {
        max-width: 1200px; /* Increase container width */
        padding: 0 var(--space-xl); /* Adjust padding */
    }

    .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 */
        padding: 0 var(--space-3xl);
    }

    .masonry-carousel__image-link {
        padding: 0 var(--space-2xl); /* Increase image padding */
    }

    .masonry-carousel__dots {
        bottom: 2rem; /* Adjust dot position */
    }
}

/* Extra large screens (1200px+): Optimize for ultra-wide displays */
@media (min-width: 1200px) {
    .masonry-wrapper {
        max-width: 1400px; /* Cap at 1400px for readability */
        padding: 0 var(--space-2xl);
    }

    .masonry-carousel__container {
        width: 60%; /* Wider image container */
        padding: 0 var(--space-xl);
    }

    .masonry-row__text-container {
        width: 40%; /* Narrower text container */
        padding: 0 var(--space-4xl);
    }

    .masonry-row__title {
        font-size: 1.8rem; /* Larger title */
    }

    .masonry-row__text {
        font-size: 1rem; /* Slightly larger text */
        line-height: 1.6;
    }

    .masonry-carousel__image-link {
        padding: 0 var(--space-3xl); /* More padding for images */
    }
}
