/**
 * WebXtrm Company Story Widget Styles
 * Multi-section animated card with 6 toggleable animations.
 */

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

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

/* ===== CARD ===== */
.wx-cs-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;
	color: #00c9f0; /* used by currentColor in chart/avatars */
}

/* Decorative top gradient line */
.wx-cs-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-cs-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
}

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

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

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

.wx-cs-status {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 9px;
	background: rgba(34, 197, 94, 0.08);
	border: 1px solid rgba(34, 197, 94, 0.3);
	border-radius: 999px;
	flex-shrink: 0;
}

.wx-cs-status-dot {
	width: 6px;
	height: 6px;
	background: #22c55e;
	border-radius: 50%;
	flex-shrink: 0;
}

.wx-cs-status-text {
	font-family: 'Inter', sans-serif;
	font-size: 10px;
	font-weight: 700;
	color: #22c55e;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	line-height: 1;
}

/* ===== STATS ===== */
.wx-cs-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin-bottom: 18px;
	padding-bottom: 18px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wx-cs-stat {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	min-width: 0;
}

.wx-cs-stat-value {
	font-family: 'Inter', sans-serif;
	font-size: 28px;
	font-weight: 800;
	color: #00c9f0;
	line-height: 1.05;
	letter-spacing: -0.5px;
	font-variant-numeric: tabular-nums;
}

.wx-cs-stat-label {
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 500;
	color: #9aacbd;
	line-height: 1.3;
	text-transform: lowercase;
}

/* ===== CHART ===== */
.wx-cs-chart-wrap {
	margin-bottom: 18px;
	padding-bottom: 18px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wx-cs-chart-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 10px;
}

.wx-cs-chart-label {
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 500;
	color: #9aacbd;
	letter-spacing: 0.3px;
}

.wx-cs-trend {
	display: inline-flex;
	align-items: center;
	padding: 3px 8px;
	background: rgba(0, 201, 240, 0.1);
	border: 1px solid #00c9f0;
	border-radius: 999px;
	font-family: 'Inter', sans-serif;
	font-size: 10px;
	font-weight: 700;
	color: #00c9f0;
	letter-spacing: 0.3px;
	line-height: 1;
}

/* Chart container — holds SVG + HTML peak overlay */
.wx-cs-chart-box {
	position: relative;
	width: 100%;
}

.wx-cs-chart {
	display: block;
	width: 100%;
	height: 90px;
	color: #00c9f0;
	overflow: visible;
}

.wx-cs-chart-baseline {
	color: #00c9f0;
}

.wx-cs-chart-fill {
	color: #00c9f0;
}

.wx-cs-chart-path {
	stroke: #00c9f0;
}

/* ===== PEAK INDICATOR (HTML overlay) ===== */
.wx-cs-peak {
	position: absolute;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	pointer-events: none;
	z-index: 2;
}

.wx-cs-peak-label {
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 800;
	color: #00e8ff;
	background: rgba(0, 232, 255, 0.12);
	border: 1px solid rgba(0, 232, 255, 0.4);
	padding: 2px 7px;
	border-radius: 999px;
	line-height: 1;
	white-space: nowrap;
	letter-spacing: -0.2px;
}

.wx-cs-peak-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #00e8ff;
	border: 2px solid #0d1117;
	box-shadow: 0 0 0 2px rgba(0, 232, 255, 0.3), 0 0 12px rgba(0, 232, 255, 0.5);
	position: relative;
}

/* ===== TEAM ===== */
.wx-cs-team {
	margin-bottom: 14px;
	padding-bottom: 16px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wx-cs-team-label {
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 500;
	color: #9aacbd;
	letter-spacing: 0.3px;
	margin-bottom: 10px;
}

.wx-cs-avatars {
	display: flex;
	align-items: center;
	gap: 0;
	margin-bottom: 8px;
	flex-wrap: wrap;
}

.wx-cs-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	color: #ffffff;
	font-family: 'Inter', sans-serif;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.3px;
	line-height: 1;
	flex-shrink: 0;
	text-transform: uppercase;
	border: 2px solid #0d1117;
	margin-left: -8px;
	position: relative;
}

.wx-cs-avatar:first-child {
	margin-left: 0;
}

.wx-cs-extra {
	margin-left: 10px;
	font-family: 'Inter', sans-serif;
	font-size: 12px;
	font-weight: 600;
	color: #9aacbd;
	line-height: 1;
}

.wx-cs-team-subtitle {
	font-family: 'Inter', sans-serif;
	font-size: 12px;
	font-weight: 500;
	color: #ffffff;
	line-height: 1.3;
}

/* ===== ACTIVITY ===== */
.wx-cs-activity {
	display: flex;
	align-items: center;
	gap: 8px;
}

.wx-cs-activity-dot {
	width: 8px;
	height: 8px;
	background: #22c55e;
	border-radius: 50%;
	flex-shrink: 0;
	position: relative;
}

.wx-cs-activity-text {
	font-family: 'Inter', sans-serif;
	font-size: 12px;
	font-weight: 500;
	color: #9aacbd;
	line-height: 1.4;
}

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

/* 1. Stats count-up — JS adds wx-cs-counted class when done */
/* No keyframe needed; JS handles the numeric tween */

/* Subtle "pop" on stat when count reaches target */
@keyframes wx-cs-stat-bump {
	0%   { transform: scale(1); }
	50%  { transform: scale(1.08); }
	100% { transform: scale(1); }
}

.wx-cs-anim-count-up .wx-cs-stat-value.wx-cs-counted {
	animation: wx-cs-stat-bump 0.45s ease-out;
}

/* 2. Chart draw-in — progressive enhancement.
   By default chart is fully visible. When JS initializes, it adds
   .wx-cs-js-ready to put the chart into the "ready to animate" state
   (line hidden, fill/peak invisible). When card enters viewport, JS
   adds .wx-cs-chart-visible to trigger the animation.
   Without JS, chart shows immediately — no broken-looking empty box. */

.wx-cs-anim-chart-draw.wx-cs-js-ready .wx-cs-chart-path {
	stroke-dasharray: 1200;
	stroke-dashoffset: 1200;
	transition: stroke-dashoffset 1.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.wx-cs-anim-chart-draw.wx-cs-js-ready .wx-cs-chart-fill {
	opacity: 0;
	transition: opacity 0.9s ease 0.8s;
}

.wx-cs-anim-chart-draw.wx-cs-js-ready .wx-cs-chart-baseline {
	opacity: 0;
	transition: opacity 0.4s ease 0.2s;
}

.wx-cs-anim-chart-draw.wx-cs-js-ready .wx-cs-peak {
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.5);
	transition: opacity 0.4s ease 1.5s, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 1.5s;
}

.wx-cs-anim-chart-draw.wx-cs-js-ready.wx-cs-chart-visible .wx-cs-chart-path {
	stroke-dashoffset: 0;
}

.wx-cs-anim-chart-draw.wx-cs-js-ready.wx-cs-chart-visible .wx-cs-chart-fill,
.wx-cs-anim-chart-draw.wx-cs-js-ready.wx-cs-chart-visible .wx-cs-chart-baseline {
	opacity: 1;
}

.wx-cs-anim-chart-draw.wx-cs-js-ready.wx-cs-chart-visible .wx-cs-peak {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* Peak dot continuous pulse — runs even without animation toggle, gentle */
@keyframes wx-cs-peak-pulse {
	0%, 100% {
		box-shadow: 0 0 0 2px rgba(0, 232, 255, 0.3), 0 0 12px rgba(0, 232, 255, 0.5);
	}
	50% {
		box-shadow: 0 0 0 5px rgba(0, 232, 255, 0.1), 0 0 18px rgba(0, 232, 255, 0.7);
	}
}

.wx-cs-peak-dot {
	animation: wx-cs-peak-pulse 2.2s ease-in-out infinite;
}

/* 3. Avatar stagger entry */
@keyframes wx-cs-avatar-in {
	from {
		opacity: 0;
		transform: scale(0.5) translateY(6px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.wx-cs-anim-avatar-stagger .wx-cs-avatar {
	opacity: 0;
	animation: wx-cs-avatar-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
	animation-delay: calc(var(--wx-i, 0) * 0.1s + 0.4s);
}

/* 4. Status dot pulse */
@keyframes wx-cs-status-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
	50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

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

/* 5. Activity dot pulse (larger ring) */
@keyframes wx-cs-activity-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
	50%      { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

.wx-cs-anim-activity-pulse .wx-cs-activity-dot {
	animation: wx-cs-activity-pulse 2.5s ease-out infinite;
}

/* 6. Card float */
@keyframes wx-cs-float {
	0%, 100% { transform: translateY(0); }
	50%      { transform: translateY(-6px); }
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.wx-cs-anim-count-up .wx-cs-stat-value,
	.wx-cs-anim-chart-draw .wx-cs-chart-path,
	.wx-cs-anim-chart-draw .wx-cs-chart-fill,
	.wx-cs-anim-chart-draw .wx-cs-chart-baseline,
	.wx-cs-anim-chart-draw .wx-cs-peak,
	.wx-cs-anim-avatar-stagger .wx-cs-avatar,
	.wx-cs-anim-status-pulse .wx-cs-status-dot,
	.wx-cs-anim-activity-pulse .wx-cs-activity-dot,
	.wx-cs-anim-float,
	.wx-cs-peak-dot {
		animation: none !important;
		transition: none !important;
		opacity: 1 !important;
		transform: none !important;
		stroke-dashoffset: 0 !important;
	}
	.wx-cs-anim-chart-draw .wx-cs-peak {
		transform: translate(-50%, -50%) !important;
	}
}

/* ===== RESPONSIVE SAFETY FALLBACKS ===== */
@media (max-width: 540px) {
	.wx-cs-card {
		padding: 20px;
		border-radius: 14px;
	}
	.wx-cs-header {
		margin-bottom: 14px;
	}
	.wx-cs-header-label {
		font-size: 13px;
	}
	.wx-cs-stats {
		gap: 8px;
		margin-bottom: 14px;
		padding-bottom: 14px;
	}
	.wx-cs-stat-value {
		font-size: 22px;
	}
	.wx-cs-stat-label {
		font-size: 10px;
	}
	.wx-cs-chart-wrap {
		margin-bottom: 14px;
		padding-bottom: 14px;
	}
	.wx-cs-chart {
		height: 75px;
	}
	.wx-cs-peak-label {
		font-size: 10px;
		padding: 2px 6px;
	}
	.wx-cs-peak-dot {
		width: 9px;
		height: 9px;
	}
	.wx-cs-avatar {
		width: 30px;
		height: 30px;
		font-size: 11px;
	}
}

@media (max-width: 380px) {
	.wx-cs-card {
		padding: 16px 14px;
	}
	.wx-cs-stat-value {
		font-size: 19px;
	}
	.wx-cs-stat-label {
		font-size: 9.5px;
	}
	.wx-cs-chart {
		height: 65px;
	}
	.wx-cs-avatar {
		width: 28px;
		height: 28px;
		font-size: 10px;
		margin-left: -6px;
	}
	.wx-cs-team-subtitle,
	.wx-cs-activity-text {
		font-size: 11px;
	}
}
