/**
 * OTA Category Feature widget styles.
 *
 * A horizontal, expanding image accordion. Cards rest as pills and expand
 * on hover / keyboard focus to reveal a description. The whole card is a link.
 */
.ota-category-feature {
	/* Rest state mirrors the "Categoy Feature / Animate" frame in the OTA
	   design file: bar/background, bar/text, radius/full and spacing/24. */
	--ocf-panel-bg: #003038;
	--ocf-text: #f0e7d8;
	--ocf-arrow-bg: #f0e7d8;
	--ocf-arrow-color: #003038;
	--ocf-gap: 0px;
	--ocf-radius: 0px;
	/*
	 * The resting pill. The design says radius/full, and 999px is the usual way
	 * to write that, but it animates badly: the browser clamps a radius to half
	 * the box, so 999px and 34px draw the same pill, and a transition from 999
	 * spends most of its time above the clamp looking frozen before appearing
	 * to snap over the last few percent. That is the jank.
	 *
	 * 34px is half the resting pill's height (a 34.32px title row inside 16px
	 * of padding), so it draws exactly the same shape and every frame of the
	 * transition to radius/md is a real one. A title that wraps to two lines
	 * makes the pill taller than 68px and this then reads as a rounded
	 * rectangle rather than a full pill, which is the price of the smooth
	 * animation and is the better looking of the two anyway.
	 */
	--ocf-pill-radius: 34px;
	/* radius/md on the expanded card's panel. The resting pill keeps
	   radius/full above, and the two are what the expand animates between. */
	--ocf-panel-radius: 14px;
	--ocf-inset: 24px;
	--ocf-height: 417px;
	/*
	 * How far the hovered card outgrows its neighbours. The "ot hover" variant
	 * and its three siblings put the open card at 600px against 280px each
	 * across a 1440px row, so the ratio is 600/280. Written as the division it
	 * came from rather than a rounded decimal, because the number means
	 * nothing on its own and a reader can check it against the design.
	 */
	--ocf-grow: 2.142857;
	--ocf-expand-speed: 0.3s;
	--ocf-radius-speed: 0.45s;

	display: flex;
	gap: var(--ocf-gap);
	align-items: stretch;
	width: 100%;
}

.ota-category-feature__item {
	position: relative;
	display: block;
	flex: 1 1 0;
	flex-grow: 1;
	min-width: 0;
	min-height: var(--ocf-height);
	border-radius: var(--ocf-radius);
	overflow: hidden;
	color: var(--ocf-text);
	text-decoration: none;
	transition: flex-grow var(--ocf-expand-speed) ease;
}

.ota-category-feature__item:hover,
.ota-category-feature__item:focus-within {
	flex-grow: var(--ocf-grow);
}

.ota-category-feature__item:focus-visible {
	outline: 3px solid var(--ocf-panel-bg);
	outline-offset: 3px;
}


/*
 * An <img> rather than a background, so it gets srcset and lazy loading.
 * object-fit reproduces what background-size: cover was doing.
 *
 * Written with the block class in front for specificity, not for style.
 * Elementor's frontend.css ships `.elementor img { height: auto }`, which at
 * (0,1,1) beats a lone `.ota-category-feature__image` at (0,1,0). Its `height:
 * auto` won, the image kept its own aspect ratio inside a card that does not
 * share it, and the card letterboxed: `object-fit: cover` had nothing left to
 * crop because the box was already the image's own shape. Two classes take it
 * to (0,2,0) and the fill is ours again.
 */
.ota-category-feature .ota-category-feature__image {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	background-color: #d9d9d9;
	object-fit: cover;
	object-position: center;
	/*
	 * The photograph is the card, so it has no corners of its own. It was
	 * getting 4px from the parent theme, which rounds every image inside the
	 * content region:
	 *
	 *   main#agendtheme-content .agendtheme-content-inner:not(...) img
	 *       { border-radius: var(--at-border-radius) }
	 *
	 * That carries an id, so `border-radius: 0` here would lose to it however
	 * many classes it was given, and out-specifying an id selector from a widget
	 * stylesheet is a fight that only escalates. Zeroing the variable the theme's
	 * own rule reads settles it instead: custom properties resolve on the element
	 * that declares them, so this turns that rule into `border-radius: 0` for
	 * these images and touches nothing else on the page.
	 *
	 * Only visible here because this card has no radius of its own. In the News
	 * and Events blocks the same 4px is hidden under a 14px card that clips it.
	 */
	--at-border-radius: 0px;

	border-radius: 0;
	transition: transform 0.6s ease;
}

.ota-category-feature__item:hover .ota-category-feature__image,
.ota-category-feature__item:focus-within .ota-category-feature__image {
	transform: scale(1.04);
}

/*
 * No scrim over the photo. The instances in the "Categoy Feature / Animate"
 * frame carry a bottom-up gradient, but it is a frame-level override rather
 * than part of the component: none of the five component variants has one, and
 * it is not in the client's style guide. The pill supplies its own contrast.
 */
.ota-category-feature__panel {
	position: absolute;
	right: var(--ocf-inset);
	bottom: var(--ocf-inset);
	left: var(--ocf-inset);
	padding: 16px 24px;
	border-radius: var(--ocf-pill-radius);
	background: var(--ocf-panel-bg);
	color: var(--ocf-text);
	overflow: hidden;
	/* Slower than the card's own expand and eased out, so the corners settle
	   after the width has finished moving rather than racing it. */
	transition: border-radius var(--ocf-radius-speed) cubic-bezier(0.33, 1, 0.68, 1);
}

.ota-category-feature__item:hover .ota-category-feature__panel,
.ota-category-feature__item:focus-within .ota-category-feature__panel {
	border-radius: var(--ocf-panel-radius);
}

.ota-category-feature__heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

/*
 * Heading/H4 from the Elementor global fonts, which carries the scale from the
 * "Typography · AAA updated" artboard. The artboard's numbers are the
 * fallbacks, so the card still renders to spec on a site whose kit has not had
 * the scale imported.
 *
 * The frame this was built from had 20.8px at weight 500, and that was
 * reproduced here literally. Neither value is in the scale: 20.8px is a scaled
 * instance rather than a chosen size, and no text style in the system is
 * weight 500. H4 at 24px Regular is the nearest member and the one the scale
 * offers for a card title.
 */
.ota-category-feature__title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: var(--e-global-typography-h4-font-size, 1.5rem);
	font-weight: var(--e-global-typography-h4-font-weight, 400);
	line-height: var(--e-global-typography-h4-line-height, 1.08em);
	letter-spacing: var(--e-global-typography-h4-letter-spacing, -0.24px);
	/* Wrap to a new line on tight widths rather than pushing the arrow out. */
	overflow-wrap: break-word;
}

.ota-category-feature__arrow {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/*
	 * 34px is the design's, kept. It used to be the title's own line box, back
	 * when the title was 20.8px at a 1.65 ratio. On the scale H4's line box is
	 * about 26px, so the arrow is now the taller of the two and sets the row
	 * height itself. That reads as padding around the title rather than as a
	 * misfit, and shrinking the circle to 26px would leave the 22px glyph with
	 * two pixels either side.
	 */
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background-color: transparent;
	color: var(--ocf-text);
	transition: background-color var(--ocf-expand-speed) ease, color var(--ocf-expand-speed) ease;
}

.ota-category-feature__item:hover .ota-category-feature__arrow,
.ota-category-feature__item:focus-within .ota-category-feature__arrow {
	background-color: var(--ocf-arrow-bg);
	color: var(--ocf-arrow-color);
}

.ota-category-feature__arrow svg {
	display: block;
	width: 22px;
	height: 22px;
}

.ota-category-feature__desc {
	display: block;
	/* Locked to the final expanded width by JS so the text is laid out once and
	   never re-wraps; the card's overflow masks it as it stretches open. */
	width: var(--ocf-desc-width, 100%);
	max-height: 0;
	margin-top: 0;
	overflow: hidden;
	opacity: 0;
	/* Body/Small, the scale member nearest the 0.95rem this was built at. */
	font-size: var(--e-global-typography-small-font-size, 0.9375rem);
	font-weight: var(--e-global-typography-small-font-weight, 300);
	line-height: var(--e-global-typography-small-line-height, 1.65em);
	transition: max-height 0.4s ease, opacity 0.4s ease, margin-top 0.4s ease;
}

/* The cap is only here to give max-height something to animate to, so it is
   set well clear of any realistic description rather than at a length that
   would truncate one mid-sentence with nothing to say it had. */
.ota-category-feature__item:hover .ota-category-feature__desc,
.ota-category-feature__item:focus-within .ota-category-feature__desc {
	max-height: 60vh;
	margin-top: 16px;
	opacity: 1;
}

/*
 * Stack wherever the reveal cannot be driven. Width alone is not the test: a
 * tablet in portrait sits above 767px and still has no pointer, so the
 * accordion stays horizontal and every description is stuck at max-height: 0
 * with no way to open it. `(hover: none)` catches that, and matches how
 * ota-mega-menu.css:836 handles the same problem in the menu.
 */
@media (max-width: 767px), (hover: none) {
	.ota-category-feature {
		flex-direction: column;
	}

	.ota-category-feature__item {
		flex: none;
		min-height: 260px;
	}

	.ota-category-feature__panel {
		border-radius: var(--ocf-panel-radius);
	}

	.ota-category-feature__desc {
		max-height: 60vh;
		margin-top: 16px;
		opacity: 1;
	}
}

/*
 * The accordion is motion at its core: the card grows, the image scales, the
 * description unrolls. Honouring the preference means the same states are
 * still reachable, they just arrive rather than animate. Matches the block in
 * ota-mega-menu.css:1561.
 */
@media (prefers-reduced-motion: reduce) {
	.ota-category-feature__item,
	.ota-category-feature__image,
	.ota-category-feature__panel,
	.ota-category-feature__arrow,
	.ota-category-feature__desc {
		transition: none;
	}

	/* Scaling the image is decorative, so it is dropped rather than snapped. */
	.ota-category-feature__item:hover .ota-category-feature__image,
	.ota-category-feature__item:focus-within .ota-category-feature__image {
		transform: none;
	}
}
