/* Custom Projects for Elementor — front-end styles */

.cpe-showcase {
	width: 100%;
	box-sizing: border-box;
}
.cpe-showcase * {
	box-sizing: border-box;
}

/* ---------- Tabs ---------- */
.cpe-tabs {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 28px;
}

.cpe-tab {
	background: #fff;
	border: 1px solid #d9dde1;
	color: #4a4a4a;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	padding: 10px 22px;
	border-radius: 30px;
	cursor: pointer;
	line-height: 1.2;
	white-space: nowrap;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.cpe-tab:hover {
	border-color: #6faf3e;
}

.cpe-tab.is-active {
	background-color: #6faf3e;
	border-color: #6faf3e;
	color: #fff;
}

/* ---------- Grid ---------- */
.cpe-grid-wrap {
	overflow: hidden;
	touch-action: pan-y;
}

.cpe-grid {
	display: grid;
	grid-template-columns: repeat(var(--cpe-columns, 3), minmax(0, 1fr));
	gap: 24px;
	transition: grid-template-columns .25s ease;
}

.cpe-card-outer {
	display: block;
	transition: opacity .32s ease, transform .32s ease;
	opacity: 1;
	transform: translateX(0) translateY(0);
}

.cpe-card-outer.cpe-is-hidden {
	display: none !important;
}

/* Next/Previous: slide + fade */
.cpe-card-outer.cpe-slide-out-left {
	opacity: 0;
	transform: translateX(-40px);
}
.cpe-card-outer.cpe-slide-out-right {
	opacity: 0;
	transform: translateX(40px);
}
.cpe-card-outer.cpe-slide-in-right {
	opacity: 0;
	transform: translateX(40px);
}
.cpe-card-outer.cpe-slide-in-left {
	opacity: 0;
	transform: translateX(-40px);
}

/* Tab switch: plain crossfade */
.cpe-card-outer.cpe-fade-out {
	opacity: 0;
	transform: translateY(10px);
}
.cpe-card-outer.cpe-fade-in {
	opacity: 0;
	transform: translateY(10px);
}

.cpe-card {
	position: relative;
	height: 380px;
	border-radius: 6px;
	overflow: hidden;
	background-color: #222;
	display: flex;
	align-items: flex-end;
	isolation: isolate;
}

/* Separate background layer so it can zoom on hover without affecting
   the overlay or the text/button content sitting on top of it. */
.cpe-card-bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	transform: scale(1);
	transition: transform .6s ease;
	z-index: -1;
	will-change: transform;
}

.cpe-card:hover .cpe-card-bg {
	transform: scale(1.1);
}

/* Adjustable dark overlay (color/opacity set from the Elementor Style tab) */
.cpe-card::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--cpe-overlay, rgba(0, 0, 0, 0.45));
	transition: background-color .3s ease;
	z-index: 0;
}

.cpe-card:hover::before {
	background: var(--cpe-overlay-hover, rgba(0, 0, 0, 0.6));
}

/* Subtle fixed gradient for extra legibility right behind the text */
.cpe-card::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.5) 100%);
	z-index: 0;
	pointer-events: none;
}

.cpe-badge {
	display: inline-block;
	background-color: #6faf3e;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	padding: 5px 12px;
	border-radius: 3px;
	margin-bottom: 10px;
}

.cpe-card-content {
	position: relative;
	z-index: 1;
	padding: 20px 24px 24px;
	width: 100%;
}

.cpe-card-title {
	color: #fff;
	font-size: 20px;
	font-weight: 800;
	line-height: 1.25;
	text-transform: uppercase;
	margin: 0;
	transition: transform .3s ease;
}

/* Collapsed by default - takes up zero space, so there is no empty gap
   under the title until the card is hovered. */
.cpe-card-reveal {
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	margin-top: 0;
	transition: max-height .35s ease, opacity .3s ease, margin-top .35s ease;
}

.cpe-card-text {
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	line-height: 1.5;
	margin: 0 0 14px;
}

.cpe-card-btn {
	display: inline-block;
	background: #fff;
	color: #222;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	padding: 10px 20px;
	border-radius: 3px;
	transition: background-color .2s ease, color .2s ease;
}

.cpe-card-btn:hover {
	background: #6faf3e;
	color: #fff;
}

/* On hover: title lifts up and the short text + button reveal below it,
   with no leftover empty space in the resting state. */
.cpe-card:hover .cpe-card-title {
	transform: translateY(-6px);
}

.cpe-card:hover .cpe-card-reveal {
	max-height: 160px;
	opacity: 1;
	margin-top: 12px;
}

/* ---------- Bottom nav (progress + arrows) ---------- */
.cpe-nav {
	display: flex;
	align-items: center;
	gap: 24px;
	margin-top: 32px;
}

.cpe-progress {
	flex: 1;
	height: 2px;
	background: #e2e5e8;
	position: relative;
}

.cpe-progress span {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	background: #6faf3e;
	transition: width .3s ease, left .3s ease;
}

.cpe-arrows {
	display: flex;
	gap: 10px;
	flex-shrink: 0;
}

.cpe-prev,
.cpe-next {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid #d9dde1;
	background: #fff;
	color: #222;
	font-size: 18px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.cpe-next {
	background: #1b1b1b;
	border-color: #1b1b1b;
	color: #fff;
}

.cpe-prev:hover {
	border-color: #6faf3e;
	color: #6faf3e;
}

.cpe-next:hover {
	background: #6faf3e;
	border-color: #6faf3e;
}

.cpe-prev:disabled,
.cpe-next:disabled {
	opacity: 0.35;
	cursor: default;
}

/* ---------- Touch devices (phones / tablets: no hover) ---------- */
@media (hover: none) {
	/* Nothing to hover, so show the short text + button right away. */
	.cpe-card-reveal {
		max-height: 200px;
		opacity: 1;
		margin-top: 10px;
	}
	.cpe-card::before {
		background: var(--cpe-overlay-hover, rgba(0, 0, 0, 0.6));
	}
	.cpe-card:hover .cpe-card-bg {
		transform: none;
	}
	.cpe-card:hover .cpe-card-title {
		transform: none;
	}
	.cpe-card-text {
		display: -webkit-box;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}
	.cpe-card-btn {
		min-height: 40px;
		line-height: 20px;
	}
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
	.cpe-tabs {
		gap: 10px;
		margin-bottom: 22px;
	}
	.cpe-tab {
		padding: 9px 18px;
		font-size: 12px;
	}
	.cpe-card-content {
		padding: 18px 20px 20px;
	}
	.cpe-card-title {
		font-size: 18px;
	}
	.cpe-nav {
		margin-top: 26px;
	}
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	/* Vertical tab list: one full-width, easy-to-tap button per row. */
	.cpe-tabs {
		flex-direction: column;
		flex-wrap: nowrap;
		align-items: stretch;
		overflow: visible;
		gap: 8px;
		margin-bottom: 18px;
	}
	.cpe-tab {
		display: block;
		width: 100%;
		text-align: left;
		padding: 14px 18px;
		font-size: 13px;
		border-radius: 8px;
		min-height: 48px;
	}
	.cpe-tab.is-active {
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	}
	/* Every item is shown at once, so no Next/Previous needed. */
	.cpe-show-all .cpe-nav {
		display: none;
	}
	.cpe-card-content {
		padding: 16px 18px 18px;
	}
	.cpe-card-title {
		font-size: 17px;
	}
	.cpe-card-text {
		font-size: 13px;
		margin-bottom: 12px;
	}
	.cpe-nav {
		gap: 16px;
		margin-top: 20px;
	}
	.cpe-prev,
	.cpe-next {
		width: 42px;
		height: 42px;
	}
	/* Smaller slide distance so nothing pokes outside narrow screens. */
	.cpe-card-outer.cpe-slide-out-left,
	.cpe-card-outer.cpe-slide-in-left {
		transform: translateX(-24px);
	}
	.cpe-card-outer.cpe-slide-out-right,
	.cpe-card-outer.cpe-slide-in-right {
		transform: translateX(24px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cpe-card-outer,
	.cpe-card-bg,
	.cpe-card-reveal,
	.cpe-card-title,
	.cpe-progress span {
		transition: none !important;
	}
}
