/* Carousel container */
.wp-block-maxon-project-carousel {
    position: relative;
    overflow: hidden;
}

.responsive-clip {
    --cut: 6rem;
    clip-path: polygon(
        var(--cut) 0,
        100% 0,
        100% calc(100% - var(--cut)),
        calc(100% - var(--cut)) 100%,
        0 100%,
        0 var(--cut)
    );
}

@media (max-width: 768px) {
    .responsive-clip {
        --cut: 2rem;
    }
}

/* Bleeding track: aligns left with container, bleeds right to viewport edge */
.wp-block-maxon-project-carousel .maxon-carousel-track {
    padding-left: max(
        2rem,
        calc((100vw - var(--wp--style--global--wide-size, 1696px)) / 2 + 2rem)
    );
    overflow: visible;
}

.wp-block-maxon-project-carousel .swiper {
    overflow: visible;
}

/* Equal-height slides */
.wp-block-maxon-project-carousel .swiper-wrapper {
    align-items: stretch !important;
}

.wp-block-maxon-project-carousel .swiper-slide {
    height: auto !important;
    display: flex !important;
    flex-direction: column;
}

/* ── Slide card ─────────────────────────────────────────── */

.maxon-project-slide {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Full card: hex clip on top-left + bottom-right, flex column so body grows */
.maxon-slide__link {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    clip-path: polygon(
        6rem 0,
        100% 0,
        100% calc(100% - 6rem),
        calc(100% - 6rem) 100%,
        0 100%,
        0 6rem
    );
}

/* ── Image area ─────────────────────────────────────────── */

/* Outer bg div: teal background fills the clip-path cutout on the image */
.maxon-slide__img-bg {
    background: #024d64;
}

/* Inner wrap: aspect-ratio drives height, clip cuts bottom-right corner */
.maxon-slide__img-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #024d64;
    overflow: hidden;
    clip-path: polygon(
        0 0,
        100% 0,
        100% calc(100% - 6rem),
        calc(100% - 6rem) 100%,
        0 100%
    );
}

.maxon-slide__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Badge: hexagonal shape, top-right of image */
.maxon-slide__badge {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 1.3rem;
    z-index: 10;
    letter-spacing: 0.02em;
    clip-path: polygon(20% 0%, 100% 0%, 100% 50%, 80% 100%, 0% 100%, 0% 50%);
}

/* ── Body area ──────────────────────────────────────────── */

.maxon-slide__body {
    position: relative;
    background: #024d64;
    padding: 1.25rem 1.5rem 1.5rem;
    margin-top: -1px;
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
        "icon  title"
        ".     excerpt"
        ".     readmore";
    column-gap: 0.5rem;
    row-gap: 0.625rem;
}

.maxon-slide__title {
    display: contents;
}

.maxon-slide__icon {
    grid-area: icon;
    align-self: center;
    flex-shrink: 0;
}

.maxon-slide__title-text {
    grid-area: title;
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
    line-height: 1.3;
    align-self: center;
}

.maxon-slide__excerpt {
    grid-area: excerpt;
    margin: 0;
    padding-right: 2rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8125rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    align-self: start;
}

.maxon-slide__read-more {
    grid-area: readmore;
    display: inline-block;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    align-self: end;
}

/* ── Mobile: smaller cuts ───────────────────────────────── */

@media (max-width: 768px) {
    .maxon-slide__link {
        clip-path: polygon(
            2rem 0,
            100% 0,
            100% calc(100% - 2rem),
            calc(100% - 2rem) 100%,
            0 100%,
            0 2rem
        );
    }

    .maxon-slide__img-wrap {
        clip-path: polygon(
            0 0,
            100% 0,
            100% calc(100% - 2rem),
            calc(100% - 2rem) 100%,
            0 100%
        );
    }
}

/* ── Navigation buttons ─────────────────────────────────── */

.wp-block-maxon-project-carousel .maxon-carousel-nav {
    display: flex;
    gap: 0.25rem;
}

.wp-block-maxon-project-carousel .swiper-button-prev,
.wp-block-maxon-project-carousel .swiper-button-next {
    position: static;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    background: #e55532;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.wp-block-maxon-project-carousel .swiper-button-prev:hover,
.wp-block-maxon-project-carousel .swiper-button-next:hover {
    background: #d04a2a;
}

.wp-block-maxon-project-carousel .swiper-button-prev::after,
.wp-block-maxon-project-carousel .swiper-button-next::after {
    font-size: 0.875rem;
    font-weight: 700;
}

.wp-block-maxon-project-carousel .swiper-pagination {
    display: none;
}

/* ── Editor preview grid ────────────────────────────────── */

.block-editor-block-list__layout
    .wp-block-maxon-project-carousel
    .maxon-carousel-grid,
.maxon-carousel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .wp-block-maxon-project-carousel .maxon-carousel-track {
        padding-left: 2rem;
    }

    .maxon-carousel-grid {
        grid-template-columns: 1fr;
    }
}
