/* Holloway chat widget. Everything is scoped under .hw-root so it can't touch the host page. */

.hw-root {
  --hw-bg: #F7F3EE;
  --hw-surface: #FFFFFF;
  --hw-blush: #EBDDD3;
  --hw-text: #2B2420;
  --hw-text-2: #6E625A;
  --hw-line: #E3D9D0;
  --hw-primary: #1F3B36;
  --hw-primary-soft: #DCE6E2;
  --hw-accent: #A8673F;
  --hw-err: #B42318;
  --hw-sh-2: 0 8px 24px -6px rgb(22 21 15 / .12), 0 2px 6px rgb(22 21 15 / .06);
  --hw-ease-out: cubic-bezier(.2, .8, .2, 1);
  --hw-ease-io: cubic-bezier(.65, 0, .35, 1);
  --hw-sans: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --hw-serif: "Newsreader", Georgia, "Times New Roman", serif;

  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  font-family: var(--hw-sans);
  font-size: 14px;
  line-height: 20px;
  color: var(--hw-text);
  -webkit-font-smoothing: antialiased;
}
.hw-root *, .hw-root *::before, .hw-root *::after { box-sizing: border-box; margin: 0; }
.hw-root button, .hw-root input { font: inherit; color: inherit; }
.hw-root button { cursor: pointer; background: none; border: 0; padding: 0; }
.hw-root svg { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.hw-root :focus-visible { outline: 2px solid var(--hw-accent); outline-offset: 2px; }
.hw-form:has(.hw-input:focus-visible) { outline: 2px solid var(--hw-accent); outline-offset: 2px; }

/* ---------- Monogram ---------- */
.hw-mono {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--hw-bg);
  color: var(--hw-primary);
  box-shadow: inset 0 0 0 1px rgb(31 59 54 / .18);
  font-family: var(--hw-serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.02em;
  padding-top: 1px;
  flex: none;
}
.hw-mono--lg { width: 36px; height: 36px; font-size: 21px; background: var(--hw-primary); color: var(--hw-bg); box-shadow: none; }

/* ---------- Launcher pill ---------- */
.hw-root .hw-launcher { /* .hw-root prefix: `.hw-root button { padding: 0 }` was beating the pill's own padding */
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 20px 0 10px;
  border-radius: 999px;
  background: var(--hw-primary) !important;
  color: #fff !important;
  box-shadow: var(--hw-sh-2);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 200ms var(--hw-ease-out), opacity 200ms var(--hw-ease-out), background-color 120ms;
}
.hw-launcher:hover { background: #18302C !important; }
.hw-launcher:active { transform: scale(.98); }
.hw-root.is-open .hw-launcher { opacity: 0; transform: scale(.96); pointer-events: none; }

/* ---------- Panel ---------- */
.hw-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--hw-surface);
  border: 1px solid var(--hw-line);
  border-radius: 16px;
  box-shadow: var(--hw-sh-2);
  overflow: hidden;
  transform-origin: bottom right;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(.96);
  transition: opacity 200ms var(--hw-ease-out), transform 200ms var(--hw-ease-out), visibility 0s linear 200ms;
}
.hw-root.is-open .hw-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: opacity 200ms var(--hw-ease-out), transform 200ms var(--hw-ease-out), visibility 0s;
}

/* Header */
.hw-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 16px;
  border-bottom: 1px solid var(--hw-line);
  flex: none;
}
.hw-head-text { flex: 1; min-width: 0; }
.hw-title { font-size: 15px; font-weight: 600; line-height: 20px; letter-spacing: -.01em; }
.hw-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--hw-text-2); margin-top: 1px; }
.hw-dot { width: 6px; height: 6px; border-radius: 999px; background: #3E8E6A; flex: none; }
.hw-root.is-demo .hw-dot { background: var(--hw-accent); }
.hw-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--hw-text-2);
  transition: background-color 120ms, color 120ms;
}
.hw-icon-btn:hover { background: var(--hw-bg); color: var(--hw-text); }

/* Body */
.hw-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.hw-body::-webkit-scrollbar { width: 8px; }
.hw-body::-webkit-scrollbar-thumb { background: var(--hw-line); border-radius: 8px; border: 2px solid var(--hw-surface); }

.hw-day { align-self: center; font-size: 12px; line-height: 16px; color: var(--hw-text-2); letter-spacing: .02em; }

/* Messages */
.hw-msg { display: flex; flex-direction: column; gap: 6px; max-width: 86%; animation: hw-in 220ms var(--hw-ease-out) both; }
.hw-msg--bot { align-self: flex-start; }
.hw-msg--user { align-self: flex-end; align-items: flex-end; }
.hw-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 21px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hw-msg--bot .hw-bubble { background: var(--hw-bg); color: var(--hw-text); border-bottom-left-radius: 4px; }
.hw-msg--user .hw-bubble { background: var(--hw-primary); color: #fff; border-bottom-right-radius: 4px; }
.hw-meta { font-size: 12px; line-height: 16px; color: var(--hw-text-2); padding-left: 2px; }
.hw-meta span + span::before { content: "·"; margin: 0 6px; }
.hw-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: currentColor;
  animation: hw-blink 1s steps(1) infinite;
}

/* Suggestion rows */
.hw-suggest { display: flex; flex-direction: column; gap: 8px; animation: hw-in 260ms var(--hw-ease-out) 80ms both; }
.hw-suggest-label { font-size: 12px; line-height: 16px; color: var(--hw-text-2); margin-bottom: 2px; }
.hw-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--hw-line) !important;
  border-radius: 12px;
  text-align: left;
  color: var(--hw-text);
  transition: background-color 120ms, border-color 120ms;
}
.hw-row:hover { background: var(--hw-bg) !important; border-color: #D6C9BD !important; }
.hw-row-icon { color: var(--hw-accent); }
.hw-row-text { flex: 1; font-size: 14px; }
.hw-row-chev { color: var(--hw-text-2); opacity: .6; transition: transform 120ms, opacity 120ms; }
.hw-row:hover .hw-row-chev { transform: translateX(2px); opacity: 1; }
.hw-suggest.is-gone { display: none; }

/* Cards */
.hw-card {
  border: 1px solid var(--hw-line);
  border-radius: 12px;
  background: var(--hw-surface);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  min-width: 248px;
  animation: hw-in 240ms var(--hw-ease-out) both;
}
.hw-card-top { display: flex; align-items: flex-start; gap: 10px; }
.hw-card-tile {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--hw-blush);
  color: var(--hw-accent);
  display: grid;
  place-items: center;
  flex: none;
}
.hw-card-name { font-size: 14px; font-weight: 600; line-height: 20px; }
.hw-card-sub { font-size: 12px; line-height: 16px; color: var(--hw-text-2); margin-top: 2px; }
.hw-card-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.hw-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--hw-bg);
  font-size: 12px;
  color: var(--hw-text);
  font-variant-numeric: tabular-nums;
}
.hw-chip svg { color: var(--hw-text-2); }
.hw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--hw-primary) !important;
  color: #fff !important;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 120ms;
}
.hw-btn:hover { background: #18302C !important; }
.hw-btn--ghost { background: transparent !important; color: var(--hw-primary) !important; box-shadow: inset 0 0 0 1px var(--hw-line); }
.hw-btn--ghost:hover { background: var(--hw-primary-soft) !important; }

/* Typing */
.hw-typing { display: flex; align-items: center; gap: 10px; align-self: flex-start; animation: hw-in 200ms var(--hw-ease-out) both; }
.hw-dots { display: inline-flex; gap: 4px; padding: 13px 14px; background: var(--hw-bg); border-radius: 14px; border-bottom-left-radius: 4px; }
.hw-dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--hw-text-2); opacity: .7; animation: hw-bounce 1s var(--hw-ease-io) infinite; }
.hw-dots i:nth-child(2) { animation-delay: 120ms; }
.hw-dots i:nth-child(3) { animation-delay: 240ms; }
.hw-typing-label { font-size: 12px; color: var(--hw-text-2); }

/* Error */
.hw-error {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  font-size: 13px;
  color: var(--hw-err);
  animation: hw-in 200ms var(--hw-ease-out) both;
}
.hw-link {
  color: var(--hw-text) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  font-weight: 500;
}
.hw-link:hover { color: var(--hw-accent) !important; }

/* Footer */
.hw-foot { flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--hw-line); }
.hw-form {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 4px 0 14px;
  border: 1px solid var(--hw-line);
  border-radius: 999px;
  background: var(--hw-surface);
  transition: border-color 120ms;
}
.hw-form:focus-within { border-color: var(--hw-primary); }
.hw-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  font-size: 14px !important;
  padding: 0 !important;
  box-shadow: none !important;
}
.hw-input::placeholder { color: var(--hw-text-2); opacity: .8; }
.hw-send {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--hw-primary) !important;
  color: #fff !important;
  transition: opacity 120ms, transform 120ms;
}
.hw-send:disabled { opacity: .35; cursor: default; }
.hw-send:not(:disabled):active { transform: scale(.94); }
.hw-fine {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 0 4px;
  font-size: 11.5px;
  line-height: 16px;
  color: var(--hw-text-2);
}
.hw-fine .hw-link { color: var(--hw-text-2) !important; font-weight: 400; white-space: nowrap; }

/* ---------- Motion ---------- */
@keyframes hw-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes hw-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-3px); } }
@keyframes hw-blink { 50% { opacity: 0; } }
@keyframes hw-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hw-pulse { 0%, 100% { opacity: .35; } 50% { opacity: .8; } }

@media (prefers-reduced-motion: reduce) {
  .hw-panel, .hw-root.is-open .hw-panel { transform: none !important; transition: opacity 200ms linear, visibility 0s linear 200ms; }
  .hw-root.is-open .hw-panel { transition: opacity 200ms linear, visibility 0s; }
  .hw-launcher, .hw-root.is-open .hw-launcher { transform: none !important; }
  .hw-msg, .hw-suggest, .hw-card, .hw-typing, .hw-error { animation-name: hw-fade; }
  .hw-dots i { animation: hw-pulse 1.2s linear infinite; }
  .hw-row-chev, .hw-row:hover .hw-row-chev { transform: none; }
  .hw-body { scroll-behavior: auto; }
  .hw-caret { display: none; }
}

/* ---------- Small screens: full-screen panel ---------- */
@media (max-width: 480px) {
  .hw-root { right: 16px; bottom: 16px; }
  .hw-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: 0;
  }
  .hw-msg { max-width: 90%; }
}

/* Reduced motion, catch-all: anything animated or transitioned above settles instantly; scrolling is never smoothed. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: 1ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
}
