/* ==========================================================================
   First Pull Coffee AI widget
   Warm cream/paper/espresso — same tokens as design.css (duplicated so the
   widget stylesheet is self-contained).
   ========================================================================== */
:root {
  --ai-noir: #120b07;
  --ai-espresso: #1d130c;
  --ai-amber: #d9a441;
  --ai-caramel: #b45f22;
  --ai-caramel-deep: #93491a;
  --ai-cream: #f5ead6;
  --ai-paper: #fffdf8;
  --ai-card: #ffffff;
  --ai-muted: #6f5f4c;
  --ai-line: rgba(18, 11, 7, 0.14);
}

/* ---------- Floating button ---------- */
.fp-ai-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--ai-amber);
  background: var(--ai-espresso);
  color: var(--ai-cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px -12px rgba(120, 70, 20, 0.45);
  transition: transform 0.15s ease, background 0.15s ease;
}
.fp-ai-fab:hover { background: #2a1b0e; transform: translateY(-2px); }
.fp-ai-fab:focus-visible {
  outline: 3px solid var(--ai-amber);
  outline-offset: 3px;
}
/* lift above the sticky mobile buy bar on shop pages */
@media (max-width: 760px) {
  body.fp-has-sticky .fp-ai-fab { bottom: 104px; }
}

/* ---------- Panel ---------- */
.fp-ai-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  z-index: 2147483000;
  width: min(384px, calc(100vw - 32px));
  max-height: min(600px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--ai-paper);
  border: 1px solid var(--ai-line);
  border-radius: 1rem;
  box-shadow: 0 24px 60px -16px rgba(18, 11, 7, 0.35);
  overflow: hidden;
}
.fp-ai-panel[hidden] { display: none; }
@media (max-width: 760px) {
  .fp-ai-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 12px;
    max-height: 72dvh;
  }
  body.fp-has-sticky .fp-ai-panel { bottom: 170px; }
}

.fp-ai-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 12px;
  background: var(--ai-cream);
  border-bottom: 1px solid var(--ai-line);
}
.fp-ai-head-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 2px;
  color: var(--ai-noir);
}
.fp-ai-head-disc {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--ai-muted);
}
.fp-ai-close {
  margin-left: auto;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--ai-line);
  background: transparent;
  color: var(--ai-noir);
  cursor: pointer;
  font-size: 0.85rem;
}
.fp-ai-close:hover { background: rgba(18, 11, 7, 0.06); }
.fp-ai-close:focus-visible,
.fp-ai-send:focus-visible,
.fp-ai-input:focus-visible,
.fp-ai-starter:focus-visible {
  outline: 3px solid var(--ai-amber);
  outline-offset: 2px;
}

.fp-ai-body { display: flex; flex-direction: column; min-height: 0; }

/* ---------- Messages ---------- */
.fp-ai-msgs {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  max-height: 380px;
  background: var(--ai-paper);
}
.fp-ai-msg { display: flex; }
.fp-ai-msg--user { justify-content: flex-end; }
.fp-ai-bubble {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 0.9rem;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.fp-ai-msg--ai .fp-ai-bubble {
  background: var(--ai-cream);
  border: 1px solid var(--ai-line);
  color: var(--ai-noir);
  border-top-left-radius: 0.25rem;
}
.fp-ai-msg--user .fp-ai-bubble {
  background: var(--ai-espresso);
  color: var(--ai-cream);
  border-top-right-radius: 0.25rem;
}
.fp-ai-error a { color: var(--ai-caramel); }

/* thinking dots */
.fp-ai-thinking { display: inline-flex; gap: 6px; align-items: center; padding: 14px 16px; }
.fp-ai-thinking span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ai-muted);
  animation: fp-ai-blink 1.2s infinite ease-in-out;
}
.fp-ai-thinking span:nth-child(2) { animation-delay: 0.2s; }
.fp-ai-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes fp-ai-blink {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

/* ---------- Starters ---------- */
.fp-ai-starters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 16px 12px;
}
.fp-ai-starter {
  text-align: left;
  background: var(--ai-card);
  border: 1px solid var(--ai-line);
  border-radius: 0.7rem;
  padding: 9px 12px;
  font-size: 0.88rem;
  color: var(--ai-noir);
  cursor: pointer;
}
.fp-ai-starter:hover { border-color: var(--ai-amber); background: var(--ai-cream); }

/* ---------- Input ---------- */
.fp-ai-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--ai-line);
  background: var(--ai-paper);
}
.fp-ai-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--ai-line);
  border-radius: 0.7rem;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--ai-card);
  color: var(--ai-noir);
}
.fp-ai-send {
  flex: none;
  border: none;
  border-radius: 0.7rem;
  background: var(--ai-caramel);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 18px;
  cursor: pointer;
}
.fp-ai-send:hover { background: var(--ai-caramel-deep); }
.fp-ai-send:disabled, .fp-ai-input:disabled { opacity: 0.55; cursor: wait; }

/* ---------- /ask/ full-page mode ---------- */
.fp-ask-wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}
.fp-ai-page-lede { color: var(--ai-muted); margin-bottom: 1.25rem; }
#fp-ask-root .fp-ai-msgs {
  border: 1px solid var(--ai-line);
  border-radius: 1rem 1rem 0 0;
  max-height: 52dvh;
  min-height: 320px;
  background: var(--ai-card);
}
#fp-ask-root .fp-ai-starters {
  border: 1px solid var(--ai-line);
  border-top: none;
  padding: 14px 16px;
  background: var(--ai-card);
}
#fp-ask-root .fp-ai-form {
  border: 1px solid var(--ai-line);
  border-top: none;
  border-radius: 0 0 1rem 1rem;
}
.fp-ask-note {
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--ai-muted);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .fp-ai-thinking span { animation: none; opacity: 0.6; }
  .fp-ai-fab { transition: none; }
}
