.units {
    position: relative;
    z-index: 2;
}

.units p a {
    color: var(--secondary);
}

.units__wrapper {
    padding: 60px 0 40px;
}

.units:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 143px;
    z-index: -1;
    left: 0;
    bottom: 0;
    background: linear-gradient(0deg, rgba(8, 8, 8, 0.50) 38.96%, rgba(8, 8, 8, 0.00) 87.49%);
}

.units__bg {
    width: 100%;
    height: 400px;
    object-fit: cover;
    position: relative;
    z-index: -2;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity;
}

/* Image transition states */
.units__bg.fade-out {
    opacity: 0;
}

.units__bg.fade-in {
    opacity: 1;
}

.units__flex {
    position: absolute;
    width: 100%;
    left: 0;
    bottom: 32px;
    padding: 0 0 0 33px;
    display: flex;
    align-items: center;
    gap: 25px;
}

.unit {
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    color: var(--White, #FFF);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.unit img {
    filter: brightness(0) invert(1);
    width: 38px;
}

.unit:nth-child(2) img {
    width: 30px;
}

@media (min-width: 768px) {
    .units {
        padding: 80px 0;
        aspect-ratio: 256 / 121;
    }

    .units__wrapper {
        padding: 0 0;
        color: #fff;
    }

    .units__wrapper h2 {
        color: #fff;
    }

    .units:after {
        height: 209px;
    }

    .units::before {
        content: '';
        position: absolute;
        width: 100%;
        height: 393px;
        z-index: -1;
        left: 0;
        top: 0;
        background: linear-gradient(180deg, rgba(8, 8, 8, 0.75) 59.92%, rgba(8, 8, 8, 0.00) 89.81%);
    }

    .units__bg {
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }

    .units__flex {
        position: relative;
        padding: 0 0 0 0;
        margin-top: 300px;
        bottom: 0;
        gap: 25px;
    }

    .unit {
        font-size: 25px;
    }

    .unit img {
        width: auto;
    }

    .unit:nth-child(2) img {
        width: auto;
    }
}

@media (min-width: 1200px) {
    .units {
        padding: 100px 0;
    }

    .units__wrapper {
        width: 400px;
    }

     .units__wrapper h2 {
        line-height: 1em;
     }

    .units:after {
        height: 100%;
        background: linear-gradient(90deg, rgba(8, 8, 8, 0.60) 10.41%, rgba(8, 8, 8, 0.00) 98.6%);
        width: calc(60% + 91px);
    }

    .units::before {
        display: none;
    }

    .units__bg {
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }

    .page-id-480 .units__bg {
        object-position: bottom;
    }

    .units__flex {
        margin-top: 120px;
        width: calc(100% + 20px);
    }

    /* Content Position: Right */
    .units--content-right .units__wrapper {
        margin-left: auto;
    }

    .units--content-right:after {
        left: auto;
        right: 0;
        background: linear-gradient(270deg, rgba(8, 8, 8, 0.60) 10.41%, rgba(8, 8, 8, 0.00) 98.6%);
    }

    .unit:hover img {
        filter: brightness(100%) invert(0);
    }
}

@media (min-width: 1400px) {
    .units {
        padding: 150px 0;
    }
}

@media (min-width: 1600px) {
    .units {
        padding: 240px 0;
    }
}

@media (min-width: 2000px) {
    .units {
        padding: 200px 0;
    }
}

/* Button hover effects */
.unit {
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    opacity: 0.9;
}

.unit:hover {
    transform: translateY(-2px);
    opacity: 1;
}

.unit:active {
    transform: translateY(0);
}

/* Disable interaction during animation */
.units.is-animating .unit {
    pointer-events: none;
    opacity: 0.7;
}

/* Smooth image positioning */
.units__bg {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.units__bg.hidden {
    display: block !important;
    visibility: visible !important;
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 767px) {
    .units {
        margin-bottom: 350px;
        overflow: visible;
    }

    .units__wrapper {
        padding: 20px 0 20px;
        position: relative;
        z-index: 1;
    }

    .units__bg {
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        width: 65%;
        height: 350px !important;
        object-fit: contain;
    }

    .units__flex {
        bottom: -310px;
        padding: 0 0 0 0;
    }

    .units:after {
        bottom: -350px;
    }
}

/* State classes for JavaScript */
.units.unit-open .toggle-unit span::before {
    content: "Close ";
}

.units.unit-closed .toggle-unit span::before {
    content: "Open ";
}