/* Global Alert — Queensland Government Design System (QGDS) component.
   https://www.designsystem.qld.gov.au/components/alerts-global

   Ported from qld-gov-au/qgds-bootstrap5 (globalAlert.scss) to plain CSS, with
   QGDS design-token hex values resolved inline. Replaces the previous solid
   Bootstrap `.alert` bars. Non-dismissible (no close button) by QRIDA decision.

   Variant mapping (block field_alerts__alert_type -> QGDS variant):
     alert-danger  -> global-alert-critical  (red,   white text)
     alert-warning -> global-alert-warning   (amber, dark text)
     alert-info    -> global-alert-info       (pale blue, dark text)
     alert-success -> global-alert-success    (pale green — QRIDA extension,
                                               not part of the QGDS spec) */

/* QGDS alert icon masks (verbatim from qgds-bootstrap5 icon assets). The icon
   is a CSS mask painted with --alert-icon-color, so it recolours per variant. */
.global-alert {
  --qgds-icon-alert-information: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3e %3cpath fill='currentColor' d='M28.9 10.5c-.7-1.7-1.7-3.2-3-4.4-1.3-1.3-2.7-2.3-4.4-3C19.8 2.4 17.9 2 16 2s-3.8.4-5.5 1.1c-1.7.7-3.2 1.7-4.4 3-1.3 1.3-2.3 2.7-3 4.4C2.4 12.2 2 14.1 2 16s.4 3.8 1.1 5.5c.7 1.7 1.7 3.2 3 4.4 1.3 1.3 2.7 2.3 4.4 3 1.7.7 3.5 1.1 5.5 1.1 1.9 0 3.7-.4 5.5-1.1 1.7-.7 3.2-1.7 4.4-3 1.3-1.3 2.3-2.7 3-4.4.7-1.7 1.1-3.5 1.1-5.5 0-1.9-.4-3.8-1.1-5.5Zm-4.3 14.1c-2.4 2.4-5.2 3.5-8.6 3.5-3.4 0-6.3-1.2-8.6-3.5C5 22.2 3.9 19.4 3.9 16c0-3.4 1.2-6.3 3.5-8.6s5.2-3.5 8.6-3.5c3.4 0 6.3 1.2 8.6 3.5 2.4 2.4 3.5 5.2 3.5 8.6 0 3.4-1.1 6.2-3.5 8.6ZM16 9c-.4 0-.7.1-.9.4-.2.2-.4.5-.4.9 0 .3.1.6.4.9.2.2.5.4.9.4s.7-.1.9-.4c.2-.2.4-.5.4-.9s-.1-.7-.4-.9c-.2-.3-.5-.4-.9-.4Zm0 5c-.3 0-.5.1-.7.3-.2.2-.3.4-.3.7v7c0 .3.1.5.3.7.2.2.4.3.7.3.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7v-7c0-.3-.1-.5-.3-.7-.2-.2-.4-.3-.7-.3Z'/%3e %3c/svg%3e");
  --qgds-icon-alert-warning: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3e %3cpath fill='currentColor' d='M16 22.5c-.4 0-.7.1-.9.4-.2.2-.4.5-.4.9s.1.7.4.9c.2.2.5.4.9.4s.7-.1.9-.4c.2-.2.4-.5.4-.9s-.1-.7-.4-.9c-.3-.3-.5-.4-.9-.4Zm13.8 4.2L17 4.6c-.1-.2-.3-.3-.4-.4-.2-.2-.4-.2-.6-.2-.2 0-.4 0-.6.1-.2.1-.3.2-.4.4L2.2 26.7c-.2.2-.2.4-.2.6 0 .2.1.4.2.5.1.2.2.3.4.4.2.1.4.2.6.2h25.7c.2 0 .4-.1.6-.2.2-.1.3-.2.4-.4.1-.2.2-.3.2-.5-.1-.2-.1-.4-.3-.6Zm-25.4-.1L16 6.5l11.6 20.1H4.4Zm10.9-13.9c-.2.2-.3.4-.3.7v6c0 .3.1.5.3.7.2.2.4.3.7.3.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7v-6c0-.3-.1-.5-.3-.7-.2-.2-.4-.3-.7-.3-.3.1-.5.1-.7.3Z'/%3e %3c/svg%3e");
  --qgds-icon-alert-danger: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3e %3cpath fill='currentColor' d='M29.8 10.2c-.1-.3-.3-.6-.6-.8l-6.6-6.6c-.2-.2-.5-.4-.8-.6-.3-.1-.7-.2-1-.2h-9.5c-.3 0-.7.1-1 .2-.4.1-.7.3-.9.6L2.8 9.4c-.2.2-.4.5-.6.8-.1.3-.2.7-.2 1v9.5c0 .3.1.7.2 1 .1.3.3.6.6.8l6.6 6.6c.2.2.5.4.8.6.3.1.7.2 1 .2h9.5c.3 0 .7-.1 1-.2.3-.1.6-.3.8-.6l6.6-6.6c.2-.2.4-.5.6-.8.1-.3.2-.7.2-1v-9.5c.1-.3 0-.6-.1-1ZM27.9 21l-7 7H11l-7-7V11l7-7h10l7 7v10h-.1Zm-12.6-3.3c-.2-.2-.3-.4-.3-.7V9c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3.3 0 .5.1.7.3.2.2.3.4.3.7v8c0 .3-.1.5-.3.7-.2.2-.4.3-.7.3-.3 0-.5-.1-.7-.3Zm1.7 3.2c.3.3.4.6.4 1s-.1.7-.4 1c-.3.3-.6.4-1 .4s-.7-.1-1-.4c-.3-.3-.4-.6-.4-1s.1-.7.4-1c.3-.3.6-.4 1-.4s.7.1 1 .4Z'/%3e %3c/svg%3e");
  --qgds-icon-alert-success: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3e %3cpath fill='currentColor' d='m13.854 19.507-3.633-3.643a.954.954 0 0 0-.67-.273.918.918 0 0 0-.689.288.915.915 0 0 0-.28.672c0 .26.093.484.28.671l4.184 4.2a1.094 1.094 0 0 0 1.616-.001l8.432-8.423a.98.98 0 0 0 .29-.684.92.92 0 0 0-.29-.69.948.948 0 0 0-.694-.273.954.954 0 0 0-.68.288l-7.866 7.868ZM16.003 30c-1.927 0-3.74-.367-5.44-1.102a14.205 14.205 0 0 1-4.455-3.004 14.202 14.202 0 0 1-3.005-4.452C2.368 19.742 2 17.929 2 16.002c0-1.936.367-3.756 1.102-5.46a14.038 14.038 0 0 1 3.004-4.446 14.307 14.307 0 0 1 4.452-2.993C12.258 2.368 14.071 2 15.998 2c1.936 0 3.756.367 5.46 1.102a14.142 14.142 0 0 1 4.446 2.992 14.14 14.14 0 0 1 2.993 4.445C29.632 12.242 30 14.06 30 15.997c0 1.927-.367 3.74-1.102 5.44a14.308 14.308 0 0 1-2.992 4.455 14.036 14.036 0 0 1-4.444 3.005c-1.704.735-3.523 1.103-5.46 1.103ZM16 28.148c3.384 0 6.255-1.18 8.613-3.543 2.357-2.363 3.535-5.23 3.535-8.605 0-3.384-1.178-6.255-3.535-8.613C22.255 5.03 19.384 3.852 16 3.852c-3.374 0-6.243 1.178-8.605 3.535C5.033 9.745 3.852 12.616 3.852 16c0 3.374 1.18 6.242 3.543 8.605 2.362 2.362 5.23 3.543 8.605 3.543Z'/%3e %3c/svg%3e");
}

/* Base */
.global-alert {
  line-height: 1.25rem;
  font-size: 0.875em;
  border-radius: 0;
  border-top-style: solid;
  border-width: 0;
  padding-block: 0.75rem;
}

/* The 1px top rule is only a separator between stacked alerts (QGDS) */
.global-alert:first-child:not(:only-child),
.global-alert + .global-alert {
  border-top-width: 1px;
}

.qld-global-alert-main {
  display: flex;
  column-gap: 1rem;
  align-items: flex-start;
  width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
}

.global-alert-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0.5rem 0;
}

/* QGDS mask-based icon — recoloured via --alert-icon-color per variant */
.global-alert .qld-icon {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  background-color: var(--alert-icon-color, #131212);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.global-alert .qld-icon-alert-information {
  --icon: var(--qgds-icon-alert-information);
}
.global-alert .qld-icon-alert-warning {
  --icon: var(--qgds-icon-alert-warning);
}
.global-alert .qld-icon-alert-danger {
  --icon: var(--qgds-icon-alert-danger);
}
.global-alert .qld-icon-alert-success {
  --icon: var(--qgds-icon-alert-success);
}

/* Content */
.global-alert-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
  padding: 0.5rem 0;
}

@media (min-width: 768px) {
  .global-alert-content {
    flex-direction: row;
    gap: 1rem;
    align-items: flex-start;
  }
}

/* Message text inherits the variant colour. !important + the .global-alert
   prefix raise specificity above the theme's body/heading colour rules. */
.global-alert .global-alert-message,
.global-alert .global-alert-message * {
  color: inherit !important;
}

/* Links inherit the variant colour, underlined (QGDS).
   Specificity must beat bootstrap-overrides.css's body-link rules, the most
   specific of which is `.text-content a:not(.btn):not(.nav-link):not(.caption)
   :not(.views-field-title a)` — that trailing :not() embeds a descendant `a`,
   making it (0,5,2). The `.global-alert` prefix + mirrored :not() chain lands
   these at (0,6,2) so they win. (The block body renders as
   `.text-content.field--name-body`, so both wrappers are covered.) */
.global-alert .global-alert-content a,
.global-alert .global-alert-content a:visited,
.global-alert .field--name-body a:not(.btn):not(.nav-link):not(.caption):not(.views-field-title a),
.global-alert .text-content a:not(.btn):not(.nav-link):not(.caption):not(.views-field-title a) {
  color: inherit !important;
  text-decoration: underline !important;
  text-decoration-color: currentColor !important;
  text-underline-offset: 0.3rem;
  background-color: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.global-alert .global-alert-content a:hover,
.global-alert .global-alert-content a:focus,
.global-alert .field--name-body a:not(.btn):not(.nav-link):not(.caption):not(.views-field-title a):hover,
.global-alert .field--name-body a:not(.btn):not(.nav-link):not(.caption):not(.views-field-title a):focus,
.global-alert .text-content a:not(.btn):not(.nav-link):not(.caption):not(.views-field-title a):hover,
.global-alert .text-content a:not(.btn):not(.nav-link):not(.caption):not(.views-field-title a):focus {
  color: inherit !important;
  text-decoration: none !important;
}

/* Optional action link (QGDS) — supported if an action is ever added */
.global-alert-action {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.global-alert-action a {
  display: flex;
  column-gap: 0.5rem;
  align-items: center;
  font-weight: 600;
  text-wrap: nowrap;
}

/* Variants — QGDS status tokens, resolved to hex */
.global-alert-critical {
  background-color: #e22339; /* status-error-default */
  border-top-color: #8a1220; /* status-error-darker */
  color: #ffffff;
  --alert-icon-color: #ffffff;
}

.global-alert-warning {
  background-color: #ffcc2c; /* status-caution-default */
  border-top-color: #b38800; /* status-caution-darker */
  color: #131212;
  --alert-icon-color: #131212;
}

.global-alert-info {
  background-color: #e5eef5; /* status-info-lighter */
  border-top-color: #006a8f; /* status-info-darker */
  color: #131212;
  --alert-icon-color: #131212;
}

/* QRIDA extension — not a QGDS global-alert variant. Same structure, success
   status tokens, so it sits consistently alongside the official three. */
.global-alert-success {
  background-color: #f2faf4; /* status-success-lighter */
  border-top-color: #0a690d; /* status-success-darker */
  color: #131212;
  --alert-icon-color: #0a690d;
}
