/* ==========================================================================
   Website assistant widget (public/assets/js/chat.js)
   --------------------------------------------------------------------------
   Built only from the site's own tokens, so it is forest and marigold on
   clavertoncollege.in and indigo and sky on aheetest.com (ahee.css re-skins
   the same tokens). WCAG 2.1 AA; motion off under prefers-reduced-motion.
   ========================================================================== */
.chatw { --cw-gap: 20px; --cw-ink: var(--c-ink, #163d3a); --cw-accent: var(--c-brass, #f2b632); position: fixed; right: var(--cw-gap); bottom: var(--cw-gap); z-index: 90; font-family: var(--f-sans, system-ui, sans-serif); color: var(--c-char, #1d2320); }

.chatw__launch {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 20px 0 16px; border: 2px solid var(--c-white, #fff); border-radius: 999px;
  background: var(--cw-ink); color: #fff; font: 700 .95rem/1 var(--f-sans, sans-serif); letter-spacing: .01em;
  box-shadow: var(--sh-3, 0 10px 30px rgba(0,0,0,.18)); cursor: pointer;
  transition: transform .2s var(--ease, ease), background-color .2s;
}
.chatw__launch:hover { background: var(--c-navy, #0f2a28); transform: translateY(-1px); }
.chatw__launch:focus-visible, .chatw button:focus-visible, .chatw__input:focus-visible, .chatw__log:focus-visible, .chatw a:focus-visible { outline: 3px solid var(--cw-accent); outline-offset: 2px; }
.chatw.is-open .chatw__launch { display: none; }

.chatw__panel {
  position: absolute; right: 0; bottom: 0;
  width: min(390px, calc(100vw - 2 * var(--cw-gap))); height: min(600px, calc(100vh - 2 * var(--cw-gap) - 20px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--c-white, #fff); border: 1px solid var(--c-line, #e4e0d6); border-radius: 18px;
  box-shadow: var(--sh-3, 0 18px 48px rgba(0,0,0,.2));
  animation: chatw-in .22s var(--ease, ease) both;
}
.chatw__panel[hidden] { display: none; }
@keyframes chatw-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.chatw__head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--cw-ink); color: #fff; }
.chatw__avatar { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--cw-accent); color: var(--cw-ink); font: 700 1.05rem/1 var(--f-sans, sans-serif); }
.chatw__titles { flex: 1; min-width: 0; }
.chatw__title { margin: 0; font: 700 1.02rem/1.2 var(--f-sans, sans-serif); color: #fff; letter-spacing: 0; }
.chatw__sub { margin: 2px 0 0; font-size: .78rem; line-height: 1.3; color: rgba(255,255,255,.82); }
.chatw__close { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; }
.chatw__close:hover { background: rgba(255,255,255,.12); }

.chatw__log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--c-linen, #fbf7f0); overscroll-behavior: contain; }
.chatw__msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; }
.chatw__msg p { margin: 0; }
.chatw__msg p + p, .chatw__msg ul + p, .chatw__msg p + ul { margin-top: 6px; }
.chatw__msg ul { margin: 0; padding-left: 1.15em; list-style: disc; }
.chatw__msg li { display: list-item; }
.chatw__msg li + li { margin-top: 2px; }
.chatw__msg--assistant { align-self: flex-start; background: var(--c-white, #fff); border: 1px solid var(--c-line, #e4e0d6); border-bottom-left-radius: 6px; }
.chatw__msg--user { align-self: flex-end; background: var(--cw-ink); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.chatw__msg a { color: var(--c-teal, var(--cw-ink)); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }

.chatw__dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.chatw__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-muted, #5d6863); opacity: .35; animation: chatw-dot 1s infinite ease-in-out; }
.chatw__dots i:nth-child(2) { animation-delay: .15s; }
.chatw__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chatw-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: .9; transform: translateY(-3px); } }

.chatw__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 0; }
.chatw__chips[hidden] { display: none; }
.chatw__chip { padding: 8px 12px; border: 1px solid var(--c-line, #e4e0d6); border-radius: 999px; background: var(--c-white, #fff); color: var(--cw-ink); font: 600 .84rem/1.2 var(--f-sans, sans-serif); text-align: left; cursor: pointer; }
.chatw__chip:hover { border-color: var(--cw-ink); }

.chatw__form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 12px 6px; border-top: 1px solid var(--c-line, #e4e0d6); background: var(--c-white, #fff); }
.chatw__input { flex: 1; min-height: 44px; max-height: 120px; padding: 11px 14px; border: 1px solid var(--c-line, #d9d4c8); border-radius: 12px; background: var(--c-white, #fff); color: inherit; font: 400 1rem/1.4 var(--f-sans, sans-serif); resize: none; }
.chatw__input::placeholder { color: var(--c-muted, #5d6863); opacity: 1; }
.chatw__send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--cw-accent); color: var(--cw-ink); cursor: pointer; }
.chatw__send:disabled { opacity: .55; cursor: progress; }
.chatw__note { margin: 0; padding: 4px 14px 10px; background: var(--c-white, #fff); color: var(--c-muted, #5d6863); font-size: .72rem; line-height: 1.35; }
.chatw__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Above the sticky mobile action bar (claverton.css, 64px, under 720px). */
@media (max-width: 720px) {
  body.has-mobile-cta .chatw { bottom: calc(64px + 12px + env(safe-area-inset-bottom)); transition: bottom .34s var(--ease, ease); }
  /* Down to the corner while the bar is still tucked away (browsers with :has). */
  body.has-mobile-cta:has(.mobile-cta:not(.is-visible)) .chatw { bottom: var(--cw-gap); }
  .chatw { --cw-gap: 14px; }
  .chatw__launch { min-height: 48px; padding: 0 16px 0 13px; font-size: .9rem; }
}
/* Phones: the panel takes the whole screen. */
@media (max-width: 560px) {
  .chatw.is-open { inset: 0; right: 0; bottom: 0; }
  body.has-mobile-cta .chatw.is-open { bottom: 0; }
  .chatw.is-open .chatw__panel { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .chatw__note { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
html.chatw-lock, html.chatw-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .chatw__panel, .chatw__dots i { animation: none; }
  .chatw, .chatw__launch { transition: none; }
}
@media print { .chatw { display: none !important; } }
