/* Homepage assistant — floating panel */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ddd-chat-root {
  --ddd-chat-w: min(100vw - 1.5rem, 400px);
  --ddd-chat-h: min(70vh, 520px);
  font-family: var(--sans, "IBM Plex Sans", system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.5;
}

.ddd-chat-toggle {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 192, 0.35);
  background: rgba(10, 13, 18, 0.92);
  color: var(--accent, #7dd3c0);
  font-family: var(--mono, "IBM Plex Mono", monospace);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.ddd-chat-toggle:hover {
  border-color: var(--accent, #7dd3c0);
  color: var(--accent-light, #a7f3d0);
  transform: translateY(-1px);
}
.ddd-chat-toggle:focus-visible {
  outline: 2px solid var(--accent, #7dd3c0);
  outline-offset: 3px;
}
.ddd-chat-toggle[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
}

.ddd-chat-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 61;
  width: var(--ddd-chat-w);
  height: var(--ddd-chat-h);
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(14, 18, 24, 0.97);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ddd-chat-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.ddd-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}
.ddd-chat-title {
  font-family: var(--mono, "IBM Plex Mono", monospace);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent, #7dd3c0);
}
.ddd-chat-close {
  border: none;
  background: transparent;
  color: var(--text-muted, #9ca3af);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}
.ddd-chat-close:hover {
  color: var(--text, #e8eaed);
}

.ddd-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.ddd-chat-msg {
  max-width: 92%;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text, #e8eaed);
  white-space: pre-wrap;
  word-break: break-word;
}
.ddd-chat-msg--user {
  align-self: flex-end;
  background: rgba(125, 211, 192, 0.12);
  border: 1px solid rgba(125, 211, 192, 0.2);
}
.ddd-chat-msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.ddd-chat-msg--err {
  align-self: flex-start;
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

/* “Assistant is typing” — three-dot bounce */
.ddd-chat-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 2.25rem;
}
.ddd-chat-typing-label {
  font-size: 0.72rem;
  color: var(--text-muted, #9ca3af);
  letter-spacing: 0.02em;
}
.ddd-chat-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.1rem 0;
}
.ddd-chat-typing-dots span {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--accent, #7dd3c0);
  opacity: 0.35;
  animation: ddd-chat-typing-dot 1.05s ease-in-out infinite;
}
.ddd-chat-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.ddd-chat-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes ddd-chat-typing-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-0.28rem);
    opacity: 1;
  }
}

.ddd-chat-foot {
  padding: 0.65rem 0.85rem 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.ddd-chat-input {
  flex: 1;
  min-height: 2.5rem;
  max-height: 6rem;
  resize: none;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text, #e8eaed);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.55rem 0.65rem;
}
.ddd-chat-input:focus {
  outline: none;
  border-color: rgba(125, 211, 192, 0.45);
}
.ddd-chat-send {
  flex-shrink: 0;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(125, 211, 192, 0.4);
  background: rgba(125, 211, 192, 0.15);
  color: var(--accent, #7dd3c0);
  font-family: var(--mono, "IBM Plex Mono", monospace);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.ddd-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.ddd-chat-disclaimer {
  padding: 0 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ddd-chat-disclaimer .ddd-chat-hint {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}
.ddd-chat-disclaimer .ddd-chat-hint + .ddd-chat-hint {
  margin-top: 0.35rem;
}
.ddd-chat-disclaimer .ddd-chat-hint:last-child {
  padding-bottom: 0.55rem;
}
.ddd-chat-hint {
  padding: 0 1rem 0.5rem;
  font-size: 0.65rem;
  color: var(--text-faint, #4b5563);
  line-height: 1.4;
}
.ddd-chat-hint strong {
  color: var(--text-muted, #9ca3af);
  font-weight: 600;
}

@media (max-width: 480px) {
  .ddd-chat-panel {
    right: 0.5rem;
    bottom: 0.5rem;
    left: 0.5rem;
    width: auto;
    --ddd-chat-h: min(75vh, 560px);
  }
  .ddd-chat-toggle {
    right: 0.5rem;
    bottom: 0.5rem;
  }
}
