/* Discord-style chat component (see src/_includes/components/discord-chat.vto).
   Fixed Discord dark palette so the chat reads as Discord on either site
   theme; surrounding chrome (toolbar, captions) uses the site tokens. */

.discord-demo {
  --dc-bg: #313338;
  --dc-hover: #2e3035;
  --dc-text: #dbdee1;
  --dc-muted: #949ba4;
  --dc-faint: #80848e;
  --dc-line: #26282c;
  --dc-embed: #2b2d31;
  --dc-input: #383a40;
  --dc-red: #f23f42;
  --dc-danger: #da373c;
  --dc-green: #23a55a;
  --dc-brand: #7f2aff;
  --dc-brand-deep: #5300d4;
}

/* Toolbar (replay) ----------------------------------------------------- */

.discord-demo-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.discord-demo-replay {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.discord-demo-replay:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.discord-demo-replay svg {
  width: 14px;
  height: 14px;
}

.discord-demo-caption {
  margin: 12px 2px 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* Frame -------------------------------------------------------------- */

.dc-frame {
  display: none;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--dc-bg);
  box-shadow: var(--shadow-2);
}

.dc-frame.is-active {
  display: block;
  animation: dc-frame-in 0.35s ease both;
}

@keyframes dc-frame-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.dc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--dc-line);
  background: var(--dc-bg);
}

.dc-header-icon {
  flex: none;
  color: var(--dc-faint);
}

.dc-header-title {
  color: #f2f3f5;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.dc-header-divider {
  color: var(--dc-line);
  font-weight: 500;
}

.dc-header-topic {
  color: var(--dc-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dc-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--dc-muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.dc-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dc-green);
  box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.5);
  animation: dc-pulse 2.4s infinite;
}

@keyframes dc-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.45);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(35, 165, 90, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(35, 165, 90, 0);
  }
}

/* Message list ------------------------------------------------------- */

.dc-list {
  list-style: none;
  margin: 0;
  padding: 16px 12px 10px;
  height: 460px;
  max-height: 62vh;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--dc-bg);
}

.dc-list::-webkit-scrollbar {
  display: none;
}

.dmsg {
  display: flex;
  gap: 14px;
  padding: 4px 8px 8px;
  border-radius: 6px;
  animation: dc-msg-in 0.24s ease both;
}

@keyframes dc-msg-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}

.dmsg-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 17px;
  font-weight: 600;
  user-select: none;
}

.dmsg-avatar-bot {
  /* Light circle so the dark-purple mark (mark.svg) reads against the
     fixed Discord dark chat background. */
  background: #f2effa;
}

.dmsg-avatar-bot svg {
  width: 22px;
  height: 22px;
}

.dmsg-avatar-sm {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.dmsg-avatar-sm svg {
  width: 11px;
  height: 11px;
}

.dmsg-body {
  min-width: 0;
  flex: 1;
}

.dmsg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.dmsg-author {
  color: var(--u, var(--dc-text));
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.dmsg-bot-tag {
  align-self: center;
  flex: none;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--dc-brand);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.dmsg-time {
  color: var(--dc-muted);
  font-size: 12px;
  font-weight: 400;
}

.dmsg-content {
  color: var(--dc-text);
  font-size: 15px;
  line-height: 1.45;
  word-break: break-word;
}

.dmsg.is-violation {
  animation: dc-flash 1.5s ease both, dc-msg-in 0.24s ease both;
}

@keyframes dc-flash {
  0% {
    background: rgba(242, 63, 66, 0.3);
    box-shadow: inset 3px 0 0 var(--dc-red);
  }
  100% {
    background: transparent;
    box-shadow: inset 3px 0 0 transparent;
  }
}

.dmsg.is-deleted .dmsg-author {
  text-decoration: line-through;
}

.dmsg.is-deleted .dmsg-content {
  color: var(--dc-muted);
  text-decoration: line-through;
}

.dc-edited {
  margin-left: 4px;
  color: var(--dc-muted);
  font-size: 12px;
  font-weight: 400;
}

/* System messages ----------------------------------------------------- */

.dmsg-system {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 2px 0;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--dc-text);
  font-size: 14px;
  font-style: italic;
}

.dmsg-system-icon {
  flex: none;
  align-self: center;
  color: var(--dc-faint);
}

.dmsg-system-author,
.dmsg-system strong {
  color: var(--dc-text);
  font-style: normal;
  font-weight: 600;
}

/* Divider (date separator) -------------------------------------------- */

.dmsg-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 4px;
  color: var(--dc-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.dmsg-divider::before,
.dmsg-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(148, 155, 164, 0.24);
}

/* Embeds -------------------------------------------------------------- */

.dmsg-embed {
  display: flex;
  margin-top: 4px;
  max-width: 30rem;
  background: var(--dc-embed);
  border-radius: 4px;
}

.dmsg-embed-bar {
  flex: none;
  width: 4px;
  border-radius: 4px 0 0 4px;
  background: var(--embed, var(--dc-brand));
}

.dmsg-embed-body {
  padding: 10px 14px 12px 12px;
}

.dmsg-embed-author {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  color: var(--dc-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.dmsg-embed-author .dmsg-avatar-sm {
  width: 18px;
  height: 18px;
}

.dmsg-embed-title {
  margin-bottom: 4px;
  color: var(--dc-text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.dmsg-embed-desc {
  color: var(--dc-text);
  font-size: 14px;
  line-height: 1.45;
}

.dmsg-embed-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  color: var(--dc-muted);
  font-size: 12px;
}

/* Confirm repair button (the admin-gated wipe) ------------------------ */

.dmsg-embed-actions {
  margin-top: 10px;
}

.dmsg-embed-button {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 4px;
  background: var(--dc-danger);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}

.dmsg-embed-button.is-pressed {
  background: #8f2022;
  transform: translateY(1px);
}

/* Typing indicator ---------------------------------------------------- */

.dc-typing {
  align-items: center;
  padding: 6px 8px;
  animation: dc-msg-in 0.2s ease both;
}

.dc-typing-balls {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--dc-embed);
}

.dc-typing-balls i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dc-muted);
  animation: dc-bounce 1.2s ease-in-out infinite;
}

.dc-typing-balls i:nth-child(2) {
  animation-delay: 0.15s;
}

.dc-typing-balls i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dc-bounce {
  0%,
  60%,
  100% {
    transform: none;
  }
  30% {
    transform: translateY(-4px);
  }
}

/* Inline code in messages (admin commands) ---------------------------- */

.dmsg-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 4px;
  padding: 1px 6px;
  color: #f0eeee;
}

/* Editor bar ---------------------------------------------------------- */

.dc-editor {
  padding: 0 16px 16px;
  background: var(--dc-bg);
}

.dc-editor-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--dc-input);
  color: var(--dc-faint);
  font-size: 14px;
}

.dc-editor-plus {
  color: var(--dc-faint);
}

/* Mini variant ----------------------------------------------------------
   A single scene with no tabs, used to illustrate each landing feature row.
   Compact chrome and type so the chat reads at card size; the surrounding
   tokens (shadow, focus, hover) stay on the site palette. */

.discord-demo--mini .dc-frame {
  box-shadow: var(--shadow-1);
}

.discord-demo--mini .dc-list {
  height: 240px;
  max-height: none;
  padding: 8px 10px 6px;
}

.discord-demo--mini .dc-header {
  height: 38px;
  padding: 0 14px;
}

.discord-demo--mini .dc-header-title {
  font-size: 14px;
}

.discord-demo--mini .dc-header-topic {
  font-size: 12.5px;
}

.discord-demo--mini .dc-status {
  font-size: 12px;
}

.discord-demo--mini .dmsg {
  gap: 10px;
  padding: 3px 6px 6px;
}

.discord-demo--mini .dmsg-avatar {
  width: 26px;
  height: 26px;
  font-size: 13px;
}

.discord-demo--mini .dmsg-avatar-bot svg {
  width: 16px;
  height: 16px;
}

.discord-demo--mini .dmsg-avatar-sm,
.discord-demo--mini .dmsg-embed-author .dmsg-avatar-sm {
  width: 14px;
  height: 14px;
  font-size: 8px;
}

.discord-demo--mini .dmsg-avatar-sm svg {
  width: 8px;
  height: 8px;
}

.discord-demo--mini .dmsg-author {
  font-size: 14px;
}

.discord-demo--mini .dmsg-time {
  font-size: 11px;
}

.discord-demo--mini .dmsg-content {
  font-size: 14px;
}

.discord-demo--mini .dmsg-system {
  padding: 4px 6px;
  font-size: 13px;
}

.discord-demo--mini .dmsg-divider {
  margin: 6px 0 2px;
  font-size: 11.5px;
}

.discord-demo--mini .dmsg-embed {
  max-width: 26rem;
}

.discord-demo--mini .dmsg-embed-body {
  padding: 8px 12px 10px 10px;
}

.discord-demo--mini .dmsg-embed-title {
  font-size: 14px;
}

.discord-demo--mini .dmsg-embed-desc {
  font-size: 13px;
}

.discord-demo--mini .dmsg-embed-footer {
  margin-top: 7px;
  font-size: 11.5px;
}

.discord-demo--mini .dmsg-embed-button {
  padding: 5px 12px;
  font-size: 12.5px;
}

.discord-demo--mini .dc-typing-balls {
  padding: 7px 9px;
}

.discord-demo--mini .dc-typing-balls i {
  width: 5px;
  height: 5px;
}

.discord-demo--mini .dc-editor {
  padding: 0 14px 10px;
}

.discord-demo--mini .dc-editor-inner {
  padding: 7px 12px;
  font-size: 13px;
}

/* Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .dc-frame.is-active,
  .dmsg,
  .dmsg.is-violation,
  .dc-status-dot,
  .dc-typing-balls i {
    animation: none;
  }

  .dmsg.is-violation {
    background: transparent;
  }
}