/**
 * CWS Hover Cards
 *
 * Colours, sizes, gradients and typography come from the widget's Style
 * tab. Values here are structural fallbacks only, kept at one class so
 * the Elementor {{WRAPPER}} rules always win.
 */

/*
 * Elementor containers size a widget by its content. Every layer of a card
 * is absolutely positioned, so the content has no natural width and the
 * widget collapses to nothing in a row container or when Align Items is set.
 * Same fix Elementor uses for its own Video widget; Advanced > Width still
 * overrides it.
 */
.e-con > .elementor-widget-cws-hover-cards,
.e-con-inner > .elementor-widget-cws-hover-cards {
	width: var(--container-widget-width, 100%);
	--flex-grow: var(--container-widget-flex-grow, 1);
}

.cws-hc {
	--cws-hc-speed: 450ms;
	--cws-hc-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--cws-hc-zoom: 1.06;
	--cws-hc-lift: 0px;
	--cws-hc-n-top: 1;    /* normal: spacer above the content */
	--cws-hc-n-bottom: 0; /* normal: spacer below the content */
	--cws-hc-h-top: 1;    /* revealed: spacer above */
	--cws-hc-h-bottom: 1; /* revealed: spacer below */

	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 40px;
	margin: 0;
	padding: 0;
	list-style: none;
	margin:0 auto !important;
	max-width:1350px;
}

.cws-hc > .cws-hc__item {
	width: 100%;
	margin: 0;
	padding: 0;
	justify-self: center;
}

.cws-hc > .cws-hc__item::before,
.cws-hc > .cws-hc__item::marker {
	content: none;
}

/* ---------- Card ---------- */

.cws-hc__card {
	position: relative;
	isolation: isolate; /* keeps rounded corners clipped during image zoom (Safari) */
	overflow: hidden;
	height: 420px;
	border-radius: 12px;
	background-color: #091a33;
	transition:
		transform var(--cws-hc-speed) var(--cws-hc-ease),
		box-shadow var(--cws-hc-speed) var(--cws-hc-ease),
		border-color var(--cws-hc-speed) var(--cws-hc-ease);
}

.cws-hc__media {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.cws-hc__card .cws-hc__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	object-position: center center;
	transition:
		transform var(--cws-hc-speed) var(--cws-hc-ease),
		filter var(--cws-hc-speed) var(--cws-hc-ease);
}

/* Two gradient layers cross-fade: CSS cannot animate one gradient into another. */
.cws-hc__shade {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	transition: opacity var(--cws-hc-speed) var(--cws-hc-ease);
}

.cws-hc__shade--hover {
	opacity: 0;
}

.cws-hc__card-link {
	position: absolute;
	inset: 0;
	z-index: 2;
}

/* ---------- Content ---------- */

.cws-hc__content {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	padding: 32px 28px;
	text-align: center;
}

/* Text passes clicks through to the whole-card link; the button stays clickable. */
.cws-hc__item--linked .cws-hc__content {
	pointer-events: none;
}

.cws-hc__item--linked .cws-hc__btn {
	pointer-events: auto;
}

/*
 * Flex spacers position the content. flex-grow animates smoothly, so the
 * block glides from bottom to centre instead of jumping.
 */
.cws-hc__content::before,
.cws-hc__content::after {
	content: "";
	flex: 0 1 0%;
	transition: flex-grow var(--cws-hc-speed) var(--cws-hc-ease);
}

.cws-hc__content::before {
	flex-grow: var(--cws-hc-n-top);
}

.cws-hc__content::after {
	flex-grow: var(--cws-hc-n-bottom);
}

.cws-hc__body {
	flex: 0 0 auto;
}

.cws-hc__title {
	margin: 0;
	padding: 0;
	color: #fff;
	transition: color var(--cws-hc-speed) var(--cws-hc-ease);
}

/* Collapsed to zero height, expands to its natural height on reveal. */
.cws-hc__reveal {
	display: grid;
	grid-template-rows: 0fr;
	opacity: 0;
	transition:
		grid-template-rows var(--cws-hc-speed) var(--cws-hc-ease),
		opacity var(--cws-hc-speed) var(--cws-hc-ease);
}

.cws-hc__reveal-inner {
	min-height: 0;
	overflow: hidden;
}

.cws-hc__desc {
	margin: 16px 0 0;
	padding: 0;
	color: rgba(255, 255, 255, 0.9);
}

/* Padding stops the button border and focus ring being clipped by the collapse. */
.cws-hc__actions {
	margin-top: 20px;
	padding: 4px;
}

.cws-hc__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid #00aeef;
	border-radius: 50px;
	padding: 12px 22px;
	background-color: transparent;
	color: #fff;
	line-height: 1.2;
	text-decoration: none;
	transition:
		color 0.3s ease,
		background-color 0.3s ease,
		border-color 0.3s ease,
		box-shadow 0.3s ease;
}

.cws-hc__btn:hover,
.cws-hc__btn:focus-visible {
	text-decoration: none;
}

.cws-hc__btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* ---------- Revealed: hover, keyboard focus, tap / editor preview (.is-active) ---------- */

.cws-hc__item:is(:hover, :focus-within, .is-active) .cws-hc__card {
	transform: translateY(calc(var(--cws-hc-lift) * -1));
}

.cws-hc__item:is(:hover, :focus-within, .is-active) .cws-hc__card .cws-hc__media img {
	transform: scale(var(--cws-hc-zoom));
}

.cws-hc__item:is(:hover, :focus-within, .is-active) .cws-hc__shade--normal {
	opacity: 0;
}

.cws-hc__item:is(:hover, :focus-within, .is-active) .cws-hc__shade--hover {
	opacity: 1;
}

.cws-hc__item:is(:hover, :focus-within, .is-active) .cws-hc__content::before {
	flex-grow: var(--cws-hc-h-top);
}

.cws-hc__item:is(:hover, :focus-within, .is-active) .cws-hc__content::after {
	flex-grow: var(--cws-hc-h-bottom);
}

.cws-hc__item:is(:hover, :focus-within, .is-active) .cws-hc__reveal {
	grid-template-rows: 1fr;
	opacity: 1;
}

/* ---------- Touch devices: "Always show content" ---------- */

@media (hover: none) {
	.cws-hc-touch--open .cws-hc__shade--normal {
		opacity: 0;
	}

	.cws-hc-touch--open .cws-hc__shade--hover {
		opacity: 1;
	}

	.cws-hc-touch--open .cws-hc__content::before {
		flex-grow: var(--cws-hc-h-top);
	}

	.cws-hc-touch--open .cws-hc__content::after {
		flex-grow: var(--cws-hc-h-bottom);
	}

	.cws-hc-touch--open .cws-hc__reveal {
		grid-template-rows: 1fr;
		opacity: 1;
	}
}

/* ---------- Reduced motion (reset) ---------- */

@media (prefers-reduced-motion: reduce) {
	.cws-hc {
		--cws-hc-speed: 1ms !important;
		--cws-hc-lift: 0px !important;
		--cws-hc-zoom: 1 !important;
	}
}
