/* Ask Nitin — chat widget. Uses only the site's CSS variables, so light/dark follow the theme toggle. */

.chat-fab {
  position: fixed; right: clamp(16px, 3vw, 28px); bottom: clamp(16px, 3vw, 28px); z-index: 40;
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .75rem 1.15rem; border-radius: 99px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--bg); font: 500 .92rem var(--sans); cursor: pointer;
  box-shadow: 0 10px 30px rgb(0 0 0 / .18); transition: transform .15s;
}
.chat-fab:hover { transform: translateY(-1px); }
.chat-fab .dot { width: 8px; height: 8px; }
.chat-fab[aria-expanded="true"] { display: none; }

.chat-panel {
  position: fixed; right: clamp(16px, 3vw, 28px); bottom: clamp(16px, 3vw, 28px); z-index: 41;
  width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 110px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px); box-shadow: 0 20px 50px rgb(0 0 0 / .22);
}
.chat-panel[hidden] { display: none; }

.chat-head { display: flex; align-items: flex-start; gap: .75rem; padding: 1rem 1.1rem .85rem; border-bottom: 1px solid var(--line); }
.chat-head h2 { font-size: 1.2rem; }
.chat-head p { margin: .15rem 0 0; font-size: .72rem; color: var(--muted); }
.chat-close {
  margin-left: auto; flex: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  background: none; border: 1px solid var(--line); color: var(--ink); font-size: 1.1rem; line-height: 1;
}
.chat-close:hover { border-color: var(--ink-2); }

.chat-log { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .75rem; }
.chat-msg { max-width: 88%; padding: .65rem .85rem; border-radius: 12px; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.chat-msg.user { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.error { align-self: flex-start; background: var(--fail-soft); color: var(--fail); border: 1px solid transparent; }
.chat-msg .cite { font-size: .7em; }

.chat-typing { display: inline-flex; gap: 4px; padding: .2rem 0; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: chat-blink 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chat-intro { margin: 0; font-size: .88rem; color: var(--ink-2); }
.chat-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: .45rem; }
.chat-suggest button {
  font: inherit; font-size: .84rem; text-align: left; cursor: pointer; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: .45rem .85rem;
}
.chat-suggest button:hover { border-color: var(--accent); background: var(--accent-soft); }

.chat-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--line); background: var(--surface); }
.chat-form textarea {
  flex: 1; resize: none; font: inherit; font-size: .9rem; line-height: 1.4; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .75rem; max-height: 120px;
}
.chat-form textarea:focus { outline: none; border-color: var(--accent); }
.chat-send {
  flex: none; align-self: flex-end; height: 40px; padding: 0 1rem; border-radius: 99px; cursor: pointer;
  background: var(--ink); color: var(--bg); border: 1px solid var(--ink); font: 500 .88rem var(--sans);
}
.chat-send:disabled { opacity: .45; cursor: default; }
.chat-foot { margin: 0; padding: 0 1rem .7rem; font-size: .68rem; color: var(--muted); background: var(--surface); }

.chat-pop { z-index: 60; max-width: min(320px, calc(100vw - 24px)); }

@media (prefers-reduced-motion: reduce) { .chat-typing span { animation: none; opacity: .6; } }
@media (max-width: 640px) {
  .chat-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; max-height: none; border-radius: 0; border: 0; }
  .chat-msg { max-width: 92%; }
}

/* citation chips: the site's .cite style, on a <button> */
.chat-cite { background: none; border: 0; margin: 0; font: inherit; font-family: var(--mono); font-size: .72em; color: var(--accent); vertical-align: super; cursor: help; padding: 0 2px; border-radius: 4px; line-height: 1; }
.chat-pop strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* tool results: contact buttons and the subtle "used" line */
.chat-contact { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .65rem; }
.chat-contact .btn { padding: .4rem .75rem; font-size: .8rem; }
.chat-tools { align-self: flex-start; margin: -.4rem 0 0 .25rem; font-size: .68rem; color: var(--muted); }

/* tabs */
.chat-tabs { display: flex; gap: .25rem; padding: .5rem .75rem 0; border-bottom: 1px solid var(--line); }
.chat-tabs button {
  font: 500 .82rem var(--sans); color: var(--ink-2); background: none; border: 0; cursor: pointer;
  padding: .45rem .7rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.chat-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.chat-panel.wide { width: min(640px, calc(100vw - 32px)); height: min(720px, calc(100vh - 110px)); }
.chat-log[hidden], .chat-form[hidden], .chat-fit[hidden] { display: none; }

/* job fit */
.chat-fit { position: relative; flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 1rem; }
.fit-form { display: flex; flex-direction: column; gap: .5rem; }
.fit-label { font-size: .86rem; color: var(--ink-2); }
.fit-form textarea {
  font: inherit; font-size: .86rem; line-height: 1.45; color: var(--ink); background: var(--bg); resize: vertical;
  border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem; min-height: 9rem;
}
.fit-form textarea:focus { outline: none; border-color: var(--accent); }
.fit-actions { display: flex; align-items: center; justify-content: space-between; }
.fit-count { font-size: .7rem; color: var(--muted); }
.fit-loading { display: flex; align-items: center; gap: .6rem; font-size: .78rem; color: var(--muted); margin: 0; }
.fit-summary { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.fit-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.fit-title h3 { font-size: 1.15rem; }
.fit-summary p { margin: .5rem 0 0; font-size: .88rem; color: var(--ink-2); }
.fit-summary .fit-tally { font-size: .72rem; color: var(--muted); }
.fit-badge { font: 500 .72rem var(--mono); padding: .2rem .6rem; border-radius: 99px; white-space: nowrap; }
.fit-badge.fit-strong, .fit-badge.fit-good { background: var(--accent-soft); color: var(--accent); }
.fit-badge.fit-partial { background: var(--warn-soft); color: var(--warn); }
.fit-badge.fit-weak { background: var(--fail-soft); color: var(--fail); }
.fit-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.fit-table th { text-align: left; font: 500 .7rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 .4rem .4rem; }
.fit-table td { padding: .6rem .4rem; border-top: 1px solid var(--line); vertical-align: top; }
.fit-table .fit-icon { width: 2rem; text-align: center; }
.fit-table strong { display: block; font-weight: 600; }
.fit-evidence { display: block; color: var(--ink-2); margin-top: .15rem; }
.fit-checks { font-size: .78rem; color: var(--muted); }
.fit-checks summary { cursor: pointer; font-size: .72rem; }
.fit-checks ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.chat-fit .chat-foot { padding: 0; background: none; }
@media (max-width: 640px) { .chat-panel.wide { width: 100vw; height: 100dvh; } }

/* "Ask Nitin" card in Featured work (uses the site's .project/.metrics styles) */
.ask-card { margin-bottom: 1.5rem; }
.ask-card button.btn { font: inherit; font-weight: 500; font-size: .92rem; cursor: pointer; }
.ask-card h4 { margin-top: .25rem; }
.ask-card .ask-note { margin: 1.25rem 0 0; line-height: 1.5; }
.chat-privacy { display: block; margin-top: .2rem; opacity: .85; }
