fn main() -> Result<(), Box<dyn std::error::Error>> {
    use std::process::Command;
    println!("cargo:rerun-if-changed=./styles/input.css");

    // Tailwind build is optional - skip gracefully in CI or environments without bun
    match Command::new("bunx")
        .args([
            "@tailwindcss/cli",
            "-i",
            "./styles/input.css",
            "-o",
            "./assets/tailwind.css",
        ])
        .status()
    {
        Ok(status) if !status.success() => {
            println!("cargo:warning=tailwind build exited with {status}, skipping CSS generation");
        }
        Err(e) => {
            println!("cargo:warning=bunx not found ({e}), skipping tailwind CSS generation");
        }
        Ok(_) => {}
    }

    Ok(())
}
