/* ============================================================
   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;
  display: flex; justify-content: flex-end; align-items: flex-end;
  width: max-content;
}
@media (max-width: 600px) { .gc { right: 12px; bottom: 12px; left: 12px; width: auto; } }

/* ---------- Launcher ---------- */
.gc__peek {
  position: absolute; right: 0; bottom: calc(100% + 0.85rem);
  width: max-content; max-width: min(260px, calc(100vw - 2rem));
  padding: 0.78rem 1rem;
  border: 1px solid rgba(214, 181, 111, 0.28);
  border-radius: 14px 14px 4px 14px;
  background: rgba(12, 12, 14, 0.82); color: var(--fg);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.48);
  font-family: var(--font-mono); font-size: var(--fs-mono);
  letter-spacing: 0.1em; text-transform: uppercase;
  animation: gc-pop-peek 0.65s var(--ease) 0.6s both;
}
.gc__peek::after {
  content: ''; position: absolute; right: 1.2rem; bottom: -6px;
  width: 10px; height: 10px;
  background: inherit; border-right: 1px solid rgba(214, 181, 111, 0.28);
  border-bottom: 1px solid rgba(214, 181, 111, 0.28);
  transform: rotate(45deg);
}
.gc__peek:hover { border-color: rgba(214, 181, 111, 0.55); color: var(--accent); }
.gc__launch {
  position: relative; right: 0; bottom: 0;
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem 1.2rem;
  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 16px 46px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(214, 181, 111, 0.3);
  transition: transform var(--dur) var(--ease), opacity 0.25s var(--ease);
  white-space: nowrap;
  animation: gc-pop-peek 0.65s var(--ease) 0.35s both;
}
.gc__launch[hidden] { display: none; }
.gc__launch:hover { transform: translateY(-3px); }
.gc__launch svg { width: 15px; height: 15px; }
.gc__launch-icon {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
}
.gc__launch-icon svg { width: 18px; height: 18px; }
.gc.is-open .gc__launch,
.gc.is-open .gc__peek { opacity: 0; pointer-events: none; transform: scale(0.9); animation: none; } /* animation:none is required: the pop-in uses fill-mode both, and an animated value beats a normal declaration */

/* ---------- 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(26px) scale(0.92);
  transform-origin: bottom right;
  transition: opacity 0.34s var(--ease), transform 0.34s var(--ease), visibility 0.34s;
}
.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)); }
  .gc__launch { right: 0; }
  .gc__peek { right: 0; }
}

@keyframes gc-pop-peek {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ---------- 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;
}
/* Bec avatar in the panel header, with the live dot on its corner */
.gc__avatar { position: relative; width: 36px; height: 36px; flex-shrink: 0; }
.gc__avatar img { display: block; width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover; background: #0c0c0e; border: 1px solid rgba(214, 181, 111, 0.45); }
.gc__avatar .gc__pulse { position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border: 2px solid var(--bg-elev-2, #0c0c0e); }
.gc__pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(214, 181, 111, 0.5);
  animation: gc-pulse 2.6s var(--ease-in-out) infinite;
}
@keyframes gc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214, 181, 111, 0.45); }
  50%      { box-shadow: 0 0 0 7px rgba(214, 181, 111, 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(214, 181, 111, 0.3);
  border-radius: 100px; background: rgba(214, 181, 111, 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(214, 181, 111, 0.45); background: rgba(214, 181, 111, 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(214, 181, 111, 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; }
}

/* ---------- Voice call row ---------- */
.gc__voice {
  display: flex; flex-direction: column; align-items: stretch; gap: .5rem;
  padding: .75rem .9rem .25rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
  margin-top: .2rem;
}
.gc__voice-btn {
  display: flex; align-items: center; justify-content: center; gap: .55rem; width: 100%;
  padding: .85rem 1rem; border-radius: 100px; cursor: pointer;
  border: 1px solid transparent; color: #1a1408;
  background: linear-gradient(180deg, #f3dcab 0%, #d6b56f 55%, #b8923e 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 -1px 0 rgba(0, 0, 0, .25) inset,
              0 10px 30px -12px rgba(214, 181, 111, .7);
  font: 600 .95rem/1 inherit; letter-spacing: .01em;
  transition: filter .2s, background .2s, border-color .2s, color .2s, opacity .2s;
}
.gc__voice-btn svg { width: 17px; height: 17px; flex: none; }
.gc__voice-btn:hover { filter: brightness(1.06); }
.gc__voice-btn:disabled { opacity: .65; cursor: default; filter: none; }
.gc__voice-note { font-size: .72rem; line-height: 1.35; color: #a9a59d; text-align: center; }
/* while live the button is a stop action, so it steps back from the gold invitation */
.gc__voice[data-state="live"] .gc__voice-btn {
  background: rgba(255, 255, 255, .06); border-color: rgba(214, 181, 111, .5);
  color: #f3dfae; box-shadow: none;
}
.gc__voice[data-state="live"] .gc__voice-note { color: #e2c589; }
/* a soft pulse only while Bec is actually speaking */
.gc__voice.is-speaking .gc__voice-btn { box-shadow: 0 0 0 0 rgba(243, 223, 174, .55); animation: gcVoicePulse 1.5s ease-out infinite; }
@keyframes gcVoicePulse { to { box-shadow: 0 0 0 12px rgba(243, 223, 174, 0); } }
@media (prefers-reduced-motion: reduce) { .gc__voice.is-speaking .gc__voice-btn { animation: none; } }

/* ---------- Fallbacks ----------
   chat.css was written against the old build's styles.css, which only the legal pages load.
   Without these the panel had no background at all on every other page. */
.gc {
  --bg-elev:     var(--ink, #0c0c0e);
  --bg-elev-2:   #151518;
  --fg-dim:      var(--muted, #a9a59d);
  --fg-faint:    var(--faint, #7b776f);
  --line-soft:   rgba(255, 255, 255, .06);
  --font-sans:   var(--font-body, 'Manrope', system-ui, sans-serif);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}
.gc__panel { background: #0c0c0e; } /* explicit, so the panel is never see-through */
