/**
 * WebXtrm Project Portfolio Widget Styles
 * Pure CSS animations + IntersectionObserver-triggered count-up (via JS).
 */

.wx-pp-wrap {
	width: 100%;
	display: flex;
	justify-content: center;
	box-sizing: border-box;
	padding: 10px 0;
}

.wx-pp-wrap * {
	box-sizing: border-box;
}

/* ===== CARD ===== */
.wx-pp-card {
	width: 100%;
	max-width: 480px;
	background: #0d1117;
	border: 1px solid rgba(0, 201, 240, 0.15);
	border-radius: 18px;
	padding: 24px;
	box-shadow: 0 20px 60px rgba(0, 201, 240, 0.08);
	position: relative;
	overflow: hidden;
}

/* Decorative top accent gradient */
.wx-pp-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(0, 201, 240, 0.6), transparent);
	pointer-events: none;
}

/* ===== HEADER ===== */
.wx-pp-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
}

.wx-pp-header-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.wx-pp-header-label {
	font-family: 'Inter', sans-serif;
	font-size: 15px;
	font-weight: 700;
	color: #ffffff;
	line-height: 1.2;
}

.wx-pp-header-sublabel {
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 400;
	color: #9aacbd;
	line-height: 1.3;
}

/* Live indicator */
.wx-pp-live {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	background: rgba(0, 232, 255, 0.08);
	border: 1px solid rgba(0, 232, 255, 0.25);
	border-radius: 999px;
	flex-shrink: 0;
}

.wx-pp-live-dot {
	width: 7px;
	height: 7px;
	background: #00e8ff;
	border-radius: 50%;
	flex-shrink: 0;
}

.wx-pp-live-text {
	font-family: 'Inter', sans-serif;
	font-size: 10px;
	font-weight: 700;
	color: #00e8ff;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	line-height: 1;
}

/* ===== TILES GRID ===== */
.wx-pp-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin-bottom: 18px;
}

/* ===== TILE ===== */
.wx-pp-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 14px;
	background: rgba(0, 201, 240, 0.04);
	border: 1px solid rgba(0, 201, 240, 0.1);
	border-radius: 12px;
	text-align: center;
	transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.wx-pp-tile:hover {
	background: rgba(0, 201, 240, 0.08);
	border-color: rgba(0, 201, 240, 0.3);
	transform: translateY(-2px);
}

.wx-pp-tile-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #00c9f0;
	margin-bottom: 2px;
}

.wx-pp-tile-icon svg {
	width: 18px;
	height: 18px;
	fill: #00c9f0;
	color: #00c9f0;
	display: block;
}

.wx-pp-tile-icon i {
	font-size: 18px;
	color: #00c9f0;
	line-height: 1;
}

.wx-pp-tile-count {
	font-family: 'Inter', sans-serif;
	font-size: 22px;
	font-weight: 800;
	color: #ffffff;
	line-height: 1;
	letter-spacing: -0.5px;
	font-variant-numeric: tabular-nums;
}

.wx-pp-tile-label {
	font-family: 'Inter', sans-serif;
	font-size: 10px;
	font-weight: 600;
	color: #9aacbd;
	line-height: 1.25;
	letter-spacing: 0.3px;
}

/* Active dot (top-right of tile, animated independently) */
.wx-pp-tile-active-dot {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 6px;
	height: 6px;
	background: #00e8ff;
	border-radius: 50%;
	opacity: 0;
	box-shadow: 0 0 0 0 rgba(0, 232, 255, 0);
}

/* ===== FOOTER ===== */
.wx-pp-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.wx-pp-total {
	display: flex;
	align-items: baseline;
	gap: 6px;
	flex-wrap: wrap;
}

.wx-pp-total-num {
	font-family: 'Inter', sans-serif;
	font-size: 28px;
	font-weight: 800;
	color: #00c9f0;
	line-height: 1;
	letter-spacing: -0.8px;
	font-variant-numeric: tabular-nums;
}

.wx-pp-total-label {
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 500;
	color: #9aacbd;
	line-height: 1.2;
}

.wx-pp-rating {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
}

.wx-pp-stars {
	display: inline-flex;
	gap: 1px;
}

.wx-pp-star {
	width: 11px;
	height: 11px;
	fill: #ffc847;
	color: #ffc847;
	display: block;
}

.wx-pp-rating-text {
	display: inline-flex;
	align-items: baseline;
	gap: 4px;
	line-height: 1;
}

.wx-pp-rating-value {
	font-family: 'Inter', sans-serif;
	font-size: 12px;
	font-weight: 700;
	color: #ffffff;
}

.wx-pp-rating-label {
	font-family: 'Inter', sans-serif;
	font-size: 10px;
	font-weight: 500;
	color: #9aacbd;
}

/* ============================================ */
/* ===== ANIMATIONS ========================== */
/* ============================================ */

/* 1. Tiles stagger in on load */
@keyframes wx-pp-tile-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.wx-pp-anim-stagger .wx-pp-tile {
	opacity: 0;
	animation: wx-pp-tile-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
	animation-delay: calc(var(--wx-i, 0) * 0.08s + 0.1s);
}

/* 2. Random tile pulse — each tile pulses at different times for "active" feel */
@keyframes wx-pp-active-pulse {
	0%, 88%, 100% {
		opacity: 0;
		transform: scale(1);
		box-shadow: 0 0 0 0 rgba(0, 232, 255, 0);
	}
	20%, 70% {
		opacity: 1;
		transform: scale(1);
		box-shadow: 0 0 0 4px rgba(0, 232, 255, 0);
	}
	45% {
		opacity: 1;
		transform: scale(1.3);
		box-shadow: 0 0 0 6px rgba(0, 232, 255, 0.25);
	}
}

.wx-pp-anim-tile-pulse .wx-pp-tile:nth-child(1) .wx-pp-tile-active-dot {
	animation: wx-pp-active-pulse 8s ease infinite;
	animation-delay: 0.5s;
}
.wx-pp-anim-tile-pulse .wx-pp-tile:nth-child(2) .wx-pp-tile-active-dot {
	animation: wx-pp-active-pulse 11s ease infinite;
	animation-delay: 3.5s;
}
.wx-pp-anim-tile-pulse .wx-pp-tile:nth-child(3) .wx-pp-tile-active-dot {
	animation: wx-pp-active-pulse 9s ease infinite;
	animation-delay: 7s;
}
.wx-pp-anim-tile-pulse .wx-pp-tile:nth-child(4) .wx-pp-tile-active-dot {
	animation: wx-pp-active-pulse 13s ease infinite;
	animation-delay: 1.8s;
}
.wx-pp-anim-tile-pulse .wx-pp-tile:nth-child(5) .wx-pp-tile-active-dot {
	animation: wx-pp-active-pulse 10s ease infinite;
	animation-delay: 5.2s;
}
.wx-pp-anim-tile-pulse .wx-pp-tile:nth-child(6) .wx-pp-tile-active-dot {
	animation: wx-pp-active-pulse 12s ease infinite;
	animation-delay: 9.5s;
}
.wx-pp-anim-tile-pulse .wx-pp-tile:nth-child(n+7) .wx-pp-tile-active-dot {
	animation: wx-pp-active-pulse 11s ease infinite;
	animation-delay: 6s;
}

/* 3. Live dot pulse (header) */
@keyframes wx-pp-live-pulse {
	0%, 100% {
		box-shadow: 0 0 0 0 rgba(0, 232, 255, 0.5);
	}
	50% {
		box-shadow: 0 0 0 8px rgba(0, 232, 255, 0);
	}
}

.wx-pp-anim-live-pulse .wx-pp-live-dot {
	animation: wx-pp-live-pulse 2s ease-out infinite;
}

/* 4. Card float — subtle vertical movement */
@keyframes wx-pp-float {
	0%, 100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-6px);
	}
}

.wx-pp-anim-float {
	animation: wx-pp-float 5s ease-in-out infinite;
}

/* 5. Count-up bump (triggered by JS adding class momentarily) */
@keyframes wx-pp-count-bump {
	0%   { transform: scale(1);    color: inherit; }
	30%  { transform: scale(1.08); color: #00e8ff; }
	100% { transform: scale(1);    color: inherit; }
}

.wx-pp-total-num.wx-pp-bump {
	animation: wx-pp-count-bump 0.6s ease-out;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.wx-pp-anim-stagger .wx-pp-tile,
	.wx-pp-anim-tile-pulse .wx-pp-tile-active-dot,
	.wx-pp-anim-live-pulse .wx-pp-live-dot,
	.wx-pp-anim-float,
	.wx-pp-total-num.wx-pp-bump {
		animation: none !important;
		opacity: 1 !important;
		transform: none !important;
	}
}

/* ===== RESPONSIVE ===== */
@media (max-width: 540px) {
	.wx-pp-card {
		padding: 18px;
	}
	.wx-pp-tile {
		padding: 10px;
	}
	.wx-pp-tile-count {
		font-size: 18px;
	}
	.wx-pp-tile-label {
		font-size: 9px;
	}
	.wx-pp-total-num {
		font-size: 24px;
	}
	.wx-pp-header-label {
		font-size: 13px;
	}
	.wx-pp-header-sublabel {
		font-size: 10px;
	}
}
