/**
 * Inoforest Media Frame
 *
 * Contents
 * 1. Defaults (variables) and widget width
 * 2. Frame and room for the inset
 * 3. Main image
 * 4. Inset image
 * 5. Badge: card, icon, number, text, float
 * 6. Responsive (design breakpoints 1199 / 991 / 767 px), reduced motion
 *
 * Colours read the Design System (--inoforest-color-*) with the HTML design's values as fallbacks. Defaults sit in
 * :where() blocks (no specificity), so the Style tab controls, which set the same variables or properties on the
 * widget, always win without !important.
 */

/* 1. Defaults ------------------------------------------------------------------ */
:where(.inoforest-media-frame) {
	--ino-mf-ratio: 9 / 10;
	--ino-mf-radius: 24px;
	--ino-mf-max-width: none;
	--ino-mf-space-x: 70px;
	--ino-mf-space-y: 70px;
	--ino-mf-inset-size: 46%;
	--ino-mf-inset-radius: var(--ino-mf-radius);
	--ino-mf-inset-border-width: 8px;
	--ino-mf-inset-border-color: var(--inoforest-color-background, #fff);
	--ino-mf-shadow: 0 14px 40px rgba(13, 27, 42, 0.1);
	--ino-mf-badge-x: -24px;
	--ino-mf-badge-y: 40px;
	--ino-mf-badge-gap: 14px;
	--ino-mf-icon-box: 52px;
	--ino-mf-icon-size: 22px;
	--ino-mf-float-duration: 5s;
	--ino-mf-float-distance: -12px;
}

/* Full width unless Advanced → Width says otherwise: in a column container Chrome works out the widget's height before
   stretching it, so the aspect-ratio photo would come out short and overlap what follows. */
.elementor-widget-inoforest-media-frame:not([class*="elementor-widget__width-"]) {
	width: 100%;
}

/* 2. Frame --------------------------------------------------------------------- */
.inoforest-media-frame {
	position: relative;
	box-sizing: border-box;
	max-width: var(--ino-mf-max-width);
	margin-right: auto;
	margin-left: auto;
}

.inoforest-media-frame[data-inset="right"] {
	padding: 0 var(--ino-mf-space-x) var(--ino-mf-space-y) 0;
}

.inoforest-media-frame[data-inset="left"] {
	padding: 0 0 var(--ino-mf-space-y) var(--ino-mf-space-x);
}

/* 3. Main image ------------------------------------------------------------------ */
.inoforest-media-frame__main {
	overflow: hidden;
	line-height: 0;
	border-radius: var(--ino-mf-radius);
}

/* Two classes to beat Elementor's `.elementor img` reset. */
.inoforest-media-frame .inoforest-media-frame__image {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	aspect-ratio: var(--ino-mf-ratio);
	object-fit: cover;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

/* 4. Inset image ------------------------------------------------------------------ */
.inoforest-media-frame__inset {
	position: absolute;
	bottom: 0;
	z-index: 1;
	box-sizing: border-box;
	width: var(--ino-mf-inset-size);
	aspect-ratio: 1;
	overflow: hidden;
	line-height: 0;
	border: var(--ino-mf-inset-border-width) solid var(--ino-mf-inset-border-color);
	border-radius: var(--ino-mf-inset-radius);
	box-shadow: var(--ino-mf-shadow);
}

.inoforest-media-frame[data-inset="right"] .inoforest-media-frame__inset {
	right: 0;
}

.inoforest-media-frame[data-inset="left"] .inoforest-media-frame__inset {
	left: 0;
}

.inoforest-media-frame .inoforest-media-frame__inset-image {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: cover;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

/* 5. Badge ----------------------------------------------------------------------- */
.inoforest-media-frame__badge {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: var(--ino-mf-badge-gap);
	padding: 16px 22px 16px 16px;
	text-align: start;
	background-color: var(--inoforest-color-background, #fff);
	border-radius: 16px;
	box-shadow: var(--ino-mf-shadow);
}

.inoforest-media-frame[data-badge-side="left"] .inoforest-media-frame__badge {
	left: var(--ino-mf-badge-x);
}

.inoforest-media-frame[data-badge-side="right"] .inoforest-media-frame__badge {
	right: var(--ino-mf-badge-x);
}

.inoforest-media-frame[data-badge-vertical="top"] .inoforest-media-frame__badge {
	top: var(--ino-mf-badge-y);
}

.inoforest-media-frame[data-badge-vertical="bottom"] .inoforest-media-frame__badge {
	bottom: var(--ino-mf-badge-y);
}

.inoforest-media-frame[data-badge-animation="float"] .inoforest-media-frame__badge {
	animation: ino-mf-float var(--ino-mf-float-duration) ease-in-out infinite;
}

@keyframes ino-mf-float {

	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(var(--ino-mf-float-distance));
	}
}

.inoforest-media-frame__badge-icon {
	display: grid;
	flex: none;
	place-items: center;
	width: var(--ino-mf-icon-box);
	height: var(--ino-mf-icon-box);
	font-size: var(--ino-mf-icon-size);
	line-height: 1;
	color: #fff;
	background-color: var(--inoforest-color-accent, #ff6a3d);
	border-radius: 50%;
}

.inoforest-media-frame__badge-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.inoforest-media-frame__badge-content {
	display: block;
	min-width: 0;
}

:where(.inoforest-media-frame) .inoforest-media-frame__badge-number {
	display: block;
	font-size: 1.5rem;
	font-weight: 800;
	line-height: 1.1;
	color: var(--inoforest-color-heading, #0d1b2a);
}

:where(.inoforest-media-frame) .inoforest-media-frame__badge-text {
	display: block;
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1.75;
	color: var(--inoforest-color-text, #5a6a79);
}

/* 6. Responsive and reduced motion --------------------------------------------------- */
@media (max-width: 1199px) {

	/* The badge stays inside the frame, so narrower screens never scroll sideways. */
	:where(.inoforest-media-frame) {
		--ino-mf-badge-x: 0px;
	}
}

@media (max-width: 991px) {

	:where(.inoforest-media-frame) {
		--ino-mf-max-width: 600px;
	}
}

@media (max-width: 767px) {

	:where(.inoforest-media-frame) {
		--ino-mf-inset-border-width: 5px;
		--ino-mf-badge-y: 20px;
		--ino-mf-badge-gap: 10px;
		--ino-mf-icon-box: 42px;
		--ino-mf-icon-size: 18px;
	}

	.inoforest-media-frame__badge {
		padding: 12px 16px 12px 12px;
	}

	:where(.inoforest-media-frame) .inoforest-media-frame__badge-number {
		font-size: 1.2rem;
	}
}

@media (prefers-reduced-motion: reduce) {

	.inoforest-media-frame[data-badge-animation] .inoforest-media-frame__badge {
		animation: none;
	}
}
