/* ============================================================
   Martina web chat - standalone stylesheet.

   Self-contained copy of the ".tchat" rules from assets/css/styles.css, for
   embedding the widget on sites that do NOT load our main stylesheet - the
   HubSpot knowledge base at help.abtrace.co in particular.

   Differences from styles.css:
     - the design tokens it needs are redeclared on .tchat itself, not :root,
       so nothing leaks into the host page's own theme;
     - @font-face src paths are absolute (www.abtrace.com), since the host page
       is on another origin. CloudFront serves /assets/* with
       Access-Control-Allow-Origin: *, so the cross-origin fetch is allowed;
     - a box-sizing/line-height guard, because a host theme's base rules would
       otherwise leak into the widget.

   Keep in sync with the ".tchat" section of assets/css/styles.css.
   ============================================================ */

@font-face{
  font-family:'Archivo';font-style:normal;font-weight:100 900;font-stretch:62% 125%;font-display:swap;
  src:url(https://www.abtrace.com/assets/fonts/archivo-var.woff2) format('woff2');
}
@font-face{
  font-family:'Atkinson Hyperlegible';font-style:normal;font-weight:400;font-display:swap;
  src:url(https://www.abtrace.com/assets/fonts/atkinson-400.woff2) format('woff2');
}
@font-face{
  font-family:'Atkinson Hyperlegible';font-style:normal;font-weight:700;font-display:swap;
  src:url(https://www.abtrace.com/assets/fonts/atkinson-700.woff2) format('woff2');
}

/* Design tokens, scoped to the widget so the host page is untouched. */
.tchat{
  --red:        #993335;
  --red-deep:   #7A2729;
  --ink:        #082C30;
  --muted:      #71797A;
  --line:       #ECE4DD;
  --surface:    #FFFAF5;
  --halo:       0 1px 2px rgba(48,24,20,.05), 0 10px 30px rgba(48,24,20,.07);
  --halo-lg:    0 2px 4px rgba(48,24,20,.06), 0 24px 60px rgba(48,24,20,.12);
  --display:    'Archivo', system-ui, sans-serif;
  --body:       'Atkinson Hyperlegible', system-ui, sans-serif;
}

/* Host themes set their own box-sizing, line-height and button/textarea fonts;
   re-assert ours inside the widget only. */
.tchat,.tchat *,.tchat *::before,.tchat *::after{box-sizing:border-box}
.tchat{line-height:1.5;letter-spacing:normal;text-transform:none}
.tchat button,.tchat textarea{font-family:inherit;letter-spacing:normal;text-transform:none;margin:0}

/* ---------- widget ---------- */
.tchat{position:fixed;right:20px;bottom:20px;z-index:11000;font-family:var(--body)}
.tchat-launch{display:flex;align-items:center;gap:8px;background:var(--red);color:#fff;border:0;border-radius:999px;padding:12px 18px;font-family:var(--display);font-weight:600;font-size:.95rem;cursor:pointer;box-shadow:var(--halo-lg);transition:transform .15s}
.tchat-launch:hover{transform:translateY(-2px)}
.tchat-nudge{position:absolute;right:2px;bottom:64px;max-width:300px;width:max-content;background:#fff;border:1px solid var(--line);border-radius:14px;padding:10px 14px;font-size:.85rem;line-height:1.4;color:var(--ink);box-shadow:var(--halo);opacity:0;transform:translateY(6px);transition:opacity .3s,transform .3s;pointer-events:none}
.tchat-nudge.show{opacity:1;transform:none}
.tchat-panel{position:absolute;right:0;bottom:66px;width:360px;max-width:calc(100vw - 40px);height:520px;max-height:calc(100vh - 110px);background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:var(--halo-lg);overflow:hidden;display:none;flex-direction:column}
.tchat-panel.open{display:flex;animation:tcfade .2s ease}
@keyframes tcfade{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.tchat-head{background:var(--ink);color:#fff;padding:14px 16px;display:flex;align-items:center;gap:12px;flex:none}
.tchat-ava{width:42px;height:42px;border-radius:50%;background:var(--red);display:grid;place-items:center;font-family:var(--display);font-weight:700;font-size:.9rem;flex:none;overflow:hidden;box-shadow:0 0 0 2px #fff,0 2px 6px rgba(0,0,0,.35)}
.tchat-ava img{width:100%;height:100%;object-fit:cover;display:block}
.tchat-head .who{flex:1;min-width:0}
.tchat-head strong{font-family:var(--display);font-weight:600;display:block;font-size:1rem}
.tchat-head .st{font-size:.74rem;color:#b9c9cd;display:flex;align-items:center;gap:5px}
.tchat-head .st::before{content:"";width:7px;height:7px;border-radius:50%;background:#4cc48a;display:inline-block}
.tchat-mute,.tchat-x{background:none;border:0;color:#fff;cursor:pointer;padding:0;flex:none;display:grid;place-items:center;width:24px;height:24px;opacity:.75;transition:opacity .12s}
.tchat-mute:hover,.tchat-x:hover{opacity:1}
.tchat-banner{flex:none;background:var(--surface);color:var(--muted);font-size:.68rem;line-height:1.35;text-align:center;padding:7px 14px}
.tchat-msgs{flex:1;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:8px 16px 16px;display:flex;flex-direction:column;gap:10px;background:var(--surface)}
.tchat-b{max-width:82%;padding:10px 13px;border-radius:14px;font-size:.9rem;line-height:1.45;white-space:pre-wrap;word-wrap:break-word}
.tchat-b.bot{align-self:flex-start;background:#fff;border:1px solid var(--line);color:var(--ink);border-bottom-left-radius:4px}
.tchat-b.me{align-self:flex-end;background:var(--red);color:#fff;border-bottom-right-radius:4px}
.tchat-b.sys{align-self:center;background:none;color:var(--muted);font-size:.78rem;text-align:center;max-width:100%;padding:2px}
.tchat-overlay{position:absolute;inset:0;z-index:5;display:grid;place-items:center;padding:22px;background:rgba(255,255,255,.55);backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px);animation:tcfade .15s ease}
.tchat-confirm{width:100%;max-width:270px;background:#fff;border:1px solid var(--line);border-radius:16px;padding:18px 16px;text-align:center;box-shadow:var(--halo-lg)}
.tchat-confirm p{margin:0 0 14px;font-family:var(--display);font-weight:600;font-size:.95rem;color:var(--ink);line-height:1.4}
.tchat-confirm .row{display:flex;gap:8px}
.tchat-confirm button{flex:1;border:0;border-radius:10px;padding:9px 10px;font-family:var(--display);font-weight:600;font-size:.83rem;cursor:pointer}
.tchat-confirm .yes{background:var(--red);color:#fff}
.tchat-confirm .no{background:var(--surface);color:var(--ink);border:1px solid var(--line)}
.tchat-survey{width:100%;max-width:300px;max-height:100%;overflow-y:auto;overscroll-behavior:contain;background:#fff;border:1px solid var(--line);border-radius:16px;padding:18px 16px;text-align:center;box-shadow:var(--halo-lg)}
.tchat-survey .q{margin:0 0 14px;font-family:var(--display);font-weight:600;font-size:.95rem;color:var(--ink);line-height:1.4}
.tchat-rates{display:flex;gap:8px}
.tchat-rate{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:12px 6px;cursor:pointer;transition:border-color .12s,transform .12s}
.tchat-rate:hover{border-color:var(--red);transform:translateY(-1px)}
.tchat-rate .emo{font-size:1.6rem;line-height:1}
.tchat-rate .lbl{font-size:.72rem;color:var(--muted)}
.tchat-skip{margin-top:14px;background:none;border:0;color:var(--muted);font-size:.78rem;cursor:pointer;text-decoration:underline}
.tchat-thanks{margin:8px 0 14px;font-family:var(--display);font-weight:600;color:var(--ink);font-size:1rem}
.tchat-done{background:var(--red);color:#fff;border:0;border-radius:10px;padding:9px 18px;font-family:var(--display);font-weight:600;font-size:.83rem;cursor:pointer}
#tchatSurveyForm{margin-top:6px;text-align:left}
#tchatSurveyForm .hs-form-field{margin:0 0 10px}
#tchatSurveyForm label{display:block;font-size:.78rem;color:var(--ink);margin-bottom:4px;font-family:var(--body)}
#tchatSurveyForm textarea,#tchatSurveyForm input[type=text],#tchatSurveyForm input[type=email]{width:100%;box-sizing:border-box;border:1px solid var(--line);border-radius:10px;padding:8px 10px;font-family:var(--body);font-size:.86rem;color:var(--ink)}
#tchatSurveyForm textarea{min-height:64px;resize:vertical}
#tchatSurveyForm .hs-button{width:100%;background:var(--red);color:#fff;border:0;border-radius:999px;padding:9px 14px;font-family:var(--display);font-weight:600;font-size:.85rem;cursor:pointer;margin-top:2px}
#tchatSurveyForm .hs-button:hover{background:var(--red-deep)}
#tchatSurveyForm .inputs-list{list-style:none;margin:0;padding:0}
#tchatSurveyForm .hs-error-msgs{list-style:none;margin:3px 0 0;padding:0;color:var(--red);font-size:.72rem}
@keyframes tchatAttn{0%,100%{transform:translateX(0)}15%{transform:translateX(-4px)}30%{transform:translateX(4px)}45%{transform:translateX(-3px)}60%{transform:translateX(2px)}75%{transform:translateX(-1px)}}
@keyframes tchatGlow{0%{box-shadow:0 0 0 0 rgba(153,51,53,0)}30%{box-shadow:0 0 0 3px rgba(153,51,53,.22)}100%{box-shadow:0 0 0 0 rgba(153,51,53,0)}}
#tchatSurveyForm .tchat-attn{animation:tchatAttn .5s ease}
#tchatSurveyForm .tchat-attn input{border-color:var(--red);animation:tchatGlow .9s ease}
.tchat-typing{align-self:flex-start;color:var(--muted);font-size:.8rem;padding:2px 4px}
.tchat-foot{flex:none;padding:12px 12px 6px;display:flex;gap:8px;align-items:flex-end;background:#fff}
.tchat-foot textarea{flex:1;box-sizing:border-box;min-width:0;height:42px;min-height:42px;border:1px solid var(--line);border-radius:22px;padding:10px 16px;font-family:var(--body);font-size:.9rem;line-height:1.35;color:var(--ink);background:var(--surface);resize:none;max-height:110px;transition:border-color .15s,box-shadow .15s,background .15s}
.tchat-foot textarea::placeholder{color:var(--muted)}
.tchat-foot textarea:focus{outline:none;background:#fff;border-color:var(--red);box-shadow:0 0 0 3px rgba(153,51,53,.12)}
.tchat-foot button{flex:none;width:42px;height:42px;border-radius:50%;background:var(--red);color:#fff;border:0;cursor:pointer;display:grid;place-items:center;box-shadow:0 2px 6px rgba(153,51,53,.35);transition:transform .12s,box-shadow .12s,opacity .12s}
.tchat-foot button:hover{transform:translateY(-1px);box-shadow:0 4px 10px rgba(153,51,53,.4)}
.tchat-foot button:active{transform:translateY(0)}
.tchat-foot button:disabled{opacity:.5;cursor:default;box-shadow:none;transform:none}
.tchat-note{font-size:.66rem;color:var(--muted);text-align:center;padding:2px 14px 10px;background:#fff;flex:none;display:flex;flex-direction:column;align-items:center;gap:5px;line-height:1.35}
.tchat-endlink{display:inline-flex;align-items:center;gap:5px;background:none;border:0;color:var(--muted);font-family:var(--body);font-size:.72rem;cursor:pointer;padding:0;transition:color .12s}
.tchat-endlink::before{content:"";width:12px;height:12px;flex:none;background:currentColor;-webkit-mask:no-repeat center/contain;mask:no-repeat center/contain;-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E")}
.tchat-endlink:hover{color:var(--red)}
@media (max-width:560px){.tchat{right:12px;bottom:12px}.tchat-panel{width:calc(100vw - 24px);height:calc(100vh - 90px)}}
/* the consent dialog blocks the page, so hold the nudge back until it is answered */
body.cc-visible .tchat-nudge{display:none}
