/* Inaya chat widget — launcher bubble + drawer. Scoped under .inaya so it
   can ride any SiteValet page (marketing + customer sites) without touching
   the page stylesheet. Tokens mirror css/style.css ("Golden Hour" theme). */

.inaya__launch {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent, #c9681f);
  color: #1c1206;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 28px rgba(47, 38, 29, .30);
  transition: transform .15s ease;
}

.inaya__launch:hover { transform: scale(1.06); }
.inaya__launch:focus-visible {
  outline: 2px solid var(--accent, #c9681f);
  outline-offset: 3px;
}

/* Sparkle twinkle on the launcher wand */
.inaya__sparkle { transform-box: fill-box; transform-origin: center; }
.inaya__launch:hover .inaya__sparkle--1 { animation: inaya-twinkle 1s ease infinite; }
.inaya__launch:hover .inaya__sparkle--2 { animation: inaya-twinkle 1s ease .25s infinite; }
.inaya__launch:hover .inaya__sparkle--3 { animation: inaya-twinkle 1s ease .5s infinite; }
@keyframes inaya-twinkle {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: .55; }
}

.inaya {
  position: fixed;
  right: 24px;
  bottom: 100px;
  z-index: 61;
  width: min(480px, calc(100vw - 32px));
  height: min(780px, calc(100vh - 132px));
  /* Reset host-page element styles: the drawer is a <section>, and pages
     like the marketing homepage style bare `section` (large padding,
     max-width, auto margins). Without this the content is inset by the
     page's section padding instead of our own. */
  margin: 0;
  padding: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  background: var(--bg-raise, #fffdf6);
  color: var(--ink, #2f261d);
  border: 1px solid var(--line, rgba(51, 41, 31, .12));
  border-radius: var(--radius, 18px);
  box-shadow: 0 20px 64px rgba(47, 38, 29, .30);
  overflow: hidden;
  font-family: var(--font-body, Inter, system-ui, sans-serif);
  font-size: 15.5px;
  line-height: 1.6;
}

/* `hidden` must win over `display: flex` above — the UA rule
   `[hidden] { display: none }` loses on specificity. Without this the
   drawer renders before the launcher is pressed and the close button
   (which sets `hidden`) appears to do nothing. */
.inaya[hidden] { display: none; }

.inaya__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  /* Slim gutter: header contents ride the panel edges; extra right room
     keeps the title clear of the corner-pinned close button. */
  padding: 10px 44px 10px 12px;
  border-bottom: 1px solid var(--line, rgba(51, 41, 31, .12));
  background: var(--bg, #fdf7ec);
}

.inaya__avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent, #c9681f);
  color: #1c1206;
}

.inaya__head-text { flex: 1; min-width: 0; }

.inaya__title {
  font-family: var(--font-display, Fraunces, Georgia, serif);
  font-size: 21px;
  font-weight: 600;
  margin: 0;
}

.inaya__subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-dim, #9c8a72);
}

.inaya__close {
  /* Pinned to the panel's top-right corner, out of the header flow. */
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  border: none;
  background: transparent;
  color: var(--ink-dim, #9c8a72);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.inaya__close:hover { color: var(--ink, #2f261d); background: var(--accent-soft, rgba(201,104,31,.14)); }

.inaya__list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inaya__row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}

.inaya__row--user {
  align-self: flex-end;
  align-items: flex-end;
}

.inaya__bubble {
  padding: 13px 17px;
  border-radius: 16px;
  background: var(--bg, #fdf7ec);
  border: 1px solid var(--line, rgba(51, 41, 31, .12));
  overflow-wrap: anywhere;
  max-width: 100%;
}

.inaya__row--user .inaya__bubble { white-space: pre-wrap; }

/* Rendered markdown inside assistant bubbles */
.inaya__bubble p { margin: 0 0 8px; }
.inaya__bubble p:last-child { margin-bottom: 0; }
.inaya__bubble ul { margin: 4px 0 8px; padding-left: 18px; }
.inaya__bubble li { margin: 2px 0; }
.inaya__bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: var(--accent-soft, rgba(201,104,31,.14));
  border-radius: 5px;
  padding: 1px 5px;
}
.inaya__md-table {
  overflow-x: auto;
  max-width: 100%;
  margin: 4px 0 8px;
}
.inaya__md-table table {
  border-collapse: collapse;
  font-size: 14px;
  min-width: 100%;
}
.inaya__md-table th,
.inaya__md-table td {
  border: 1px solid var(--line, rgba(51, 41, 31, .18));
  padding: 5px 9px;
  text-align: left;
  white-space: nowrap;
}
.inaya__md-table th {
  background: var(--accent-soft, rgba(201,104,31,.14));
  font-weight: 600;
}

.inaya__row--user .inaya__bubble {
  background: var(--accent, #c9681f);
  border-color: var(--accent, #c9681f);
  color: #1c1206;
}

.inaya__bubble--error {
  color: #8c3a1d;
  border-color: rgba(140, 58, 29, .4);
}

/* Typing indicator: three pulsing dots while the assistant composes */
.inaya__typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 18px;
}

.inaya__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-dim, #9c8a72);
  animation: inaya-typing 1.2s ease-in-out infinite;
}

.inaya__dot:nth-child(2) { animation-delay: .18s; }
.inaya__dot:nth-child(3) { animation-delay: .36s; }

@keyframes inaya-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.inaya__starters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Pin the chips to the bottom of the (flex-growing) message list so the
     empty-state dead space sits above them, not between them and the
     input bar. No effect once the list fills with conversation. */
  margin-top: auto;
}

.inaya__starter {
  text-align: left;
  width: 100%;
  border: 1px solid var(--line, rgba(51, 41, 31, .12));
  background: var(--bg-raise, #fffdf6);
  color: var(--accent, #c9681f);
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  cursor: pointer;
}

.inaya__starter:hover { background: var(--accent-soft, rgba(201,104,31,.14)); }

.inaya__cites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}

.inaya__cites-label {
  font-size: 11.5px;
  color: var(--ink-dim, #9c8a72);
}

.inaya__cite {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft, rgba(201,104,31,.14));
  color: var(--accent, #c9681f);
  border: 1px solid transparent;
}

.inaya__form {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--line, rgba(51, 41, 31, .12));
}

.inaya__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line, rgba(51, 41, 31, .12));
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  background: var(--bg, #fdf7ec);
  color: inherit;
}

.inaya__input:focus-visible {
  outline: 2px solid var(--accent, #c9681f);
  outline-offset: 1px;
}

.inaya__send {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--accent, #c9681f);
  color: #1c1206;
  cursor: pointer;
}

.inaya__send:disabled { opacity: .5; cursor: default; }

@media (max-width: 520px) {
  .inaya {
    right: 8px;
    bottom: 84px;
    width: calc(100vw - 16px);
    height: min(74vh, 780px);
  }
  .inaya__launch { right: 12px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .inaya__launch { transition: none; }
  .inaya__sparkle { animation: none !important; }
  .inaya__dot { animation: none; opacity: .8; }
}
