/* Vanguard Epoxy Systems: chat host dock. Loaded by chat.js (or a <link> in the page head).
   Mobile first (375px): a bottom sheet above the sticky Call / Get estimate bar. 640px+: a calm floating card.
   Inherits the site's tokens from style.css (dark default, ?theme=light); every token has a fallback so the dock
   also renders if style.css has not loaded. No external requests. */

.vxc, .vxc *, .vxc *::before, .vxc *::after { box-sizing: border-box; }

/* ---------- launcher: shows Chuck's face (decorated by chat.js; the page may also ship the <img> itself) ---------- */
.chat-btn .vx-launch-face { width: 32px; height: 32px; flex: none; border-radius: 50%; background: #0a0a0d; border: 1px solid var(--gold, #c9a45c); display: block; margin-left: -8px; }
.chat-btn.vxc-has-face { padding-left: 14px; }
.chat-btn.vxc-has-face > svg { display: none; }

/* ---------- root / backdrop ---------- */
.vxc { position: relative; z-index: 80; font-family: var(--sans, "Jost", system-ui, sans-serif); color: var(--text, #ece8df); }
.vxc[hidden] { display: none; }
.vxc-backdrop { position: fixed; left: 0; right: 0; top: 0; bottom: calc(var(--dock-h, 56px) + 1px + env(safe-area-inset-bottom, 0px)); background: rgba(0, 0, 0, .55); z-index: 75; }
html.vxc-kb .vxc-backdrop { bottom: 0; }
html.vxc-lock { overflow: hidden; }

/* ---------- the sheet ---------- */
.vxc-sheet {
  position: fixed; left: 0; right: 0; z-index: 80;
  bottom: var(--vxc-bottom, calc(var(--dock-h, 56px) + 1px + env(safe-area-inset-bottom, 0px)));
  height: var(--vxc-h, calc(100vh - var(--dock-h, 56px) - env(safe-area-inset-bottom, 0px) - 20px));
  height: var(--vxc-h, calc(100dvh - var(--dock-h, 56px) - env(safe-area-inset-bottom, 0px) - 20px));
  max-height: 780px;
  display: flex; flex-direction: column;
  background: var(--bg, #0a0a0d); color: var(--text, #ece8df);
  border-top: 1px solid var(--hair, rgba(201,164,92,.42));
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .45);
  outline: none;
}
html[data-theme="light"] .vxc-sheet { box-shadow: 0 -14px 40px rgba(60, 45, 15, .16); }
.vxc-sheet::before { content: ""; position: absolute; top: -1px; left: 50%; width: 36px; margin-left: -18px; height: 2px; background: var(--gold, #c9a45c); opacity: .9; }
@media (prefers-reduced-motion: no-preference) {
  .vxc-sheet { animation: vxc-rise .55s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes vxc-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

/* ---------- header ---------- */
.vxc-head { display: flex; align-items: center; gap: 12px; padding: 14px 4px 12px 16px; border-bottom: 1px solid var(--hair-soft, rgba(201,164,92,.2)); flex: none; }
.vxc-face { position: relative; width: 56px; height: 56px; flex: none; border-radius: 50%; background: #0a0a0d; box-shadow: 0 0 0 1px var(--gold, #c9a45c); transition: box-shadow .6s ease; }
.vxc-face canvas { display: block; width: 56px; height: 56px; border-radius: 50%; }
.vxc-face[data-state="speaking"] { box-shadow: 0 0 0 1px var(--gold, #c9a45c), 0 0 0 4px rgba(201, 164, 92, .22); }
.vxc-face[data-state="listening"] { box-shadow: 0 0 0 1px var(--focus, #8cb8ff), 0 0 0 4px rgba(140, 184, 255, .25); }
.vxc-titles { min-width: 0; flex: 1; }
.vxc-title { margin: 0; font: 400 1.28rem/1.15 var(--serif, "Cormorant Garamond", Georgia, serif); letter-spacing: .005em; color: var(--text, #ece8df); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vxc-pill { font: 500 .62rem/1 var(--sans, sans-serif); letter-spacing: .18em; text-transform: uppercase; color: var(--gold-text, #d3b270); border: 1px solid var(--hair, rgba(201,164,92,.42)); padding: 4px 7px 3px; }
.vxc-pill[hidden] { display: none; }
.vxc-by { margin: 5px 0 0; display: flex; align-items: center; gap: 7px; font: 400 .74rem/1.2 var(--sans, sans-serif); letter-spacing: .05em; color: var(--muted, #a9a499); }
.vxc-bymark { width: 20px; height: 20px; flex: none; border-radius: 50%; background: #0a0a0d; box-shadow: 0 0 0 1px var(--hair, rgba(201,164,92,.42)); display: block; overflow: hidden; }
.vxc-bymark img { width: 20px; height: 20px; display: block; }
.vxc-iconbtn { width: 48px; height: 48px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted, #a9a499); cursor: pointer; border-radius: 0; transition: color .3s ease; }
.vxc-iconbtn:hover { color: var(--text, #ece8df); }
.vxc-iconbtn svg { width: 20px; height: 20px; }
.vxc-iconbtn[hidden] { display: none; }
.vxc-iconbtn[aria-pressed="true"] { color: var(--gold-text, #d3b270); }

/* ---------- conversation ---------- */
.vxc-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 16px 10px; display: flex; flex-direction: column; gap: 22px; scroll-padding-bottom: 12px; -webkit-overflow-scrolling: touch; }
.vxc-msg { max-width: 92%; font-size: 1.0625rem; line-height: 1.6; font-weight: 300; letter-spacing: .01em; overflow-wrap: anywhere; }
.vxc-msg p { margin: 0 0 .7em; max-width: none; }
.vxc-msg p:last-child { margin-bottom: 0; }
.vxc-host { align-self: flex-start; padding-left: 14px; border-left: 1px solid var(--gold, #c9a45c); }
.vxc-me { align-self: flex-end; padding: 10px 14px; border: 1px solid var(--hair-soft, rgba(201,164,92,.2)); background: var(--bg-soft, #111115); }
.vxc-note { align-self: stretch; max-width: none; font-size: .92rem; line-height: 1.55; color: var(--muted, #a9a499); text-align: center; padding: 0 6px; }
.vxc-note::before { content: ""; display: block; width: 28px; height: 1px; background: var(--gold, #c9a45c); margin: 0 auto 12px; opacity: .8; }
.vxc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.vxc-typing { align-self: flex-start; padding-left: 14px; border-left: 1px solid var(--gold, #c9a45c); display: flex; gap: 6px; align-items: center; min-height: 28px; }
.vxc-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold, #c9a45c); opacity: .35; display: block; }
@media (prefers-reduced-motion: no-preference) {
  .vxc-typing i { animation: vxc-dot 1.4s ease-in-out infinite; }
  .vxc-typing i:nth-child(2) { animation-delay: .2s; }
  .vxc-typing i:nth-child(3) { animation-delay: .4s; }
  @keyframes vxc-dot { 0%, 100% { opacity: .25; } 40% { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { .vxc-typing i { opacity: .8; } }

/* quick replies */
.vxc-chips { align-self: stretch; display: flex; flex-wrap: wrap; gap: 10px; }
.vxc-chip { min-height: 48px; padding: 8px 18px; border: 1px solid var(--hair, rgba(201,164,92,.42)); background: transparent; color: var(--text, #ece8df); font: 400 .98rem/1.25 var(--sans, sans-serif); letter-spacing: .02em; cursor: pointer; border-radius: 0; text-align: left; transition: border-color .4s ease, background-color .4s ease; }
.vxc-chip:hover { border-color: var(--gold, #c9a45c); background: var(--bg-soft, #111115); }
.vxc-chip:active { background: var(--bg-soft, #111115); }

/* review card */
.vxc-card { align-self: stretch; border: 1px solid var(--hair, rgba(201,164,92,.42)); padding: 20px 18px 18px; background: var(--bg-soft, #111115); outline: none; }
.vxc-card h3 { margin: 0 0 4px; font: 400 1.4rem/1.2 var(--serif, Georgia, serif); }
.vxc-card .vxc-sub { margin: 0 0 14px; font-size: .9rem; color: var(--muted, #a9a499); line-height: 1.5; }
.vxc-card dl { margin: 0 0 16px; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 1rem; }
.vxc-card dt { color: var(--muted, #a9a499); font-size: .9rem; }
.vxc-card dd { margin: 0; overflow-wrap: anywhere; }
.vxc-consent { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; min-height: 48px; padding: 6px 0; cursor: pointer; font-size: .98rem; line-height: 1.45; }
.vxc-consent input { width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--gold, #c9a45c); }
.vxc-consent small { display: block; margin-top: 3px; color: var(--muted, #a9a499); font-size: .84rem; line-height: 1.4; }
.vxc-err { margin: 8px 0 0; color: var(--danger, #ff9b9b); font-size: .92rem; line-height: 1.45; }
.vxc-err:empty { display: none; }
.vxc-actions { display: grid; gap: 10px; margin-top: 14px; }
.vxc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 22px; border: 1px solid transparent; border-radius: 0; font: 500 .78rem/1 var(--sans, sans-serif); letter-spacing: .2em; text-transform: uppercase; text-decoration: none; cursor: pointer; text-align: center; transition: background-color .4s ease, border-color .4s ease, opacity .3s ease; }
.vxc-btn-gold { background: var(--btn-bg, #c9a45c); color: var(--btn-ink, #14110a); }
.vxc-btn-gold:hover { background: var(--btn-bg-hover, #d9b873); }
.vxc-btn-ghost { background: transparent; color: var(--text, #ece8df); border-color: var(--hair, rgba(201,164,92,.42)); }
.vxc-btn-ghost:hover { border-color: var(--gold, #c9a45c); }
.vxc-btn[disabled], .vxc-btn[aria-disabled="true"] { opacity: .55; cursor: wait; }
.vxc-card.vxc-done { border-color: var(--ok, #8fd9ae); }
.vxc-card.vxc-done h3 { color: var(--text, #ece8df); }

/* voice consent + live indicators */
.vxc-voice { margin: 0 16px 10px; padding: 14px 14px 12px; border: 1px solid var(--hair, rgba(201,164,92,.42)); background: var(--bg-soft, #111115); font-size: .92rem; line-height: 1.5; color: var(--muted, #a9a499); flex: none; }
.vxc-voice[hidden] { display: none; }
.vxc-voice strong { display: block; color: var(--text, #ece8df); font: 400 1.15rem/1.2 var(--serif, Georgia, serif); margin-bottom: 4px; }
.vxc-voice .vxc-actions { grid-template-columns: 1fr 1fr; }
.vxc-status { flex: none; min-height: 0; margin: 0 16px; font-size: .9rem; color: var(--muted, #a9a499); display: flex; align-items: center; gap: 10px; }
.vxc-status:empty { display: none; }
.vxc-status.is-listening { color: var(--text, #ece8df); min-height: 36px; }
.vxc-status .vxc-rec { width: 10px; height: 10px; border-radius: 50%; background: var(--danger, #ff9b9b); flex: none; }
@media (prefers-reduced-motion: no-preference) { .vxc-status .vxc-rec { animation: vxc-rec 1.2s ease-in-out infinite; } @keyframes vxc-rec { 50% { opacity: .35; } } }

/* ---------- composer ---------- */
.vxc-form { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 12px; border-top: 1px solid var(--hair-soft, rgba(201,164,92,.2)); flex: none; }
.vxc-input { flex: 1; min-width: 0; min-height: 48px; padding: 8px 4px; font: 300 1.125rem/1.35 var(--sans, sans-serif); color: var(--text, #ece8df); background: transparent; border: 0; border-bottom: 1px solid var(--field, rgba(236,232,223,.38)); border-radius: 0; -webkit-appearance: none; appearance: none; }
.vxc-input::placeholder { color: var(--muted, #a9a499); opacity: .85; }
.vxc-input:focus-visible { outline: none; border-bottom-color: var(--gold, #c9a45c); box-shadow: 0 1px 0 0 var(--gold, #c9a45c); }
.vxc-send { width: 48px; height: 48px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 0; background: var(--btn-bg, #c9a45c); color: var(--btn-ink, #14110a); cursor: pointer; transition: background-color .4s ease, opacity .3s ease; }
.vxc-send:hover { background: var(--btn-bg-hover, #d9b873); }
.vxc-send svg { width: 20px; height: 20px; }
.vxc-send[aria-disabled="true"] { opacity: .45; cursor: default; }
.vxc-foot { flex: none; margin: 0; padding: 2px 16px 10px; font-size: .76rem; line-height: 1.4; color: var(--muted, #a9a499); text-align: center; letter-spacing: .02em; max-width: none; }

.vxc :focus-visible { outline: 2px solid var(--focus, #8cb8ff); outline-offset: 3px; border-radius: 2px; }
.vxc .vxc-input:focus-visible { outline: none; }

/* ---------- tablet / desktop: a calm floating card ---------- */
@media (min-width: 640px) {
  .vxc-backdrop { display: none; }
  html.vxc-lock { overflow: auto; }
  .vxc-sheet {
    left: auto; right: 14px; width: 26rem;
    bottom: calc(var(--dock-h, 56px) + env(safe-area-inset-bottom, 0px) + 74px);
    height: min(40rem, calc(100vh - var(--dock-h, 56px) - 100px));
    height: min(40rem, calc(100dvh - var(--dock-h, 56px) - 100px));
    border: 1px solid var(--hair, rgba(201,164,92,.42));
    box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
  }
  html[data-theme="light"] .vxc-sheet { box-shadow: 0 24px 60px rgba(60, 45, 15, .2); }
  .vxc-sheet::before { display: none; }
}
@media (min-width: 900px) {
  .vxc-sheet { right: 28px; bottom: 92px; width: 27rem; height: min(42rem, calc(100vh - 124px)); height: min(42rem, calc(100dvh - 124px)); }
}
@media (prefers-reduced-motion: reduce) {
  .vxc *, .vxc *::before, .vxc *::after { animation: none !important; transition: none !important; }
}
