/* Ask Wyzie: Kilter visual language (tokens.css). Panel on Paper, one blue for what is interactive. */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--signal-ink); text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .15s; }
a:hover { background-size: 100% 1px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: var(--r-control); }
[hidden] { display: none !important; }

.app { display: flex; flex-direction: column; height: 100%; max-width: 52rem; margin: 0 auto; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; }
.brand { display: flex; align-items: center; gap: 0.625rem; color: var(--ink); font-weight: 600; font-size: 1.125rem; letter-spacing: -0.025em; background: none; }
.brand img { border-radius: 0.4rem; }
.actions { display: flex; gap: 0.375rem; align-items: center; }

.ghost { background: transparent; border: 1px solid transparent; color: var(--slate); font: inherit; font-size: 0.75rem; font-weight: 500; height: 2rem; padding: 0 0.625rem; border-radius: var(--r-control); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.ghost:hover { background: var(--inset-hover); border-color: var(--hairline); color: var(--ink); }
.ghost.icon { width: 2rem; padding: 0; display: inline-grid; place-items: center; }

.log { flex: 1; overflow-y: auto; padding: 1rem 1rem 0.5rem; scroll-behavior: smooth; outline: none; }
.hello { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-container); box-shadow: var(--raised); padding: 1.5rem; margin-top: 4vh; }
.hello h1 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 0.375rem; }
.hello p { color: var(--slate); font-size: 0.875rem; margin: 0 0 1rem; max-width: 36rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { font: inherit; font-size: 0.75rem; font-weight: 500; color: var(--slate); background: transparent; border: 1px solid var(--hairline); height: 2rem; padding: 0 0.75rem; border-radius: var(--r-control); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.chip:hover { border-color: var(--hairline-strong); background: var(--inset-hover); color: var(--ink); }
.chip:active { background: var(--signal-soft); border-color: var(--signal-line); color: var(--signal-ink); }

.msg { margin: 0 0 1.125rem; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { background: var(--panel); border: 1px solid var(--hairline); box-shadow: var(--raised); padding: 0.5rem 0.75rem; border-radius: var(--r-container); max-width: 86%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot .bubble { max-width: 100%; overflow-wrap: anywhere; }
.bubble > :first-child { margin-top: 0; }
.bubble > :last-child { margin-bottom: 0; }
.bubble p { margin: 0 0 0.75em; }
.bubble ul, .bubble ol { margin: 0 0 0.75em; padding-left: 1.25em; }
.bubble li { margin: 0.2em 0; }
.bubble h3 { margin: 1em 0 0.35em; font-size: 0.875rem; font-weight: 600; }
.bubble code { background: var(--inset); border: 1px solid var(--hairline); padding: 0 0.3em; border-radius: 0.25rem; font-size: 0.75rem; font-family: var(--mono); color: var(--ink); }
.bubble pre { background: var(--inset); border: 1px solid var(--hairline); border-radius: var(--r-container); padding: 0.625rem 0.75rem; overflow-x: auto; margin: 0 0 0.75em; }
.bubble pre code { background: none; border: 0; padding: 0; }
.thinking { display: inline-flex; gap: 4px; padding: 6px 0; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--ash); animation: pulse 1s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.err { background: var(--tone-danger-bg); color: var(--tone-danger-ink); border-radius: var(--r-container); padding: 0.5rem 0.75rem; }
.srcs { margin: 0.625rem 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.375rem; align-items: center; }
.srcs .lbl { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.025em; color: var(--ash); margin-right: 0.25rem; }
.srcs a { display: inline-block; font-size: 0.75rem; font-weight: 500; color: var(--slate); background: var(--panel); border: 1px solid var(--hairline); padding: 0.125rem 0.625rem; border-radius: var(--r-control); transition: border-color .15s, background .15s; }
.srcs a:hover { border-color: var(--signal-line); background: var(--signal-soft); color: var(--signal-ink); }

.compose { padding: 0.5rem 1rem calc(0.875rem + env(safe-area-inset-bottom)); }
.ctx { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--slate); background: var(--signal-soft); border: 1px solid var(--signal-line); border-radius: var(--r-control); padding: 0.125rem 0.25rem 0.125rem 0.625rem; margin-bottom: 0.5rem; width: fit-content; max-width: 100%; }
.ctx-title { color: var(--signal-ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
form { display: flex; gap: 0.5rem; align-items: flex-end; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-container); box-shadow: var(--raised); padding: 0.375rem 0.375rem 0.375rem 0.75rem; transition: border-color .15s; }
form:hover { border-color: var(--hairline-strong); }
form:focus-within { outline: 2px solid var(--signal); outline-offset: 0; }
textarea { flex: 1; resize: none; background: none; border: 0; outline: 0; color: var(--ink); font: inherit; max-height: 10rem; padding: 0.4rem 0; line-height: 1.5; }
textarea::placeholder { color: var(--ash); }
.send { flex: none; width: 2.25rem; height: 2.25rem; border-radius: var(--r-control); border: 1px solid var(--signal-edge); background: var(--signal); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: var(--raised); transition: background .15s, border-color .15s; }
.send:hover { background: var(--signal-hover); }
.send:disabled { opacity: .6; cursor: not-allowed; }
.note { margin: 0.5rem 0.25rem 0; font-size: 0.6875rem; color: var(--ash); }

.embed .bar { padding: 0.5rem 0.75rem; }
.embed .hello { margin-top: 1vh; }
@media (max-width: 560px) {
  body { font-size: 1rem; }
  .log, .compose, .bar { padding-left: 0.75rem; padding-right: 0.75rem; }
  .msg.user .bubble { max-width: 92%; }
  textarea { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.tbl { overflow-x: auto; margin: 0 0 0.75em; }
.bubble table { border-collapse: collapse; font-size: 0.75rem; }
.bubble th, .bubble td { border: 1px solid var(--hairline); padding: 0.25rem 0.5rem; text-align: left; vertical-align: top; }
.bubble th { background: var(--inset); font-weight: 600; }
