/* CHAT LINKS -- clickable addresses and unfurled link previews.
   Normal blue links for recognizability, dark-blue cards that still fit the
   Battle Comms panel aesthetic. The card is a link, so hover has to read as
   "this opens something". */

.chat-yell {
  display: inline;
  color: inherit;
  font-size: 1.12em;
  font-weight: 1000;
  letter-spacing: .045em;
  text-transform: uppercase;
  text-shadow: 0 0 8px currentColor;
}

.chat-link {
  color: #72b7ff;
  text-decoration: underline;
  text-decoration-color: rgba(114, 183, 255, .68);
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
  cursor: pointer;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.chat-link:hover,
.chat-link:focus-visible {
  color: #b3d9ff;
  text-decoration-color: #b3d9ff;
  outline: none;
}

.chat-link-preview {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-top: 9px;
  padding: 9px 11px;
  max-width: 460px;
  border: 1px solid #2a3a52;
  border-left: 3px solid #1a73e8;
  background: linear-gradient(180deg, rgba(18, 24, 36, .92), rgba(8, 10, 16, .96));
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.chat-link-preview:hover,
.chat-link-preview:focus-visible {
  border-color: #3b6cb3;
  border-left-color: #2f7de1;
  box-shadow: 0 0 16px rgba(47, 125, 225, .22);
  outline: none;
}
.chat-link-preview:active {
  transform: translateY(1px);
}

.chat-link-preview-image {
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  object-fit: cover;
  background: #020203;
  border: 1px solid #1f2d42;
}

.chat-link-preview-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.chat-link-preview-site {
  color: #7aa7e8;
  font: 800 9px/1.2 var(--font-machine, ui-monospace, monospace);
  letter-spacing: .22em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-link-preview-title {
  color: #f2f7ff;
  font: 800 14px/1.3 var(--font-display, system-ui, sans-serif);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-link-preview-description {
  color: #b8c4d6;
  font: 600 12px/1.45 var(--font-display, system-ui, sans-serif);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-link-preview-open {
  margin-top: 2px;
  color: #72b7ff;
  font: 800 9px/1.2 var(--font-machine, ui-monospace, monospace);
  letter-spacing: .2em;
}

/* PRE-SEND PREVIEW -- lives inside either composer form, above its input. */
.chat-compose-link-preview {
  flex: 1 0 100%;
  width: 100%;
  padding: 0 0 9px;
}
.chat-compose-link-preview[hidden] { display: none !important; }
.chat-compose-link-preview--gm {
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 0 0 8px;
}
.chat-compose-link-preview .chat-link-preview {
  margin: 0;
  max-width: min(560px, 100%);
  border-color: #3d3150;
  border-left-color: #a65be0;
  background: linear-gradient(180deg, rgba(28,20,38,.98), rgba(10,9,15,.98));
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.chat-compose-link-preview--gm .chat-link-preview {
  max-width: 100%;
}
.chat-compose-link-preview .chat-link-preview::before {
  content: "LINK PREVIEW";
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.chat-compose-link-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  padding: 8px 11px;
  border: 1px solid #30273d;
  background: #0c0b10;
  color: #9f8caf;
  font: 800 9px/1 var(--font-machine, ui-monospace, monospace);
  letter-spacing: .18em;
}
.chat-compose-link-loading span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bd69ef;
  box-shadow: 0 0 9px #9e4bd1;
  animation: chat-link-loading 1s ease-in-out infinite alternate;
}
@keyframes chat-link-loading { to { opacity: .3; transform: scale(.7); } }

@media (max-width: 620px) {
  :where(html:not(.asoc-mobile)) .chat-link-preview {
    max-width: 100%;
    gap: 9px;
    padding: 8px 9px;
  }
  :where(html:not(.asoc-mobile)) .chat-link-preview-image {
    width: 64px;
    height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-link,
  .chat-link-preview {
    transition: none;
  }
  .chat-link-preview:active {
    transform: none;
  }
}
