/// COLOUR DEFINITIONS
/// Using a BEM-like syntax for variable names.
///
/// Values used in calculations for hover background and foreground colours are derived from
/// previously hardcoded colours. Those colours are/were:
/// - link colour: ds_colour__blue (#0065bd)
/// - link hover background: ds_colour__blue--light (#d9effc)
/// - link hover colour: ds_colour__blue--darker (#002d64)
///
/// [1] 0.83: the luminance of ds_colour__blue--light
/// [2] 12.5%: the amount that ds_colour__blue--darker is darker than ds_colour__blue

@use 'sass:color';
@use "../../helpers/colours";

/// Palette
$ds_colour__white:          #ffffff;
$ds_colour__black:          #000000;

$ds_colour__blue--light:    #d9effc;
$ds_colour__blue:           #0065bd;
$ds_colour__blue--dark:     #00437e;
$ds_colour__blue--darker:   #002d54;

$ds_colour__grey--lighter:  #f8f8f8;
$ds_colour__grey--light:    #ebebeb;
$ds_colour__grey--medium:   #b3b3b3;
$ds_colour__grey:           #5e5e5e;
$ds_colour__grey--dark:     #1a1a1a;

$ds_colour__sg-secondary:   #333e48;

/// Extended palette
$ds_colour__dark-blue:  $ds_colour__blue--darker;
$ds_colour__teal:       #28a197;
$ds_colour__dark-teal:  #1c5d5d;
$ds_colour__green:      #5eb135;
$ds_colour__dark-green: #1a7032;
$ds_colour__yellow:     #fdd522;
$ds_colour__orange:     #cb4e0b;
$ds_colour__red:        #d32205;
$ds_colour__pink:       #e5007e;
$ds_colour__purple:     #741e6d;
$ds_colour__brown:      #592c20;


///
/// Branding
///

/// Primary brand colour
/// @type Color
$ds_colour__brand: $ds_colour__blue !default;

/// Secondary brand colour
/// @type Color
$ds_colour__brand--secondary: $ds_colour__sg-secondary !default;

/// Brand gradient direction
/// @type String
$ds_brand-gradient-direction: right !default;

// Output a warning if the brand colour does not meet 4.5:1 contrast ratio against white
@if colours.getContrastRatio(#ffffff, $ds_colour__brand) < 4.5 {
    @warn 'Brand colour #{$ds_colour__brand} does not meet 4.5:1 contrast ratio against white.';
}


///
/// General backgrounds
/// 

/// Primary background colour
/// @type Color
$ds_colour__background--primary: $ds_colour__white !default;

/// Secondary background colour
/// @type Color
$ds_colour__background--secondary: $ds_colour__grey--lighter !default;

/// Tertiary background colour
/// @type Color
$ds_colour__background--tertiary: $ds_colour__grey--light !default;


///
/// Borders
///

/// Default border colour
/// @type Color
$ds_colour__border: $ds_colour__grey--medium !default;

/// Higher emphasis border colour
/// @type Color
$ds_colour__border--strong: $ds_colour__grey--dark !default;

/// Lower emphasis border colour
/// @type Color
$ds_colour__border--faint: $ds_colour__grey--light !default;

/// Maximum emphasis border colour
/// @type Color
$ds_colour__border--highlight: $ds_colour__brand !default;


///
/// Typography
/// 

/// Default text colour
/// @type Color
$ds_colour__text: $ds_colour__grey--dark !default;

/// Secondary text colour
/// @type Color
$ds_colour__text--secondary: $ds_colour__grey !default;

/// Inverse text colour (for use on dark backgrounds)
/// @type Color
$ds_colour__text--reversed: $ds_colour__white !default;

/// Placeholder text colour
/// @type Color
$ds_colour__placeholder: $ds_colour__text--secondary !default;


///
/// Focus
/// 

/// Focus foreground colour
/// @type Color
$ds_colour__focus: $ds_colour__grey--dark !default;

/// Focus constrasting background colour
/// @type Color
$ds_colour__focus--background: $ds_colour__yellow !default;


///
/// Links
/// 

/// Default link colour
/// @type Color
$ds_colour__link: $ds_colour__brand !default;

/// Link hover background colour
/// @type Color
$ds_colour__link--hover__background: colours.adjustLuminance($ds_colour__link, 0.83) !default; /// [1]

/// Link hover foreground colour
/// @type Color
$ds_colour__link--hover: colours.adjustForContrast(color.adjust($ds_colour__link, $lightness: -12.5%), $ds_colour__link--hover__background, 4.5) !default; /// [2]

/// Link focus foreground colour
/// @type Color
$ds_colour__link--focus: $ds_colour__focus !default;

/// Link focus outline colour
/// @type Color
$ds_colour__link--focus__outline: $ds_colour__focus--background !default;

/// Link focus background colour
/// @type Color
$ds_colour__link--focus__background: $ds_colour__focus--background !default;

/// Link focus shadow colour
/// @type Color
$ds_colour__link--focus__shadow: $ds_colour__focus !default;

/// Link current foreground colour
/// @type Color
$ds_colour__link--current: $ds_colour__text !default;

/// Link current background colour
/// @type Color
$ds_colour__link--current__background: $ds_colour__background--secondary !default;

/// Link disabled foreground colour
/// @type Color
$ds_colour__link--disabled: $ds_colour__text !default;

/// Link disabled background colour
/// @type Color
$ds_colour__link--disabled__background: $ds_colour__background--tertiary !default;

/// Link reversed foreground colour - uses same colour as the text surrounding it, typically white on a dark background
/// @type Color
$ds_colour__link--reversed: currentColor !default;

/// Link reversed hover foreground colour - uses same colour as the text surrounding it, typically white on a dark background
/// @type Color
$ds_colour__link--reversed--hover: currentColor !default;

/// Link reversed focus foreground colour
/// @type Color
$ds_colour__link--reversed--focus: $ds_colour__link--focus !default;

///
/// Block links
/// 

/// Block link background colour
/// @type Color
$ds_colour__blocklink-bg: $ds_colour__white !default;

/// Block link hover background colour
/// @type Color
$ds_colour__blocklink-bg--hover: $ds_colour__link--hover__background !default;

/// Block link focus background colour
/// @type Color
$ds_colour__blocklink-bg--focus: $ds_colour__link--focus__background !default;


///
/// Buttons
/// 

/// Primary button

/// Primary button foreground colour
/// @type Color
$ds_colour__button: $ds_colour__white !default;

/// Primary button background colour
/// @type Color
$ds_colour__button__background: $ds_colour__brand !default;

/// Primary button hover foreground colour
/// @type Color
$ds_colour__button--hover__background:  colours.adjustForContrast(color.adjust($ds_colour__button__background, $lightness: -12.5%), $ds_colour__button, 4.5) !default; /// [2]

/// Primary button focus foreground colour
/// @type Color
$ds_colour__button--focus: $ds_colour__link--focus !default;

/// Primary button focus background colour
/// @type Color
$ds_colour__button--focus__background:  $ds_colour__link--focus__background !default;


/// Secondary button

/// Secondary button foreground colour
/// @type Color
$ds_colour__button--secondary: $ds_colour__button__background !default;

/// Secondary button background colour
/// @type Color
$ds_colour__button--secondary__background: transparent !default;

/// Secondary button hover foreground colour
/// @type Color
$ds_colour__button--secondary--hover: $ds_colour__button--hover__background !default;

/// Secondary button hover background colour
/// @type Color
$ds_colour__button--secondary--hover__background: colours.adjustLuminance($ds_colour__button--secondary, 0.83) !default; /// [1]

/// Secondary button focus foreground colour
/// @type Color
$ds_colour__button--secondary--focus: $ds_colour__button--focus !default;


/// Cancel button - Deprecated - use secondary button instead

/// Cancel button foreground colour
/// @type Color
$ds_colour__button--cancel: $ds_colour__text !default;

/// Cancel button background colour
/// @type Color
$ds_colour__button--cancel__background: $ds_colour__button--secondary__background !default;

/// Cancel button hover background colour
/// @type Color
$ds_colour__button--cancel--hover__background: colours.adjustLuminance($ds_colour__button--cancel, 0.83) !default; /// [1]


/// Disabled button

/// Disabled button foreground colour
/// @type Color
$ds_colour__button--disabled: $ds_colour__text !default;

/// Disabled button background colour
/// @type Color
$ds_colour__button--disabled__background: $ds_colour__grey--medium !default;


///
/// inputs
/// 

/// Input border colour
/// @type Color
$ds_colour__input--border: $ds_colour__border--strong !default;

/// Input hover border colour - not currently used / Deprecated
/// @type Color
$ds_colour__input--hover__border: $ds_colour__grey--medium !default;

/// Input focus background colour
/// @type Color
$ds_colour__input--focus__background: $ds_colour__white !default;

/// Input focus outline colour
/// @type Color
$ds_colour__input--focus__outline: $ds_colour__focus--background !default;

/// Input (spot) colour - not currently used / Deprecated
/// @type Color
$ds_colour__input--spot: currentColor !default;


///
/// State
/// 

/// Information state colour
/// @type Color
$ds_colour__state--info: $ds_colour__blue;

/// Negative state colour
/// @type Color
$ds_colour__state--negative: $ds_colour__red;

/// Positive state colour
/// @type Color
$ds_colour__state--positive: $ds_colour__dark-green;

/// Warning state colour
/// @type Color
$ds_colour__state--warning: $ds_colour__orange;