pragma Singleton

import Quickshell
import QtQuick

Singleton {
    // ─── Apex palettes ───────────────────────
    readonly property var palettes: ({
        neon: {
            // Backgrounds — v2 cool-tinted ground (Void→Stealth)
            base: "#070709", mantle: "#101218", crust: "#070709",
            surface0: "#181b22", surface1: "#262a34", surface2: "#383d49",
            overlay0: "#8b909c", overlay1: "#5a606c",
            // Text — Stark, not pure white
            text: "#e6e8ec", subtext0: "#aab0bc", subtext1: "#cdd4e3",
            // Accent colors — apex-neon v2 spine
            lavender: "#9d00ff",  // special / root violet
            mauve:    "#9d00ff",  // special / root violet
            focus:       "#d68fff",  // attention — "you are here" crosshair (Focus Max)
            focusActive: "#b14dff",  // attention — current selection / matched pair
            focusField:  "#3a1a4d",  // attention — selection / region background
            emberField:  "#1f0a12",  // danger — critical-severity ground (red figure on this)
            pink:     "#ff0044",  // danger red
            red:      "#ff0044",  // danger red
            yellow:   "#ffb700",  // warning amber
            green:    "#00ff99",  // success green
            teal:     "#00ff99",  // success green
            blue:     "#5b8cff",  // real blue — accent / active-neutral
            sky:      "#00eaff"   // info cyan
        },
        aeon: {
            // Backgrounds — v2 light ground
            base: "#f1f3f7", mantle: "#e7eaf0", crust: "#ffffff",
            surface0: "#e7eaf0", surface1: "#dde1ea", surface2: "#c8cdd8",
            overlay0: "#6a7080", overlay1: "#8a909c",
            // Text
            text: "#16181d", subtext0: "#3a3f4a", subtext1: "#2a2e38",
            // Accent colors — apex-aeon v2 spine
            lavender: "#6a1fb8",  // special / root violet
            mauve:    "#6a1fb8",  // special / root violet
            focus:       "#7c2fd6",  // attention — "you are here" crosshair (Focus Max)
            focusActive: "#6a1fb8",  // attention — current selection / matched pair
            focusField:  "#e3d6f5",  // attention — selection / region background
            emberField:  "#f7dbe2",  // danger — critical-severity ground
            pink:     "#c8003a",  // danger red
            red:      "#c8003a",  // danger red
            yellow:   "#a86b00",  // warning amber
            green:    "#00875a",  // success green
            teal:     "#00875a",  // success green
            blue:     "#2148c0",  // real blue — accent / active-neutral
            sky:      "#0080a6"   // info cyan
        }
    })

    readonly property var p: palettes[Config.apexFlavor] || palettes.neon

    // ─── Palette colors ──────────────────────
    readonly property color base: p.base
    readonly property color mantle: p.mantle
    readonly property color crust: p.crust
    readonly property color surface0: p.surface0
    readonly property color surface1: p.surface1
    readonly property color surface2: p.surface2
    readonly property color overlay0: p.overlay0
    readonly property color text: p.text
    readonly property color subtext0: p.subtext0
    readonly property color subtext1: p.subtext1
    readonly property color lavender: p.lavender
    readonly property color mauve: p.mauve
    readonly property color focus: p.focus
    readonly property color focusActive: p.focusActive
    readonly property color focusField: p.focusField
    readonly property color emberField: p.emberField
    readonly property color pink: p.pink
    readonly property color red: p.red
    readonly property color yellow: p.yellow
    readonly property color green: p.green
    readonly property color teal: p.teal
    readonly property color blue: p.blue
    readonly property color sky: p.sky

    // ─── Semantic aliases ────────────────────
    readonly property color accent: blue      // real blue — active-neutral
    readonly property color success: green    // success green
    readonly property color warning: yellow   // warning amber
    readonly property color danger: red       // danger red
    readonly property color info: sky         // info cyan
    readonly property color muted: overlay0   // muted grey

    // ─── Opacity tokens ──────────────────────
    readonly property real opacitySubtle: 0.08      // borders, faint dividers
    readonly property real opacityLight: 0.15       // tinted backgrounds
    readonly property real opacityMedium: 0.3       // active borders, overlays
    readonly property real opacityStrong: 0.45      // muted/disabled elements
    readonly property real opacityFill: 0.7         // progress bar fills

    // ─── Border token ────────────────────────
    readonly property bool isDark: Config.apexFlavor === "neon"
    readonly property color borderSubtle: isDark ? Qt.rgba(1, 1, 1, opacitySubtle) : Qt.rgba(0, 0, 0, opacitySubtle)

    // ─── Transparency ────────────────────────
    readonly property bool transparencyEnabled: Config.transparency
    readonly property color barBackground: transparencyEnabled ? Qt.alpha(mantle, 0.75) : mantle
    readonly property color popoutBackground: transparencyEnabled ? Qt.alpha(mantle, 0.82) : mantle

    // ─── Layout ──────────────────────────────
    readonly property int barWidth: 52
    readonly property int barInnerWidth: 40
    readonly property int barPadding: 6
    readonly property int spacing: 10

    // Popouts
    readonly property int popoutWidth: 320
    readonly property int popoutPadding: 16
    readonly property int popoutSpacing: 10

    // Rounding
    readonly property int radiusSmall: 8
    readonly property int radiusNormal: 14
    readonly property int radiusPill: 1000

    // ─── Typography ──────────────────────────
    readonly property int fontSmall: 11
    readonly property int fontSize: 13
    readonly property int fontLarge: 15
    readonly property string fontFamily: "GeistMono Nerd Font"
    readonly property string iconFont: "GeistMono Nerd Font"

    // ─── Animation ───────────────────────────
    readonly property int animFast: 150
    readonly property int animNormal: 300
    readonly property int animSlow: 500
}
