/* Converse.js 14.0.1: keep local styles separate from the vendor bundle. */
.hollowness-chat .conversejs {
  --hl-font: system-ui, "Segoe UI", sans-serif;
  --hl-surface: #fff;
  --hl-history: #e7edf3;
  --hl-incoming: #fff;
  --hl-outgoing: #d9edff;
  --hl-text: #172635;
  --hl-muted: #536c81;
  --hl-accent: #1465a3;
  --hl-edge: #d1dde7;
  --hl-quote: #eaf3fb;
  --hl-quote-outgoing: #c8e2f8;
  --hl-selection: #dcecf9;
  --hl-hover: #edf4fa;
  --normal-font: var(--hl-font);
  --heading-font: var(--hl-font);
  --avatar-border-radius: 50%;
}

.hollowness-chat .conversejs:is([data-converse-theme="dracula"], [data-converse-theme="cyberpunk"]) {
  --hl-surface: #17212b;
  --hl-history: #101923;
  --hl-incoming: #182633;
  --hl-outgoing: #294e70;
  --hl-text: #edf4fb;
  --hl-muted: #a5bad0;
  --hl-accent: #80c6ff;
  --hl-edge: #263849;
  --hl-quote: #203547;
  --hl-quote-outgoing: #213e59;
  --hl-selection: #294b68;
  --hl-hover: #202f3e;
}

.hollowness-chat .conversejs :is(#controlbox, .chatbox) {
  --background-color: var(--hl-surface);
  --foreground-color: var(--hl-text);
  --text-color: var(--hl-text);
  --chat-color: var(--hl-accent);
  --muc-color: var(--hl-accent);
  --chat-header-fg-color: var(--hl-text);
  --muc-header-fg-color: var(--hl-text);
  --link-color: var(--hl-accent);
  --link-color-hover: var(--hl-accent);
  --controlbox-color: var(--hl-edge);
  --secondary-color: var(--hl-muted) !important;
  --highlight-color: var(--hl-selection);
  --highlight-color-hover: var(--hl-hover);
  --chat-separator-border-bottom: 0;
}

.hollowness-chat .conversejs #controlbox :is(.controlbox-heading .list-toggle, .roster-group .group-toggle) {
  color: var(--hl-muted);
  font: 600 0.8125rem/1.4 var(--hl-font);
  letter-spacing: 0;
  text-transform: none;
}

.hollowness-chat .conversejs .chatbox :is(.chat-head, converse-chat-toolbar) {
  background-color: var(--hl-surface);
  border-color: var(--hl-edge);
}

.hollowness-chat .conversejs .chatbox :is(.bottom-panel, converse-muc-bottom-panel) .chat-message-form {
  border-block-start: 1px solid var(--hl-edge) !important;
}

/* Converse 14.0.1 renders the direct chat reply preview in both the panel and the form. */
.hollowness-chat .conversejs converse-chat-bottom-panel > converse-reply-preview:has(~ converse-message-form) {
  display: none;
}

.hollowness-chat .conversejs .chatbox .chat-content {
  background-color: var(--hl-history);
}

.hollowness-chat .conversejs .chat-content__messages > converse-message-history {
  align-self: flex-start;
  inline-size: min(100%, 64rem);
}

.hollowness-chat .conversejs .chat-content .message:is(.date-separator, .separator) .separator-text {
  background-color: var(--hl-quote);
  border-radius: 999px;
  color: var(--hl-muted);
  font-size: 0.8125rem;
}

.hollowness-chat .conversejs .chat-content .message:is(.date-separator, .separator) hr.separator {
  border: 0;
}

.hollowness-chat .conversejs .message.chat-msg:not(.chat-msg--action) {
  display: flex;
  align-items: flex-end;
  padding: 3px 12px;
}

.hollowness-chat .conversejs .message.chat-msg:not(.chat-msg--action, .correcting):hover {
  background-color: transparent;
}

.hollowness-chat .conversejs .message.chat-msg:not(.chat-msg--action) > .show-msg-author-modal {
  align-self: flex-end;
  flex: none;
  margin-inline-end: 8px;
}

.hollowness-chat .conversejs .message.chat-msg:not(.chat-msg--action) > a[id]:empty {
  align-self: flex-start;
}

.hollowness-chat .conversejs .message.chat-msg:not(.chat-msg--action) .chat-msg__content {
  --hl-bubble-quote: var(--hl-quote);
  width: fit-content;
  min-width: 0;
  max-width: min(calc(100% - 48px), 42rem);
  margin-inline-start: 0;
  padding: 7px 10px;
  border-radius: 15px 15px 15px 4px;
  background: var(--hl-incoming);
  color: var(--hl-text);
  overflow-wrap: anywhere;
}

.hollowness-chat .conversejs .message.chat-msg--with-avatar.chat-msg--followup:not(.chat-msg--action)
  .chat-msg__content:not(.chat-msg__content--me) {
  margin-inline-start: 48px;
}

.hollowness-chat .conversejs .message.chat-msg:not(.chat-msg--action) > .chat-msg__content--me {
  --hl-bubble-quote: var(--hl-quote-outgoing);
  margin-inline-start: auto;
  border-radius: 15px 15px 4px 15px;
  background: var(--hl-outgoing);
}

.hollowness-chat .conversejs .message.chat-msg:not(.chat-msg--action):has(> .chat-msg__content--me)
  > .show-msg-author-modal {
  display: none;
}

.hollowness-chat .conversejs .message.chat-msg .chat-msg__heading {
  margin-bottom: 2px;
}

.hollowness-chat .conversejs .message.chat-msg .chat-msg__author {
  font-size: 0.875rem;
}

.hollowness-chat .conversejs .message.chat-msg .chat-msg__time {
  color: var(--hl-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.hollowness-chat .conversejs .message.chat-msg .chat-msg__body .chat-msg__text {
  min-width: 0;
}

.hollowness-chat .conversejs .message.chat-msg:not(.chat-msg--action) .chat-msg__body {
  flex-direction: column;
}

.hollowness-chat .conversejs .message.chat-msg .chat-msg__reply-context {
  min-width: 0;
  border-radius: 6px;
  background: var(--hl-bubble-quote, var(--hl-quote));
}

.hollowness-chat .conversejs .message.chat-msg .chat-msg__reply-context:hover {
  background: var(--hl-selection);
}

.hollowness-chat .conversejs .message.chat-msg .chat-image {
  border-radius: 9px;
  max-height: 24rem;
}

.hollowness-chat .conversejs .message.chat-msg .chat-msg__reactions {
  margin-block: 6px 0;
}

.hollowness-chat .conversejs .chat-msg converse-message-actions:has(.hl-message-shortcuts) {
  display: flex;
  align-self: flex-end;
  align-items: center;
  margin: 2px 0 0;
}

.hollowness-chat .hl-message-shortcuts {
  display: inline-flex;
  order: -1;
}

.hollowness-chat .chat-msg:has(.hl-message-shortcuts) :is(.hl-message-shortcuts button, .chat-msg__actions > .btn--standalone) {
  display: inline-grid;
  place-items: center;
  inline-size: 32px;
  block-size: 32px;
  border: 0;
  border-radius: 8px;
  margin: 0;
  padding: 0;
  background: var(--hl-surface);
  color: var(--hl-muted);
  opacity: 1;
}

.hollowness-chat .chat-msg:has(.hl-message-shortcuts) :is(.hl-message-shortcuts button, .chat-msg__actions > .btn--standalone):hover {
  background: var(--hl-selection);
  color: var(--hl-accent);
}

.hollowness-chat .hl-message-shortcuts button:focus-visible {
  outline: 2px solid var(--hl-accent);
  outline-offset: -2px;
}

/* The native picker opens below/above its button. Keep it inside the history horizontally. */
.hollowness-chat .chat-msg:has(.hl-message-shortcuts) .reaction-picker {
  inset-inline-start: 0 !important;
  inset-inline-end: auto !important;
  max-inline-size: calc(100vw - 76px);
  flex-wrap: wrap;
}

.hollowness-chat .chat-msg__content--me:has(.hl-message-shortcuts) .reaction-picker {
  inset-inline-start: auto !important;
  inset-inline-end: 0 !important;
}

.hollowness-chat .chat-msg .reaction-picker .dropdown-menu {
  max-inline-size: min(22rem, calc(100vw - 12px));
}

@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .hollowness-chat .conversejs .message.chat-msg:not(.chat-msg--action) .chat-msg__content {
    max-width: min(calc(100% - 10rem), 72%, 42rem);
  }

  .hollowness-chat .conversejs .chat-msg:not(.chat-msg--action) converse-message-actions:has(.hl-message-shortcuts) {
    display: contents;
  }

  .hollowness-chat .chat-msg:not(.chat-msg--action) :is(.hl-message-shortcuts, .chat-msg__actions:has(~ .hl-message-shortcuts)) {
    --hl-action-offset: 16px;
    position: absolute;
    inset-block-start: -4px;
    inset-inline-start: calc(100% + var(--hl-action-offset));
    opacity: 0;
    pointer-events: none;
  }

  .hollowness-chat .chat-msg:not(.chat-msg--action) .chat-msg__actions:has(~ .hl-message-shortcuts) {
    --hl-action-offset: 80px;
  }

  .hollowness-chat .chat-msg:not(.chat-msg--action) .chat-msg__content--me
    :is(.hl-message-shortcuts, .chat-msg__actions:has(~ .hl-message-shortcuts)) {
    inset-inline-start: auto;
    inset-inline-end: calc(100% + var(--hl-action-offset));
  }

  .hollowness-chat .chat-msg:is(:hover, :focus-within, :has(.reaction-picker, .chat-msg__actions .show))
    :is(.hl-message-shortcuts, .chat-msg__actions:has(~ .hl-message-shortcuts)) {
    opacity: 1;
    pointer-events: auto;
  }
}
