COMPOSE = docker compose -f docker-compose.prod.yml --env-file .env.production

# --- Frontend (Tailwind v4 + PenguinUI) -----------------------------
# Uses the Tailwind v4 standalone binary (no Node required at runtime).
# The compiled assets/static/css/app.css is committed and served by loco.
TW          = bin/tailwindcss
CSS_IN      = assets/css/app.css
CSS_OUT     = assets/static/css/app.css
UNAME_M    := $(shell uname -m)
ifeq ($(UNAME_M),aarch64)
  TW_TARGET = tailwindcss-linux-arm64
else
  TW_TARGET = tailwindcss-linux-x64
endif

.PHONY: up down restart logs build ps css css-watch tailwind

$(TW):
	@mkdir -p bin
	curl -fsSL -o $(TW) \
	  "https://github.com/tailwindlabs/tailwindcss/releases/latest/download/$(TW_TARGET)"
	chmod +x $(TW)

tailwind: $(TW)

css: $(TW)
	$(TW) -i $(CSS_IN) -o $(CSS_OUT) --minify

css-watch: $(TW)
	$(TW) -i $(CSS_IN) -o $(CSS_OUT) --watch

up:
	$(COMPOSE) up -d --build

down:
	$(COMPOSE) down

restart: down up

logs:
	$(COMPOSE) logs -f --tail=100

build:
	$(COMPOSE) build --no-cache

ps:
	$(COMPOSE) ps
