/* Ask Otaconskeep — site chat widget. Matches the site's codec/terminal
   aesthetic using the same design tokens as style.css. */
.keep-chat-launcher {
 position: fixed;
 right: 18px;
 bottom: 18px;
 z-index: 9999;
 display: flex;
 align-items: center;
 gap: 10px;
 padding: 16px 26px;
 background: var(--accent);
 color: var(--bg);
 border: none;
 border-radius: 999px;
 font-family: 'JetBrains Mono', ui-monospace, monospace;
 font-size: 1.02rem;
 font-weight: 600;
 letter-spacing: 0.02em;
 cursor: pointer;
 box-shadow: var(--shadow);
 transition: background 0.15s ease, transform 0.15s ease;
}
.keep-chat-launcher:hover { background: var(--accent-bright); transform: translateY(-1px); }
.keep-chat-launcher[hidden] { display: none; }

.keep-chat-avatar {
 width: 44px;
 height: 44px;
 object-fit: contain;
 object-position: bottom;
 flex-shrink: 0;
}
.keep-chat-avatar-head { width: 40px; height: 40px; }

.keep-chat-panel {
 position: fixed;
 right: 18px;
 bottom: 18px;
 z-index: 9999;
 width: min(380px, calc(100vw - 36px));
 height: min(520px, calc(100vh - 36px));
 background: var(--bg-elevated);
 border: 1px solid var(--line-bright);
 border-radius: 8px;
 box-shadow: var(--shadow);
 display: flex;
 flex-direction: column;
 overflow: hidden;
 font-family: 'Figtree', sans-serif;
}
.keep-chat-panel[hidden] { display: none; }

.keep-chat-head {
 display: flex;
 align-items: center;
 gap: 10px;
 padding: 10px 14px;
 background: var(--surface-2);
 border-bottom: 1px solid var(--line);
}
.keep-chat-head-text {
 display: flex;
 flex-direction: column;
 gap: 2px;
 flex: 1;
 min-width: 0;
}
.keep-chat-head-title {
 font-family: 'JetBrains Mono', ui-monospace, monospace;
 font-size: 0.72rem;
 letter-spacing: 0.08em;
 text-transform: uppercase;
 color: var(--accent-bright);
}
.keep-chat-head-badge {
 font-size: 0.68rem;
 color: var(--cream-faint);
}
.keep-chat-close {
 background: none;
 border: none;
 color: var(--cream-dim);
 font-size: 1.1rem;
 line-height: 1;
 cursor: pointer;
 padding: 2px 6px;
 flex-shrink: 0;
}
.keep-chat-close:hover { color: var(--cream); }

.keep-chat-log {
 flex: 1;
 overflow-y: auto;
 padding: 14px;
 display: flex;
 flex-direction: column;
 gap: 10px;
}
.keep-chat-msg {
 max-width: 88%;
 padding: 8px 11px;
 border-radius: 6px;
 font-size: 0.88rem;
 line-height: 1.45;
 white-space: pre-wrap;
}
.keep-chat-msg.user {
 align-self: flex-end;
 background: var(--accent-dim);
 color: var(--cream);
}
.keep-chat-msg.assistant {
 align-self: flex-start;
 background: var(--surface);
 border: 1px solid var(--line);
 color: var(--cream);
}
.keep-chat-msg.assistant a { color: var(--accent-bright); }
.keep-chat-msg.assistant.streaming::after { content: '_'; animation: blink 1.1s steps(1) infinite; color: var(--accent-bright); }
@keyframes blink { 50% { opacity: 0; } }
.keep-chat-thinking {
 align-self: flex-start;
 display: flex;
 align-items: center;
 gap: 8px;
 padding: 8px 11px;
 border: 1px solid var(--line);
 border-radius: 6px;
 background: var(--surface);
 font-family: 'JetBrains Mono', ui-monospace, monospace;
 font-size: 0.72rem;
 letter-spacing: 0.08em;
 text-transform: uppercase;
 color: var(--accent-bright);
}
.keep-chat-thinking-dots { display: inline-flex; gap: 3px; }
.keep-chat-thinking-dots span {
 width: 4px; height: 4px; border-radius: 50%;
 background: var(--accent-bright);
 animation: keep-chat-pulse 1.1s ease-in-out infinite;
}
.keep-chat-thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.keep-chat-thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes keep-chat-pulse {
 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
 30% { opacity: 1; transform: translateY(-2px); }
}
.keep-chat-msg.pending { color: var(--cream-faint); font-style: italic; }
.keep-chat-msg.error { border-color: var(--danger); color: var(--danger); }

.keep-chat-form {
 display: flex;
 gap: 8px;
 padding: 10px;
 border-top: 1px solid var(--line);
 background: var(--surface-2);
}
.keep-chat-input {
 flex: 1;
 background: var(--surface);
 border: 1px solid var(--line-bright);
 border-radius: 4px;
 color: var(--cream);
 padding: 8px 10px;
 font-size: 0.85rem;
 font-family: 'Figtree', sans-serif;
}
.keep-chat-input:focus { outline: 1px solid var(--accent); }
.keep-chat-send {
 background: var(--accent);
 color: var(--bg);
 border: none;
 border-radius: 4px;
 padding: 0 14px;
 font-weight: 600;
 font-size: 0.82rem;
 cursor: pointer;
}
.keep-chat-send:disabled { opacity: 0.5; cursor: default; }
.keep-chat-send:not(:disabled):hover { background: var(--accent-bright); }

@media (max-width: 480px) {
 .keep-chat-panel { right: 8px; left: 8px; bottom: 8px; width: auto; }
 .keep-chat-launcher { right: 8px; bottom: 8px; }
}
