/**
 * Captioned Image widget.
 *
 * Position is driven entirely by custom properties set from the Elementor
 * controls, so the four corners need one rule rather than four, and the
 * position control can be responsive without swapping classes.
 *
 * No !important anywhere: Elementor's generated selectors are 0-3-0 and must
 * always be able to override these defaults.
 */

.gemtech-captioned-image {
	--gtea-ci-offset-x: 0px;
	--gtea-ci-offset-y: 0px;
	--gtea-ci-top: auto;
	--gtea-ci-right: auto;
	--gtea-ci-bottom: var(--gtea-ci-offset-y);
	--gtea-ci-left: var(--gtea-ci-offset-x);
	--gtea-ci-scrim: rgba(0, 0, 0, 0.55);
	--gtea-ci-scrim-size: 45%;

	position: relative;
	display: block;
	line-height: 0; /* kills the descender gap under the image */
}

.gemtech-captioned-image__link {
	position: relative;
	display: block;
	color: inherit;
	text-decoration: none;
}

.gemtech-captioned-image__image {
	display: block;
	width: 100%;
	height: auto;
}

/* The scrim sits between image and caption, so it darkens the photo without
   washing out the caption's own background. */
.gemtech-captioned-image--scrim .gemtech-captioned-image__link::after {
	content: "";
	position: absolute;
	right: 0;
	left: 0;
	height: var(--gtea-ci-scrim-size);
	pointer-events: none;
}

.gemtech-captioned-image--scrim.gemtech-captioned-image--bottom-left .gemtech-captioned-image__link::after,
.gemtech-captioned-image--scrim.gemtech-captioned-image--bottom-right .gemtech-captioned-image__link::after {
	bottom: 0;
	background: linear-gradient(to top, var(--gtea-ci-scrim), transparent);
}

.gemtech-captioned-image--scrim.gemtech-captioned-image--top-left .gemtech-captioned-image__link::after,
.gemtech-captioned-image--scrim.gemtech-captioned-image--top-right .gemtech-captioned-image__link::after {
	top: 0;
	background: linear-gradient(to bottom, var(--gtea-ci-scrim), transparent);
}

.gemtech-captioned-image__caption {
	position: absolute;
	top: var(--gtea-ci-top);
	right: var(--gtea-ci-right);
	bottom: var(--gtea-ci-bottom);
	left: var(--gtea-ci-left);

	display: inline-flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 10px;

	width: auto;
	max-width: calc(100% - (var(--gtea-ci-offset-x) * 2));
	box-sizing: border-box;

	background: rgba(0, 0, 0, 0.75);
	line-height: 1.3;
}

/* Full width overrides both horizontal edges directly, which beats the
   custom-property defaults on specificity without needing !important. */
.gemtech-captioned-image--full .gemtech-captioned-image__caption {
	right: var(--gtea-ci-offset-x);
	left: var(--gtea-ci-offset-x);
	max-width: none;
}

.gemtech-captioned-image__item {
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.gemtech-captioned-image__separator {
	color: #e8a33d;
	line-height: inherit;
	/* Never the thing that wraps to its own line. */
	flex: 0 0 auto;
}

/* An absolutely positioned caption can swamp a small screen, so let it wrap
   and keep it inside the image. */
@media (max-width: 767px) {
	.gemtech-captioned-image__caption {
		max-width: calc(100% - (var(--gtea-ci-offset-x) * 2));
	}
}
