/**
 * Project Steps Infographic — Frontend Styles
 *
 * All selectors are prefixed with .psi- to avoid conflicts.
 * CSS custom properties are used for theme-ability.
 *
 * @package Project_Steps_Infographic
 * @version 1.0.0
 */

/* ─── Google Font (Inter) ──────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Base Reset ────────────────────────────────────────────────────────────── */
.psi-project-steps *,
.psi-project-steps *::before,
.psi-project-steps *::after {
	box-sizing: border-box;
}

/* ─── Widget Wrapper ────────────────────────────────────────────────────────── */
.psi-project-steps {
	position: relative;
	overflow: visible;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	padding: 60px 40px;
}

/* ─── SVG Connector ─────────────────────────────────────────────────────────── */
.psi-connector-svg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
	pointer-events: none;
	z-index: 0;
}

.psi-connector-path {
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Draw animation */
.psi-connector-svg.psi-anim--draw .psi-connector-path {
	animation: psiConnectorDraw 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Fade animation */
.psi-connector-svg.psi-anim--fade .psi-connector-path {
	animation: psiConnectorFade 1.2s ease forwards;
}

/* Pulse animation */
.psi-connector-svg.psi-anim--pulse .psi-connector-path {
	animation: psiConnectorPulse 2s ease-in-out infinite;
}

@keyframes psiConnectorDraw {
	from { stroke-dashoffset: var(--psi-path-length, 5000); }
	to   { stroke-dashoffset: 0; }
}

@keyframes psiConnectorFade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes psiConnectorPulse {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.35; }
}

/* ─── Steps List ────────────────────────────────────────────────────────────── */
.psi-steps-list {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	list-style: none;
	margin: 0;
	padding: 0;
}

/* ─── Single Step ───────────────────────────────────────────────────────────── */
.psi-step {
	position: relative;
	margin-bottom: 0;
	padding: 40px 0 100px;
}

.psi-step:first-child {
	padding-top: 20px;
}

.psi-step:last-child {
	padding-bottom: 160px;
}

.psi-step__inner {
	display: flex;
	align-items: center;
	gap: 40px;
	width: 100%;
}

/* Alternating / fixed direction */
.psi-step--image-left  .psi-step__inner { flex-direction: row; }
.psi-step--image-right .psi-step__inner { flex-direction: row-reverse; }

/* ─── Circle Wrapper ────────────────────────────────────────────────────────── */
.psi-step__circle-wrapper {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	z-index: 2;
}

/* ─── Circle ────────────────────────────────────────────────────────────────── */
.psi-step__circle {
	width: 150px;
	height: 150px;
	border-radius: 50%;
	background-color: #24365e;
	overflow: hidden;
	isolation: isolate;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	position: relative;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.psi-step__circle:hover {
	transform: scale(1.04);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.psi-step__circle img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Number shown inside the circle when no image */
.psi-step__circle-number {
	font-size: 2rem;
	font-weight: 800;
	color: #ffffff;
	line-height: 1;
	letter-spacing: -0.02em;
	pointer-events: none;
}

/* ─── Content Area ──────────────────────────────────────────────────────────── */
.psi-step__content {
	flex: 1;
	min-width: 0;
}

.psi-step__content-inner {
	/* Transparent by default */
	padding: 0;
}

/* Card style */
.psi-container--card .psi-step__content-inner {
	background: #ffffff;
	border-radius: 12px;
	padding: 20px 24px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
	border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Glass style */
.psi-container--glass .psi-step__content-inner {
	background: rgba(255, 255, 255, 0.55);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: 12px;
	padding: 20px 24px;
	border: 1px solid rgba(255, 255, 255, 0.45);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* ─── Step Number ───────────────────────────────────────────────────────────── */
.psi-step__number {
	display: inline-block;
	color: #efac27;
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1;
}

/* Above title */
.psi-step__number--above {
	display: block;
	margin-bottom: 6px;
}

/* Beside title — rendered inside the heading */
.psi-step__number--beside {
	margin-right: 10px;
	vertical-align: middle;
}

/* Inline — merged before title text */
.psi-step__number--inline {
	font-size: inherit;
	font-weight: inherit;
}

/* ─── Step Title ────────────────────────────────────────────────────────────── */
.psi-step__title {
	margin: 0 0 4px;
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1.3;
	color: #24365e;
	letter-spacing: -0.01em;
}

/* Age / subtitle under title */
.psi-step__subtitle {
	margin: 0 0 12px;
	font-size: 0.9375rem;
	font-weight: 400;
	line-height: 1.4;
	color: #8a8a8a;
}

/* ─── Step Description ──────────────────────────────────────────────────────── */
.psi-step__description {
	font-size: 1rem;
	line-height: 1.75;
	color: #555555;
	margin: 0;
}

.psi-step__description p {
	margin: 0 0 0.875em;
}

.psi-step__description p:last-child {
	margin-bottom: 0;
}

/* ─── Step Tags / Pills ─────────────────────────────────────────────────────── */
.psi-step__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 16px;
}

.psi-step__tags--on-line {
	position: absolute;
	z-index: 3;
	margin: 0;
	gap: 0;
	pointer-events: none;
}

.psi-step__tags--on-line .psi-step__tag {
	pointer-events: auto;
	white-space: nowrap;
	box-shadow: 0 0 0 5px #ffffff;
}

.psi-step:has(.psi-step__tags--on-line) {
	padding-bottom: 100px;
}

.psi-step:last-child {
	padding-bottom: 160px;
}

.psi-step__tag {
	display: inline-flex;
	align-items: center;
	padding: 6px 14px;
	font-size: 0.8125rem;
	font-weight: 500;
	color: #24365e;
	background-color: #e6eaf5;
	border-radius: 20px;
	line-height: 1.2;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.psi-step__tag:hover {
	background-color: #d5dced;
}

/* ─── Style Presets ─────────────────────────────────────────────────────────── */

/* Legato (default) */
.psi-preset--legato .psi-step__circle { background-color: #24365e; }
.psi-preset--legato .psi-step__number { color: #efac27; }
.psi-preset--legato .psi-step__title { color: #24365e; }
.psi-preset--legato .psi-step__tag { color: #24365e; background-color: #e6eaf5; }

/* Classic Red */
.psi-preset--classic-red .psi-step__circle { background-color: #C92525; }
.psi-preset--classic-red .psi-step__number { color: #C92525; }

/* Modern Blue */
.psi-preset--modern-blue .psi-step__circle  { background-color: #2563EB; }
.psi-preset--modern-blue .psi-step__number  { color: #2563EB; }
.psi-preset--modern-blue .psi-step__title   { color: #1e3a5f; }

/* Minimal Black */
.psi-preset--minimal-black .psi-step__circle { background-color: #111111; }
.psi-preset--minimal-black .psi-step__number { color: #111111; }
.psi-preset--minimal-black .psi-step__title  { color: #111111; }

/* ─── CSS Fallback Connector (vertical left-edge line on mobile) ─────────────── */
.psi-steps-list--fallback::before {
	content: '';
	position: absolute;
	left: 45px;
	top: 0;
	bottom: 0;
	width: 3px;
	background: #efac27;
	border-radius: 2px;
	z-index: 0;
}

/* ─── Entry Animations ──────────────────────────────────────────────────────── */
.psi-step--will-animate {
	opacity: 0;
	transition:
		opacity    var(--psi-anim-duration, 600ms) ease var(--psi-anim-delay, 0ms),
		transform  var(--psi-anim-duration, 600ms) ease var(--psi-anim-delay, 0ms);
}

.psi-step--will-animate.psi-anim--fade-in   { transform: none; }
.psi-step--will-animate.psi-anim--fade-up   { transform: translateY(40px); }
.psi-step--will-animate.psi-anim--fade-down { transform: translateY(-40px); }
.psi-step--will-animate.psi-anim--slide-left  { transform: translateX(60px); }
.psi-step--will-animate.psi-anim--slide-right { transform: translateX(-60px); }
.psi-step--will-animate.psi-anim--scale { transform: scale(0.88); }

.psi-step--animated {
	opacity: 1;
	transform: none !important;
}

/* ─── Number Position Overrides ─────────────────────────────────────────────── */
.psi-numpos--beside .psi-step__title {
	display: flex;
	align-items: baseline;
	gap: 6px;
	flex-wrap: wrap;
}

/* ─── Responsive — Tablet ───────────────────────────────────────────────────── */
@media ( max-width: 1024px ) {
	.psi-project-steps {
		padding: 40px 24px;
	}

	.psi-step__circle {
		width: 120px;
		height: 120px;
	}

	.psi-step {
		margin-bottom: 40px;
	}

	.psi-step__inner {
		gap: 20px;
	}

	.psi-step__title {
		font-size: 1.15rem;
	}

	.psi-step__description {
		font-size: 0.9625rem;
	}
}

/* ─── Responsive — Mobile ───────────────────────────────────────────────────── */
@media ( max-width: 767px ) {
	.psi-project-steps {
		padding: 32px 16px;
	}

	/* Switch to vertical stacked layout */
	.psi-step__inner,
	.psi-step--image-left  .psi-step__inner,
	.psi-step--image-right .psi-step__inner {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}

	.psi-step__circle {
		width: 90px;
		height: 90px;
		align-self: center;
	}

	.psi-step__circle-number {
		font-size: 1.4rem;
	}

	.psi-step__tags--on-line {
		position: static;
		height: auto !important;
		top: auto !important;
		width: auto !important;
		margin-top: 16px;
		gap: 10px;
		pointer-events: auto;
	}

	.psi-step__tags--on-line .psi-step__tag {
		position: static !important;
		box-shadow: none;
	}

	.psi-step:has(.psi-step__tags--on-line) {
		padding-bottom: 20px;
	}

	.psi-step__content {
		width: 100%;
	}

	.psi-step__title {
		font-size: 1.1rem;
		margin-bottom: 8px;
	}

	.psi-step__description {
		font-size: 0.9375rem;
	}

	.psi-step {
		margin-bottom: 30px;
		padding-left: 0;
	}

	/* SVG connector hidden on mobile — use CSS fallback */
	.psi-connector-svg {
		display: none;
	}

	/* Activate CSS fallback connector */
	.psi-steps-list {
		padding-left: 20px;
		border-left: 3px solid #efac27;
	}

	/* Remove fallback border for non-connector variant */
	.psi-project-steps:not([data-psi*='"show":"1"']) .psi-steps-list {
		padding-left: 0;
		border-left: none;
	}

	/* Step dot on left edge */
	.psi-step::before {
		content: '';
		position: absolute;
		left: -27px;
		top: 50%;
		transform: translateY(-50%);
		width: 10px;
		height: 10px;
		border-radius: 50%;
		background: #efac27;
		z-index: 2;
	}

	/* Glass/card styles collapse their padding slightly */
	.psi-container--card .psi-step__content-inner,
	.psi-container--glass .psi-step__content-inner {
		padding: 14px 16px;
	}
}

/* ─── Reduced Motion ────────────────────────────────────────────────────────── */
@media ( prefers-reduced-motion: reduce ) {
	.psi-step--will-animate {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}

	.psi-connector-path {
		animation: none !important;
		stroke-dashoffset: 0 !important;
	}

	.psi-step__circle {
		transition: none !important;
	}
}

/* ─── Elementor Editor adjustments ─────────────────────────────────────────── */
.elementor-editor-active .psi-step--will-animate {
	opacity: 1 !important;
	transform: none !important;
}

.elementor-editor-active .psi-connector-path {
	stroke-dashoffset: 0 !important;
	animation: none !important;
}
