/* Chat widget: floating bubble + panel. Reuses --ink/--paper from style.css's
   :root (loaded first) rather than redeclaring the page's palette. z-index: 3
   sits above .content (1) and .reveal-toggle (2) — the only other fixed UI
   chrome on the page. */

.chat-bubble {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 3;
  width: 3.25rem;
  height: 3.25rem;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

.chat-bubble:hover {
  transform: scale(1.05);
}

.chat-bubble .material-symbols-outlined {
  font-size: 26px;
}

.chat-panel {
  position: fixed;
  right: 1.5rem;
  bottom: 5.25rem;
  z-index: 3;
  width: min(360px, calc(100vw - 3rem));
  max-height: min(560px, calc(100vh - 8rem));
  display: flex;
  flex-direction: column;
  background: #0c0c0c;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  font-family: system-ui, sans-serif;
}

.chat-panel[hidden] {
  display: none;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: #161616;
  color: var(--ink);
  font-size: 0.95rem;
}

.chat-close {
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 160px;
}

.chat-msg {
  max-width: 85%;
  padding: 0.55rem 0.8rem;
  border-radius: 0.9rem;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-visitor {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 0.25rem;
}

.chat-msg-tomas {
  align-self: flex-start;
  background: #262626;
  color: var(--ink);
  border-bottom-left-radius: 0.25rem;
}

.chat-msg-system {
  align-self: center;
  background: transparent;
  color: #999;
  font-size: 0.8rem;
  text-align: center;
}

.chat-contact-prompt {
  padding: 0.75rem 1rem;
  background: #161616;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-contact-prompt[hidden] {
  display: none;
}

.chat-contact-prompt p {
  margin: 0 0 0.5rem;
  color: #ccc;
  font-size: 0.82rem;
}

.chat-contact-prompt form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-contact-prompt input[type='text'] {
  padding: 0.5rem 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0c0c0c;
  color: var(--ink);
  font-size: 0.85rem;
}

.chat-contact-prompt button {
  align-self: flex-end;
  padding: 0.4rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font-size: 0.85rem;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-row textarea {
  flex: 1;
  resize: none;
  max-height: 6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0c0c0c;
  color: var(--ink);
  font-family: system-ui, sans-serif;
  font-size: 0.9rem;
}

.chat-input-row button {
  border: none;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* Honeypot fields (chat.js's chatMessageWebsite/chatWebsite): off-screen but
   present in the DOM and tab-order-excluded, same convention as party's
   .hp-field — a real visitor never touches these, a bot filling out every
   field will. */
.chat-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 600px) {
  .chat-panel {
    right: 0.75rem;
    bottom: 4.75rem;
  }

  .chat-bubble {
    right: 0.9rem;
    bottom: 0.9rem;
  }
}
