/**
 * Drupal status / warning / error / info messages.
 *
 * Replaces Solo's black gradient boxes with light, friendly cards: a soft
 * tint, a colored left edge, rounded corners and dark readable text. Solo
 * marks its message rules !important, so these do too (with an extra
 * "html body" for specificity). Dark mode is at the bottom.
 */

html body .messages,
html body .webform-message .messages.messages--webform {
  --msg-accent: #2e7d4f;
  --msg-tint: #eef8f1;
  --msg-text: #1f2430;
  --msg-link: #1d5f3a;
  color: var(--msg-text) !important;
  background: var(--msg-tint) !important;
  border: 1px solid color-mix(in srgb, var(--msg-accent) 25%, transparent) !important;
  border-left: 4px solid var(--msg-accent) !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06) !important;
  padding: 0.9rem 1.1rem !important;
  min-height: 0 !important;
  font-size: 1rem;
  line-height: 1.5;
}

html body .messages.messages--status {
  --msg-accent: #2e7d4f;
  --msg-tint: #eef8f1;
  --msg-link: #1d5f3a;
}
html body .messages.messages--warning {
  --msg-accent: #b7791f;
  --msg-tint: #fff8e6;
  --msg-link: #7a4d00;
}
html body .messages.messages--error {
  --msg-accent: #c62f3b;
  --msg-tint: #fdeff0;
  --msg-link: #9b1c28;
}
html body .messages.messages--info {
  --msg-accent: #1f6fbf;
  --msg-tint: #edf4fd;
  --msg-link: #17589a;
}

/* Text: Solo forces "inherit" on everything inside; keep it readable. */
html body .messages *:not(pre, svg, svg *) {
  color: var(--msg-text) !important;
  background-color: transparent !important;
}
html body .messages a,
html body .messages a * {
  color: var(--msg-link) !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
}
html body .messages a:hover,
html body .messages a:focus {
  text-decoration-thickness: 2px !important;
}

/* Icon in the accent color, a little smaller and aligned with the text. */
html body .messages .messages__icon svg {
  width: 1.4rem !important;
  height: 1.4rem !important;
  border: 0 !important;
}
html body .messages .messages__icon svg,
html body .messages .messages__icon svg * {
  fill: var(--msg-accent) !important;
  color: var(--msg-accent) !important;
}
html body .messages .messages__content {
  padding-inline: 0.75rem 0 !important;
}
html body .messages .messages__content > :first-child,
html body .messages .messages__item > :first-child {
  margin-top: 0;
}
html body .messages .messages__content > :last-child,
html body .messages .messages__item > :last-child {
  margin-bottom: 0;
}

/* Several messages of one type: thin dividers instead of big gaps. */
html body .messages .messages__item + .messages__item {
  margin-block-start: 0.6rem !important;
  padding-top: 0.6rem;
  border-top: 1px solid color-mix(in srgb, var(--msg-accent) 20%, transparent);
}

/* Bulleted lists inside a message (e.g. the lab's blank-questions note). */
html body .messages ul:not(.messages__list) {
  list-style: disc !important;
  margin: 0.35rem 0 0 1.25rem !important;
  padding: 0 !important;
}
html body .messages ul:not(.messages__list) li {
  margin: 0.15rem 0 !important;
  padding: 0 !important;
}

/* Close button. */
html body .messages .messages__close::before,
html body .messages .messages__close::after {
  border-color: var(--msg-text) !important;
}

/* ---------- Dark mode ---------- */
html.a11y-dark body .messages,
html.a11y-dark body .webform-message .messages.messages--webform {
  --msg-text: var(--dk-text, #e4e6ea);
  background: color-mix(in srgb, var(--msg-accent) 14%, var(--dk-surface-2, #262a31)) !important;
  border-color: color-mix(in srgb, var(--msg-accent) 40%, transparent) !important;
  border-left-color: var(--msg-accent) !important;
  box-shadow: none !important;
}
html.a11y-dark body .messages.messages--status {
  --msg-accent: #4cc27a;
  --msg-link: #8fe0ae;
}
html.a11y-dark body .messages.messages--warning {
  --msg-accent: #e0a92b;
  --msg-link: #ffd77a;
}
html.a11y-dark body .messages.messages--error {
  --msg-accent: #ef6b76;
  --msg-link: #ffa3aa;
}
html.a11y-dark body .messages.messages--info {
  --msg-accent: #5aa3f0;
  --msg-link: #9cc8ff;
}
