/*
 * Pop-up (image or text bar) that slides up from the bottom edge of an Uncode grid tile.
 *
 * Tweak the look with these variables, e.g. in Appearance > Customize > Additional CSS:
 *   .amn-ghi-has-pop { --amn-ghi-bar-bg: #d81f4f; }
 */
.amn-ghi-has-pop {
	--amn-ghi-width: 50%;       /* image pop-up width, relative to the tile */
	--amn-ghi-max-height: 70%;  /* never cover more than this much of the tile */
	--amn-ghi-gap: 0px;         /* space between an image pop-up and the bottom edge */
	--amn-ghi-duration: 0.35s;

	/*
	 * Text bar. Sizes are in cqw (1% of the bar's width, i.e. the tile's width)
	 * so the bar keeps the same proportions at every tile size. They match the
	 * approved mockup, where a ~630px tile has ~28px padding, 11px categories
	 * and a 30px heading. The px values are for browsers without cqw support.
	 */
	--amn-ghi-bar-bg: #eb2f5b;
	--amn-ghi-bar-color: #ffffff;
	--amn-ghi-bar-pad-y: 26px;
	--amn-ghi-bar-pad-x: 26px;
	--amn-ghi-cats-size: 11px;
	--amn-ghi-cats-gap: 12px;   /* space between the categories and the heading */
	--amn-ghi-heading-size: 28px;
}

@supports (width: 1cqw) {
	.amn-ghi-has-pop {
		--amn-ghi-bar-pad-y: max(16px, 4.4cqw);
		--amn-ghi-bar-pad-x: max(16px, 4.6cqw);
		--amn-ghi-cats-size: max(10px, 1.75cqw);
		--amn-ghi-cats-gap: max(8px, 2cqw);
		--amn-ghi-heading-size: max(20px, 4.75cqw);
	}
}

/*
 * !important is needed because Uncode's own ".tmb .t-entry-visual img" rules
 * (full width, zoom on hover) would otherwise apply to the image too.
 * .t-entry-visual is position: relative + overflow: hidden, so the pop-up is
 * clipped while it sits below the bottom edge.
 * --amn-ghi-x centres the image; the full-width text bar sets it to 0.
 */
.tmb .t-entry-visual .amn-ghi-pop {
	--amn-ghi-x: -50%;
	position: absolute !important;
	left: 50%;
	bottom: var(--amn-ghi-gap);
	z-index: 4 !important; /* above the image (1) and the dark overlay (2) */
	max-height: var(--amn-ghi-max-height);
	margin: 0;
	opacity: 0;
	transform: translate(var(--amn-ghi-x), 100%) !important;
	transition: transform var(--amn-ghi-duration) cubic-bezier(0.22, 1, 0.36, 1), opacity var(--amn-ghi-duration) ease !important;
	pointer-events: none; /* clicks and hovers still reach Uncode's link */
}

.tmb .t-entry-visual img.amn-ghi-pop--image {
	width: var(--amn-ghi-width) !important;
	max-width: none;
	height: auto;
	object-fit: contain;
	object-position: bottom center;
}

.tmb .t-entry-visual .amn-ghi-pop--text {
	--amn-ghi-x: 0;
	left: 0;
	bottom: 0;
	box-sizing: border-box;
	width: 100%;
	overflow: hidden;
	background: var(--amn-ghi-bar-bg);
	color: var(--amn-ghi-bar-color);
	text-align: left;
	overflow-wrap: break-word;
	container-type: inline-size; /* the cqw sizes above measure this bar */
}

/* Padding and text live on an inner wrapper: an element can't size itself in its own cqw. */
.tmb .t-entry-visual .amn-ghi-pop--text .amn-ghi-inner {
	padding: var(--amn-ghi-bar-pad-y) var(--amn-ghi-bar-pad-x);
}

.tmb .t-entry-visual .amn-ghi-pop--text .amn-ghi-cats {
	margin: 0 0 var(--amn-ghi-cats-gap);
	font-size: var(--amn-ghi-cats-size);
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: inherit;
}

/*
 * Font family comes from the site's own h2 styling (Womby). No text-transform:
 * Womby gives the capitals look itself, and keeps a typed lowercase "i" distinct.
 */
.tmb .t-entry-visual .amn-ghi-pop--text .amn-ghi-heading {
	margin: 0;
	padding: 0;
	font-size: var(--amn-ghi-heading-size);
	line-height: 1.1;
	letter-spacing: normal;
	text-transform: none;
	color: inherit !important; /* Uncode's light-skin heading colour would otherwise win */
}

/* Same triggers Uncode uses for its zoom/overlay, so everything runs together. */
.no-touch .tmb .t-entry-visual:hover .amn-ghi-pop,
.tmb .t-entry-visual:focus-within .amn-ghi-pop {
	opacity: 1;
	transform: translate(var(--amn-ghi-x), 0) !important;
}

@media (prefers-reduced-motion: reduce) {
	.tmb .t-entry-visual .amn-ghi-pop {
		transform: translate(var(--amn-ghi-x), 0) !important;
		transition: opacity 0.2s ease !important;
	}
}
