/* ============================================================
   Digital Twin chat widget — matches the site theme
   (charcoal + Adobe-red accent, dark/light via site variables)
   ============================================================ */

.twin-toggle{
  position:fixed;left:22px;bottom:22px;z-index:130;
  display:flex;align-items:center;gap:10px;
  background:var(--red);color:#fff;border:none;cursor:pointer;
  font-family:var(--font-head);font-weight:600;font-size:.95rem;
  padding:13px 20px;border-radius:999px;box-shadow:var(--shadow);
  transition:background .2s,transform .2s;
}
.twin-toggle:hover{background:var(--red-dark);transform:translateY(-2px)}
.twin-toggle .twin-dot{width:9px;height:9px;border-radius:50%;background:#fff;opacity:.9}

.twin-panel{
  position:fixed;left:22px;bottom:86px;z-index:131;
  width:min(380px,calc(100vw - 32px));height:min(560px,calc(100dvh - 120px));
  display:flex;flex-direction:column;overflow:hidden;
  background:var(--surface);border:1px solid var(--line);border-radius:18px;
  box-shadow:var(--shadow);
}
.twin-panel[hidden]{display:none}

.twin-head{
  display:flex;align-items:center;gap:12px;
  padding:16px 18px;border-bottom:1px solid var(--line);background:var(--surface-2);
}
.twin-avatar{
  display:grid;place-items:center;flex:0 0 auto;
  width:42px;height:42px;border-radius:12px;
  background:var(--bg);border:1px solid var(--line);
  font-family:var(--font-head);font-weight:700;font-size:.85rem;position:relative;overflow:hidden;
}
.twin-avatar::after{content:"";position:absolute;left:10px;right:10px;bottom:7px;height:3px;border-radius:2px;background:var(--red)}
.twin-head-text{flex:1;min-width:0}
.twin-head-text strong{display:block;font-family:var(--font-head);font-size:.98rem;line-height:1.3}
.twin-head-text span{display:block;color:var(--muted);font-size:.8rem;line-height:1.4}
.twin-close{
  flex:0 0 auto;background:none;border:none;cursor:pointer;
  color:var(--muted);font-size:1.25rem;line-height:1;padding:6px;border-radius:8px;
}
.twin-close:hover{color:var(--text)}

.twin-log{
  flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:10px;
}
.twin-msg{display:flex}
.twin-msg-user{justify-content:flex-end}
.twin-bubble{
  max-width:85%;padding:10px 14px;border-radius:16px;
  font-size:.92rem;line-height:1.55;white-space:pre-wrap;word-wrap:break-word;
}
.twin-msg-bot .twin-bubble{background:var(--surface-2);border:1px solid var(--line);border-bottom-left-radius:6px}
.twin-msg-user .twin-bubble{background:var(--red);color:#fff;border-bottom-right-radius:6px}
.twin-typing .twin-bubble{color:var(--muted);font-style:italic}

.twin-chips{
  display:flex;flex-wrap:wrap;gap:8px;padding:0 16px 12px;
}
.twin-chips button{
  background:var(--bg);color:var(--muted);border:1px solid var(--line);
  font-family:var(--font-body);font-size:.8rem;font-weight:500;
  padding:6px 12px;border-radius:999px;cursor:pointer;transition:color .2s,border-color .2s;
}
.twin-chips button:hover{color:var(--text);border-color:var(--red)}

.twin-form{
  display:flex;gap:8px;padding:12px;border-top:1px solid var(--line);background:var(--surface);
}
.twin-form input{
  flex:1;min-width:0;background:var(--bg);color:var(--text);
  border:1px solid var(--line);border-radius:999px;padding:10px 16px;
  font-family:var(--font-body);font-size:.92rem;
}
.twin-form input:focus{outline:2px solid var(--red);outline-offset:1px}
.twin-form button{
  flex:0 0 auto;background:var(--red);color:#fff;border:none;cursor:pointer;
  font-family:var(--font-head);font-weight:600;font-size:.9rem;
  padding:10px 18px;border-radius:999px;transition:background .2s;
}
.twin-form button:hover{background:var(--red-dark)}

.twin-note{
  padding:0 16px 12px;color:var(--muted);font-size:.75rem;line-height:1.5;background:var(--surface);
}

/* The twin lives in the bottom-LEFT corner: the bottom-right is taken
   by Netlify's injected "Powered by Netlify" badge (locked on the Free
   plan) and the site's own back-to-top button. Nothing sits bottom-left,
   so the twin can never overlap either of them. */
@media (max-width:560px){
  .twin-toggle{left:16px;bottom:16px}
  .twin-panel{left:16px;bottom:78px}
}
@media print{
  .twin-toggle,.twin-panel{display:none !important}
}
