package dev.kaizen.app.ui.theme

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.colorspace.ColorSpaces

// ---------------------------------------------------------------------------
// Kaizen Color Tokens — DisplayP3 pipeline
// ---------------------------------------------------------------------------
// Every brand color is declared in the Display P3 color space so the full
// gamut is used on wide-color displays (every Galaxy since 2018, every Pixel
// since the 4). On sRGB-only panels the runtime clamps gracefully.
//
// The sRGB hex approximations are in trailing comments for design handoff.
// Never use Color(0xFF…) for brand colors outside this file.
// ---------------------------------------------------------------------------

private fun p3(r: Float, g: Float, b: Float, a: Float = 1f): Color =
    Color(red = r, green = g, blue = b, alpha = a, colorSpace = ColorSpaces.DisplayP3)

// ── Brand Amber (constant across all themes — they ARE the brand) ──────────
val Amber     = p3(0.878f, 0.635f, 0.243f)   // ≈ #E0A23E
val AmberDeep = p3(0.784f, 0.525f, 0.165f)   // ≈ #C8862A
val OnAmber   = p3(0.106f, 0.071f, 0.024f)   // ≈ #1B1206

// ── Dark scheme — Obsidian Steel-Blue ──────────────────────────────────────
val Obsidian         = p3(0.039f, 0.055f, 0.086f)   // background   ≈ #0A0E16
val ObsidianElevated = p3(0.078f, 0.106f, 0.153f)   // surface      ≈ #141B27
val ObsidianInput    = p3(0.067f, 0.094f, 0.141f)   // surfaceVar   ≈ #111824
val DarkText         = p3(0.910f, 0.922f, 0.945f)   // onBackground ≈ #E8EBF1
val DarkMuted        = p3(0.545f, 0.580f, 0.643f)   // onSurfaceVar ≈ #8B94A4
val DarkStroke       = p3(1f, 1f, 1f, 0.09f)        // outline

// ── Light scheme ───────────────────────────────────────────────────────────
val LightBackground     = p3(0.965f, 0.969f, 0.976f)  // ≈ #F6F7F9
val LightSurface        = p3(1.000f, 1.000f, 1.000f)  // ≈ #FFFFFF
val LightSurfaceVariant = p3(0.933f, 0.941f, 0.953f)  // ≈ #EEF0F3
val LightText           = p3(0.102f, 0.122f, 0.161f)  // ≈ #1A1F29
val LightMuted          = p3(0.357f, 0.392f, 0.439f)  // ≈ #5B6470
val LightStroke         = p3(0f, 0f, 0f, 0.08f)       // outline

// ── Background blobs (Amber theme defaults, derived from amber.css) ────────
// These are the light-mode defaults. Theme-specific blobs come from
// LocalKaizenAccent.current.blob1..4 once the theme system is wired.
val BlobAmber = p3(0.992f, 0.767f, 0.282f)   // oklch(0.85 0.15 83)  gold
val BlobCoral = p3(1.000f, 0.562f, 0.230f)   // oklch(0.78 0.18 50)  coral
val BlobHoney = p3(0.917f, 0.853f, 0.471f)   // oklch(0.88 0.12 100) honey
val BlobTeal  = p3(0.461f, 0.885f, 0.908f)   // oklch(0.85 0.10 200) teal accent

// ── Semantic Colors (theme-independent) ───────────────────────────────────
// Used across the app for status, actions, and provider branding.
// Single source of truth — never use raw hex outside this file.

object KaizenSemanticColors {
    val error          = Color(0xFFEF4444)   // destructive actions, stop, delete
    val errorDeep      = Color(0xFFDC2626)   // error banners, stronger emphasis
    val success        = Color(0xFF10B981)   // success confirmation, check marks
    val successBright  = Color(0xFF22C55E)   // copy-confirmed flash
    val indigo         = Color(0xFF6366F1)   // Vertex AI badge, gallery accent
    val linkLight      = Color(0xFF2563EB)   // markdown links (light mode)
    val linkDark       = Color(0xFF60A5FA)   // markdown links (dark mode)
    val dropdownDark   = Color(0xFF1A2030)   // dropdown/menu bg (dark)
    val dropdownLight  = Color(0xFFF8F9FB)   // dropdown/menu bg (light)
}
