/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* DO NOT EDIT this file directly, instead modify moz-toggle.tokens.json
 * and run `mach buildtokens` to see your changes. */

@layer tokens-foundation, tokens-browser-theme, tokens-foundation-brand, tokens-foundation-nova, tokens-browser-theme-nova, tokens-foundation-brand-nova, tokens-prefers-contrast, tokens-prefers-contrast-nova, tokens-forced-colors, tokens-forced-colors-nova;

@layer tokens-foundation {
  :root,
  :host {
    --toggle-background-color: var(--button-background-color);
    --toggle-background-color-hover: var(--button-background-color-hover);
    --toggle-background-color-active: var(--button-background-color-active);
    --toggle-background-color-pressed: var(--color-accent-primary);
    --toggle-background-color-pressed-hover: var(--color-accent-primary-hover);
    --toggle-background-color-pressed-active: var(--color-accent-primary-active);
    --toggle-border-color: light-dark(var(--color-gray-70), var(--border-color-interactive));
    --toggle-border-color-hover: var(--toggle-border-color);
    --toggle-border-color-active: var(--toggle-border-color);
    --toggle-border-radius: var(--border-radius-circle);
    --toggle-border-width: var(--border-width);
    --toggle-dot-background-color: var(--toggle-border-color);
    --toggle-dot-background-color-hover: var(--toggle-dot-background-color);
    --toggle-dot-background-color-active: var(--toggle-dot-background-color);
    --toggle-dot-background-color-on-pressed: var(--background-color-canvas);
    --toggle-dot-height: calc(var(--toggle-height) - 2 * var(--toggle-dot-margin) - 2 * var(--toggle-border-width));
    --toggle-dot-margin: 1px;
    --toggle-dot-transform-x: calc(var(--toggle-width) - 2 * var(--toggle-dot-margin) - 2px - var(--toggle-dot-width));
    --toggle-dot-width: var(--toggle-dot-height);
    --toggle-height: var(--size-item-small);
    --toggle-inset: calc(-1 * var(--dimension-2));
    --toggle-opacity-disabled: var(--button-opacity-disabled);
    --toggle-width: var(--size-item-large);
  }
}

/* Bug 1879900: Can't nest media queries inside of :host, :root selector
   until Bug 1879349 lands */
@layer tokens-prefers-contrast {
  @media (prefers-contrast) {
    :root,
    :host {
      --toggle-border-color: var(--border-color-interactive);
    }
  }
}

/* Bug 1879900: Can't nest media queries inside of :host, :root selector
   until Bug 1879349 lands */
@layer tokens-forced-colors {
  @media (forced-colors) {
    :root,
    :host {
      --toggle-border-color: var(--border-color-interactive);
      --toggle-border-color-hover: var(--border-color-interactive-hover);
      --toggle-border-color-active: var(--border-color-interactive-active);
      --toggle-dot-background-color: var(--color-accent-primary);
      --toggle-dot-background-color-hover: var(--color-accent-primary-hover);
      --toggle-dot-background-color-active: var(--color-accent-primary-active);
      --toggle-dot-background-color-on-pressed: var(--button-background-color);
    }
  }
}

@media -moz-pref("browser.nova.enabled") {
  @layer tokens-foundation-nova {
    :root,
    :host {
      --toggle-background-color-pressed: var(--button-background-color-primary);
      --toggle-background-color-pressed-hover: var(--button-background-color-primary-hover);
      --toggle-background-color-pressed-active: var(--button-background-color-primary-active);
      --toggle-border-color: var(--border-color-interactive);
      --toggle-border-color-hover: var(--border-color-interactive-hover);
      --toggle-border-color-active: var(--border-color-interactive-active);
      --toggle-dot-background-color: var(--toggle-border-color);
      --toggle-dot-background-color-hover: var(--toggle-border-color-hover);
      --toggle-dot-background-color-active: var(--toggle-border-color-active);
      --toggle-dot-background-color-on-pressed: var(--background-color-box);
    }
  }
}
