// JDS tokens: primary neutral, base neutral, radius 0.625rem, font geist.
// Generated from https://www.usejds.dev/tokens/{format}. Don't edit by hand; download again to update.

import SwiftUI

public enum JDS {
    /** Adapts to light and dark mode. */
    public enum Colors {
        public static let background = Color(light: Color(.displayP3, red: 0.9803, green: 0.9803, blue: 0.9803, opacity: 1), dark: Color(.displayP3, red: 0.073, green: 0.073, blue: 0.073, opacity: 1))
        public static let foreground = Color(light: Color(.displayP3, red: 0.0394, green: 0.0394, blue: 0.0394, opacity: 1), dark: Color(.displayP3, red: 0.9215, green: 0.9215, blue: 0.9215, opacity: 1))
        public static let card = Color(light: Color(.displayP3, red: 1, green: 1, blue: 1, opacity: 1), dark: Color(.displayP3, red: 0.095, green: 0.095, blue: 0.095, opacity: 1))
        public static let cardForeground = Color(light: Color(.displayP3, red: 0.0394, green: 0.0394, blue: 0.0394, opacity: 1), dark: Color(.displayP3, red: 0.9215, green: 0.9215, blue: 0.9215, opacity: 1))
        public static let popover = Color(light: Color(.displayP3, red: 1, green: 1, blue: 1, opacity: 1), dark: Color(.displayP3, red: 0.1085, green: 0.1085, blue: 0.1085, opacity: 1))
        public static let popoverForeground = Color(light: Color(.displayP3, red: 0.0394, green: 0.0394, blue: 0.0394, opacity: 1), dark: Color(.displayP3, red: 0.9215, green: 0.9215, blue: 0.9215, opacity: 1))
        public static let primary = Color(light: Color(.displayP3, red: 0.0905, green: 0.0905, blue: 0.0905, opacity: 1), dark: Color(.displayP3, red: 0.9215, green: 0.9215, blue: 0.9215, opacity: 1))
        public static let primaryForeground = Color(light: Color(.displayP3, red: 0.9803, green: 0.9803, blue: 0.9803, opacity: 1), dark: Color(.displayP3, red: 0.0861, green: 0.0861, blue: 0.0861, opacity: 1))
        public static let secondary = Color(light: Color(.displayP3, red: 0.941, green: 0.941, blue: 0.941, opacity: 1), dark: Color(.displayP3, red: 0.1409, green: 0.1409, blue: 0.1409, opacity: 1))
        public static let secondaryForeground = Color(light: Color(.displayP3, red: 0.0905, green: 0.0905, blue: 0.0905, opacity: 1), dark: Color(.displayP3, red: 0.9215, green: 0.9215, blue: 0.9215, opacity: 1))
        public static let muted = Color(light: Color(.displayP3, red: 0.9475, green: 0.9475, blue: 0.9475, opacity: 1), dark: Color(.displayP3, red: 0.1268, green: 0.1268, blue: 0.1268, opacity: 1))
        public static let mutedForeground = Color(light: Color(.displayP3, red: 0.4109, green: 0.4109, blue: 0.4109, opacity: 1), dark: Color(.displayP3, red: 0.5965, green: 0.5965, blue: 0.5965, opacity: 1))
        public static let accent = Color(light: Color(.displayP3, red: 0.9345, green: 0.9345, blue: 0.9345, opacity: 1), dark: Color(.displayP3, red: 0.1503, green: 0.1503, blue: 0.1503, opacity: 1))
        public static let accentForeground = Color(light: Color(.displayP3, red: 0.0905, green: 0.0905, blue: 0.0905, opacity: 1), dark: Color(.displayP3, red: 0.9215, green: 0.9215, blue: 0.9215, opacity: 1))
        public static let destructive = Color(light: Color(.displayP3, red: 0.8303, green: 0.1404, blue: 0.1332, opacity: 1), dark: Color(.displayP3, red: 0.8717, green: 0.4339, blue: 0.3995, opacity: 1))
        public static let destructiveForeground = Color(light: Color(.displayP3, red: 0.6704, green: 0.1476, blue: 0.1322, opacity: 1), dark: Color(.displayP3, red: 0.9214, green: 0.5562, blue: 0.5185, opacity: 1))
        public static let border = Color(light: Color(.displayP3, red: 0.8827, green: 0.8827, blue: 0.8827, opacity: 1), dark: Color(.displayP3, red: 1, green: 1, blue: 1, opacity: 0.09))
        public static let input = Color(light: Color(.displayP3, red: 0.857, green: 0.857, blue: 0.857, opacity: 1), dark: Color(.displayP3, red: 1, green: 1, blue: 1, opacity: 0.13))
        public static let ring = Color(light: Color(.displayP3, red: 0.5021, green: 0.5021, blue: 0.5021, opacity: 1), dark: Color(.displayP3, red: 0.4447, green: 0.4447, blue: 0.4447, opacity: 1))
        public static let success = Color(light: Color(.displayP3, red: 0.3312, green: 0.5779, blue: 0.3568, opacity: 1), dark: Color(.displayP3, red: 0.4729, green: 0.7258, blue: 0.495, opacity: 1))
        public static let successForeground = Color(light: Color(.displayP3, red: 0.2106, green: 0.3879, blue: 0.2295, opacity: 1), dark: Color(.displayP3, red: 0.6, green: 0.8157, blue: 0.6153, opacity: 1))
        public static let warning = Color(light: Color(.displayP3, red: 0.8383, green: 0.6431, blue: 0.2426, opacity: 1), dark: Color(.displayP3, red: 0.866, green: 0.7232, blue: 0.3822, opacity: 1))
        public static let warningForeground = Color(light: Color(.displayP3, red: 0.5133, green: 0.3464, blue: 0.099, opacity: 1), dark: Color(.displayP3, red: 0.9121, green: 0.7914, blue: 0.5093, opacity: 1))
        public static let info = Color(light: Color(.displayP3, red: 0.28, green: 0.5272, blue: 0.7348, opacity: 1), dark: Color(.displayP3, red: 0.4431, green: 0.6465, blue: 0.8235, opacity: 1))
        public static let infoForeground = Color(light: Color(.displayP3, red: 0.1888, green: 0.3857, blue: 0.5497, opacity: 1), dark: Color(.displayP3, red: 0.603, green: 0.7674, blue: 0.9124, opacity: 1))
        public static let chart1 = Color(light: Color(.displayP3, red: 0.8314, green: 0.8314, blue: 0.8314, opacity: 1), dark: Color(.displayP3, red: 0.8314, green: 0.8314, blue: 0.8314, opacity: 1))
        public static let chart2 = Color(light: Color(.displayP3, red: 0.4515, green: 0.4515, blue: 0.4515, opacity: 1), dark: Color(.displayP3, red: 0.4515, green: 0.4515, blue: 0.4515, opacity: 1))
        public static let chart3 = Color(light: Color(.displayP3, red: 0.322, green: 0.322, blue: 0.322, opacity: 1), dark: Color(.displayP3, red: 0.322, green: 0.322, blue: 0.322, opacity: 1))
        public static let chart4 = Color(light: Color(.displayP3, red: 0.2505, green: 0.2505, blue: 0.2505, opacity: 1), dark: Color(.displayP3, red: 0.2505, green: 0.2505, blue: 0.2505, opacity: 1))
        public static let chart5 = Color(light: Color(.displayP3, red: 0.1494, green: 0.1494, blue: 0.1494, opacity: 1), dark: Color(.displayP3, red: 0.1494, green: 0.1494, blue: 0.1494, opacity: 1))
        public static let sidebar = Color(light: Color(.displayP3, red: 0.9671, green: 0.9671, blue: 0.9671, opacity: 1), dark: Color(.displayP3, red: 0.0861, green: 0.0861, blue: 0.0861, opacity: 1))
        public static let sidebarForeground = Color(light: Color(.displayP3, red: 0.0394, green: 0.0394, blue: 0.0394, opacity: 1), dark: Color(.displayP3, red: 0.9215, green: 0.9215, blue: 0.9215, opacity: 1))
        public static let sidebarPrimary = Color(light: Color(.displayP3, red: 0.0905, green: 0.0905, blue: 0.0905, opacity: 1), dark: Color(.displayP3, red: 0.9215, green: 0.9215, blue: 0.9215, opacity: 1))
        public static let sidebarPrimaryForeground = Color(light: Color(.displayP3, red: 0.9803, green: 0.9803, blue: 0.9803, opacity: 1), dark: Color(.displayP3, red: 0.0861, green: 0.0861, blue: 0.0861, opacity: 1))
        public static let sidebarAccent = Color(light: Color(.displayP3, red: 0.9345, green: 0.9345, blue: 0.9345, opacity: 1), dark: Color(.displayP3, red: 0.1409, green: 0.1409, blue: 0.1409, opacity: 1))
        public static let sidebarAccentForeground = Color(light: Color(.displayP3, red: 0.0905, green: 0.0905, blue: 0.0905, opacity: 1), dark: Color(.displayP3, red: 0.9215, green: 0.9215, blue: 0.9215, opacity: 1))
        public static let sidebarBorder = Color(light: Color(.displayP3, red: 0.8827, green: 0.8827, blue: 0.8827, opacity: 1), dark: Color(.displayP3, red: 1, green: 1, blue: 1, opacity: 0.09))
        public static let sidebarRing = Color(light: Color(.displayP3, red: 0.5021, green: 0.5021, blue: 0.5021, opacity: 1), dark: Color(.displayP3, red: 0.4447, green: 0.4447, blue: 0.4447, opacity: 1))
        public static let glass = Color(light: Color(.displayP3, red: 1, green: 1, blue: 1, opacity: 0.45), dark: Color(.displayP3, red: 0.1989, green: 0.1989, blue: 0.1989, opacity: 0.28))
    }

    /** Corner radii in points. */
    public enum Radius {
        public static let sm: CGFloat = 6
        public static let md: CGFloat = 8
        public static let lg: CGFloat = 10
        public static let xl: CGFloat = 14
        public static let xl2: CGFloat = 18
        public static let xl3: CGFloat = 22
        public static let xl4: CGFloat = 26
    }

    /** Base spacing unit; use multiples of it. */
    public static let spacing: CGFloat = 4
    /** Minimum size for anything tappable. */
    public static let touchTarget: CGFloat = 44
    /** Bundle the font with the app; falls back to the system font if missing. */
    public static let fontFamily = "Geist"

    /** Durations in seconds. Keep UI feedback under 0.25. */
    public enum Duration {
        public static let instant: Double = 0.1
        public static let fast: Double = 0.16
        public static let base: Double = 0.24
        public static let slow: Double = 0.4
    }

    /** snappy: buttons and toggles. gentle: panels and messages. soft: voice orbs. */
    public enum Spring {
        public static let snappy = Animation.interpolatingSpring(mass: 0.6, stiffness: 520, damping: 34)
        public static let gentle = Animation.interpolatingSpring(mass: 1, stiffness: 260, damping: 30)
        public static let soft = Animation.interpolatingSpring(mass: 1, stiffness: 120, damping: 18)
    }

    public enum Ease {
        public static func out(duration: Double = Duration.base) -> Animation {
            .timingCurve(0.22, 1, 0.36, 1, duration: duration)
        }
        public static func inOut(duration: Double = Duration.base) -> Animation {
            .timingCurve(0.76, 0, 0.24, 1, duration: duration)
        }
    }
}

extension Color {
    /** A color that follows the system appearance. */
    fileprivate init(light: Color, dark: Color) {
        #if canImport(UIKit)
        self.init(UIColor { $0.userInterfaceStyle == .dark ? UIColor(dark) : UIColor(light) })
        #elseif canImport(AppKit)
        self.init(NSColor(name: nil) { $0.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua ? NSColor(dark) : NSColor(light) })
        #else
        self = light
        #endif
    }
}
