/* ============================================================
   GRACIA STUDIO — chat widget
   Uses the design tokens from styles.css. No new colours.
   ============================================================ */

.gc { position: fixed; right: var(--pad); bottom: var(--pad); z-index: 9000; }
@media (max-width: 600px) { .gc { right: 12px; bottom: 12px; left: 12px; } }

/* ---------- Launcher ---------- */
.gc__launch {
  position: absolute; right: 0; bottom: 0;
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.15rem;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 100px;
  font-family: var(--font-mono); font-size: var(--fs-mono);
  letter-spacing: 0.14em; text-transform: uppercase; font-weight: 500;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  transition: transform var(--dur) var(--ease), opacity 0.25s var(--ease);
  white-space: nowrap;
}
.gc__launch[hidden] { display: none; }
.gc__launch:hover { transform: translateY(-2px); }
.gc__launch svg { width: 15px; height: 15px; }
.gc__launch-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-ink); opacity: 0.55;
}
.gc.is-open .gc__launch { opacity: 0; pointer-events: none; transform: scale(0.9); }

/* ---------- Panel ---------- */
.gc__panel {
  position: absolute; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  width: min(400px, calc(100vw - var(--pad) * 2));
  height: min(600px, calc(100vh - var(--pad) * 2 - var(--header-h)));
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  opacity: 0; visibility: hidden;
  transform: translateY(14px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0.28s;
}
.gc.is-open .gc__panel { opacity: 1; visibility: visible; transform: none; }
@media (max-width: 600px) {
  .gc__panel { width: 100%; height: min(78vh, calc(100vh - 90px)); }
}

/* ---------- Header ---------- */
.gc__head {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-elev-2);
  flex-shrink: 0;
}
.gc__pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(204, 255, 0, 0.5);
  animation: gc-pulse 2.6s var(--ease-in-out) infinite;
}
@keyframes gc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(204, 255, 0, 0.45); }
  50%      { box-shadow: 0 0 0 7px rgba(204, 255, 0, 0); }
}
.gc__title { font-family: var(--font-mono); font-size: var(--fs-mono);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg); }
.gc__sub { font-family: var(--font-mono); font-size: var(--fs-mono);
  letter-spacing: 0.1em; color: var(--fg-faint); margin-left: auto; margin-right: 0.4rem; }
.gc__close { display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; color: var(--fg-dim); transition: color 0.2s, background 0.2s; flex-shrink: 0; }
.gc__close:hover { color: var(--fg); background: rgba(255, 255, 255, 0.06); }
.gc__close svg { width: 15px; height: 15px; }

/* ---------- Message log ---------- */
.gc__log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 1.1rem; display: flex; flex-direction: column; gap: 0.85rem;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.16) transparent;
}
.gc__log::-webkit-scrollbar { width: 6px; }
.gc__log::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 3px; }

.gc__msg {
  max-width: 88%; padding: 0.7rem 0.9rem;
  font-size: 0.9375rem; line-height: 1.55;
  border-radius: 12px; white-space: pre-wrap; word-wrap: break-word;
  animation: gc-in 0.34s var(--ease) both;
}
@keyframes gc-in { from { opacity: 0; transform: translateY(6px); } }
.gc__msg--bot {
  align-self: flex-start; background: var(--bg-elev-2);
  border: 1px solid var(--line-soft); color: var(--fg);
  border-bottom-left-radius: 4px;
}
.gc__msg--me {
  align-self: flex-end; background: var(--accent); color: var(--accent-ink);
  font-weight: 500; border-bottom-right-radius: 4px;
}
.gc__msg--err { align-self: flex-start; background: rgba(255, 90, 90, 0.08);
  border: 1px solid rgba(255, 90, 90, 0.28); color: #ffb4b4; }
.gc__msg a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.gc__msg--me a { color: var(--accent-ink); }

/* typing dots */
.gc__typing { display: inline-flex; gap: 4px; align-items: center; padding: 0.25rem 0; }
.gc__typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--fg-faint);
  animation: gc-bounce 1.3s var(--ease-in-out) infinite; }
.gc__typing i:nth-child(2) { animation-delay: 0.16s; }
.gc__typing i:nth-child(3) { animation-delay: 0.32s; }
@keyframes gc-bounce { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); } }

/* lead-sent confirmation strip */
.gc__flag {
  align-self: center; display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.75rem; border: 1px solid rgba(204, 255, 0, 0.3);
  border-radius: 100px; background: rgba(204, 255, 0, 0.06);
  font-family: var(--font-mono); font-size: var(--fs-mono);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
}

/* ---------- Starter chips ---------- */
.gc__chips { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1.1rem 0.9rem; flex-shrink: 0; }
.gc__chips:empty { display: none; }
.gc__chip {
  padding: 0.45rem 0.75rem; border: 1px solid var(--line);
  border-radius: 100px; background: transparent; color: var(--fg-dim);
  font-family: var(--font-mono); font-size: var(--fs-mono);
  letter-spacing: 0.08em; text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.gc__chip:hover { color: var(--accent); border-color: rgba(204, 255, 0, 0.45); background: rgba(204, 255, 0, 0.05); }

/* ---------- Composer ---------- */
.gc__form {
  display: flex; align-items: flex-end; gap: 0.55rem;
  padding: 0.8rem; border-top: 1px solid var(--line-soft);
  background: var(--bg-elev-2); flex-shrink: 0;
}
.gc__input {
  flex: 1; resize: none; max-height: 120px;
  padding: 0.65rem 0.8rem;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--font-sans); font-size: 0.9375rem; line-height: 1.45;
  transition: border-color 0.2s;
}
.gc__input::placeholder { color: var(--fg-faint); }
.gc__input:focus { outline: none; border-color: rgba(204, 255, 0, 0.5); }
.gc__send {
  display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
  background: var(--accent); color: var(--accent-ink); border-radius: 10px;
  transition: opacity 0.2s, transform 0.2s var(--ease);
}
.gc__send:hover:not(:disabled) { transform: translateY(-1px); }
.gc__send:disabled { opacity: 0.3; cursor: not-allowed; }
.gc__send svg { width: 16px; height: 16px; }

.gc__foot {
  padding: 0 1.1rem 0.7rem; text-align: center;
  font-family: var(--font-mono); font-size: 0.5625rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint);
  background: var(--bg-elev-2); flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .gc__panel, .gc__launch, .gc__msg { transition: none; animation: none; }
  .gc__pulse, .gc__typing i { animation: none; }
}
