/* ==========================================================================
   Elementor General Cards Widget — general-cards.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   Grid container
   -------------------------------------------------------------------------- */
.egcw-cards-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
}

/* --------------------------------------------------------------------------
   Card base
   The card uses position: relative + overflow: hidden to clip the sliding
   hover overlay. All internal layers are stacked via z-index.
   -------------------------------------------------------------------------- */
.egcw-card {
	position: relative;
	min-height: 220px;
	border-radius: 12px;
	overflow: hidden;
	display: block;
	text-decoration: none;
	background-color: #1e4696; /* fallback when no image */
	cursor: pointer;
}

/* --------------------------------------------------------------------------
   Layer 0 — Background image
   -------------------------------------------------------------------------- */
.egcw-card__bg {
	position: absolute;
	inset: 0;
	z-index: 0;
}

.egcw-card__bg img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center center;
	display: block;
}

/* --------------------------------------------------------------------------
   Layer 1 — Base overlay (always visible tinted layer over the image)
   -------------------------------------------------------------------------- */
.egcw-card__base-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	background-color: transparent;
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   Layer 2 — Hover overlay
   Hidden by default; activated and animated by direction classes below.
   The transition shorthand is set here so Elementor can override only the
   duration and timing via its selector controls.
   -------------------------------------------------------------------------- */
.egcw-card__hover-overlay {
	position: absolute;
	inset: 0;
	z-index: 2;
	background-color: rgba(20, 50, 120, 0.88);
	pointer-events: none;
	will-change: transform, opacity;
	/* Base transition — duration/timing overridden by Elementor selectors */
	transition: transform 0.4s ease, opacity 0.4s ease;
	/* Hidden until a direction class activates it */
	opacity: 0;
	transform: none;
}

/* --------------------------------------------------------------------------
   Layer 3 — Card body (title + content)
   Always rendered on top of both overlay layers so the text is never
   obscured by the hover animation.
   -------------------------------------------------------------------------- */
.egcw-card__body {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
	padding: 20px;
}

/* --------------------------------------------------------------------------
   Typography defaults
   -------------------------------------------------------------------------- */
.egcw-card__title {
	margin: 0 0 8px;
	color: #ffffff;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.3;
	text-transform: uppercase;
}

.egcw-card__content {
	margin: 0;
	color: #ffffff;
	font-size: 0.875rem;
	line-height: 1.5;
}

/* ==========================================================================
   Hover overlay — direction variants
   Controlled by prefix_class on the Elementor widget wrapper.
   Class pattern: egcw-gc-hover-{none|fade|up|down|left|right}
   ========================================================================== */

/* --------------------------------------------------------------------------
   NONE — disable the overlay entirely
   -------------------------------------------------------------------------- */
.egcw-gc-hover-none .egcw-card__hover-overlay {
	display: none;
}

/* --------------------------------------------------------------------------
   FADE — pure opacity transition
   -------------------------------------------------------------------------- */
.egcw-gc-hover-fade .egcw-card__hover-overlay {
	opacity: 0;
	transform: none;
}

.egcw-gc-hover-fade .egcw-card:hover .egcw-card__hover-overlay {
	opacity: 1;
}

/* --------------------------------------------------------------------------
   UP — overlay enters from the bottom and slides upward  ↑
   -------------------------------------------------------------------------- */
.egcw-gc-hover-up .egcw-card__hover-overlay {
	opacity: 1;
	transform: translateY(100%);
}

.egcw-gc-hover-up .egcw-card:hover .egcw-card__hover-overlay {
	transform: translateY(0);
}

/* --------------------------------------------------------------------------
   DOWN — overlay enters from the top and slides downward  ↓
   -------------------------------------------------------------------------- */
.egcw-gc-hover-down .egcw-card__hover-overlay {
	opacity: 1;
	transform: translateY(-100%);
}

.egcw-gc-hover-down .egcw-card:hover .egcw-card__hover-overlay {
	transform: translateY(0);
}

/* --------------------------------------------------------------------------
   LEFT — overlay enters from the right side and slides left  ←
   -------------------------------------------------------------------------- */
.egcw-gc-hover-left .egcw-card__hover-overlay {
	opacity: 1;
	transform: translateX(100%);
}

.egcw-gc-hover-left .egcw-card:hover .egcw-card__hover-overlay {
	transform: translateX(0);
}

/* --------------------------------------------------------------------------
   RIGHT — overlay enters from the left side and slides right  →
   -------------------------------------------------------------------------- */
.egcw-gc-hover-right .egcw-card__hover-overlay {
	opacity: 1;
	transform: translateX(-100%);
}

.egcw-gc-hover-right .egcw-card:hover .egcw-card__hover-overlay {
	transform: translateX(0);
}

/* --------------------------------------------------------------------------
   Accessibility: reduce-motion support
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.egcw-card__hover-overlay {
		transition: opacity 0.15s ease !important;
		transform: none !important;
	}

	.egcw-gc-hover-up .egcw-card__hover-overlay,
	.egcw-gc-hover-down .egcw-card__hover-overlay,
	.egcw-gc-hover-left .egcw-card__hover-overlay,
	.egcw-gc-hover-right .egcw-card__hover-overlay {
		opacity: 0;
		transform: none;
	}

	.egcw-gc-hover-up .egcw-card:hover .egcw-card__hover-overlay,
	.egcw-gc-hover-down .egcw-card:hover .egcw-card__hover-overlay,
	.egcw-gc-hover-left .egcw-card:hover .egcw-card__hover-overlay,
	.egcw-gc-hover-right .egcw-card:hover .egcw-card__hover-overlay {
		opacity: 1;
		transform: none;
	}
}

/* ==========================================================================
   Flip card effect
   Activated when the widget wrapper has class egcw-gc-flip-enabled.
   ========================================================================== */

/* Card wrapper needs perspective for 3D; overflow visible to not clip faces */
.egcw-gc-flip-enabled .egcw-card--flip {
	overflow: visible;
	background-color: transparent !important;
	perspective: 1200px;
}

/* The flipper div holds both faces and does the rotation */
.egcw-card__flipper {
	position: absolute;
	inset: 0;
	transform-style: preserve-3d;
	transition: transform 0.6s ease;
	border-radius: inherit;
}

/* Each face is positioned absolute, fills the card, clips its own content */
.egcw-card__face {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	overflow: hidden;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

/* --------------------------------------------------------------------------
   Back face — default rotation for horizontal flip (rotateY)
   -------------------------------------------------------------------------- */
.egcw-card__face--back {
	transform: rotateY(180deg);
}

/* Vertical flip: back face is rotated on X axis instead */
.egcw-gc-flipdir-vertical .egcw-card__face--back {
	transform: rotateX(180deg);
}

/* --------------------------------------------------------------------------
   Hover trigger — flip the flipper on :hover
   -------------------------------------------------------------------------- */
.egcw-gc-flip-enabled.egcw-gc-flipdir-horizontal .egcw-card--flip:hover .egcw-card__flipper {
	transform: rotateY(180deg);
}

.egcw-gc-flip-enabled.egcw-gc-flipdir-vertical .egcw-card--flip:hover .egcw-card__flipper {
	transform: rotateX(180deg);
}

/* In click mode, disable the hover flip so only JS-toggled .is-flipped works */
.egcw-gc-flip-enabled.egcw-gc-fliptrigger-click .egcw-card--flip:hover .egcw-card__flipper {
	transform: none;
}

/* --------------------------------------------------------------------------
   Click trigger — JS adds/removes .is-flipped on the card
   -------------------------------------------------------------------------- */
.egcw-gc-flip-enabled.egcw-gc-flipdir-horizontal .egcw-card--flip.is-flipped .egcw-card__flipper {
	transform: rotateY(180deg);
}

.egcw-gc-flip-enabled.egcw-gc-flipdir-vertical .egcw-card--flip.is-flipped .egcw-card__flipper {
	transform: rotateX(180deg);
}

/* Click-mode card: pointer cursor */
.egcw-gc-fliptrigger-click .egcw-card--flip {
	cursor: pointer;
}

/* --------------------------------------------------------------------------
   Back face body
   -------------------------------------------------------------------------- */
.egcw-card__back-body {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
	padding: 20px;
	background-color: #1e4696;
}

.egcw-card__subtitle {
	margin: 0 0 8px;
	color: rgba(255, 255, 255, 0.75);
	font-size: 0.8125rem;
	line-height: 1.4;
}

.egcw-card__back-title {
	margin: 0 0 8px;
	color: #ffffff;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.3;
}

.egcw-card__back-subtitle {
	margin: 0 0 8px;
	color: rgba(255, 255, 255, 0.75);
	font-size: 0.8125rem;
	line-height: 1.4;
}

.egcw-card__back-content {
	margin: 0 0 16px;
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.875rem;
	line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Rich text block (front and back face — shared class)
   Resets inner element margins so WordPress editor styles
   don't overflow the card boundaries.
   -------------------------------------------------------------------------- */
.egcw-card__rich-text {
	color: #ffffff;
	font-size: 0.875rem;
	line-height: 1.5;
}

.egcw-card__rich-text > * {
	margin-top: 0;
}

.egcw-card__rich-text > *:last-child {
	margin-bottom: 0;
}

.egcw-card__rich-text a {
	color: inherit;
	text-decoration: underline;
}

.egcw-card__back-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 20px;
	background-color: #ffffff;
	color: #1e4696;
	border-radius: 4px;
	text-decoration: none;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.egcw-card__back-btn:hover {
	background-color: #e0e0e0;
}

/* --------------------------------------------------------------------------
   Accessibility: reduce-motion for flip
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.egcw-card__flipper {
		transition: none !important;
	}
}

/* ==========================================================================
   Decorative icon
   Positioned absolutely within .egcw-card__body / .egcw-card__back-body.
   Position variant is driven by the --{position} modifier class.
   ========================================================================== */
.egcw-card__icon {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* Default colour / size — overridden by Elementor selectors */
	font-size: 2rem;
	color: rgba(255, 255, 255, 0.5);
	line-height: 1;
	pointer-events: none;
	z-index: 1;
}

.egcw-card__icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* --------------------------------------------------------------------------
   Position variants
   -------------------------------------------------------------------------- */
.egcw-card__icon--top-left {
	top: 0;
	left: 0;
}

.egcw-card__icon--top-center {
	top: 0;
	left: 50%;
	transform: translateX(-50%);
}

.egcw-card__icon--top-right {
	top: 0;
	right: 0;
}

.egcw-card__icon--center-left {
	top: 50%;
	left: 0;
	transform: translateY(-50%);
}

.egcw-card__icon--center-right {
	top: 50%;
	right: 0;
	transform: translateY(-50%);
}

.egcw-card__icon--bottom-left {
	bottom: 0;
	left: 0;
}

.egcw-card__icon--bottom-center {
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
}

.egcw-card__icon--bottom-right {
	bottom: 0;
	right: 0;
}
