/**
 * @file
 * System messages: the glow, close button and fade from js/bdc-messages.js,
 * and room beside the coach column.
 *
 * Every rule keys on .bdc-message, which only the script adds, so without
 * JavaScript messages look exactly as each theme draws them.
 */

.bdc-message {
  position: relative;
  padding-right: 44px;
}

/* Close ------------------------------------------------------------------ */

.bdc-message__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 22px;
  line-height: 28px;
  text-align: center;
  opacity: 0.6;
  cursor: pointer;
}

.bdc-message__close:hover,
.bdc-message__close:focus-visible {
  background: rgba(15, 23, 42, 0.08);
  opacity: 1;
}

.bdc-message__close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 1px;
}

/* Arrival: a slow glow ---------------------------------------------------
 *
 * The message's own color lightens and returns, once. Nothing moves or
 * changes size. A white layer fades in to 80% and back out: mixing in white
 * lightens and softens any color, so it works on a pale message and on a dark
 * one alike. The layer sits behind the text (negative z-index inside the box's
 * own stacking context, from isolation), so the words never wash out.
 */

.bdc-message {
  isolation: isolate;
}

.bdc-message--emphasis::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: #FFFFFF;
  opacity: 0;
  pointer-events: none;
  animation: bdc-message-glow 2.4s ease-in-out;
}

@keyframes bdc-message-glow {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 0.8;
  }
}

/* Departure: fade while folding away -------------------------------------
 *
 * The message fades as it shrinks to nothing, top edge fixed, so whatever is
 * below glides up into its place instead of jumping. The script sets the
 * starting height and then 0 on the next frame.
 */

.bdc-message--leaving {
  /* The script's starting height is the box's full outer height, so it must
     count padding and border; otherwise the box would grow by its padding on
     the first frame, nudging the page down before it slides up. */
  box-sizing: border-box;
  overflow: hidden;
  opacity: 0;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-top-width: 0 !important;
  border-bottom-width: 0 !important;
  transition:
    opacity 0.5s ease,
    height 0.6s ease-in-out,
    margin 0.6s ease-in-out,
    padding 0.6s ease-in-out,
    border-width 0.6s ease-in-out;
}

/* Beside the coach --------------------------------------------------------
 *
 * The coach column is fixed over the right of the page, so a full-width
 * message ran underneath it. Where the coach column is showing, messages take
 * the workbook column's width instead. The messages region sits in the same
 * container as the page content, so the same widths line them up exactly.
 * Below these breakpoints the coach is a full-screen panel of its own and
 * messages keep the full width.
 */

/* Control Panel: the workbook column is 50% wide, capped at 940px, from
   1200px up (css/bdc-cp-layout.css, bdc-control-panel.css). */
@media (min-width: 1200px) {
  body:has(.bdc-cp-layout__right) [data-drupal-messages],
  body:has(.bdc-cp-layout__right) .region-highlighted .messages:not([data-drupal-messages] *) {
    width: 50%;
    max-width: 940px;
  }
}

/* BizDev Planner: the coach is a 600px column from 768px up and the questions
   column is calc(100% - 600px) beside it (css/dashboard.css). */
@media (min-width: 768px) {
  body.path-bizdevplanner:has(.bdc-mq-chatbot) [data-drupal-messages],
  body.path-bizdevplanner:has(.bdc-mq-chatbot) .region-highlighted .messages:not([data-drupal-messages] *) {
    max-width: calc(100% - 600px);
  }
}
