STYLE_SRC=./public/style/global.css
STYLE_DIST=./public/style/dist.css

all: install

install: ## Download TailwindCSS binary and install other dependencies
	@npm ci
	@echo "Installing qlot dependencies..."
	@qlot install

watch: ## Start TailwindCSS in watch mode for automatic rebuilds
	@npx @tailwindcss/cli -i $(STYLE_SRC) -o $(STYLE_DIST) --watch=always

build: ## Generate the final CSS output
	@npx @tailwindcss/cli -i $(STYLE_SRC) -o $(STYLE_DIST)

help: ## Display available commands and their descriptions
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
		awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

lem: ## Open Lem with TailwindCSS server
	@echo "Starting TailwindCSS server in background..."
	@make watch > /dev/null 2>&1 & \
	WATCH_PID=$$!; \
	trap "kill $$WATCH_PID" SIGINT SIGTERM EXIT; \
	lem; \
	kill $$WATCH_PID

docker-build:
	docker build -t hp .

docker-run:
	docker run -p 3000:3000 hp