/* Wippy chat widget styles — extracted from the main site's styles.css
   (:root design tokens + chat block). Re-extract if the main site's widget changes. */
:root {
  /* Palette */
  --ink: #14110e;
  --ink-2: #2a2520;
  --bone: #f7f4ef;
  --bone-2: #ece6dc;
  --sand: #d9cfc0;
  --brass: #b08d4f;
  --brass-deep: #8a6d38;
  --sage: #6b7a66;
  --slate: #5b5650;
  --white: #ffffff;
  --success: #4f7a52;
  --danger: #a23b33;

  /* Type families (system serif/sans fallbacks; self-hosted webfonts can
     be dropped in later without touching markup) */
  --font-serif:
    "Cormorant Garamond", "Canela", Georgia, "Times New Roman", serif;
  --font-sans:
    "Inter", "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;

  /* Type scale (fluid) */
  --fs-display: clamp(2.75rem, 6vw, 5rem);
  --fs-h1: clamp(2rem, 4vw, 3.25rem);
  --fs-h2: clamp(1.5rem, 2.5vw, 2.25rem);
  --fs-h3: 1.375rem;
  --fs-lead: 1.25rem;
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-eyebrow: 0.75rem;

  /* Spacing (8pt base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 40px;
  --space-6: 64px;
  --space-7: 96px;
  --space-8: 140px;

  /* Layout */
  --maxw: 1200px;
  --readw: 68ch;

  /* Radii */
  --radius-sm: 4px;
  --radius: 10px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(20, 17, 14, 0.06);
  --shadow: 0 10px 30px -12px rgba(20, 17, 14, 0.18);
  --shadow-lg: 0 30px 60px -20px rgba(20, 17, 14, 0.3);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 0.45s;
}
/* ============================================================
   Chat widget — launcher bubble + popup panel
   ============================================================ */
.chat-launcher {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 150;
  width: 62px;
  height: 62px;
  border-radius: var(--radius-pill);
  border: 0;
  overflow: hidden;
  padding: 0;
  background: var(--brass);
  color: var(--bone);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  transition:
    background var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.chat-launcher:hover {
  background: var(--brass-deep);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.chat-launcher::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  border: 2px solid var(--brass);
  animation: chat-pulse 2.6s var(--ease) infinite;
}

@keyframes chat-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  70% {
    transform: scale(1.5);
    opacity: 0;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-launcher::after {
    animation: none;
    display: none;
  }
  .chat-launcher:hover {
    transform: none;
  }
}

.chat-launcher[aria-expanded="true"] {
  display: none;
}

.chat-launcher-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* Wippy avatar inside the chat panel header mark */
.ch-mark {
  overflow: hidden;
  padding: 0;
}
.ch-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* "Jacked AI" teaser bubble next to the launcher */
.chat-teaser {
  position: fixed;
  right: var(--space-4);
  bottom: calc(var(--space-4) + 76px);
  z-index: 149;
  max-width: 252px;
  background: var(--ink);
  color: var(--bone);
  padding: 14px 16px 13px;
  border-radius: 16px 16px 4px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 0.92rem;
  line-height: 1.45;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition:
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.chat-teaser.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  animation: teaser-pop 0.5s var(--ease);
}
@keyframes teaser-pop {
  0% {
    transform: translateY(8px) scale(0.96);
  }
  60% {
    transform: translateY(-3px) scale(1.02);
  }
  100% {
    transform: none;
  }
}
.chat-teaser p {
  margin: 0 0 6px;
}
.chat-teaser strong {
  color: var(--brass);
}
.chat-teaser-cta {
  font-size: 0.8rem;
  color: var(--sand);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.chat-teaser-x {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: 0;
  color: var(--bone);
  opacity: 0.5;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.chat-teaser-x:hover {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .chat-teaser.show {
    animation: none;
  }
}

/* Panel */
.chat-panel {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 160;
  width: 380px;
  max-width: calc(100vw - var(--space-4) * 2);
  max-height: min(640px, calc(100vh - var(--space-5)));
  display: flex;
  flex-direction: column;
  background: var(--bone);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  pointer-events: none;
  transition:
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.chat-panel.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .chat-panel {
    transition: opacity var(--dur) var(--ease);
    transform: none;
  }
}

@media (max-width: 520px) {
  .chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 100svh;
    height: 100svh;
    border-radius: 0;
  }
}

/* Header */
.chat-header {
  background: var(--ink);
  color: var(--bone);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chat-header .ch-mark {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: var(--brass);
  color: var(--bone);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 1rem;
}

.chat-header .ch-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.1;
  margin: 0;
  color: var(--bone);
}

.chat-header .ch-sub {
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0;
}

.chat-close {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: rgba(247, 244, 239, 0.8);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.chat-close:hover {
  color: var(--bone);
}

/* Pinned disclaimer */
.chat-disclaimer {
  background: var(--bone-2);
  color: var(--slate);
  font-size: 0.75rem;
  line-height: 1.5;
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--sand);
}

/* Message log */
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scrollbar-width: thin;
}

.msg {
  max-width: 86%;
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-lg);
  font-size: var(--fs-small);
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.msg.assistant {
  align-self: flex-start;
  background: var(--bone-2);
  color: var(--ink);
  border-bottom-left-radius: var(--radius-sm);
}

.msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--bone);
  border-bottom-right-radius: var(--radius-sm);
}

.msg a {
  color: var(--brass);
  text-decoration: underline;
}
.msg.user a {
  color: var(--bone);
}
.msg p {
  margin: 0 0 var(--space-2);
}
.msg p:last-child {
  margin-bottom: 0;
}

/* Typing indicator */
.msg.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: var(--space-3);
}

.msg.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--slate);
  opacity: 0.5;
  animation: typing-bounce 1.2s var(--ease) infinite;
}

.msg.typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.msg.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg.typing span {
    animation: none;
  }
}

/* Captured-lead confirmation */
.chat-captured {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bone-2);
  border: 1px solid var(--brass);
  border-radius: var(--radius);
  padding: var(--space-3);
  font-size: var(--fs-small);
  color: var(--ink);
}

.chat-captured .check {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--brass);
  color: var(--bone);
  display: grid;
  place-items: center;
}

.chat-captured .check svg {
  width: 16px;
  height: 16px;
}

/* Suggested-reply chips */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-2);
}

.chip {
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  color: var(--brass);
  background: transparent;
  border: 1px solid var(--brass);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  cursor: pointer;
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.chip:hover {
  background: var(--brass);
  color: var(--bone);
}

/* Input bar */
.chat-input {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--sand);
  background: var(--bone);
}

.chat-input textarea {
  flex: 1;
  resize: none;
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bone-2);
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  padding: 10px var(--space-3);
  max-height: 120px;
  min-height: 44px;
  transition: border-color var(--dur) var(--ease);
}

.chat-input textarea:focus {
  outline: none;
  border-color: var(--brass);
}

.chat-send {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: 0;
  background: var(--brass);
  color: var(--bone);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--dur) var(--ease);
}

.chat-send:hover {
  background: var(--brass-deep);
}
.chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.chat-send svg {
  width: 18px;
  height: 18px;
}

.chat-error {
  padding: 0 var(--space-4) var(--space-2);
  font-size: var(--fs-small);
  color: var(--danger);
}
