/* 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/. */

/* Tor Browser instructions
 * ========================
 *
 * DO NOT EDIT this file directly!
 *
 * DO NOT MANUALLY RESOLVE MERGE CONFLICTS for this file!
 *
 * This is a file generated by `./mach buildtokens`.
 *
 * When resolving conflicts, first resolve other conflicts outside the
 * 'dist' directory, if there are any:
 *   git mergetool ':(exclude)toolkit/themes/shared/design-system/dist/'
 *
 * Then regenerate these 'dist' files:
 *
 *   ./mach buildtokens
 *
 * Then add the generated files as resolved:
 *
 *   git add toolkit/themes/shared/design-system/dist/
 */
/* DO NOT EDIT this file directly, instead modify moz-message-bar.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 {
    --message-bar-actions-button-padding: var(--space-xsmall) var(--space-large);
    --message-bar-actions-gap: var(--space-small);
    --message-bar-background-color: var(--background-color-information);
    --message-bar-background-color-critical: var(--background-color-critical);
    --message-bar-background-color-success: var(--background-color-success);
    --message-bar-background-color-warning: var(--background-color-warning);
    --message-bar-border-color: oklch(from var(--message-bar-icon-color) l c h / 20%);
    --message-bar-border-radius: var(--border-radius-medium);
    --message-bar-border-width: var(--border-width);
    --message-bar-container-gap: var(--space-small);
    --message-bar-container-min-height: var(--size-item-large);
    --message-bar-container-padding-block: var(--space-small);
    --message-bar-container-padding-inline: var(--space-medium) var(--space-small);
    --message-bar-content-gap: var(--space-small) var(--space-medium);
    --message-bar-icon-background-color: var(--background-color-information);
    --message-bar-icon-background-color-critical: var(--background-color-critical);
    --message-bar-icon-background-color-success: var(--background-color-success);
    --message-bar-icon-background-color-warning: var(--background-color-warning);
    --message-bar-icon-color: var(--icon-color-information);
    --message-bar-icon-container-border: none;
    --message-bar-icon-container-border-color: transparent;
    --message-bar-icon-container-border-radius: var(--border-radius-circle);
    --message-bar-icon-container-height: min-content;
    --message-bar-icon-container-margin-block-start: calc(var(--space-small) + 2px);
    --message-bar-icon-container-padding: 0;
    --message-bar-icon-size: var(--icon-size);
    --message-bar-message-margin-inline-end: var(--space-xsmall);
    --message-bar-text-color: var(--text-color);
    --message-bar-text-container-gap: var(--space-xsmall) var(--space-small);
    --message-bar-text-container-padding-block: calc((var(--message-bar-container-min-height) - var(--message-bar-icon-size)) / 2);
    --message-bar-text-content-gap: var(--space-xsmall) var(--space-small);
  }
}

/* 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 {
      --message-bar-border-color: var(--border-color);
    }
  }
}

@media -moz-pref("browser.nova.enabled") {
  @layer tokens-foundation-nova {
    :root,
    :host {
      --message-bar-background-color: var(--background-color-box);
      --message-bar-background-color-critical: var(--message-bar-background-color);
      --message-bar-background-color-success: var(--message-bar-background-color);
      --message-bar-background-color-warning: var(--message-bar-background-color);
      --message-bar-border-radius: var(--border-radius-large);
      /* Using rem-based space tokens ends up causing subpixel rendering issues that cause the icon to look uncentered */
      --message-bar-container-padding-inline: 8px;
      --message-bar-icon-container-border: 1px solid var(--message-bar-icon-container-border-color);
      --message-bar-icon-container-border-color: transparent;
      --message-bar-icon-container-height: var(--message-bar-icon-size);
      --message-bar-icon-container-margin-block-start: 0;
      --message-bar-icon-container-padding: calc(var(--space-small) - 1px);
      --message-bar-text-container-padding-block: 0;
    }
  }

  /* 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 {
        --message-bar-icon-container-border-color: var(--message-bar-icon-color);
      }
    }
  }
}
