:root,
[data-bs-theme="light"] {
  // Note: Custom variable values only support SassScript inside `#{}`.

  // Colors
  //
  // Generate palettes for full colors, grays, and theme colors.

  @each $color, $value in $gray-list {
    --#{$prefix}gray-#{$color}: #{$value};
  }

  @each $color, $value in $theme-colors {
    --#{$prefix}#{$color}: #{$value};
    --#{$prefix}#{$color}-hover: #{if(color-contrast($value) == $color-contrast-light, shade-color($value, $theme-hover-shade-amount), tint-color($value, $theme-hover-tint-amount))};
    --#{$prefix}#{$color}-active: #{if(color-contrast($value) == $color-contrast-light, shade-color($value, $theme-active-shade-amount), tint-color($value, $theme-active-tint-amount))};
    --#{$prefix}#{$color}-subtle: #{tint-color($value, $theme-subtle-tint-amount)};
    --#{$prefix}#{$color}-subtle-hover: #{tint-color($value, $theme-subtle-hover-tint-amount)};
    --#{$prefix}#{$color}-subtle-active: #{tint-color($value, $theme-subtle-active-tint-amount)};
    --#{$prefix}#{$color}-emphasis: #{shade-color($value, $theme-emphasis-shade-amount)};
    --#{$prefix}#{$color}-emphasis-hover: #{shade-color($value, $theme-emphasis-hover-shade-amount)};
    --#{$prefix}text-on-#{$color}: #{color-contrast($value)};
    --#{$prefix}#{$color}-border-subtle: #{tint-color($value, $theme-border-subtle-tint-amount)};
  }

  @each $color, $value in $theme-colors-rgb {
    --#{$prefix}#{$color}-rgb: #{$value};
  }

  --#{$prefix}white-rgb: #{to-rgb($white)};
  --#{$prefix}black-rgb: #{to-rgb($black)};

  // Fonts

  // Note: Use `inspect` for lists so that quoted items keep the quotes.
  // See https://github.com/sass/sass/issues/2383#issuecomment-336349172
  --#{$prefix}font-sans-serif: #{inspect($font-family-sans-serif)};
  --#{$prefix}font-monospace: #{inspect($font-family-monospace)};
  --#{$prefix}gradient: #{$gradient};

  // Root and body
  // scss-docs-start root-body-variables
  @if $font-size-root != null {
    --#{$prefix}root-font-size: #{$font-size-root};
  }
  --#{$prefix}body-font-family: #{inspect($font-family-base)};
  @include rfs($font-size-base, --#{$prefix}body-font-size);
  --#{$prefix}body-font-weight: #{$font-weight-base};
  --#{$prefix}body-line-height: #{$line-height-base};

  --#{$prefix}body-color: #{$body-color};
  --#{$prefix}body-color-rgb: #{to-rgb($body-color)};
  --#{$prefix}body-bg: #{$body-bg};
  --#{$prefix}body-bg-rgb: #{to-rgb($body-bg)};

  --#{$prefix}surface-color: #{$surface-color};
  --#{$prefix}surface-color-rgb: #{to-rgb($surface-color)};
  --#{$prefix}surface-bg: #{$surface-bg};
  --#{$prefix}surface-bg-rgb: #{to-rgb($surface-bg)};
  --#{$prefix}surface-bg-hover: #{$surface-bg-hover};

  --#{$prefix}emphasis-color: #{$emphasis-color};
  --#{$prefix}emphasis-color-rgb: #{to-rgb($emphasis-color)};

  --#{$prefix}muted-color: #{$muted-color};

  @if $body-text-align != null {
    --#{$prefix}body-text-align: #{$body-text-align};
  }
  // scss-docs-end root-body-variables

  --#{$prefix}heading-color: #{$headings-color};

  --#{$prefix}link-color: #{$link-color};
  --#{$prefix}link-decoration: #{$link-decoration};

  --#{$prefix}link-hover-color: #{$link-hover-color};

  @if $link-hover-decoration != null {
    --#{$prefix}link-hover-decoration: #{$link-hover-decoration};
  }

  --#{$prefix}code-color: #{$code-color};
  --#{$prefix}highlight-bg: #{$mark-bg};

  // scss-docs-start root-border-var
  --#{$prefix}border-width: #{$border-width};
  --#{$prefix}border-style: #{$border-style};
  --#{$prefix}border-color: #{$border-color};
  --#{$prefix}border-color-translucent: #{$border-color-translucent};

  --#{$prefix}border-radius: #{$border-radius};
  --#{$prefix}border-radius-sm: #{$border-radius-sm};
  --#{$prefix}border-radius-lg: #{$border-radius-lg};
  --#{$prefix}border-radius-xl: #{$border-radius-xl};
  --#{$prefix}border-radius-xxl: #{$border-radius-xxl};
  --#{$prefix}border-radius-2xl: var(--#{$prefix}border-radius-xxl); // Deprecated in v5.3.0 for consistency
  --#{$prefix}border-radius-pill: #{$border-radius-pill};
  // scss-docs-end root-border-var

  --#{$prefix}box-shadow: #{$box-shadow};
  --#{$prefix}box-shadow-sm: #{$box-shadow-sm};
  --#{$prefix}box-shadow-lg: #{$box-shadow-lg};
  --#{$prefix}box-shadow-inset: #{$box-shadow-inset};

  // scss-docs-start form-control-vars
  --#{$prefix}form-control-bg: var(--#{$prefix}body-bg);
  --#{$prefix}form-control-disabled-bg: var(--#{$prefix}surface-bg);
  // scss-docs-end form-control-vars

  @each $name, $value in $grid-breakpoints {
    --#{$prefix}breakpoint-#{$name}: #{$value};
  }

  @each $name, $value in $shadows {
    --#{$prefix}shadow-#{$name}: #{$value};
  }

  // Focus styles
  // scss-docs-start root-focus-variables
  --#{$prefix}focus-ring-width: #{$focus-ring-width};
  --#{$prefix}focus-ring-opacity: #{$focus-ring-opacity};
  --#{$prefix}focus-ring-color: #{$focus-ring-color};
  // scss-docs-end root-focus-variables
}

@if $enable-dark-mode {
  @include color-mode(dark, true) {
    color-scheme: dark;

    // scss-docs-start root-dark-mode-vars
    --#{$prefix}body-color: #{$body-color-dark};
    --#{$prefix}body-color-rgb: #{to-rgb($body-color-dark)};
    --#{$prefix}body-bg: #{$body-bg-dark};
    --#{$prefix}body-bg-rgb: #{to-rgb($body-bg-dark)};

    --#{$prefix}surface-color: #{$surface-color-dark};
    --#{$prefix}surface-color-rgb: #{to-rgb($surface-color-dark)};
    --#{$prefix}surface-bg: #{$surface-bg-dark};
    --#{$prefix}surface-bg-rgb: #{to-rgb($surface-bg-dark)};
    --#{$prefix}surface-bg-hover: #{$surface-bg-dark-hover};

    --#{$prefix}emphasis-color: #{$emphasis-color-dark};
    --#{$prefix}emphasis-color-rgb: #{to-rgb($emphasis-color-dark)};

    --#{$prefix}muted-color: #{$muted-color-dark};

    @each $color, $value in $theme-colors {
      $theme: tint-color($value, $theme-dark-tint-amount);

      --#{$prefix}#{$color}: #{$theme};
      --#{$prefix}#{$color}-rgb: #{to-rgb($theme)};
      --#{$prefix}#{$color}-hover: #{if(color-contrast($theme) == $color-contrast-light, shade-color($theme, $theme-dark-hover-shade-amount), tint-color($theme, $theme-dark-hover-tint-amount))};
      --#{$prefix}#{$color}-active: #{if(color-contrast($theme) == $color-contrast-light, shade-color($theme, $theme-dark-active-shade-amount), tint-color($theme, $theme-dark-active-tint-amount))};
      --#{$prefix}#{$color}-subtle: #{shade-color($value, $theme-dark-subtle-shade-amount)};
      --#{$prefix}#{$color}-subtle-hover: #{shade-color($value, $theme-dark-subtle-hover-shade-amount)};
      --#{$prefix}#{$color}-subtle-active: #{shade-color($value, $theme-dark-subtle-active-shade-amount)};
      --#{$prefix}#{$color}-emphasis: #{tint-color($value, $theme-dark-emphasis-tint-amount)};
      --#{$prefix}#{$color}-emphasis-hover: #{tint-color($value, $theme-dark-emphasis-hover-tint-amount)};
      --#{$prefix}text-on-#{$color}: #{color-contrast($theme)};
      --#{$prefix}#{$color}-border-subtle: #{shade-color($value, $theme-dark-border-subtle-shade-amount)};
    }

    --#{$prefix}heading-color: #{$headings-color-dark};

    --#{$prefix}border-color: #{$border-color-dark};
    --#{$prefix}border-color-translucent: #{$border-color-translucent-dark};
    // scss-docs-end root-dark-mode-vars
  }
}
