/* ── How It Works Flow ── */

#amp-hiw-flow {
	padding: 1.25rem 0 2.5rem;
}

.amp-flow {
	display: flex;
	align-items: stretch;
	gap: 0;
	position: relative;
	max-width: 100%;
}

/* ── Step ── */
.amp-flow-step {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	opacity: 0.3;
	transition: opacity 0.5s ease;
	overflow: visible;
	z-index: 1;
}

.amp-flow-step.active {
	opacity: 1;
	z-index: 2;
}

.amp-flow-step-number {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.06);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.75rem;
	font-weight: 700;
	color: #6B7280;
	margin-bottom: 0.5rem;
	transition: all 0.4s ease;
}

.amp-flow-step.active .amp-flow-step-number {
	background: #000000;
	color: #EAE8DD;
}

.amp-flow-step-label {
	font-size: 0.78rem;
	font-weight: 600;
	color: #6B7280;
	margin-bottom: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	transition: color 0.4s ease;
}

.amp-flow-step.active .amp-flow-step-label {
	color: #000000;
}

/* ── Step panel (card) ── */
.amp-flow-panel {
	width: 100%;
	background: #FAFAF8;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 12px;
	padding: 1.25rem;
	min-height: 180px;
	font-family: Inter, system-ui, -apple-system, sans-serif;
	position: relative;
	overflow: visible;
}

/* ── Connectors between steps ── */
.amp-flow-connector {
	position: absolute;
	top: 14px; /* aligns with step number center */
	width: 100%;
	height: 2px;
	z-index: 1;
}

.amp-flow-connector-line {
	height: 100%;
	background: #000000;
	width: 0;
	transition: width 0.6s ease;
}

.amp-flow-connector.active .amp-flow-connector-line {
	width: 100%;
}

/* Connector wrapper positioning */
.amp-flow-connector-wrap {
	position: absolute;
	top: 14px;
	height: 2px;
	z-index: 2;
}

.amp-flow-connector-wrap:first-of-type {
	left: calc(100% / 6);
	width: calc(100% / 3);
}

.amp-flow-connector-wrap:last-of-type {
	left: calc(100% / 2);
	width: calc(100% / 3);
}

/* ── Panel 1: Connect ── */
.amp-flow-systems {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	margin-bottom: 0.75rem;
}

.amp-flow-sys {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	opacity: 0;
	transform: translateX(-8px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.amp-flow-sys.visible {
	opacity: 1;
	transform: translateX(0);
}

.amp-flow-sys-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.15);
	flex-shrink: 0;
	transition: background 0.3s ease;
}

.amp-flow-sys.connected .amp-flow-sys-dot {
	background: #000000;
}

.amp-flow-sys-name {
	font-size: 0.75rem;
	color: #6B7280;
	font-weight: 500;
}

.amp-flow-sys.connected .amp-flow-sys-name {
	color: #000000;
}

.amp-flow-sys-status {
	margin-left: auto;
	font-size: 0.65rem;
	font-weight: 600;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.amp-flow-sys.connected .amp-flow-sys-status {
	opacity: 1;
	color: #000000;
}

/* ── Panel 2: Deploy ── */
.amp-flow-role {
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.35s ease, transform 0.35s ease;
}

.amp-flow-role.visible {
	opacity: 1;
	transform: translateY(0);
}

.amp-flow-role-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.75rem;
}

.amp-flow-role-name {
	font-size: 0.82rem;
	font-weight: 700;
	color: #000000;
}

.amp-flow-role-badge {
	font-size: 0.65rem;
	font-weight: 600;
	padding: 0.2rem 0.5rem;
	border-radius: 100px;
	background: rgba(0, 0, 0, 0.06);
	color: #6B7280;
	transition: all 0.3s ease;
}

.amp-flow-role-badge.active {
	background: #000000;
	color: #4ade80;
}

.amp-flow-task {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.3rem 0;
	font-size: 0.75rem;
	color: #6B7280;
	opacity: 0;
	transform: translateX(-6px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.amp-flow-task.visible {
	opacity: 1;
	transform: translateX(0);
}

.amp-flow-task-check {
	width: 14px;
	height: 14px;
	border-radius: 4px;
	border: 1.5px solid rgba(0, 0, 0, 0.15);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: all 0.3s ease;
}

.amp-flow-task.done .amp-flow-task-check {
	background: #000000;
	border-color: #000000;
}

.amp-flow-task.done .amp-flow-task-check svg {
	opacity: 1;
}

.amp-flow-task-check svg {
	width: 8px;
	height: 8px;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.amp-flow-task.done {
	color: #000000;
}

/* ── Panel 3: Monitor ── */
.amp-flow-log {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.amp-flow-log-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.35rem 0.5rem;
	border-radius: 6px;
	font-size: 0.72rem;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.amp-flow-log-item.visible {
	opacity: 1;
	transform: translateY(0);
	background: rgba(0, 0, 0, 0.02);
}

.amp-flow-log-time {
	font-family: "IBM Plex Mono", monospace;
	font-size: 0.65rem;
	color: #9CA3AF;
	flex-shrink: 0;
	min-width: 42px;
}

.amp-flow-log-text {
	color: #000000;
	font-weight: 500;
	flex: 1;
}

.amp-flow-log-check {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	color: #000000;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.amp-flow-log-item.done .amp-flow-log-check {
	opacity: 1;
}

/* ── Fade for loop ── */
.amp-flow.fading {
	animation: amp-flow-fade-out 0.8s ease forwards;
}

@keyframes amp-flow-fade-out {
	to {
		opacity: 0;
		transform: translateY(8px);
	}
}

.amp-flow.fading-in {
	animation: amp-flow-fade-in 0.6s ease forwards;
}

@keyframes amp-flow-fade-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ── Responsive ── */
@media (max-width: 768px) {
	#amp-hiw-flow {
		padding: 1rem 0 1.5rem;
	}

	.amp-flow {
		flex-direction: column;
		gap: 1.5rem;
	}

	.amp-flow-connector-wrap {
		display: none;
	}

	.amp-flow-step {
		opacity: 1;
	}

	.amp-flow-panel {
		min-height: auto;
		padding: 1rem;
	}

	.amp-flow-step-number {
		width: 32px;
		height: 32px;
		font-size: 0.85rem;
	}

	.amp-flow-step-label {
		font-size: 0.85rem;
	}

	.amp-flow-role-name {
		font-size: 0.9rem;
	}

	.amp-flow-task {
		font-size: 0.8rem;
	}

	.amp-flow-log-text {
		font-size: 0.78rem;
	}
}
