/*  We’re planning to move this in to the monorepo in which case
    we could share the dark mode mix in. Kelly is planning to take
    some time to make that move so can we add a comment here to
    circle back on this at that point?

    - Rafe
      April 2025
*/

@mixin dark-mode($global: false) {
  $root: &;

  @if not $root {
    [data-color-mode='dark'] {
      @content;
    }

    [data-color-mode='auto'],
    [data-color-mode='system'] {
      @media (prefers-color-scheme: dark) {
        @content;
      }
    }
  } @else if $global {
    :global([data-color-mode='dark']) & {
      @content;
    }

    :global([data-color-mode='auto']) &,
    :global([data-color-mode='system']) & {
      @media (prefers-color-scheme: dark) {
        @content;
      }
    }
  } @else {
    [data-color-mode='dark'] & {
      @content;
    }

    [data-color-mode='auto'] &,
    [data-color-mode='system'] & {
      @media (prefers-color-scheme: dark) {
        @content;
      }
    }
  }
}
