/* ---- chat assistant ----
   Sits above page content but below the shop's own overlays (z-index 100),
   so the basket drawer and video player still cover it. */

.chat-launcher {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; cursor: pointer; font: inherit; font-weight: 750; font-size: 14px;
  padding: 12px 18px 12px 14px; border-radius: 999px;
  background: var(--brand-dark); color: #fff; box-shadow: var(--shadow);
}
.chat-launcher:hover { filter: brightness(1.15); }
.chat-launcher-icon { font-size: 18px; line-height: 1; }
.chat-launcher.is-open .chat-launcher-text { display: none; }
.chat-launcher.is-open { padding: 12px 14px; }

.chat-tease {
  position: fixed; right: 18px; bottom: 76px; z-index: 90;
  max-width: 260px; display: flex; align-items: flex-start; gap: 6px;
  padding: 12px 10px 12px 14px; border-radius: 16px 16px 4px 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: chat-pop .25s ease-out;
}
.chat-tease[hidden] { display: none; }
.chat-tease-text {
  border: 0; background: none; padding: 0; cursor: pointer; text-align: left;
  font: inherit; font-size: 14px; line-height: 1.4; color: var(--ink);
}
.chat-tease-close {
  border: 0; background: none; cursor: pointer; color: var(--ink-3);
  font-size: 12px; padding: 2px 4px;
}

.chat-panel {
  position: fixed; right: 18px; bottom: 76px; z-index: 90;
  width: min(380px, calc(100vw - 36px)); height: min(600px, calc(100vh - 110px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--page); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 12px 40px rgba(11, 11, 11, .18);
  animation: chat-pop .2s ease-out;
}
.chat-panel[hidden] { display: none; }

.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; background: var(--brand-dark); color: #fff;
}
.chat-title { flex: 1; min-width: 0; }
.chat-title-name { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; }
.chat-title-sub { font-size: 12px; opacity: .7; }
.chat-title-sub::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px;
  border-radius: 999px; background: var(--accent); vertical-align: 1px;
}
.chat-close {
  border: 0; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer;
  width: 30px; height: 30px; border-radius: 999px; font-size: 13px;
}
.chat-close:hover { background: rgba(255, 255, 255, .22); }

.chat-log {
  flex: 1; overflow-y: auto; padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 8px; background: var(--surface-2);
}

.chat-msg { display: flex; }
.chat-msg.is-user { justify-content: flex-end; }
.chat-bubble {
  max-width: 82%; padding: 9px 13px; font-size: 14px; line-height: 1.45;
  border-radius: 16px 16px 16px 4px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); overflow-wrap: anywhere;
}
.chat-msg.is-user .chat-bubble {
  border-radius: 16px 16px 4px 16px; border-color: transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.chat-msg.is-wide { display: block; }

.chat-link { display: inline-block; margin-top: 6px; color: var(--accent-text); font-weight: 750; text-decoration: none; }
.chat-link:hover { text-decoration: underline; }

.chat-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.chat-typing span {
  width: 6px; height: 6px; border-radius: 999px; background: var(--ink-3);
  animation: chat-dot 1s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }

.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; padding: 2px 0 4px; }
.chat-chip {
  border: 1px solid var(--ink); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
  padding: 6px 12px; border-radius: 999px;
}
.chat-chip:hover { background: var(--accent-soft); }
.chat-chip.is-primary { background: var(--accent); border-color: var(--accent); }

.chat-samples {
  display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 8px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 6px;
}
.chat-sample {
  scroll-snap-align: start; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.chat-sample-main { display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; padding-bottom: 8px; flex: 1; }
.chat-sample-main img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--surface-2); margin-bottom: 4px; }
.chat-sample-name {
  padding: 0 9px; font-size: 12.5px; font-weight: 650; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.chat-sample-price { padding: 0 9px; font-size: 13px; font-weight: 800; display: flex; gap: 6px; align-items: baseline; }
.chat-sample-was { font-size: 11.5px; font-weight: 500; color: var(--ink-3); text-decoration: line-through; }
.chat-sample-tag {
  align-self: flex-start; margin: 2px 9px 0; padding: 2px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 750;
}
.chat-sample-tag.is-ready { color: var(--good); background: color-mix(in srgb, var(--good) 13%, transparent); }
.chat-sample-tag.is-low { color: #b4700d; background: color-mix(in srgb, #d98b16 15%, transparent); }
.chat-sample-tag.is-pre { color: var(--accent-ink); background: var(--accent-soft); border: 1px solid var(--accent); }
.chat-sample-video {
  display: block; text-align: center; padding: 7px 6px; font-size: 12px; font-weight: 750;
  border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; background: var(--accent-soft);
}
.chat-sample-video:hover { background: var(--accent); }

.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--page); }
.chat-input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.chat-input:focus { outline: none; border-color: var(--ink); }
.chat-send {
  border: 0; cursor: pointer; font: inherit; font-weight: 750; font-size: 14px;
  padding: 0 16px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
}

.chat-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--sale); color: #fff; font-size: 11.5px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--page);
}
.chat-badge[hidden] { display: none; }
.chat-launcher:has(.chat-badge:not([hidden])) { animation: chat-nudge 2.4s ease-in-out 3; }

/* The in-page card that points at the chat. */
.chat-prompt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  margin-top: 14px; padding: 12px 14px; text-align: left; cursor: pointer;
  font: inherit; color: var(--ink);
  background: var(--surface); border: 1px dashed var(--ink-3); border-radius: 14px;
}
.chat-prompt:hover { border-style: solid; border-color: var(--ink); background: var(--accent-soft); }
.chat-prompt-icon {
  flex: none; width: 38px; height: 38px; border-radius: 999px;
  display: grid; place-items: center; font-size: 18px; background: var(--brand-dark);
}
.chat-prompt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.chat-prompt-text strong { font-size: 14.5px; color: var(--ink); }
.chat-prompt-go { flex: none; font-size: 13px; font-weight: 800; color: var(--accent-text); white-space: nowrap; }
.hero .chat-prompt { max-width: 520px; margin: 18px auto 0; }

@keyframes chat-nudge { 0%, 70%, 100% { transform: none; } 78% { transform: translateY(-5px); } 86% { transform: none; } 92% { transform: translateY(-2px); } }
@keyframes chat-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-tease, .chat-typing span, .chat-launcher { animation: none !important; }
}

/* Phones: the panel becomes a sheet over the lower page, the button shrinks
   to its icon, and both lift above the landing page's own sticky bits. */
@media (max-width: 560px) {
  .chat-launcher { right: 14px; bottom: 14px; padding: 13px; }
  .chat-launcher-text { display: none; }
  .chat-tease { right: 14px; bottom: 72px; max-width: calc(100vw - 28px); }
  .chat-panel {
    right: 0; left: 0; bottom: 0; width: 100%;
    height: min(86vh, calc(100dvh - 60px)); border-radius: 20px 20px 0 0;
  }
  .chat-launcher.is-open { display: none; }
  .chat-prompt-go { display: none; }
}

/* ---- the chat as its own page (/chat) ---- */
.chat-page-body { background: var(--surface-2); }
.chat-page { max-width: 640px; margin: 0 auto; padding: 18px 16px 24px; }
.chat-panel.is-page {
  position: static; width: 100%; animation: none;
  /* Fills the screen under the header, so the conversation and the typing
     box are both in view on a phone without scrolling the page itself. */
  height: calc(100dvh - 120px); min-height: 420px;
}
@media (max-width: 560px) {
  .chat-page { padding: 0; }
  .chat-panel.is-page { height: calc(100dvh - 64px); border-radius: 0; border-left: 0; border-right: 0; }
}
