/* augmora.org site chat (chat.js). Uses the tokens in the page's stylesheet (css/v2/<page>.css); load after it. */

.chat-fab {
  position: fixed; left: 20px; bottom: 20px; z-index: 150;
  display: grid; place-items: center; width: 56px; height: 56px; padding: 0;
  border: 1px solid var(--ink); border-radius: 9999px;
  background: var(--ink); color: var(--on-ink);
  box-shadow: 0 6px 20px rgba(24, 27, 33, 0.18); cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}
.chat-fab:hover { background: var(--ink-hover); }
.chat-fab:active { transform: scale(0.96); }
.chat-fab.on-dark { background: var(--surface); color: var(--ink); border-color: var(--surface); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); }
.chat-fab.on-dark:hover { background: var(--pearl); }
.chat-fab.on-dark:focus-visible { outline-color: var(--pearl); }

.chat-panel {
  position: fixed; left: 20px; bottom: 88px; z-index: 150;
  display: flex; flex-direction: column;
  width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100dvh - 112px));
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 20px;
  box-shadow: 0 18px 60px rgba(24, 27, 33, 0.18);
  overflow: hidden;
  font-family: var(--font-ui);
}
.chat-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.chat-fab:focus-visible, .chat-panel :is(button, a, input, textarea, [tabindex]):focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.chat-log:focus-visible { outline-offset: -3px; }
.chat-privacy { flex: none; margin: 0; padding: 0 16px 8px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.chat-privacy a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .chat-panel:not([hidden]) { animation: chat-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1); transform-origin: bottom left; }
  @keyframes chat-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
}

.chat-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 12px 10px 10px 18px; border-bottom: 1px solid var(--border);
}
.chat-title { margin: 6px 0 0; font-family: var(--font-brand); font-size: 16px; font-weight: 600; line-height: 1; }
.chat-title img { display: block; width: auto; height: 24px; }
.chat-note { margin-top: 7px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.chat-close {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 9999px; background: transparent; color: var(--muted); cursor: pointer;
}
.chat-close:hover { background: var(--soft); color: var(--text); }
.chat-close svg { width: 18px; height: 18px; }

.chat-log {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px;
  background: var(--surface); font-size: 15px; line-height: 1.45;
}
.chat-msg { max-width: 86%; padding: 10px 16px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.in { align-self: flex-start; background: #f1f3f6; }
.chat-msg.out { align-self: flex-end; max-width: 80%; background: var(--ink); color: var(--on-ink); }
.chat-msg.error { color: var(--muted); }
.chat-msg a { text-decoration: underline; text-underline-offset: 2px; }
.chat-msg.typing::after { content: "…"; display: inline-block; min-width: 1.5em; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) {
  .chat-msg.typing::after { animation: chat-dots 1s steps(4, end) infinite; overflow: hidden; vertical-align: bottom; }
  @keyframes chat-dots { from { width: 0; min-width: 0; } to { width: 1.2em; min-width: 0; } }
}

.chat-challenge { padding: 12px 16px 0; font-size: 13px; color: var(--muted); }
.chat-challenge p { margin-bottom: 8px; }

.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 12px 8px 16px; border-top: 1px solid var(--border); }
.chat-input {
  flex: 1; min-width: 0; min-height: 48px; max-height: 120px; resize: none; margin: 0; padding: 12px 18px;
  border: 1px solid transparent; border-radius: 24px; background: #f1f3f6; color: var(--text);
  font: inherit; font-size: 16px; line-height: 1.35;
}
.chat-input::placeholder { color: var(--muted); opacity: 1; }
.chat-input:focus-visible { outline-offset: 0; }
.chat-send {
  display: grid; place-items: center; flex: none; width: 48px; height: 48px; padding: 0;
  border: 1px solid var(--ink); border-radius: 9999px; background: var(--ink); color: var(--on-ink); cursor: pointer;
}
.chat-send:hover { background: var(--ink-hover); }
.chat-send:disabled { opacity: 0.45; cursor: default; }
.chat-send svg { width: 18px; height: 18px; }

.chat-foot { display: flex; align-items: center; gap: 12px; padding: 4px 16px 14px; font-size: 12px; color: var(--muted); }
.chat-book {
  display: inline-flex; align-items: center; flex: none; min-height: 44px; padding: 0 16px; white-space: nowrap;
  border-radius: 9999px; background: var(--soft); border: 1px solid rgba(24, 27, 33, 0.15); color: var(--text);
  font-family: var(--font-brand); font-size: 12px; font-weight: 500; letter-spacing: 0.065em; text-transform: uppercase;
  cursor: pointer;
}
.chat-book:hover { opacity: 1; background: var(--border); }

/* ---------- Booking a call: question cards inside the conversation ---------- */
.chat-card {
  flex: none; display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; padding: 16px 16px 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: 0 10px 30px rgba(23, 28, 36, 0.12);
}
.chat-card:focus-visible { outline-offset: 3px; }
.chat-card-step { margin: 0; font-size: 12px; font-weight: 600; line-height: 1.3; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.chat-card-title { margin: 0; padding: 0; font-family: var(--font-ui); font-size: 18px; font-weight: 600; line-height: 1.3; color: var(--ink-hover); }
.chat-opts { display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 0; border: 0; }
.chat-opts .chat-card-title { margin-bottom: 4px; }
.chat-opt {
  display: flex; align-items: center; gap: 12px; min-height: 50px; margin: 0 -8px; padding: 5px 8px;
  border-bottom: 1px solid #eef0f3; color: var(--ink-hover); cursor: pointer;
}
.chat-opt:last-of-type { border-bottom-color: transparent; }
.chat-opt:has(input:checked) { background: #f1f3f6; border-radius: 12px; border-bottom-color: transparent; }
.chat-opt:has(input:checked) .chat-opt-label { font-weight: 600; }
.chat-opt:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 0; border-radius: 12px; }
.chat-opt svg { flex: none; color: var(--soft-text); }
.chat-opt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-opt-label { font-size: 16px; line-height: 1.3; }
.chat-opt-hint { font-size: 13px; line-height: 1.35; color: var(--muted); }
.chat-opt input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.chat-panel .chat-opt input:focus-visible { outline: none; }

.chat-field { display: flex; flex-direction: column; gap: 5px; }
.chat-field[hidden] { display: none; }
.chat-field label { font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--soft-text); }
.chat-optional { font-weight: 400; color: var(--muted); }
.chat-field-input {
  box-sizing: border-box; width: 100%; min-height: 48px; margin: 0; padding: 11px 14px; resize: none;
  border: 1.5px solid #8a93a1; border-radius: 12px; background: var(--surface); color: var(--ink-hover);
  font: inherit; font-size: 16px; line-height: 1.35;
}
.chat-field-input[aria-invalid="true"] { border-color: #a4262c; }
.chat-field-error { margin: 0; font-size: 13px; line-height: 1.4; font-weight: 600; color: #a4262c; }
.chat-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.chat-recap { display: flex; align-items: center; gap: 10px; padding: 2px 6px 2px 12px; border-radius: 12px; background: #f1f3f6; }
.chat-recap span { flex: 1; min-width: 0; padding: 8px 0; font-size: 14px; line-height: 1.4; color: var(--soft-text); overflow-wrap: anywhere; }
.chat-edit {
  flex: none; min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.chat-next {
  min-height: 48px; margin-top: 2px; padding: 0 16px; border: 0; border-radius: 14px;
  background: var(--ink); color: var(--on-ink); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.chat-next:hover { background: var(--ink-hover); }
.chat-next:disabled { background: #eceef2; color: #6b7482; cursor: default; }
.chat-card-status { margin: 0; font-size: 13px; line-height: 1.45; color: var(--soft-text); }
.chat-card-status:empty { display: none; }
.chat-card-status a, .chat-card-note a, .chat-sent-help a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.chat-card-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
.chat-card-note svg { flex: none; margin-top: 1px; color: var(--soft-text); }
.chat-card-note a, .chat-card-status a, .chat-sent-help a { display: inline-block; padding: 12px 0; margin: -12px 0; }

.chat-sent { align-items: stretch; gap: 10px; }
.chat-sent-mark { align-self: center; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 9999px; background: var(--ink); color: var(--on-ink); }
.chat-sent-title { margin: 0; text-align: center; font-family: var(--font-ui); font-size: 22px; font-weight: 600; line-height: 1.25; color: var(--ink); }
.chat-sent-lead { margin: 0; text-align: center; font-size: 15px; line-height: 1.45; color: var(--soft-text); overflow-wrap: anywhere; }
.chat-sent-lead strong { color: var(--ink); }
.chat-sent .chat-card-step { margin-top: 8px; padding-top: 12px; border-top: 1px solid #eef0f3; font-family: var(--font-ui); }
.chat-sent-recap { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; margin: 0; font-size: 14px; line-height: 1.4; }
.chat-sent-recap dt { color: var(--muted); }
.chat-sent-recap dd { margin: 0; overflow-wrap: anywhere; }
.chat-steps { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.chat-steps li { display: flex; align-items: flex-start; gap: 10px; }
.chat-step-mark {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 9999px;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #e6e8ec 30%, #a9aeb6 72%, #7d838c 100%);
}
.chat-step-mark.on { background: var(--ink); color: var(--on-ink); }
.chat-step-text { display: flex; flex-direction: column; gap: 1px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.chat-step-text strong { font-size: 15px; color: var(--ink); }
.chat-step-state { font-weight: 400; color: var(--muted); }
.chat-sent-help { margin: 4px 0 0; padding-top: 12px; border-top: 1px solid #eef0f3; font-size: 13px; line-height: 1.4; color: var(--muted); }

/* ---------- The dark bar under the conversation: message box, privacy line, Book a call row ---------- */
.chat-bar { flex: none; padding-bottom: 6px; background: #0b0c10; color: #ffffff; color-scheme: dark; }
.chat-bar .chat-form { padding: 12px 12px 8px 16px; border-top: 0; }
.chat-bar .chat-input { padding: 12px 14px; border-color: #3a404c; border-radius: 6px; background: #14171d; color: #ffffff; }
.chat-bar .chat-input::placeholder { color: #9aa2ae; }
.chat-bar .chat-send { border-color: #e7ecf4; border-radius: 6px; background: #e7ecf4; color: #212630; }
.chat-bar .chat-send:hover { border-color: #ffffff; background: #ffffff; }
.chat-bar .chat-privacy { padding-bottom: 10px; color: #9aa2ae; }
.chat-bar .chat-privacy a { color: #e7ecf4; }
.chat-bar .chat-foot { gap: 10px; padding: 0 6px 6px 16px; color: #aeb5c0; }
.chat-bar .chat-foot[hidden] { display: none; }
.chat-bar .chat-foot span { flex: 1; min-width: 0; }
.chat-bar .chat-book { border: 1px solid #6b7280; border-radius: 6px; background: transparent; color: #ffffff; }
.chat-bar .chat-book:hover { background: #1b1f27; }
.chat-hide {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: #aeb5c0; cursor: pointer;
}
.chat-hide:hover { background: #1b1f27; color: #ffffff; }
.chat-panel .chat-bar :is(button, a, textarea):focus-visible { outline-color: #e7ecf4; }

/* ---------- Follow-up choices that open under a picked row ---------- */
.chat-opt:has(+ .chat-sub:not([hidden])) { border-radius: 12px 12px 0 0; }
.chat-sub { min-width: 0; margin: 0 -8px 4px; padding: 2px 8px 12px; border: 0; border-radius: 0 0 12px 12px; background: #f1f3f6; }
.chat-sub[hidden] { display: none; }
.chat-sub legend { float: left; width: 100%; padding: 0 0 8px; font-size: 13px; line-height: 1.35; color: var(--soft-text); }
.chat-pills { clear: both; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chat-pill {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px;
  border: 1.5px solid #8a93a1; border-radius: 12px; background: var(--surface); color: var(--ink-hover);
  font-size: 14px; line-height: 1.25; cursor: pointer;
}
.chat-pill input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.chat-pill:has(input:checked) { border-color: var(--ink); background: var(--ink); color: var(--on-ink); font-weight: 600; }
.chat-pill:has(input:checked) input { accent-color: #e7ecf4; }
.chat-pill:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.chat-panel .chat-pill input:focus-visible { outline: none; }

/* ---------- "A good place to start" on the Message sent card ---------- */
.chat-suggest { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; padding: 14px 16px; border-radius: 16px; background: #e7ecf4; color: var(--ink); }
.chat-sent .chat-suggest .chat-card-step { margin: 0; padding: 0; border: 0; color: var(--soft-text); }
.chat-suggest-title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.chat-suggest-text { margin: 0; font-size: 14px; line-height: 1.45; color: var(--soft-text); }
.chat-suggest-link {
  align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; padding: 0 18px;
  border-radius: 9999px; background: var(--ink); color: var(--on-ink);
  font-family: var(--font-brand); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none;
}
.chat-suggest-link:hover { background: var(--ink-hover); opacity: 1; }

/* Booking: a full-height panel on the right, wide enough for each question card. */
@media (min-width: 600px) {
  .chat-panel.is-sheet {
    left: auto; right: 20px; top: 92px; bottom: 20px;
    width: min(440px, calc(100vw - 40px)); height: auto; max-height: 760px;
    transform-origin: bottom right;
  }
}
/* Phones: the panel fills the screen, so a whole question card fits. */
@media (max-width: 599.98px) {
  .chat-fab { left: 16px; bottom: 16px; }
  .chat-panel {
    inset: 0; width: auto; height: auto; border: 0; border-radius: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }
  /* The dark bar runs to the bottom edge; it keeps clear of the home indicator itself. */
  .chat-bar { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  .chat-msg { font-size: 16px; }
}
@media print { .chat-fab, .chat-panel { display: none !important; } }

.chat-panel[hidden], .chat-fab[hidden] { display: none; }
/* Scrolling down tucks the button below the screen edge so it never sits on text; scrolling up brings it back. */
.chat-fab.is-tucked { transform: translateY(calc(100% + 40px)); opacity: 0; visibility: hidden; pointer-events: none; transition: transform 240ms ease, opacity 200ms ease, visibility 0s linear 240ms; }
.chat-fab:not(.is-tucked) { transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 240ms ease, opacity 200ms ease, visibility 0s; }
@media (prefers-reduced-motion: reduce) { .chat-fab, .chat-fab.is-tucked, .chat-fab:not(.is-tucked) { transition: none; } }
@media (max-width: 480px) { .chat-fab.phone-in-view { display: none; } }
.chat-title { display: flex; gap: 10px; align-items: center; }
.chat-title::before { content: ""; width: 22px; height: 22px; border-radius: 50%; background: url("/assets/pearl.png") center/cover; }

/* The phone hosts the very same panel as the site launcher. Its shell owns the bezel and status bar. */
.chat-film-example { display: none; }
.film-chat-slot .chat-panel {
  position: relative; inset: auto; z-index: auto; width: 100%; height: 100%; min-height: 0; padding: 0;
  border: 0; border-radius: 0; box-shadow: none; text-align: left; text-transform: none; letter-spacing: normal;
}
.film-chat-slot .chat-head {
  flex: none; display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 4px;
  margin: 0; padding: 4px 12px 10px 5px; background: var(--surface); color: var(--text);
}
.film-chat-slot .chat-close { grid-area: 1 / 1; color: var(--ink); }
.film-chat-slot .chat-title { margin: 0; font-size: 18px; font-weight: 600; text-transform: none; letter-spacing: normal; }
.film-chat-slot .chat-note { margin: 3px 0 0; }
.film-chat-slot .chat-log { padding: 12px; text-align: left; }
.film-chat-slot .chat-film-example { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.film-chat-slot .chat-log:has(.chat-film-example) > .chat-msg:first-child { display: none; }
.film-chat-slot .chat-msg { flex: none; padding: 9px 12px; font-size: 15px; }
.film-chat-slot .chat-example-label { font: 600 11px/1.3 var(--font-ui); color: var(--muted); letter-spacing: .09em; text-transform: uppercase; }
.film-chat-slot .chat-example-book {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px;
  border-radius: 24px; background: var(--ink); color: var(--on-ink);
  font: 500 12px/1.25 var(--font-brand); text-decoration: none;
}
.film-chat-slot .chat-bar { color-scheme: light; padding: 0 0 2px; background: var(--surface); color: var(--text); border-top: 1px solid var(--border); }
.film-chat-slot .chat-form { align-items: center; gap: 6px; padding: 8px 10px; }
.film-chat-slot .chat-bar .chat-input { min-height: 44px; padding: 10px 12px; background: #f3f5f6; color: var(--text); border-color: var(--border); border-radius: 22px; }
.film-chat-slot .chat-bar .chat-input::placeholder { color: var(--muted); }
.film-chat-slot .chat-bar .chat-send { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--ink); color: var(--on-ink); }
.film-chat-slot .chat-privacy { padding: 0 12px 8px; color: var(--muted); }
.film-chat-slot .chat-bar .chat-privacy a { color: var(--text); }
.film-chat-slot .chat-bar .chat-foot { margin: 0; padding: 0 8px 4px; gap: 6px; color: var(--muted); background: transparent; }
.film-chat-slot .chat-panel:has(.chat-film-example) .chat-foot { display: none; }
.film-chat-slot .chat-bar .chat-book { border-color: var(--border); border-radius: 22px; background: #f3f5f6; color: var(--ink); }
.film-chat-slot .chat-bar .chat-hide { color: var(--muted); }
.film-chat-slot .chat-bar .chat-hide:hover { color: var(--ink); background: var(--soft); }
.film-chat-slot .chat-panel :is(button, a, textarea):focus-visible { outline-color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .film-chat-slot .chat-panel:not([hidden]) { animation: chat-screen-in 180ms ease-out; }
  @keyframes chat-screen-in { from { opacity: 0; transform: translateX(6px); } }
}
