/*
 * Zuzu sales chat (views/partials/zuzu-chat.php, assets/js/zuzu-chat.js).
 * Every class is prefixed .zz-chat- ; the home page's Zuzu section owns .zz-chat, .zz-chat-head,
 * .zz-chat-name and .zz-chat-tag (fixes.css), so those exact names are never used here.
 * Stacking: launcher, teaser and desktop panel sit at z-index 45, above the mobile sticky CTA (40)
 * and below the header and cookie bar (50); the phone sheet (60) covers the whole screen.
 * Contrast: teal #1d5e63 on white 7.4:1 (on cream 6.9:1), white on teal 7.4:1, ink on white 17.8:1,
 * #57554f on cream 7.0:1, placeholder #6e6c66 on white 5.2:1, cream/80 on teal-deep 9.5:1.
 */
.zz-chat-root {
  --zz-teal: #1d5e63;
  --zz-teal-dark: #143e42;
  --zz-deep: #0c2a2d;
  --zz-cream: #faf7f0;
  --zz-ink: #15181c;
  --zz-muted: #57554f;
  --zz-line: #e3ded2;
  --zz-coral: #f15a4a;
  --zz-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --zz-gap: 16px;
  /* Lifted above whichever bottom bar is showing: the cookie bar (measured by the script) or the
     sticky CTA (its height comes from site.js), and never into the iPhone home-indicator area. */
  --zz-lift: max(var(--zz-cookie-lift, 0px), var(--zz-cta-lift, 0px), env(safe-area-inset-bottom, 0px));
  --zz-bottom: calc(var(--zz-lift) + var(--zz-gap));
  --zz-right: max(var(--zz-gap), env(safe-area-inset-right, 0px));
  font-family: var(--font-sans, "Inter", ui-sans-serif, system-ui, sans-serif);
}
html.has-mobile-cta .zz-chat-root {
  --zz-cta-lift: var(--mobile-cta-height, 4.5rem);
}
/* While the chat is open the sticky CTA steps aside (it would sit under a floating panel). */
html.zz-chat-open .zz-chat-root {
  --zz-cta-lift: 0px;
}
html.zz-chat-open .mobile-cta.is-visible {
  transform: translateY(110%);
  visibility: hidden;
}
@media (min-width: 64rem) {
  .zz-chat-root {
    --zz-gap: 24px;
  }
}

.zz-chat-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.zz-chat-icon {
  width: 20px;
  height: 20px;
}
.zz-chat-icon--sm {
  width: 16px;
  height: 16px;
}

/* -- Avatar: Zuzu's head cropped from the full-length artwork (720 x 986) ------------ */
.zz-chat-face {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #fdf1ea 0%, #f6e3d6 70%);
}
.zz-chat-face img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
  transform: scale(2.9);
  transform-origin: 50% 3%;
}

/* -- Launcher -------------------------------------------------------------------------- */
.zz-chat-launcher {
  position: fixed;
  right: var(--zz-right);
  bottom: var(--zz-bottom);
  z-index: 45;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 3px solid var(--zz-teal);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 10px 28px rgba(12, 42, 45, 0.26), 0 2px 6px rgba(12, 42, 45, 0.12);
  cursor: pointer;
  transition: bottom 0.3s var(--zz-ease), transform 0.2s var(--zz-ease), box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.zz-chat-launcher .zz-chat-face {
  width: 100%;
  height: 100%;
}
@media (hover: hover) {
  .zz-chat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(12, 42, 45, 0.3), 0 2px 6px rgba(12, 42, 45, 0.12);
  }
}
.zz-chat-launcher:focus-visible {
  outline: 3px solid var(--zz-teal);
  outline-offset: 3px;
}
html.zz-chat-open .zz-chat-launcher {
  display: none;
}
.zz-chat-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 17px;
  height: 17px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--zz-coral);
  animation: zz-chat-pop 0.35s var(--zz-ease);
}

/* -- Teaser bubble (proactive opener) ---------------------------------------------------- */
.zz-chat-teaser {
  position: fixed;
  right: var(--zz-right);
  bottom: calc(var(--zz-bottom) + 72px);
  z-index: 45;
  display: flex;
  align-items: flex-start;
  width: max-content;
  max-width: min(300px, calc(100vw - 2 * var(--zz-gap)));
  border: 1px solid var(--zz-line);
  border-radius: 18px 18px 6px 18px;
  background: #fff;
  color: var(--zz-ink);
  box-shadow: 0 16px 40px rgba(12, 42, 45, 0.18), 0 2px 6px rgba(12, 42, 45, 0.08);
  transition: bottom 0.3s var(--zz-ease);
  animation: zz-chat-rise 0.4s var(--zz-ease);
}
.zz-chat-teaser-open {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 2px 14px 16px;
  border: 0;
  border-radius: 18px 0 0 6px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.zz-chat-teaser-name {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--zz-teal);
}
.zz-chat-teaser-text {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
}
.zz-chat-teaser-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 6px 6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--zz-muted);
  cursor: pointer;
}
.zz-chat-teaser-close:hover {
  background: #f1eee6;
  color: var(--zz-ink);
}

/* -- Panel ---------------------------------------------------------------------------- */
.zz-chat-panel {
  position: fixed;
  right: var(--zz-right);
  bottom: var(--zz-bottom);
  z-index: 45;
  display: flex;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 2 * var(--zz-gap));
  /* Never under the sticky site header (about 72px) on short screens. */
  height: min(560px, calc(100vh - var(--zz-bottom) - 96px));
  height: min(560px, calc(100dvh - var(--zz-bottom) - 96px));
  min-height: 320px;
  overflow: hidden;
  border: 1px solid rgba(12, 42, 45, 0.12);
  border-radius: 20px;
  background: var(--zz-cream);
  color: var(--zz-ink);
  box-shadow: 0 28px 70px rgba(12, 42, 45, 0.28), 0 4px 14px rgba(12, 42, 45, 0.12);
  animation: zz-chat-rise 0.35s var(--zz-ease);
}
.zz-chat-panel:focus {
  outline: none;
}
.zz-chat-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  padding: 12px 10px 12px 14px;
  background: var(--zz-deep);
  color: var(--zz-cream);
}
.zz-chat-face--head {
  flex: none;
  width: 44px;
  height: 44px;
  box-shadow: 0 0 0 2px #3d8d92;
}
.zz-chat-heading {
  min-width: 0;
}
.zz-chat-title {
  margin: 0;
  font-family: var(--font-brand, "Archivo Black", "Inter", sans-serif);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--zz-cream);
}
.zz-chat-sub {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.3;
  color: rgba(250, 247, 240, 0.8);
}
.zz-chat-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--zz-cream);
  cursor: pointer;
}
.zz-chat-close:hover {
  background: rgba(250, 247, 240, 0.12);
}
.zz-chat-header :focus-visible {
  outline: 2px solid var(--zz-cream);
  outline-offset: 1px;
}

/* -- Messages -------------------------------------------------------------------------- */
.zz-chat-scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 12px;
  scrollbar-width: thin;
  scrollbar-color: #c9c5b9 transparent;
}
.zz-chat-scroll:focus-visible {
  outline: 2px solid var(--zz-teal);
  outline-offset: -3px;
}
.zz-chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.zz-chat-msg {
  display: flex;
  flex: none;
  align-items: flex-start;
  gap: 8px;
}
.zz-chat-msg--me {
  justify-content: flex-end;
}
.zz-chat-face--xs {
  flex: none;
  width: 30px;
  height: 30px;
  margin-top: 2px;
  box-shadow: 0 0 0 1.5px var(--zz-teal);
}
.zz-chat-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  max-width: 84%;
}
.zz-chat-msg--me .zz-chat-body {
  align-items: flex-end;
}
.zz-chat-bubble {
  margin: 0;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.zz-chat-msg--bot .zz-chat-bubble {
  border: 1px solid var(--zz-line);
  border-top-left-radius: 6px;
  background: #fff;
  color: var(--zz-ink);
}
.zz-chat-msg--me .zz-chat-bubble {
  border-bottom-right-radius: 6px;
  background: var(--zz-teal);
  color: #fff;
}
.zz-chat-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.zz-chat-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1.5px solid var(--zz-teal);
  border-radius: 12px;
  background: #fff;
  color: var(--zz-teal);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.zz-chat-cta:hover {
  background: #e7f0ef;
  color: var(--zz-teal-dark);
}
.zz-chat-cta--primary {
  background: var(--zz-teal);
  color: #fff;
  box-shadow: 0 6px 16px rgba(12, 42, 45, 0.14);
}
.zz-chat-cta--primary:hover {
  border-color: var(--zz-teal-dark);
  background: var(--zz-teal-dark);
  color: #fff;
}

/* Typing indicator */
.zz-chat-typing .zz-chat-bubble {
  padding: 14px 15px;
}
.zz-chat-dots {
  display: flex;
  gap: 5px;
}
.zz-chat-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6e6c66;
  animation: zz-chat-blink 1.2s infinite ease-in-out;
}
.zz-chat-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.zz-chat-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

/* -- Quick replies, composer, note ------------------------------------------------------ */
.zz-chat-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 0 2px 38px;
}
.zz-chat-chip {
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid rgba(29, 94, 99, 0.7); /* 3.4:1 against the cream panel */
  border-radius: 999px;
  background: #fff;
  color: var(--zz-deep);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.zz-chat-chip:hover:not(:disabled) {
  border-color: var(--zz-teal);
  background: var(--zz-teal);
  color: #fff;
}
.zz-chat-chip:disabled {
  opacity: 0.55;
  cursor: default;
}
.zz-chat-form {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 8px;
  margin: 0 12px;
  padding: 6px 6px 6px 14px;
  border: 1px solid #948f84; /* 3:1 against the cream panel and the white field */
  border-radius: 16px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.zz-chat-form:focus-within {
  border-color: var(--zz-teal);
  box-shadow: 0 0 0 3px rgba(29, 94, 99, 0.2);
}
.zz-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 120px;
  margin: 0;
  padding: 8px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--zz-ink);
  font: inherit;
  font-size: 16px; /* 16px keeps iOS from zooming in on focus */
  line-height: 1.4;
  resize: none;
}
.zz-chat-input::placeholder {
  color: #6e6c66;
  opacity: 1;
}
.zz-chat-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--zz-teal);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s;
}
.zz-chat-send:hover:not(:disabled) {
  background: var(--zz-teal-dark);
}
.zz-chat-send:disabled {
  opacity: 0.55;
  cursor: default;
}
.zz-chat-send .zz-chat-icon {
  width: 18px;
  height: 18px;
  margin-left: -2px;
}
.zz-chat-note {
  flex: none;
  margin: 0;
  padding: 8px 16px 12px;
  color: var(--zz-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
.zz-chat-note a {
  color: var(--zz-teal);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.zz-chat-panel :is(a, button):focus-visible,
.zz-chat-teaser :is(a, button):focus-visible {
  outline: 2px solid var(--zz-teal);
  outline-offset: 2px;
}
.zz-chat-panel .zz-chat-header :focus-visible {
  outline-color: var(--zz-cream);
}

/* -- Phones: a full-screen sheet --------------------------------------------------------- */
@media (max-width: 39.99rem) {
  .zz-chat-launcher {
    width: 56px;
    height: 56px;
  }
  .zz-chat-teaser {
    bottom: calc(var(--zz-bottom) + 68px);
  }
  .zz-chat-panel {
    inset: 0;
    z-index: 60;
    width: auto;
    max-width: none;
    height: auto;
    min-height: 0;
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--zz-cream);
    animation-name: zz-chat-sheet;
  }
  .zz-chat-header {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  .zz-chat-body {
    max-width: 88%;
  }
  html.zz-chat-open,
  html.zz-chat-open body {
    overflow: hidden;
  }
}

/* -- Motion ----------------------------------------------------------------------------- */
@keyframes zz-chat-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes zz-chat-sheet {
  from { opacity: 0.6; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes zz-chat-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}
@keyframes zz-chat-blink {
  0%, 80%, 100% { opacity: 0.35; transform: none; }
  40% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .zz-chat-launcher,
  .zz-chat-teaser,
  .zz-chat-panel,
  .zz-chat-dot,
  .zz-chat-cta,
  .zz-chat-chip {
    animation: none;
    transition: none;
  }
  .zz-chat-launcher:hover {
    transform: none;
  }
  .zz-chat-dots span {
    animation: none;
    opacity: 0.7;
  }
}

@media print {
  .zz-chat-root {
    display: none !important;
  }
}

/* -- "Leave your details" (name and email for the team) ----------------------------------- */
.zz-chat-details {
  margin-left: auto;
}
.zz-chat-details + .zz-chat-close {
  margin-left: 0;
}
.zz-chat-lead .zz-chat-body {
  max-width: 88%;
}
.zz-chat-leadform {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.zz-chat-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.zz-chat-label {
  color: var(--zz-ink);
  font-size: 13px;
  font-weight: 700;
}
.zz-chat-text {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--zz-line);
  border-radius: 12px;
  background: #fff;
  color: var(--zz-ink);
  font: inherit;
  font-size: 16px; /* 16px keeps iOS from zooming in on focus */
  line-height: 1.3;
}
.zz-chat-text:focus-visible {
  outline: 2px solid var(--zz-teal);
  outline-offset: 1px;
  border-color: var(--zz-teal);
}
.zz-chat-text[aria-invalid="true"] {
  border-color: #b42318;
}
.zz-chat-lead-error {
  margin: 0;
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.zz-chat-lead-note {
  margin: 0;
  color: var(--zz-muted);
  font-size: 12px;
  line-height: 1.4;
}
.zz-chat-lead-error a {
  color: inherit;
  text-decoration: underline;
}
.zz-chat-lead-note a {
  color: var(--zz-teal);
  text-decoration: underline;
}
.zz-chat-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
