/* ============================================================================
   PORTFOLIO CHAT WIDGET — scoped styles (everything under #gachat / .gachat-*)
   On-brand: warm paper + clay, Archivo / Geist / Geist Mono. Transforms+opacity
   only; respects prefers-reduced-motion. Self-contained — safe to drop on any page.
   ============================================================================ */
#gachat{
  --gc-paper:#FBF7EF; --gc-card:#ffffff; --gc-ink:#2A2520; --gc-soft:#5C554C;
  --gc-muted:#9a9384; --gc-line:#E7E0D2; --gc-accent:#C8643C; --gc-accent-soft:#F6E7DD;
  /* right edge follows the page grid (--edge) so the launcher lines up with the
     clock in the nav above; falls back to 22px on pages without the grid token */
  position:fixed; right:var(--edge, 22px); bottom:22px; z-index:9000;
  font-family:"Geist",system-ui,sans-serif; color:var(--gc-ink);
}
#gachat *{box-sizing:border-box;}

/* ---- launcher ---- */
.gachat-launch{
  display:inline-flex; align-items:center; gap:10px; cursor:pointer;
  background:var(--gc-paper); color:var(--gc-ink);
  border:1px solid var(--gc-line); border-radius:999px; padding:12px 18px 12px 14px;
  box-shadow:0 14px 30px -14px rgba(42,37,32,.5); font-family:"Geist Mono",monospace;
  font-size:12px; letter-spacing:.04em; text-transform:lowercase;
  transition:transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s, opacity .2s;
}
.gachat-launch:hover{ transform:translateY(-2px); box-shadow:0 18px 36px -14px rgba(42,37,32,.55); }
.gachat-launch .dot{ width:9px; height:9px; border-radius:50%; background:var(--gc-accent);
  box-shadow:0 0 0 0 rgba(200,100,60,.5); animation:gc-pulse 2.4s ease-in-out infinite; }
.gachat-launch b{ font-weight:500; }
@keyframes gc-pulse{ 0%,100%{box-shadow:0 0 0 0 rgba(200,100,60,.45)} 50%{box-shadow:0 0 0 7px rgba(200,100,60,0)} }
#gachat.open .gachat-launch{ opacity:0; pointer-events:none; transform:scale(.9); }

/* ---- panel ---- */
.gachat-panel{
  position:absolute; right:0; bottom:0; width:380px; max-width:calc(100vw - 32px);
  height:560px; max-height:calc(100vh - 44px); display:flex; flex-direction:column;
  background:var(--gc-paper); border:1px solid var(--gc-line); border-radius:20px; overflow:hidden;
  box-shadow:0 30px 70px -24px rgba(42,37,32,.55);
  opacity:0; transform:translateY(16px) scale(.98); pointer-events:none;
  transition:opacity .3s ease, transform .3s cubic-bezier(.16,1,.3,1);
}
#gachat.open .gachat-panel{ opacity:1; transform:none; pointer-events:auto; }

.gachat-head{ display:flex; align-items:center; gap:10px; padding:16px 16px 14px;
  border-bottom:1px solid var(--gc-line); background:linear-gradient(180deg,var(--gc-paper),rgba(251,247,239,.7)); }
.gachat-head .ttl{ font-family:"Archivo",sans-serif; font-weight:900; letter-spacing:-.02em;
  text-transform:lowercase; font-size:18px; line-height:1; }
.gachat-head .ttl .a{ color:var(--gc-accent); }
.gachat-av{ width:38px; height:38px; flex:0 0 38px; border-radius:50%; display:grid; place-items:center;
  background:radial-gradient(120% 120% at 30% 25%,#E89B6F,var(--gc-accent)); box-shadow:0 4px 12px -4px rgba(200,100,60,.6); }
.gachat-av svg{ width:20px; height:20px; }
.gachat-head .sub{ display:flex; align-items:center; gap:6px; font-family:"Geist Mono",monospace; font-size:10px;
  text-transform:uppercase; letter-spacing:.1em; color:var(--gc-muted); margin-top:5px; }
.gachat-head .sub .live{ width:6px; height:6px; border-radius:50%; background:#6f9a4f;
  box-shadow:0 0 0 0 rgba(111,154,79,.5); animation:gc-live 2.4s ease-in-out infinite; }
@keyframes gc-live{ 0%,100%{box-shadow:0 0 0 0 rgba(111,154,79,.45)} 50%{box-shadow:0 0 0 5px rgba(111,154,79,0)} }
.gachat-head .grow{ flex:1; }
.gachat-iconbtn{ border:none; background:transparent; color:var(--gc-soft); cursor:pointer;
  width:30px; height:30px; border-radius:8px; display:grid; place-items:center; transition:background .2s,color .2s; }
.gachat-iconbtn:hover{ background:rgba(42,37,32,.06); color:var(--gc-accent); }
.gachat-iconbtn svg{ width:17px; height:17px; }

/* ---- message scroll area ---- */
.gachat-log{ flex:1; overflow-y:auto; padding:18px 16px 8px; display:flex; flex-direction:column; gap:12px; }
.gachat-row{ display:flex; gap:9px; align-items:flex-end; max-width:90%; }
.gachat-row.user{ align-self:flex-end; flex-direction:row-reverse; }
.gachat-row.bot{ align-self:flex-start; }
.gachat-botav{ width:24px; height:24px; flex:0 0 24px; border-radius:50%; display:grid; place-items:center; margin-bottom:2px;
  background:radial-gradient(120% 120% at 30% 25%,#E89B6F,var(--gc-accent)); }
.gachat-botav svg{ width:13px; height:13px; }
.gachat-msg{ max-width:100%; font-size:14.5px; line-height:1.5; white-space:pre-wrap; word-wrap:break-word; }
.gachat-msg.user{ align-self:flex-end; background:var(--gc-accent); color:#fff; border-radius:15px 15px 4px 15px; padding:10px 14px; }
.gachat-msg.bot{ align-self:flex-start; background:var(--gc-card); border:1px solid var(--gc-line);
  border-radius:15px 15px 15px 4px; padding:10px 14px; color:var(--gc-ink); }
.gachat-msg.bot.err{ border-color:rgba(200,100,60,.45); color:var(--gc-accent); }
.gachat-msg a{ color:var(--gc-accent); text-decoration:underline; text-underline-offset:2px; word-break:break-word; }
.gachat-msg strong{ font-weight:600; color:var(--gc-ink); }

/* greeting + starter chips (empty state) */
.gachat-intro{ padding:6px 2px 2px; }
.gachat-intro p{ font-size:14.5px; line-height:1.55; color:var(--gc-soft); margin-bottom:14px; }
.gachat-chips{ display:flex; flex-direction:column; gap:8px; }
.gachat-chip{ text-align:left; cursor:pointer; font-family:"Geist",sans-serif; font-size:13.5px; color:var(--gc-ink);
  background:var(--gc-card); border:1px solid var(--gc-line); border-radius:12px; padding:10px 13px;
  transition:border-color .2s, transform .15s, background .2s; }
.gachat-chip:hover{ border-color:rgba(200,100,60,.4); transform:translateX(2px); background:#fffdf8; }

/* typing indicator */
.gachat-typing{ align-self:flex-start; display:inline-flex; gap:4px; padding:12px 14px;
  background:var(--gc-card); border:1px solid var(--gc-line); border-radius:15px 15px 15px 4px; }
.gachat-typing i{ width:6px; height:6px; border-radius:50%; background:var(--gc-muted); animation:gc-bounce 1.2s ease-in-out infinite; }
.gachat-typing i:nth-child(2){ animation-delay:.15s; } .gachat-typing i:nth-child(3){ animation-delay:.3s; }
@keyframes gc-bounce{ 0%,80%,100%{transform:translateY(0);opacity:.5} 40%{transform:translateY(-4px);opacity:1} }

/* ---- composer ---- */
.gachat-form{ display:flex; align-items:center; gap:8px; padding:12px 14px 14px; border-top:1px solid var(--gc-line); }
.gachat-inwrap{ flex:1; display:flex; align-items:center; background:var(--gc-card); border:1px solid var(--gc-line);
  border-radius:22px; padding:3px 4px 3px 14px; transition:border-color .2s; }
.gachat-inwrap:focus-within{ border-color:var(--gc-accent); }
.gachat-form textarea{ flex:1; resize:none; border:none; background:transparent; padding:8px 0;
  font-family:"Geist",sans-serif; font-size:14px; line-height:1.4; color:var(--gc-ink); max-height:110px; outline:none; }
.gachat-send{ flex:0 0 auto; width:38px; height:38px; border:none; border-radius:50%; cursor:pointer;
  background:var(--gc-accent); color:#fff; display:grid; place-items:center; transition:transform .15s, opacity .2s; }
.gachat-send:hover{ transform:translateY(-1px); }
.gachat-send:disabled{ opacity:.45; cursor:not-allowed; transform:none; }
.gachat-send svg{ width:18px; height:18px; }

/* ---- voice mode: mic button + header toggle ---- */
.gachat-mic{ flex:0 0 auto; width:38px; height:38px; border:1px solid var(--gc-line); border-radius:50%;
  cursor:pointer; background:var(--gc-card); color:var(--gc-soft); display:grid; place-items:center;
  transition:transform .15s, color .2s, border-color .2s, background .2s; }
.gachat-mic:hover{ color:var(--gc-accent); border-color:rgba(200,100,60,.4); transform:translateY(-1px); }
.gachat-mic svg{ width:17px; height:17px; }
.gachat-mic.listening{ background:var(--gc-accent); color:#fff; border-color:var(--gc-accent);
  animation:gc-listen 1.4s ease-in-out infinite; }
@keyframes gc-listen{ 0%,100%{ box-shadow:0 0 0 0 rgba(200,100,60,.5); } 50%{ box-shadow:0 0 0 7px rgba(200,100,60,0); } }
.gachat-iconbtn.gc-voice.on{ background:var(--gc-accent); color:#fff; }
.gachat-iconbtn.gc-voice.on:hover{ background:var(--gc-accent); color:#fff; }
@media (prefers-reduced-motion: reduce){ .gachat-mic.listening{ animation:none; } }
.gachat-foot{ font-family:"Geist Mono",monospace; font-size:9.5px; letter-spacing:.1em; text-transform:uppercase;
  color:var(--gc-muted); text-align:center; padding:0 0 10px; }

@media (max-width:480px){
  #gachat{ right:14px; bottom:14px; }
  .gachat-panel{ width:calc(100vw - 28px); height:calc(100vh - 90px); }
}
@media (prefers-reduced-motion:reduce){
  #gachat *, #gachat *::before{ animation:none !important; transition:none !important; }
  .gachat-panel{ transform:none; }
}

/* ---- inline case cards + contextual follow-ups (award-style) ---- */
.gachat-card{ align-self:flex-start; margin-left:33px; max-width:84%; display:flex; flex-direction:column; gap:2px;
  text-decoration:none; background:var(--gc-card); border:1px solid var(--gc-line); border-radius:14px;
  padding:11px 13px; transition:border-color .2s, transform .15s, box-shadow .2s; }
.gachat-card:hover{ border-color:var(--gc-accent); transform:translateY(-1px);
  box-shadow:0 12px 24px -16px rgba(42,37,32,.45); }
.gachat-card-ttl{ font-family:"Archivo",sans-serif; font-weight:900; font-size:14px; letter-spacing:-.01em;
  text-transform:lowercase; color:var(--gc-ink); line-height:1.05; }
.gachat-card-meta{ font-family:"Geist Mono",monospace; font-size:10px; letter-spacing:.06em;
  text-transform:uppercase; color:var(--gc-muted); }
.gachat-card-go{ font-family:"Geist Mono",monospace; font-size:11px; letter-spacing:.06em;
  text-transform:uppercase; color:var(--gc-accent); margin-top:5px; }
.gachat-follow{ align-self:flex-start; margin-left:33px; display:flex; flex-wrap:wrap; gap:7px; max-width:90%; }
.gachat-chip.sm{ font-size:12px; padding:7px 12px; border-radius:20px; }

/* ---- message entrance microinteraction ---- */
@keyframes gc-rise{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }
.gachat-row, .gachat-card, .gachat-follow{ animation:gc-rise .35s cubic-bezier(.16,1,.3,1) both; }
@media (prefers-reduced-motion: reduce){ .gachat-row, .gachat-card, .gachat-follow{ animation:none; } }
