package wang.yaojia.webterm.designsystem

/**
 * # WebTerm design system — the FROZEN numeric spec (pure Kotlin, JVM-testable).
 *
 * Mirrors the iOS `DS` token vocabulary
 * (`ios/App/WebTerm/DesignSystem/Tokens.swift`). Every visual constant lives here
 * as a raw ARGB [Long] / [Float] / [Int] with **no Compose import**, so it can be
 * unit-tested on the plain JVM with no device (see `DesignSpecTest`). `Tokens.kt`
 * builds Compose `Color`/`Dp` values from these; screens must reference the tokens,
 * never inline a hex/gap.
 *
 * Direction: "精致原生" (refined native), dark-appearance-first, amber-gold accent
 * matched to the desktop/web theme (`public/style.css` `--accent`). Color is NEVER
 * the only status signal — pair it with the shape/label in `StatusStyle`.
 */
public object DesignSpec {

    // ── Accent (amber gold — matches desktop --accent / --accent-2) ─────────────
    // Adaptive: dark = #E3A64A (gold), light = #C9892F (deeper gold) for contrast
    // on a light background. Gold needs DARK ink on top → use [ON_ACCENT].
    public const val ACCENT_DARK: Long = 0xFFE3A64AL // #E3A64A (web --accent)
    public const val ACCENT_LIGHT: Long = 0xFFC9892FL // #C9892F (web --accent-2)
    public const val ON_ACCENT: Long = 0xFF1A1305L // #1A1305 (web --on-accent)

    // ── Semantic status colors (match the desktop/web status palette) ───────────
    // These are the ONLY status colors. `StatusStyle` pairs each with a distinct
    // shape so status is never conveyed by color alone (color-blind safe).
    public const val STATUS_WORKING: Long = 0xFF46D07FL // #46D07F (web --green)
    public const val STATUS_WAITING: Long = 0xFFF5B14CL // #F5B14C (web --amber)
    public const val STATUS_STUCK: Long = 0xFFFF6B6BL // #FF6B6B (web --red)
    public const val STATUS_IDLE: Long = 0xFF8B8578L // warm secondary gray
    public const val STATUS_UNKNOWN: Long = 0xFF6E6A61L // neutral gray (no signal yet)

    // ── Timeline event classes (A28) ────────────────────────────────────────────
    public const val TIMELINE_TOOL: Long = 0xFF5E9EFFL // indigo — a tool run
    public const val TIMELINE_USER: Long = 0xFFAF7BFFL // violet — a user message

    // ── Surfaces & text — DARK scheme (the default appearance) ──────────────────
    public const val DARK_BACKGROUND: Long = 0xFF14130FL // warm near-black chrome
    public const val DARK_SURFACE: Long = 0xFF1C1A15L
    public const val DARK_CARD: Long = 0xFF24211AL // grouped-content step-up
    public const val DARK_HAIRLINE: Long = 0xFF35322AL // separator/border
    public const val DARK_TEXT_PRIMARY: Long = 0xFFECE9E3L // warm off-white (web --text)
    public const val DARK_TEXT_SECONDARY: Long = 0xFFA8A296L
    public const val DARK_TEXT_TERTIARY: Long = 0xFF6E6A61L

    // ── Surfaces & text — LIGHT scheme ──────────────────────────────────────────
    public const val LIGHT_BACKGROUND: Long = 0xFFFAF8F3L // warm off-white
    public const val LIGHT_SURFACE: Long = 0xFFFFFFFFL
    public const val LIGHT_CARD: Long = 0xFFF0EDE6L
    public const val LIGHT_HAIRLINE: Long = 0xFFD8D3C8L
    public const val LIGHT_TEXT_PRIMARY: Long = 0xFF1A1712L
    public const val LIGHT_TEXT_SECONDARY: Long = 0xFF6B6559L
    public const val LIGHT_TEXT_TERTIARY: Long = 0xFF9A9488L

    // ── Terminal canvas (FIXED — independent of app theme) ──────────────────────
    // A terminal reads as dark regardless of app appearance (like the desktop).
    // Values mirror the web chrome: --bg #100F0D / --text #ECE9E3, gold caret.
    public const val TERMINAL_BACKGROUND: Long = 0xFF100F0DL // web --bg
    public const val TERMINAL_FOREGROUND: Long = 0xFFECE9E3L // web --text
    public const val TERMINAL_CARET: Long = 0xFFE3A64AL // gold caret

    // ── Spacing scale — 2·4·8·12·16·20·24 (dp). No off-scale gaps. ──────────────
    public const val SPACE_XS2: Float = 2f
    public const val SPACE_XS4: Float = 4f
    public const val SPACE_SM8: Float = 8f
    public const val SPACE_MD12: Float = 12f
    public const val SPACE_LG16: Float = 16f
    public const val SPACE_XL20: Float = 20f
    public const val SPACE_XXL24: Float = 24f

    // ── Corner radii (dp) ───────────────────────────────────────────────────────
    public const val RADIUS_SM8: Float = 8f
    public const val RADIUS_MD12: Float = 12f
    public const val RADIUS_LG16: Float = 16f
    public const val RADIUS_PILL: Float = 999f

    // ── Stroke (dp) ──────────────────────────────────────────────────────────────
    public const val STROKE_HAIRLINE: Float = 1f

    // ── Opacity (dimming multipliers) ────────────────────────────────────────────
    public const val OPACITY_STALE: Float = 0.45f // telemetry past its TTL
    public const val OPACITY_EXITED: Float = 0.55f // a session that has exited
    public const val OPACITY_PRESSED: Float = 0.72f // pressed-state feedback
    public const val OPACITY_ACCENT_SOFT: Float = 0.15f // faint accent wash

    // ── Layout (dp) ───────────────────────────────────────────────────────────────
    public const val MIN_HIT_TARGET: Float = 44f // Material/HIG minimum touch target

    // ── Motion (ms) — subtle, eased; ALWAYS gate through reduce-motion ──────────
    public const val MOTION_FAST_MS: Int = 180
    public const val MOTION_BASE_MS: Int = 250
}
