/*
 * WovenFort — AI concierge widget.
 * Behaviour is Portfolio's chat.js, unchanged; the classes below are the ones
 * chat-widget.ejs renders and chat.js creates at runtime, dressed in the design
 * template's tokens (greys, Inter, square corners, pixel accents).
 */
.chat-fab {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 900;
  display: inline-flex; align-items: center; gap: 0.625rem;
  padding: 0.75rem 1.125rem 0.75rem 0.875rem;
  border: 0; border-radius: 999px;
  background: var(--color--gray-900, #111); color: #fff;
  font: 500 0.875rem/1 Inter, sans-serif; letter-spacing: -0.01em;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s;
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab.hidden { opacity: 0; visibility: hidden; transform: translateY(8px); }
.chat-fab__mark { display: inline-flex; }
.chat-fab__logo { display: block; height: 0.9rem; width: auto; }
.chat-fab-badge {
  position: absolute; top: -4px; right: -4px; min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem;
  border-radius: 999px; background: #ef4e3e; color: #fff; font: 600 0.6875rem/1.25rem Inter, sans-serif; text-align: center;
  transform: scale(0); transition: transform 0.2s;
}
.chat-fab-badge.show { transform: scale(1); }

.chat-panel {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 901;
  width: min(24rem, calc(100vw - 2rem)); height: min(36rem, calc(100vh - 3rem));
  display: flex; flex-direction: column;
  background: var(--_themes---palette--background, #fff);
  color: var(--_themes---palette--text-body, #555);
  border: 1px solid var(--_themes---palette--divider, #ddd);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.35);
  font: 400 0.875rem/1.55 Inter, sans-serif;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.chat-panel.open { opacity: 1; visibility: visible; transform: none; }

.chat-head { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.125rem; background: var(--color--gray-900, #111); color: #fff; }
.chat-head-avatar { width: 2.25rem; height: 2.25rem; border-radius: 999px; background: #fff; color: #111; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-head-logo { height: 0.85rem; width: auto; display: block; }
.chat-head-info { flex: 1; min-width: 0; }
.chat-head-title { font-weight: 500; font-size: 0.9375rem; }
.chat-head-sub { font-size: 0.75rem; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-close { border: 0; background: transparent; color: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; opacity: 0.8; }
.chat-close:hover { opacity: 1; }

.chat-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.625rem; background: var(--_themes---palette--layer-soft, #f7f7f7); }
.chat-msg { max-width: 85%; padding: 0.625rem 0.875rem; word-wrap: break-word; }
.chat-msg.bot { align-self: flex-start; background: var(--_themes---palette--background, #fff); color: var(--_themes---palette--text-headings, #111); border: 1px solid var(--_themes---palette--divider, #ddd); }
.chat-msg.user { align-self: flex-end; background: var(--color--gray-900, #111); color: #fff; }
.chat-msg.note { align-self: stretch; max-width: none; font-size: 0.8125rem; text-align: center; color: var(--_themes---palette--text-body, #666); background: transparent; padding: 0.25rem 0.5rem; }
.chat-msg ul { margin: 0.375rem 0; padding-left: 1.1rem; }
.chat-msg a { color: inherit; text-decoration: underline; }

.chat-typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 0.75rem 0.875rem; background: var(--_themes---palette--background, #fff); border: 1px solid var(--_themes---palette--divider, #ddd); }
.chat-typing span { width: 6px; height: 6px; background: currentColor; opacity: 0.35; animation: wf-chat-dot 1s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes wf-chat-dot { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.9; } }

.chat-starters { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.chat-starter {
  border: 1px solid var(--_themes---palette--divider, #ccc); background: var(--_themes---palette--background, #fff);
  color: var(--_themes---palette--text-headings, #111); padding: 0.375rem 0.75rem; border-radius: 999px;
  font: 400 0.8125rem/1.3 Inter, sans-serif; cursor: pointer;
}
.chat-starter:hover { background: var(--_themes---palette--layer-strong, #eee); }

.chat-foot { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--_themes---palette--divider, #ddd); }
.chat-input {
  flex: 1; resize: none; border: 1px solid var(--_themes---palette--divider, #ccc); padding: 0.625rem 0.75rem;
  font: 400 0.875rem/1.4 Inter, sans-serif; color: var(--_themes---palette--text-headings, #111); background: var(--_themes---palette--background, #fff);
  max-height: 6rem;
}
.chat-input:focus { outline: none; border-color: var(--_themes---palette--text-headings, #111); }
.chat-sendbtn { width: 2.5rem; height: 2.5rem; flex-shrink: 0; border: 0; background: var(--color--gray-900, #111); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.chat-sendbtn svg { width: 1.125rem; height: 1.125rem; }
.chat-sendbtn:disabled { opacity: 0.5; cursor: default; }
.chat-handoff { display: block; padding: 0 0.75rem 0.75rem; font-size: 0.8125rem; color: var(--_themes---palette--text-body, #666); text-decoration: none; }
.chat-handoff:hover { color: var(--_themes---palette--text-headings, #111); }
.handoff-row { display: flex; gap: 0.375rem; margin-top: 0.5rem; }
.handoff-row input { flex: 1; min-width: 0; border: 1px solid var(--_themes---palette--divider, #ccc); padding: 0.5rem 0.625rem; font: inherit; }
.handoff-row button { border: 0; background: var(--color--gray-900, #111); color: #fff; padding: 0 0.875rem; cursor: pointer; }

.chat-teaser {
  position: fixed; right: 1.5rem; bottom: 5.25rem; z-index: 899; max-width: 17rem;
  padding: 0.875rem 2rem 0.875rem 1rem; background: var(--_themes---palette--background, #fff);
  border: 1px solid var(--_themes---palette--divider, #ddd); box-shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.35);
  font: 400 0.875rem/1.45 Inter, sans-serif; color: var(--_themes---palette--text-headings, #111); cursor: pointer;
}
.chat-teaser p { margin: 0; }
.chat-teaser-x { position: absolute; top: 0.25rem; right: 0.375rem; border: 0; background: transparent; font-size: 1.125rem; line-height: 1; cursor: pointer; color: inherit; opacity: 0.6; }

@media (max-width: 479px) {
  .chat-fab__label { display: none; }
  .chat-fab { padding: 0.875rem; right: 1rem; bottom: 1rem; }
  .chat-panel { right: 0.5rem; bottom: 0.5rem; width: calc(100vw - 1rem); height: calc(100vh - 1rem); }
}
@media print { .chat-fab, .chat-panel, .chat-teaser { display: none !important; } }
