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

@import url("chrome://global/skin/design-system/text-and-typography.css");

/*
 Bug 1972702: Remove the following TODOs
  TODO: need dark mode theming for the following:
    * color-violet-80 (message-text-color)
    * color-violet-0 (background-color)
    * color-violet-30 (border-color)
  TODO: need HCM styles
*/

:host([type="vibrant"]) {
  --promo-message-text-color: light-dark(var(--color-violet-80), var(--color-violet-0));
  --promo-heading-text-color: var(--promo-message-text-color);
  --promo-background-color: light-dark(var(--color-violet-0), var(--color-violet-90));
  --promo-border-color: var(--color-violet-30);
}

:host([imagealignment="center"]) {
  .container {
    flex-direction: column;
  }

  .image-container {
    /* TODO: The height of this container should _probably_ be configurable  */
    /* Bug 1966430: We need this in order to show the image at all when the
      alignment is set to center
    */
    min-height: var(--size-item-large);
    margin: var(--space-large);
    margin-block-start: 0;
  }
}

:host {
  --promo-message-text-color: var(--text-color);
  --promo-heading-text-color: var(--promo-message-text-color);
  --promo-background-color: var(--background-color-box-info);
  --promo-border: var(--promo-border-width) solid var(--promo-border-color);
  --promo-border-color: var(--border-color);
  --promo-border-width: var(--border-width);
  --promo-border-radius: var(--border-radius-medium);
  --promo-container-min-height: var(--dimension-56);

  @media (prefers-contrast) {
    --promo-message-text-color: var(--text-color);
  }
}

/* MozPromo layout */

.container {
  background-color: var(--promo-background-color);
  border: var(--promo-border);
  border-radius: var(--promo-border-radius);
  color: var(--promo-message-text-color);
  display: flex;
  flex-direction: row;
  gap: var(--space-xsmall);
  min-height: var(--promo-container-min-height);
  align-items: center;
  overflow: hidden;
}

.text-container {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-xsmall);
  padding: var(--space-medium);
}

.image-container {
  background-image: var(--promo-image-url);
  background-size: cover;
  background-position: var(--promo-image-position, center);
  background-repeat: no-repeat;
  flex-basis: 25%;
  align-self: stretch;
}

/* MozPromo heading style */

.heading {
  color: var(--promo-heading-text-color);
  margin-block: 0;
}

/* MozPromo message styles */

.message {
  display: flex;
  flex-wrap: wrap;
  word-break: break-word;
  margin: 0;
  align-items: center;

  &:has(slot:has-slotted) {
    gap: var(--space-small);
  }
}

/* MozPromo slot styles */

.actions-and-support-link-wrapper {
  display: none;
  gap: var(--space-small);
  align-items: baseline;
}

.actions-and-support-link-wrapper.active {
  display: flex;
}
