/* ARK HUB - customer chat widget skin (JANE). Every selector starts with .arkc, nothing leaks to the host page.
 * Colours, fonts and radii are variables. A site may set any --arkc-* value; otherwise the per-business block below
 * reads the host page's own variables (with fallbacks), so no theme snippet is needed. Light theme only.
 *
 *  --arkc-font  --arkc-font-head  --arkc-bg  --arkc-surface  --arkc-ink  --arkc-muted  --arkc-line
 *  --arkc-accent  --arkc-accent-bg  --arkc-on-accent  --arkc-tint  --arkc-focus  --arkc-error  --arkc-error-bg
 *  --arkc-radius  --arkc-radius-btn  --arkc-lift (set by the script: extra bottom offset to clear a page button)
 */
.arkc {
  --_bg: var(--arkc-bg, var(--_d-bg, #ffffff));
  --_surface: var(--arkc-surface, var(--_d-surface, #ffffff));
  --_ink: var(--arkc-ink, var(--_d-ink, #14202e));
  --_muted: var(--arkc-muted, var(--_d-muted, #566475));
  --_line: var(--arkc-line, var(--_d-line, #cfd8e1));
  --_accent: var(--arkc-accent, var(--_d-accent, #1c4f8a));
  --_accent-bg: var(--arkc-accent-bg, var(--_accent));
  --_on: var(--arkc-on-accent, #ffffff);
  --_tint: var(--arkc-tint, var(--_d-tint, #eef3f8));
  --_focus: var(--arkc-focus, var(--_accent));
  --_err: var(--arkc-error, #8f1d12);
  --_err-bg: var(--arkc-error-bg, #fdf0ef);
  --_r: var(--arkc-radius, var(--_d-radius, 14px));
  --_rb: var(--arkc-radius-btn, var(--_d-radius-btn, 999px));
  --_font: var(--arkc-font, var(--_d-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif));
  --_head: var(--arkc-font-head, var(--_d-head, var(--_font)));
  --_fw: var(--arkc-fw, var(--_d-fw, 700));
  --_gap: calc(16px + var(--arkc-lift, 0px));

  font-family: var(--_font);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--_ink);
  text-align: left;
}
.arkc[data-business="cooldown"] { --_d-bg: var(--paper, #fbfdff); --_d-surface: #fff; --_d-ink: var(--ink, #0f1a2a); --_d-muted: #55657a; --_d-line: var(--rule, #c9dbe8); --_d-accent: var(--blue, #0d498d); --_d-tint: var(--ice, #f0f9ff); --_d-font: var(--font-sans, system-ui, sans-serif); --_d-radius: 14px; --_d-radius-btn: 12px; }
.arkc[data-business="wilsark"]  { --_d-bg: var(--panel, #fff); --_d-surface: #fff; --_d-ink: var(--text, #132030); --_d-muted: #536375; --_d-line: var(--rule, #d8dee5); --_d-accent: var(--steel-deep, #1c5f80); --_d-tint: var(--steel-wash, #eef5f9); --_d-font: var(--sans, system-ui, sans-serif); --_d-radius: 4px; --_d-radius-btn: 4px; }
.arkc[data-business="cabral"]   { --_d-bg: #fbf5ee; --_d-surface: #fffdf9; --_d-ink: #2a1c1f; --_d-muted: #6b5a56; --_d-line: #e0cdbd; --_d-fw: 500; --_d-accent: #9c4a36; --_d-tint: #f6e6dc; --_d-font: var(--body, system-ui, sans-serif); --_d-head: var(--display, var(--body, system-ui, sans-serif)); --_d-radius: 18px; --_d-radius-btn: 999px; }
.arkc[data-business="razzle"]   { --_d-bg: var(--bg2, #fffdf9); --_d-surface: #fff; --_d-ink: var(--ink, #2b2a26); --_d-muted: #5f5a50; --_d-line: #d9cfba; --_d-accent: var(--brand, #1e4433); --_d-tint: var(--soft, #e7efe9); --_d-font: var(--font-body, system-ui, sans-serif); --_d-head: var(--font-head, Georgia, serif); --_d-radius: var(--radius, 16px); --_d-radius-btn: 999px; }

/* low specificity reset, so every .arkc__ class below wins */
.arkc, .arkc *, .arkc *::before, .arkc *::after { box-sizing: border-box; }
:where(.arkc) button, :where(.arkc) input { font: inherit; color: inherit; margin: 0; letter-spacing: normal; text-transform: none; }
:where(.arkc) button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
.arkc [hidden] { display: none !important; }
.arkc :focus { outline: none; }
.arkc :focus-visible { outline: 3px solid var(--_focus); outline-offset: 2px; }

/* launcher */
.arkc__launch {
  position: fixed; z-index: 2147483000;
  right: calc(16px + var(--arkc-r, 0px) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--_gap) + var(--arkc-b, 0px) + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--_accent-bg); color: var(--_on);
  box-shadow: 0 8px 22px -6px rgba(15, 26, 42, .45), 0 0 0 1px rgba(255, 255, 255, .5) inset;
  transition: transform .15s ease;
}
.arkc__launch:hover { transform: scale(1.06); }
.arkc__launch:focus-visible { outline-color: var(--_focus); outline-offset: 3px; box-shadow: 0 0 0 3px #fff, 0 8px 22px -6px rgba(15, 26, 42, .45); }

/* panel: desktop card */
.arkc__panel {
  position: fixed; z-index: 2147483001;
  right: calc(16px + var(--arkc-r, 0px) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--_gap) + var(--arkc-b, 0px) + env(safe-area-inset-bottom, 0px));
  margin: 0; padding: 0;
  width: 380px; max-width: calc(100vw - 32px);
  height: min(560px, calc(100vh - 32px - var(--arkc-lift, 0px)));
  height: min(560px, calc(100dvh - 32px - var(--arkc-lift, 0px)));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--_bg); color: var(--_ink);
  border: 1px solid var(--_line); border-radius: var(--_r);
  box-shadow: 0 24px 60px -16px rgba(15, 26, 42, .45), 0 4px 14px rgba(15, 26, 42, .12);
  animation: arkc-in .18s ease-out;
}
.arkc__panel:focus { outline: none; }

.arkc__head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 12px; background: var(--_surface); border-bottom: 1px solid var(--_line);
}
.arkc__av {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--_accent-bg); color: var(--_on);
}
.arkc__ttl { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.arkc__name { display: block; font-family: var(--_head); font-size: .9375rem; line-height: 1.2; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arkc__role { font-size: .8125rem; color: var(--_muted); line-height: 1.3; }
.arkc__hbtn {
  flex: 0 0 auto; min-width: 44px; min-height: 44px; border-radius: var(--_rb);
  display: inline-flex; align-items: center; justify-content: center; color: var(--_ink);
}
.arkc__hbtn:hover { background: var(--_tint); }
.arkc__fresh { padding: 0 8px; font-size: .8125rem; font-weight: var(--_fw); color: var(--_accent); white-space: nowrap; }

/* messages */
.arkc__list {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 12px;
}
.arkc__row { display: flex; flex-direction: column; gap: 3px; max-width: 88%; }
.arkc__row--bot { align-self: flex-start; align-items: flex-start; }
.arkc__row--me { align-self: flex-end; align-items: flex-end; }
.arkc__who { font-size: .75rem; color: var(--_muted); padding: 0 4px; }
.arkc__bubble {
  padding: 10px 13px; font-size: .9375rem; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  border-radius: var(--_r);
}
.arkc__row--bot .arkc__bubble { background: var(--_tint); color: var(--_ink); border: 1px solid var(--_line); border-top-left-radius: 4px; }
.arkc__row--me .arkc__bubble { background: var(--_accent-bg); color: var(--_on); border-top-right-radius: 4px; }
.arkc__row--err .arkc__bubble { background: var(--_err-bg); color: var(--_err); border-color: var(--_err); }

.arkc__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.arkc__chip {
  min-height: 44px; padding: 8px 14px; font-size: .875rem; font-weight: var(--_fw); text-align: left; line-height: 1.25;
  background: var(--_surface); color: var(--_accent); border: 1.5px solid var(--_accent); border-radius: var(--_rb);
}
.arkc__chip:hover:not(:disabled) { background: var(--_accent-bg); color: var(--_on); }
.arkc__chip:disabled { opacity: .55; cursor: default; }

.arkc__acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.arkc__act {
  min-height: 44px; padding: 8px 16px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .875rem; font-weight: var(--_fw); line-height: 1.2; text-decoration: none;
  background: var(--_surface); color: var(--_accent); border: 1.5px solid var(--_accent); border-radius: var(--_rb);
}
.arkc__act--book { background: var(--_accent-bg); color: var(--_on); }
.arkc__act:hover { filter: brightness(.94); }

/* typing dots */
.arkc__typing .arkc__bubble { display: inline-flex; gap: 5px; align-items: center; padding: 14px 15px; }
.arkc__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--_muted); animation: arkc-dot 1s infinite ease-in-out; }
.arkc__dot:nth-child(2) { animation-delay: .15s; }
.arkc__dot:nth-child(3) { animation-delay: .3s; }
.arkc__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* input */
.arkc__form { flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 12px 4px; background: var(--_bg); }
.arkc__input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 14px; font-size: 1rem; /* 16px: no iOS zoom */
  background: var(--_surface); color: var(--_ink); border: 1.5px solid var(--_line); border-radius: var(--_rb);
}
.arkc__input::placeholder { color: var(--_muted); opacity: 1; }
.arkc__input:focus-visible { outline: 3px solid var(--_focus); outline-offset: 1px; border-color: var(--_accent); }
.arkc__send {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--_accent-bg); color: var(--_on);
}
.arkc__send:disabled { opacity: .45; cursor: default; }
.arkc__note { flex: 0 0 auto; padding: 2px 14px 10px; font-size: .75rem; line-height: 1.35; color: var(--_muted); text-align: center; }

/* phone: nearly full screen sheet */
@media (max-width: 640px) {
  .arkc__panel {
    top: 24px; right: var(--arkc-r, 0px); left: 0; bottom: var(--arkc-b, 0px); width: auto; max-width: none; height: auto;
    border-radius: var(--_r) var(--_r) 0 0; border-width: 1px 0 0;
    animation-name: arkc-up;
  }
  .arkc__note { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .arkc__row { max-width: 92%; }
}

@keyframes arkc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes arkc-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes arkc-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .arkc__panel, .arkc__dot { animation: none; }
  .arkc__launch { transition: none; }
}
