using Microsoft.Xna.Framework;

namespace Theriapolis.Game.CodexUI.Core;

/// <summary>
/// Color tokens for the illuminated-codex aesthetic. Values extracted from
/// the React design at <c>_design_handoff/character_creation/from_design/index.html</c>
/// `:root` CSS variable block. Single source of truth for every paint colour
/// in CodexUI; widgets must read from here rather than hardcoding.
/// </summary>
public static class CodexColors
{
    // Backgrounds — parchment family
    public static readonly Color Bg         = HexColor(0xE8DCC0);  // parchment
    public static readonly Color BgDeep     = HexColor(0xC7B48B);  // worn parchment shadow
    public static readonly Color Bg2        = HexColor(0xD9C9A6);  // card body fill

    // Inks — primary text gradient
    public static readonly Color Ink        = HexColor(0x2B1D10);  // primary serif text
    public static readonly Color InkSoft    = HexColor(0x5A4527);  // secondary text
    public static readonly Color InkMute    = HexColor(0x8A6F48);  // tertiary / placeholder

    // Accents
    public static readonly Color Gild       = HexColor(0xB48A3C);  // gilded borders + select halo
    public static readonly Color GildBright = HexColor(0xD4A23E);  // hover halo / highlight
    public static readonly Color Seal       = HexColor(0x7A1F12);  // wax-red, danger / negative bonus
    public static readonly Color Seal2      = HexColor(0x5A160C);  // dark wax (selected accent)
    public static readonly Color Rule       = HexColor(0x8A6F48);  // hairline rule color

    // Transparent / overlay variants
    public static readonly Color CardHoverHalo = new(180, 138, 60, 28);
    public static readonly Color CardSelectedHalo = new(122, 31, 18, 64);
    public static readonly Color PoolDieBg     = new(180, 138, 60, 12);

    private static Color HexColor(uint rgb) =>
        new((byte)((rgb >> 16) & 0xFF), (byte)((rgb >> 8) & 0xFF), (byte)(rgb & 0xFF), (byte)0xFF);
}

/// <summary>
/// Density / spacing tokens. Mirror the React design's <c>--gap</c>, <c>--pad</c>
/// and per-widget spacing constants. Widgets pull these instead of hardcoding
/// magic numbers so a future "compact density" toggle can resize the whole UI.
/// </summary>
public static class CodexDensity
{
    public const int RowGap     = 6;
    public const int ColGap     = 8;
    public const int CardPad    = 18;
    public const int PanelPad   = 28;
    public const int ChipPad    = 6;
    public const int ButtonPad  = 10;
    public const int CardWidth  = 240;   // minimum card width (matches design's grid-template min)
    public const int CardGap    = 24;
    public const int AsideWidth = 380;
}
