/* On-site chat brief. Same palette as the page: graphite surfaces, warm white
   text, gold only for the launcher, the active choice and the progress line. */
.chat-launch {
  position: fixed; right: clamp(0.75rem, 2vw, 1.5rem); bottom: clamp(0.75rem, 2vw, 1.5rem); z-index: 80;
  display: inline-flex; align-items: center; gap: 0.6em;
  padding: 0.85em 1.2em 0.85em 1em;
  background: var(--sc-accent); color: var(--sc-accent-ink);
  border: 0; border-radius: var(--sc-r-sm); font: 500 var(--sc-t-sm)/1.2 var(--sc-font-text); cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.4), 0 14px 40px -12px rgb(var(--gold-rgb) / 0.7), var(--sc-e2);
  transition: background-color 180ms var(--sc-ease-out), translate 240ms var(--sc-ease-out), scale 140ms var(--sc-ease-out);
}
.chat-launch svg, .chat__send svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { .chat-launch:hover { background: var(--gold-hot); translate: 0 -2px; } }
.chat-launch:active { scale: 0.97; }
.chat-launch[hidden] { display: none; }

.chat {
  position: fixed; right: clamp(0.75rem, 2vw, 1.5rem); bottom: clamp(0.75rem, 2vw, 1.5rem); z-index: 81;
  display: flex; flex-direction: column;
  width: min(26rem, calc(100vw - 1.5rem)); height: min(40rem, calc(100svh - 6rem));
  background: var(--sc-surface); color: var(--sc-ink);
  border: 1px solid var(--sc-hairline-strong); border-radius: 12px; overflow: hidden;
  box-shadow: var(--sc-edge), var(--sc-e3), 0 30px 90px -30px #000;
  animation: chat-in 320ms var(--sc-ease-out);
}
.chat[hidden] { display: none; }
@keyframes chat-in { from { opacity: 0; transform: translate3d(0, 14px, 0) scale(0.98); } }

.chat__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.8rem 0.9rem 0.8rem 1rem; border-bottom: 1px solid var(--sc-hairline); }
.chat__who { display: flex; align-items: center; gap: 0.7rem; }
.chat__who div { display: grid; line-height: 1.25; }
.chat__who b { font-size: var(--sc-t-sm); font-weight: 600; letter-spacing: 0.05em; }
.chat__who span:not(.chat__avatar) { font-size: var(--sc-t-xs); color: var(--sc-ink-soft); }
.chat__avatar { width: 2.25rem; height: 2.25rem; border-radius: 50%; background: #000 url("assets/img/logo-mark-192.png") center / 118% no-repeat; }
.chat__close { position: relative; width: 2.25rem; height: 2.25rem; background: none; border: 1px solid transparent; border-radius: var(--sc-r-sm); color: var(--sc-ink); cursor: pointer; transition: border-color 160ms var(--sc-ease-out); }
.chat__close::before, .chat__close::after { content: ""; position: absolute; left: 50%; top: 50%; width: 1rem; height: 1px; margin-left: -0.5rem; background: currentColor; }
.chat__close::before { rotate: 45deg; } .chat__close::after { rotate: -45deg; }
@media (hover: hover) and (pointer: fine) { .chat__close:hover { border-color: var(--sc-accent); color: var(--sc-accent); } }

.chat__bar { height: 1px; background: var(--sc-hairline); }
.chat__bar i { display: block; height: 100%; background: var(--sc-accent); transform-origin: 0 50%; transform: scaleX(0); transition: transform 420ms var(--sc-ease-out); }

.chat__log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem; scrollbar-width: thin; }
.chat__msg {
  max-width: 88%; padding: 0.65em 0.9em; font-size: var(--sc-t-sm); line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere;
  animation: chat-msg 260ms var(--sc-ease-out);
}
@keyframes chat-msg { from { opacity: 0; transform: translate3d(0, 6px, 0); } }
.chat__msg--bot { align-self: flex-start; background: var(--graphite); border-radius: 0.95em 0.95em 0.95em 0.3em; }
.chat__msg--me { align-self: flex-end; background: rgb(var(--gold-rgb) / 0.1); border: 1px solid rgb(var(--gold-rgb) / 0.45); border-radius: 0.95em 0.95em 0.3em 0.95em; }
.chat__msg--me.is-skip { background: none; border-color: var(--sc-hairline-strong); color: var(--sc-ink-soft); }
.chat__section { align-self: center; margin: 0.6rem 0 0.2rem; font-size: var(--sc-t-xs); color: var(--sc-accent); letter-spacing: 0.04em; }
.chat__typing { display: inline-flex; gap: 0.3em; padding: 0.85em 0.9em; }
.chat__typing i { width: 0.4em; height: 0.4em; border-radius: 50%; background: var(--sc-ink-soft); animation: chat-dot 900ms ease-in-out infinite; }
.chat__typing i:nth-child(2) { animation-delay: 150ms; } .chat__typing i:nth-child(3) { animation-delay: 300ms; }
@keyframes chat-dot { 0%, 100% { opacity: 0.3; transform: none; } 40% { opacity: 1; transform: translate3d(0, -2px, 0); } }

.chat__choices { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.15rem; }
.chat__chip {
  padding: 0.5em 0.9em; background: transparent; color: var(--sc-ink);
  border: 1px solid var(--sc-hairline-strong); border-radius: var(--sc-r-pill);
  font: 400 var(--sc-t-sm)/1.25 var(--sc-font-text); text-align: left; cursor: pointer;
  transition: border-color 160ms var(--sc-ease-out), color 160ms var(--sc-ease-out), background-color 160ms var(--sc-ease-out), scale 140ms var(--sc-ease-out);
}
.chat__chip.is-on { border-color: var(--sc-accent); color: var(--sc-accent); background: rgb(var(--gold-rgb) / 0.1); }
.chat__chip--done { background: var(--sc-accent); border-color: var(--sc-accent); color: var(--sc-accent-ink); font-weight: 500; }
.chat__chip--skip { color: var(--sc-ink-soft); border-style: dashed; }
@media (hover: hover) and (pointer: fine) {
  .chat__chip:hover { border-color: var(--sc-accent); }
  .chat__chip--done:hover { background: var(--gold-hot); }
}
.chat__chip:active { scale: 0.96; }

.chat__form { display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--sc-hairline); }
.chat__form[hidden] { display: none; }
.chat__input { flex: 1; min-width: 0; padding: 0.7em 0.9em; background: var(--sc-canvas); color: var(--sc-ink); border: 1px solid var(--sc-hairline-strong); border-radius: var(--sc-r-sm); font: 400 1rem/1.3 var(--sc-font-text); }
.chat__input::placeholder { color: #8f8a82; }
.chat__input:focus-visible { outline: none; border-color: var(--sc-accent); box-shadow: 0 0 0 3px rgb(var(--gold-rgb) / 0.18); }
.chat__send { flex: none; width: 2.9rem; display: grid; place-items: center; background: var(--sc-accent); color: var(--sc-accent-ink); border: 0; border-radius: var(--sc-r-sm); cursor: pointer; transition: background-color 160ms var(--sc-ease-out), scale 140ms var(--sc-ease-out); }
@media (hover: hover) and (pointer: fine) { .chat__send:hover { background: var(--gold-hot); } }
.chat__send:active { scale: 0.95; }

/* On a phone the chat takes the whole screen, like a messenger. */
@media (max-width: 600px) {
  .chat { inset: 0; width: auto; height: auto; border: 0; border-radius: 0; }
  .chat-open, .chat-open body { overflow: hidden; }
  .chat-launch span { display: none; }
  .chat-launch { padding: 0.9em; border-radius: 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .chat, .chat__msg { animation: none; }
  .chat__typing i { animation: none; opacity: 0.6; }
}

.chat-invite { margin-top: var(--sc-5); font-size: var(--sc-t-sm); color: var(--sc-ink-soft); }
.chat-invite button { padding: 0; background: none; border: 0; color: var(--sc-accent); font: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 1px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .chat-invite button:hover { color: var(--gold-hot); } }
