@charset "UTF-8";

/* ==========================================================================
   Portfolio assistant (local chatbot)
   ========================================================================== */
.chat-widget {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 45; /* below the sticky header (50), whose stacking context holds the mobile menu */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
}

.chat-launcher {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: 3.25rem;
  padding: 0 1.25rem 0 0.5rem;
  border: 2px solid var(--fg);
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  box-shadow: 0.3rem 0.3rem 0 var(--primary);
  font-weight: 600;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-spring);
}
.chat-launcher:hover { transform: translate(-2px, -2px); box-shadow: 0.5rem 0.5rem 0 var(--primary); }
.launcher-icon { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--primary); }
.launcher-icon svg { width: 1.15rem; height: 1.15rem; stroke: var(--on-primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chat-panel {
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 2rem));
  height: 480px;
  max-height: min(72vh, 560px);
  overflow: hidden;
  border: 2px solid var(--fg);
  border-radius: 1.25rem;
  background: var(--bg);
  box-shadow: 0.5rem 0.5rem 0 var(--fg);
  animation: chat-in 0.25s var(--ease-out);
}
.chat-panel[hidden] { display: none; }
@keyframes chat-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.chat-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem; border-bottom: 2px solid var(--fg); }
.chat-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #1b1b1b;
  color: #f5f5f5;
  font-size: 0.85rem;
  font-weight: 700;
}
:root[data-theme='dark'] .chat-avatar { border: 1px solid var(--light); }
.chat-header h2 { font-size: 1rem; font-weight: 700; }
.chat-header p { display: flex; align-items: center; gap: 0.45rem; color: var(--fg-soft); font-size: 0.75rem; }
.chat-header .pulse-dot { width: 0.45rem; height: 0.45rem; }
.chat-close {
  width: 2rem;
  height: 2rem;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
}
.chat-close:hover { background: var(--fg-faint); }

.chat-messages { display: flex; flex: 1; flex-direction: column; gap: 0.6rem; overflow: auto; padding: 1rem; }
.chat-message { max-width: 88%; padding: 0.6rem 0.85rem; border-radius: 1rem; font-size: 0.875rem; line-height: 1.55; white-space: pre-line; }
.bot-message { align-self: flex-start; border-bottom-left-radius: 0.25rem; background: var(--fg-faint); }
.user-message { align-self: flex-end; border-bottom-right-radius: 0.25rem; background: var(--primary); color: var(--on-primary); }

.chat-quick-replies { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1rem 0.75rem; }
.chat-quick-replies button {
  padding: 0.3rem 0.75rem;
  border: 1.5px solid var(--fg);
  border-radius: 999px;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.chat-quick-replies button:hover { background: var(--fg); color: var(--bg); }

.chat-form { display: flex; gap: 0.5rem; padding: 0.75rem 1rem; border-top: 2px solid var(--fg); }
.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.95rem;
  border: 1.5px solid var(--fg);
  border-radius: 999px;
  background: transparent;
  font-size: 0.875rem;
}
.chat-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.chat-form button { display: grid; flex: none; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: var(--fg); color: var(--bg); }
.chat-form button svg { width: 1.1rem; height: 1.1rem; }
.chat-disclaimer { padding: 0 1rem 0.75rem; color: var(--fg-soft); font-size: 0.6875rem; }

@media (max-width: 767px) {
  .chat-widget { right: 1rem; bottom: 1rem; }
  .chat-launcher { height: 3rem; }
}

@media (max-width: 479px) {
  .chat-launcher .launcher-label { display: none; }
  .chat-launcher { padding: 0 0.45rem; }
}
