/*
 * The Yemo assistant widget (client 2026-08-21).
 *
 * Its own file rather than more lines in styles.css: the widget is self-contained
 * and this keeps it out of a stylesheet several people edit. It reads the site's
 * existing brand tokens (--gold, --ink, --font-body …) with literal fallbacks, so
 * it still looks right if it is ever dropped onto a page that does not define them.
 *
 * Everything is namespaced `.ya-` so it can never collide with page styles.
 */

.ya {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000; /* above the page, below nothing that matters */
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
}

/* ---- Launcher ---- */
.ya-launch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 999px;
  background: var(--gold, #f3a90a);
  color: #1a1b1a;
  cursor: pointer;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.45);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.ya-launch:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px -8px rgba(0, 0, 0, 0.55);
}
/* A soft, slow pulse ring so the widget draws the eye instead of blending into
   the page corner (client 2026-08-22). Non-interactive; off for reduced motion. */
.ya-launch::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(243, 169, 10, 0.45);
  animation: ya-pulse 2.6s ease-out infinite;
}
.ya-launch:hover::after {
  animation: none;
}
@keyframes ya-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(243, 169, 10, 0.45);
  }
  70% {
    box-shadow: 0 0 0 18px rgba(243, 169, 10, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(243, 169, 10, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ya-launch::after {
    animation: none;
  }
}
/* The launcher would otherwise sit on top of the open panel on a phone. */
.ya-open .ya-launch {
  display: none;
}

/* ---- Panel ---- */
/*
 * Reset first. The host page styles bare `section`/`form` elements (the landing
 * page puts 96px of padding on every section), and inheriting that put ~117px of
 * dead space inside the panel. The widget uses divs now, but these resets keep it
 * immune wherever it is dropped.
 */
.ya,
.ya * {
  box-sizing: border-box;
}
.ya-panel,
.ya-head,
.ya-form,
.ya-log,
.ya-lead {
  margin: 0;
  padding: 0;
}

.ya-panel {
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  /* svh, not vh: on mobile Safari vh includes the collapsing toolbar, which
     pushes the input box under the browser chrome. */
  height: min(600px, calc(100svh - 120px));
  background: var(--ink-raised, #232426);
  border: 1px solid var(--ink-line, #2a2a2e);
  border-radius: 18px;
  overflow: hidden;
  /* Deeper shadow + a faint gold ring so the panel reads as a focused, premium
     surface rather than a flat box on the page (client 2026-08-22). */
  box-shadow:
    0 28px 70px -12px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(243, 169, 10, 0.14);
}
.ya-panel[hidden] {
  display: none;
}

.ya-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ink, #1a1b1a);
  border-bottom: 1px solid var(--ink-line, #2a2a2e);
}
.ya-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
.ya-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--on-dark-muted, #b4b4bc);
}
.ya-close {
  border: 0;
  background: transparent;
  color: var(--on-dark-muted, #b4b4bc);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.ya-close:hover {
  color: #fff;
}

/* ---- Transcript ---- */
.ya-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Custom scrollbars — the native ones (a chunky grey bar + up/down arrow
   buttons) looked cheap against the dark panel (client 2026-08-22). Thin,
   subtle, rounded, and with the arrow buttons removed entirely. */
.ya-log,
.ya-input {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.ya-log::-webkit-scrollbar,
.ya-input::-webkit-scrollbar {
  width: 8px;
}
.ya-log::-webkit-scrollbar-track,
.ya-input::-webkit-scrollbar-track {
  background: transparent;
}
.ya-log::-webkit-scrollbar-thumb,
.ya-input::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.ya-log::-webkit-scrollbar-thumb:hover,
.ya-input::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}
/* The offending up/down arrow buttons from the screenshot. */
.ya-log::-webkit-scrollbar-button,
.ya-input::-webkit-scrollbar-button {
  display: none;
  height: 0;
  width: 0;
}

.ya-msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere; /* a pasted URL must not widen the panel */
}
.ya-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-dark, #b4b4bc);
  border-bottom-left-radius: 4px;
}
.ya-user {
  align-self: flex-end;
  background: var(--gold, #f3a90a);
  color: #1a1b1a;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

/* Rotating status word — "thinking… / fetching… / yemoing…" in a loop while the
   answer is on its way (client 2026-08-24). The only motion in the transcript.
   A small dot sits before it so it reads as the assistant, mid-thought. */
.ya-typing {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--on-dark-muted, #b4b4bc);
}
.ya-typing::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--gold, #f3a90a);
  animation: ya-dot-pulse 1s ease-in-out infinite;
}
.ya-typing-word {
  font-size: 14px;
  font-style: italic;
  letter-spacing: 0.01em;
  /* Re-fired from JS on every word swap, so each new word fades in. */
  animation: ya-word-fade 0.9s ease both;
}
@keyframes ya-word-fade {
  0% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}
@keyframes ya-dot-pulse {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---- Opener (Stamp-style intro above the first message) ---- */
.ya-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 14px 12px 4px;
}
.ya-intro-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--gold, #f3a90a);
  color: #1a1b1a;
  box-shadow: 0 8px 24px -8px rgba(243, 169, 10, 0.5);
}
.ya-intro-title {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.ya-intro-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--on-dark-muted, #b4b4bc);
}

/* ---- Composer ---- */
.ya-form {
  display: flex;
  /* Anchor the send button to the bottom, so it stays put as the textarea grows. */
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--ink-line, #2a2a2e);
  background: var(--ink, #1a1b1a);
}
.ya-input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--ink-line, #2a2a2e);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  /* 16px, deliberately: anything smaller makes iOS Safari zoom the page on
     focus, and the visitor ends up scrolled sideways mid-sentence. */
  font-size: 16px;
  font-family: inherit;
  /* Textarea (Shift+Enter = new line): one row tall, grows in JS up to this cap,
     no drag-handle, and it lines up with the button rather than riding high. */
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  overflow-y: auto;
  vertical-align: bottom;
}
.ya-input::placeholder {
  color: var(--placeholder, #71717a);
}
.ya-input:focus {
  outline: none;
  border-color: var(--gold, #f3a90a);
}
.ya-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: var(--gold, #f3a90a);
  color: #1a1b1a;
  cursor: pointer;
}
.ya-send:hover {
  filter: brightness(1.05);
}
/* While a reply is in flight the composer is disabled — say so visually, so it
   reads as "wait a moment" rather than "broken". */
.ya-input:disabled,
.ya-send:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ---- Lead capture ---- */
.ya-lead {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--ink-line, #2a2a2e);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}
.ya-lead-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.ya-lead input[type='text'] {
  padding: 10px 12px;
  border: 1px solid var(--ink-line, #2a2a2e);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 16px; /* same iOS zoom reason as the composer */
  font-family: inherit;
}
.ya-lead input[type='text']::placeholder {
  color: var(--placeholder, #71717a);
}
.ya-lead-consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 11px;
  line-height: 1.45;
  color: var(--on-dark-muted, #b4b4bc);
}
.ya-lead-consent input {
  margin-top: 2px;
  flex: none;
  accent-color: var(--gold, #f3a90a);
}
.ya-lead-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ya-lead-send {
  flex: 1;
  padding: 10px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--gold, #f3a90a);
  color: #1a1b1a;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.ya-lead-send:disabled {
  opacity: 0.6;
  cursor: default;
}
.ya-lead-skip {
  border: 0;
  background: transparent;
  color: var(--on-dark-muted, #b4b4bc);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* Phones: full-width sheet rather than a floating card. */
@media (max-width: 480px) {
  .ya {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
  .ya-panel {
    width: 100%;
    height: min(70svh, calc(100svh - 100px));
  }
  .ya-launch {
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ya-launch,
  .ya-typing::before,
  .ya-typing-word {
    transition: none;
    animation: none;
  }
}
