/*---*\
Half Media / Half Text
Mobile-first: stacked media + text. Tablet+ side-by-side; modifier classes flip column order and rounded corner.
\*---*/

.half-media-half-text .half-media-half-text__row {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--space-paragraph);
}

.half-media-half-text .half-media-half-text__media-inner {
	position: relative;
    display: inline-block;
    width: auto;
    padding-top: 15px;

    &:before {
        content: '';
        position: absolute;
        top: 0;
        display: block;
        width: calc(100% - 15px);
        height: calc(100% - 15px);
        border: 1px solid var(--color-primary);
        z-index: 3;
        pointer-events: none;
    }
}

.half-media-half-text.half-media-half-text__left .half-media-half-text__media-inner {
	width: auto;
	min-width: calc(100% - 15px);
    padding-right: 15px;

    &:before {
        left: 15px;
        border-top-right-radius: 115px;
    }

    img {
        border-top-right-radius: 100px;
    }
}

/* Media right: round top-right */
.half-media-half-text.half-media-half-text__right .half-media-half-text__media-inner {
    padding-left: 15px;

    &:before {
        right: 15px;
        border-top-left-radius: 115px;
    }

    img {
        border-top-left-radius: 100px;
    }
}

.half-media-half-text .half-media-half-text__media img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
}

/* Video play control: staggered ripple rings (matches Figma pulse) */
@keyframes half-media-half-text-play-ripple {
    0% {
        transform: scale(1);
        opacity: 0.38;
    }
    100% {
        transform: scale(2.15);
        opacity: 0;
    }
}

.half-media-half-text__media-video {
    position: absolute;
    left: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 15px);
    height: calc(100% - 15px);
    border-top-right-radius: 100px;
    background: linear-gradient(0deg, rgba(20, 20, 37, 0.80) 0%, rgba(20, 20, 37, 0.80) 100%) no-repeat;
    z-index: 2;
    text-decoration: none;

    .media-play-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        font-size: 30px;
        padding-left: 5px;
        width: 73px;
        height: 73px;
        background-color: var(--color-primary);
        color: var(--color-white);
        border-radius: 50%;
    }

    .media-play-wrapper::before,
    .media-play-wrapper::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 50%;
        background: color-mix(in srgb, var(--color-primary) 80%, transparent);
        pointer-events: none;
        animation: half-media-half-text-play-ripple 2s ease-out infinite;
    }

    .media-play-wrapper::after {
        animation-delay: 1s;
    }

    .media-play-wrapper .wc-play {
        position: relative;
        z-index: 1;
    }

    .media-play-text {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .half-media-half-text__media-video .media-play-wrapper::before,
    .half-media-half-text__media-video .media-play-wrapper::after {
        animation: none;
    }
}

.half-media-half-text__right .half-media-half-text__media-video {
    border-top-right-radius: 0;
    border-top-left-radius: 100px;
    left: auto;
}

.half-media-half-text .half-media-half-text__media-inner img.half-media-cut-out {
    position: absolute;
    bottom: 0;
    max-height: none;
    width: calc(100% - 15px);
    right: 15px;
	z-index: 4;
}

.half-media-half-text.half-media-half-text__right .half-media-half-text__media-inner img.half-media-cut-out {
    right: 0;
}

@media (min-width: 768px) {

    .half-media-half-text .half-media-half-text__media-inner {
        padding-top: 32px;

        img {
            display: block;
            width: auto;
            height: 100%;
        }

        &:before {
            width: calc(100% - 32px);
            height: calc(100% - 32px);
        }
    }


    /* Media left (default from DOM order): round top-left */
    .half-media-half-text.half-media-half-text__left .half-media-half-text__media-inner {
		width: auto;
		min-width: calc(100% - 34px);
        padding-right: 32px;

        &:before {
            left: 32px;
            border-top-right-radius: 230px;
        }

        img {
            border-top-right-radius: 200px;
        }
    }

    /* Media right: round top-right */
    .half-media-half-text.half-media-half-text__right .half-media-half-text__media-inner {
        padding-left: 32px;

        &:before {
            right: 32px;
            border-top-left-radius: 230px;
        }

        img {
            border-top-left-radius: 200px;
        }
    }

    .half-media-half-text__media-video {
        width: calc(100% - 32px);
        height: calc(100% - 32px);
        border-top-right-radius: 200px;
    }

    .half-media-half-text__right .half-media-half-text__media-video {
        border-top-left-radius: 200px;
    }

	.half-media-half-text .half-media-half-text__text {
		box-sizing: border-box;
	}

    .half-media-half-text__media-video  {
        .media-play-wrapper {
            width: 107px;
            height: 107px;
            font-size: 44px;
            padding-left: 9px;
        }

        .media-play-text {
            color: var(--color-white);
            display: block;
            font-size: 20px;
            font-weight: 700;
            margin-left: -12px;
            z-index: 2;
        }
    }

    .half-media-half-text .half-media-half-text__media-inner img.half-media-cut-out {
        max-height: none;
        width: calc(100% - 32px);
        right: 32px;
        height: auto;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {

	.half-media-half-text__media {
		display: flex;
	}

    .half-media-half-text.half-media-half-text__left .half-media-half-text__media-inner {
		width: 100%;
        max-width: 650px;
        min-width: auto;
        margin: auto;
	}
}

@media (min-width: 1025px) {
    .half-media-half-text .half-media-half-text__row {
		flex-direction: row;
		flex-wrap: nowrap;
        align-items: center;
		gap: 0;
	}

	.half-media-half-text.half-media-half-text__right .half-media-half-text__row {
		flex-direction: row-reverse;
	}

	.half-media-half-text .half-media-half-text__media,
	.half-media-half-text .half-media-half-text__text {
		flex: 0 0 50%;
		max-width: 50%;
		padding-right: 10px;
	}

	.half-media-half-text .half-media-half-text__media {
		align-self: flex-start;
		position: sticky;
		top: calc(var(--section-margins) + 45px);
	}

	.half-media-half-text .half-media-half-text__text {
		padding-top: 0;
		padding-bottom: 0;
	}

	.half-media-half-text__left.half-media-half-text .half-media-half-text__text {
		padding-right: 0;
		padding-left: 50px;
	}

	.half-media-half-text__right.half-media-half-text .half-media-half-text__text {
		padding-left: 32px;
		padding-right: 50px;
	}
}

/*---*\
Half / Half Cover
\*---*/

.half-media-text__cover {
	--cover-radius: 100px;
	--cover-frame-bottom: 16px;
	--cover-frame-right: 38px;
	--cover-inner-gap: 64px;
	--cover-media-min-h: 331px;
	--cover-text-max: 616px;
	--cover-col-gap: 32px;
}

.half-media-text__cover .bg-light-gray {
	background-color: var(--color-neutral-off-white);
}

.half-media-text__cover > .bg-white,
.half-media-text__cover > .bg-light-gray,
.half-media-text__cover > .bg-dark {
	min-width: 0;
}

/* Mobile */
@media (max-width: 767px) {
	.half-media-text__cover.section-padding {
		padding-bottom: 128px;
	}
}

.half-media-text__cover-inner {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	box-sizing: border-box;
	width: 100%;
}

.half-media-text__cover-media {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
    padding-right: 53px;
}

.half-media-text__cover-media-inner {
	position: relative;
	min-height: var(--cover-media-min-h);
	overflow: hidden;
	border-top-right-radius: var(--cover-radius);
}

.half-media-text__cover-media-inner img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.half-media-text__cover-media::after {
    content: '';
    position: absolute;
    z-index: 3;
    top: -15px;
    bottom: 15px;
    right: 38px;
    left: 15px;
    border: 1px solid var(--color-primary);
    border-top-right-radius: var(--cover-radius);
    pointer-events: none;
}

.half-media-text__cover-text {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
	padding-top: var(--section-margins);
	padding-bottom: var(--section-margins);
    padding-left: var(--bs-gutter-x, 22px);
    padding-right: var(--bs-gutter-x, 22px);
}

.half-media-text__cover-text :where(h2, .h2) {
	font-size: var(--font-size-h2);
	line-height: var(--line-height-h2);
}

.half-media-text__cover-text .btn-group {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	column-gap: var(--space-paragraph);
	row-gap: 12px;
}

.half-media-text__cover--right .half-media-text__cover-media-inner {
	border-top-right-radius: 0;
	border-top-left-radius: var(--cover-radius);
}

.half-media-text__cover--right .half-media-text__cover-media::after {
	left: var(--cover-frame-right);
	right: 15px;
	border-top-right-radius: 0;
	border-top-left-radius: var(--cover-radius);
}

.half-media-text__cover--right .half-media-text__cover-media-video {
	border-top-right-radius: 0;
	border-top-left-radius: var(--cover-radius);
}

.half-media-text__cover--right .half-media-text__cover-media {
    padding-left: 53px;
    padding-right: 0;
}

@media (min-width: 768px) {
	.half-media-text__cover {
		--cover-radius: 200px;
		--cover-frame-bottom: 32px;
		--cover-frame-right: 20px;
		--cover-inner-gap: 128px;
		--cover-media-min-h: 408px;
	}

    .half-media-text__cover-text {
        padding-left: var(--bs-gutter-x, 52px);
        padding-right: var(--bs-gutter-x, 52px);
    }
	
	.half-media-text__cover-text .btn-group {
		row-gap: 16px;
		column-gap: var(--space-paragraph);
	}

    .half-media-text__cover-media::after {
        top: -32px;
        bottom: 32px;
        right: 21px;
        left: 32px;
        border-top-right-radius: 230px;
    }

    .half-media-text__cover--right .half-media-text__cover-media::after {
        right: 32px;
        border-top-left-radius: 230px;
    }
}

@media (min-width: 1200px) {
	.half-media-text__cover {
		--cover-radius: 200px;
		--cover-frame-bottom: 32px;
		--cover-frame-right: -32px;
		--cover-inner-gap: var(--cover-col-gap);
		--cover-media-min-h: 0;
	}

    .half-media-text__cover-text {
        padding-left: var(--bs-gutter-x, 32px);
        padding-right: var(--bs-gutter-x, 32px);
    }

	.half-media-text__cover-inner {
		flex-direction: row;
		align-items: stretch;
	}

	.half-media-text__cover--right .half-media-text__cover-inner {
		flex-direction: row-reverse;
	}

	.half-media-text__cover-media {
		width: 50%;
		min-height: 0;
		align-self: stretch;
	}

	.half-media-text__cover-media-inner {
		min-height: 0;
		height: 100%;
	}

	.half-media-text__cover-text {
		max-width: 650px;
		justify-content: flex-end;
		padding-top: var(--section-margins);
		padding-bottom: var(--section-margins);
	}

	.half-media-text__cover--left .half-media-text__cover-text {
        padding-left: 43px;
	}

	.half-media-text__cover--right .half-media-text__cover-text {
        padding-right: 96px;
	}

	.half-media-text__cover-text .btn-group {
		row-gap: var(--cover-col-gap);
	}


    .half-media-text__cover--right .half-media-text__cover-media {
        padding-left: 0;
    }
}

@media (min-width: 1360px) {
	.half-media-text__cover--left .half-media-text__cover-text {
		padding-right: 0;
	}

	.half-media-text__cover--right .half-media-text__cover-text {
		padding-left: 0;
	}
}

/* Cover layout: video overlay + play control */
.half-media-text__cover-media-video {
	position: absolute;
	left: 0;
	bottom: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border-top-right-radius: var(--cover-radius);
	background: linear-gradient(
		0deg,
		rgba(20, 20, 37, 0.8) 0%,
		rgba(20, 20, 37, 0.8) 100%
	);
	text-decoration: none;
}

.half-media-text__cover-media-video:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 4px;
}

.half-media-text__cover-media-video .media-play-wrapper {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 30px;
	padding-left: 5px;
	width: 73px;
	height: 73px;
	background-color: var(--color-primary);
	color: var(--color-primary-on);
	border-radius: 50%;
}

.half-media-text__cover-media-video .media-play-wrapper::before,
.half-media-text__cover-media-video .media-play-wrapper::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: color-mix(in srgb, var(--color-primary) 80%, transparent);
	pointer-events: none;
	animation: half-media-half-text-play-ripple 2s ease-out infinite;
}

.half-media-text__cover-media-video .media-play-wrapper::after {
	animation-delay: 1s;
}

.half-media-text__cover-media-video .media-play-wrapper .wc-play {
	position: relative;
	z-index: 1;
}

.half-media-text__cover-media-video .media-play-text {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	.half-media-text__cover-media-video .media-play-wrapper::before,
	.half-media-text__cover-media-video .media-play-wrapper::after {
		animation: none;
	}
}

@media (min-width: 1200px) {
	.half-media-text__cover-media-video .media-play-wrapper {
		width: 107px;
		height: 107px;
		font-size: 44px;
		padding-left: 9px;
	}

	.half-media-text__cover-media-video .media-play-text {
		display: block;
		color: var(--color-primary-on);
		font-size: 20px;
		font-weight: 700;
		margin-left: -12px;
		z-index: 2;
		position: relative;
	}
}
