/* 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-urlbarview.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 {
    --urlbarview-action-button-background-color: color-mix(in srgb, var(--urlbarview-background-color-hover) 50%, transparent);
    --urlbarview-action-button-background-color-hover: var(--urlbarview-background-color-hover);
    --urlbarview-background-color-hover: var(--background-color-dimmed);
    --urlbarview-background-color-selected: SelectedItem;
    --urlbarview-border-radius: calc(var(--button-border-radius) + 2px);
    --urlbarview-favicon-size: var(--icon-size);
    --urlbarview-row-min-height: var(--size-item-large);
    --urlbarview-row-padding-block: var(--space-small);
    --urlbarview-separator-color: color-mix(in srgb, currentColor 14%, transparent);
    --urlbarview-text-color-action: LinkText;
    --urlbarview-text-color-secondary: color-mix(in srgb, currentColor 73%, transparent);
    --urlbarview-text-color-selected: SelectedItemText;
  }
}

/* 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 {
      --urlbarview-separator-color: color-mix(in srgb, currentColor 86%, transparent);
    }
  }
}

/* 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 {
      --urlbarview-text-color-secondary: currentColor;
    }
  }
}

/* Bug 1879900: Can't nest media queries inside of :host, :root selector
   until Bug 1879349 lands */
@layer tokens-browser-theme {
  @media not ((forced-colors) or (-moz-native-theme)) {
    :root:is([theme-in-app], :not([lwtheme])),
    :host(.anonymous-content-host) {
      --urlbarview-background-color-hover: light-dark(rgb(240, 240, 244), var(--background-color-dimmed));
      --urlbarview-background-color-selected: light-dark(#e0e0e6, rgb(43, 42, 51));
      --urlbarview-separator-color: light-dark(rgb(240, 240, 244), rgb(82, 82, 94));
      --urlbarview-text-color-action: light-dark(rgb(91, 91, 102), rgb(191, 191, 201));
      --urlbarview-text-color-secondary: color-mix(in srgb, currentColor 73%, transparent);
      --urlbarview-text-color-selected: light-dark(rgb(21, 20, 26), rgb(251, 251, 254));
    }
  }
}

@media -moz-pref("browser.nova.enabled") {
  @layer tokens-foundation-nova {
    :root,
    :host {
      --urlbarview-action-button-background-color: var(--urlbar-box-background-color);
      --urlbarview-action-button-background-color-hover: var(--urlbar-box-background-color-hover);
      --urlbarview-background-color-hover: var(--background-color-dimmed);
      --urlbarview-background-color-selected: SelectedItem;
      --urlbarview-border-radius: var(--urlbar-border-radius);
      --urlbarview-separator-color: color-mix(in srgb, currentColor 14%, transparent);
      --urlbarview-text-color-action: LinkText;
      --urlbarview-text-color-secondary: color-mix(in srgb, currentColor 73%, transparent);
      --urlbarview-text-color-selected: SelectedItemText;
    }
  }

  /* Bug 1879900: Can't nest media queries inside of :host, :root selector
   until Bug 1879349 lands */
  @layer tokens-forced-colors-nova {
    @media (forced-colors) {
      :root,
      :host {
        --urlbarview-separator-color: #ffffff;
        --urlbarview-text-color-secondary: #ffffff;
      }
    }
  }

  /* Bug 1879900: Can't nest media queries inside of :host, :root selector
   until Bug 1879349 lands */
  @layer tokens-browser-theme-nova {
    @media not ((forced-colors) or (-moz-native-theme)) {
      :root:is([theme-in-app], :not([lwtheme])),
      :host(.anonymous-content-host) {
        --urlbarview-background-color-hover: var(--toolbarbutton-background-color-hover);
        --urlbarview-background-color-selected: var(--toolbarbutton-background-color-active);
        --urlbarview-separator-color: light-dark(var(--color-gray-20), var(--color-gray-60));
        --urlbarview-text-color-action: var(--toolbar-field-text-color-focus);
        --urlbarview-text-color-secondary: light-dark(#3e315f, #e7e1f8);
        --urlbarview-text-color-selected: var(--toolbar-field-text-color-focus);
      }
    }
  }
}
