/* Floating portfolio chat — uses site CSS variables */

.cb-root {
  position: fixed;
  right: clamp(16px, 3vw, 24px);
  bottom: clamp(16px, 3vw, 24px);
  z-index: 1000;
  font-family: var(--mono);
}

.cb-bubble {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  box-shadow: 0 10px 34px color-mix(in oklab, var(--ink) 26%, transparent);
  transition: transform 120ms ease;
}
.cb-bubble:hover { transform: translateY(-1px); }
.cb-bubble-prompt { color: var(--accent); font-weight: 700; }
.cb-bubble-cursor { animation: cb-blink 1.1s infinite steps(1); margin-left: 2px; }
@keyframes cb-blink { 50% { opacity: 0; } }

.cb-panel {
  width: min(400px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 100px));
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--rad);
  box-shadow: 0 24px 60px color-mix(in oklab, var(--ink) 18%, transparent);
  font-size: 12.5px;
  overflow: hidden;
}

.cb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-2);
  flex-shrink: 0;
}
.cb-head-title { font-weight: 600; font-size: 12px; }
.cb-head-sep { color: var(--mute); font-weight: 400; }
.cb-close {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--mute);
  padding: 0 4px;
}
.cb-close:hover { color: var(--ink); }

.cb-sub {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 10px;
  color: var(--mute);
  border-bottom: 1px dashed var(--line-2);
  flex-shrink: 0;
}

.cb-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scroll-behavior: smooth;
}

.cb-greet { margin-bottom: 12px; }
.cb-greet p { margin: 0 0 10px; color: var(--ink-2); line-height: 1.55; font-size: 12.5px; }
.cb-greet .cb-mcp-link {
  display: inline;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cb-greet .cb-mcp-link:hover {
  color: var(--ink);
  text-decoration-thickness: 2px;
}
.cb-greet .cb-mcp-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.cb-suggest-label { font-size: 10px; color: var(--mute); margin-bottom: 6px; }
.cb-chips { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.cb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  background: color-mix(in oklab, var(--accent) 8%, var(--bg-elev));
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
}
.cb-chip:hover { background: var(--accent-soft); }

.cb-msg { margin-bottom: 14px; }
.cb-msg-user .cb-msg-line { color: var(--mute); font-size: 10px; margin-bottom: 4px; }
.cb-msg-user .cb-msg-text { font-size: 12.5px; color: var(--ink); white-space: pre-wrap; }
.cb-msg-bot .cb-msg-line { color: var(--accent); font-size: 10px; font-weight: 700; margin-bottom: 4px; }
.cb-msg-md {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.55;
  word-wrap: break-word;
}
.cb-msg-md p { margin: 0 0 0.65em; }
.cb-msg-md p:last-child { margin-bottom: 0; }
.cb-msg-md strong { font-weight: 600; color: var(--ink); }
.cb-msg-md ul,
.cb-msg-md ol { margin: 0.35em 0 0.65em 1.15em; padding: 0; }
.cb-msg-md li { margin-bottom: 0.35em; }
.cb-msg-md li:last-child { margin-bottom: 0; }
.cb-msg-md a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.cb-msg-md h1,
.cb-msg-md h2,
.cb-msg-md h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0.85em 0 0.4em;
  line-height: 1.3;
}
.cb-msg-md h1:first-child,
.cb-msg-md h2:first-child,
.cb-msg-md h3:first-child { margin-top: 0; }
.cb-msg-md hr { border: none; border-top: 1px solid var(--line-2); margin: 0.75em 0; }
.cb-msg-md blockquote {
  margin: 0.5em 0;
  padding-left: 0.75em;
  border-left: 3px solid var(--line-2);
  color: var(--ink-2);
}
.cb-msg-md code {
  font-family: var(--mono);
  font-size: 11px;
  background: color-mix(in oklab, var(--ink) 6%, transparent);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.cb-msg-md pre {
  margin: 0.5em 0;
  padding: 8px 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 11px;
  background: color-mix(in oklab, var(--ink) 6%, transparent);
  border-radius: var(--rad);
  border: 1px solid var(--line-2);
}
.cb-msg-md pre code { background: none; padding: 0; font-size: inherit; }
.cb-msg-md table { border-collapse: collapse; font-size: 11.5px; margin: 0.5em 0; width: 100%; }
.cb-msg-md th,
.cb-msg-md td { border: 1px solid var(--line-2); padding: 4px 6px; text-align: left; vertical-align: top; }
.cb-msg-md th { background: color-mix(in oklab, var(--ink) 5%, transparent); font-weight: 600; }

.cb-err {
  padding: 8px 10px;
  background: color-mix(in oklab, #dc2626 10%, var(--bg-elev));
  border: 1px solid color-mix(in oklab, #dc2626 35%, transparent);
  border-radius: var(--rad);
  font-size: 11.5px;
  color: var(--ink);
  margin-bottom: 10px;
}

.cb-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line-2);
  flex-shrink: 0;
}
.cb-foot-prefix { color: var(--accent); font-weight: 700; font-size: 12px; }
.cb-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  min-width: 0;
}
.cb-input::placeholder { color: var(--mute-2); }
.cb-send {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  padding: 4px;
}
.cb-send:disabled { opacity: 0.35; cursor: not-allowed; }

.cb-statusbar {
  display: flex;
  justify-content: space-between;
  padding: 4px 12px;
  font-size: 9px;
  color: var(--mute);
  border-top: 1px dashed var(--line-2);
  flex-shrink: 0;
}
.cb-statusbar span:first-child { color: var(--accent); }

.cb-typing { color: var(--mute); font-size: 12px; margin: 8px 0; }

@media (prefers-reduced-motion: reduce) {
  .cb-bubble-cursor { animation: none; }
}
