#!/usr/bin/env bash
# Generate neutral placeholder PNG icons for the PWA manifest (Fase 6.2).
#
# These are placeholders — replace with real art before public launch. The
# glyph is a single uppercase "C" (Colectivo) centred on the Monolith slate
# background (#0f172a).
#
# Dep: ImageMagick (`convert`).

set -euo pipefail

ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
OUT="$ROOT/apps/web/static/icons"
mkdir -p "$OUT"

BG="#0f172a"
FG="#f7f9fb"

render() {
	local size="$1"; local out="$2"; local safe="${3:-$size}"
	local font_size=$(( safe * 55 / 100 ))
	convert -size "${size}x${size}" "xc:${BG}" \
		-gravity center \
		-pointsize "${font_size}" -fill "${FG}" -font "DejaVu-Sans-Bold" \
		-annotate "+0+0" "C" \
		-quality 90 "$out"
	echo "  wrote $out"
}

render 192 "$OUT/icon-192.png"
render 512 "$OUT/icon-512.png"
render 512 "$OUT/icon-512-maskable.png" 410
render 180 "$OUT/icon-180.png"

echo
echo "Done. Placeholder icons written to $OUT."
echo "Replace before public launch — see apps/web/static/icons/README.md."
