/**
 * @file overrides/core.messages.css
 * Drupal core status messages (the `status_messages` element + Drupal.message
 * JS). Styled on the standard `.messages` markup so they look the same whether
 * rendered server-side or injected client-side. Flat colour per type, white
 * text; icon and close button injected by messages.js. Fixed at the bottom-left.
 *
 * Part of the wwf_tw/core.messages library (CSS + core.messages.js), a dependency of
 * wwf_tw/global. Unlayered: its selectors are specific to the message markup,
 * so there is no need to sit in a cascade layer.
 */

/* Stack container: fixed bottom-left, above the cart flyout, clearing any
   admin displacement (bottom AND left, a fixed vertical toolbar tray
   publishes a left offset). Clicks pass through the gaps. The width leaves
   the side margins inside the viewport on phones narrower than the cap. */
[data-drupal-messages] {
  position: fixed;
  z-index: var(--wwf-z-message, 1100);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: calc(100% - 2rem);
  max-width: 24rem;
  pointer-events: none;
  inset-block-end: calc(var(--drupal-displace-offset-bottom, 0px) + 1rem);
  inset-inline-start: calc(var(--drupal-displace-offset-left, 0px) + 1rem);
  align-items: flex-start;
}

[data-drupal-messages] > * {
  pointer-events: auto;
}

/* Some core/contrib templates wrap the list; let it pass through. */
[data-drupal-messages] .messages__wrapper {
  display: contents;
}

/* Card: solid colour by type, white content. */
[data-drupal-messages] .messages {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem;
  border-radius: 0;
  box-shadow: var(--wwf-shadow-lg);
  color: #fff;
  font-size: var(--wwf-text-small);
  line-height: 1.4;
  background: var(--wwf-color-info);
}
[data-drupal-messages] .messages--status {
  background: var(--wwf-color-success);
}
[data-drupal-messages] .messages--warning {
  background: var(--wwf-color-warning);
}
[data-drupal-messages] .messages--error {
  background: var(--wwf-color-error);
}

/* Visually-hidden message heading. */
[data-drupal-messages] .messages__header {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  overflow: hidden;
  clip-path: inset(50%);
}

[data-drupal-messages] .messages a {
  color: #fff;
  text-decoration: underline;
}
[data-drupal-messages] .messages ul {
  margin: 0;
  padding-inline-start: 1.25rem;
  list-style: disc;
}

/* Icon + close button injected by messages.js. */
.wwf-message__icon {
  flex: none;
  display: inline-flex;
  margin-top: 0.1rem;
}
.wwf-message__body {
  flex: 1 1 auto;
  min-width: 0;
}
.wwf-message__close {
  flex: none;
  display: inline-flex;
  cursor: pointer;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.8;
  transition: opacity var(--wwf-motion-duration-fast, 150ms) var(--wwf-motion-ease, ease);
}
.wwf-message__close:hover {
  opacity: 1;
}
.wwf-message__icon svg,
.wwf-message__close svg {
  width: 1.25rem;
  height: 1.25rem;
}
