/* Mill and Vine — sticky AI chat demo (front-end only) */
.mv-chat-root {
  --mv-chat-bg: #1a1513;
  --mv-chat-panel: #241e1b;
  --mv-chat-border: rgba(255, 248, 240, 0.14);
  --mv-chat-text: #f6efe6;
  --mv-chat-muted: rgba(246, 239, 230, 0.62);
  --mv-chat-accent: #c45c3e;
  --mv-chat-bot: #2e2723;
  --mv-chat-user: #3d2a24;
  --mv-chat-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), 0 4px 14px rgba(0, 0, 0, 0.25);
  position: fixed;
  right: 1.15rem;
  bottom: 1.15rem;
  z-index: 9200;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--mv-chat-text);
  pointer-events: none;
}
.mv-chat-root * { box-sizing: border-box; }
.mv-chat-root button { font: inherit; color: inherit; }
html.embed-phone .mv-chat-root {
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 8800;
}

.mv-chat-fab {
  pointer-events: auto;
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 999px;
  border: 1px solid var(--mv-chat-border);
  background: linear-gradient(160deg, #c96845 0%, #a6442c 100%);
  color: #fff8f2;
  box-shadow: var(--mv-chat-shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.mv-chat-fab:hover { transform: translateY(-1px) scale(1.03); }
.mv-chat-fab:focus-visible {
  outline: 2px solid #f6efe6;
  outline-offset: 3px;
}
.mv-chat-fab svg { width: 1.35rem; height: 1.35rem; display: block; }
.mv-chat-fab[aria-expanded="true"] { background: linear-gradient(160deg, #3a312c, #241e1b); }

.mv-chat-panel {
  pointer-events: auto;
  position: absolute;
  right: 0;
  bottom: calc(3.35rem + 0.75rem);
  width: min(340px, calc(100vw - 1.6rem));
  max-height: 420px;
  display: none;
  flex-direction: column;
  border-radius: 1.05rem;
  overflow: hidden;
  background: var(--mv-chat-panel);
  border: 1px solid var(--mv-chat-border);
  box-shadow: var(--mv-chat-shadow);
}
.mv-chat-panel.is-open { display: flex; }

.mv-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  background: #1a1513;
  border-bottom: 1px solid var(--mv-chat-border);
}
.mv-chat-head strong {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.mv-chat-close {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--mv-chat-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.mv-chat-close:hover { color: var(--mv-chat-text); background: rgba(255,255,255,0.06); }
.mv-chat-close:focus-visible { outline: 2px solid #f6efe6; outline-offset: 2px; }

.mv-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.9rem 0.85rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 12rem;
  max-height: 280px;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(196, 92, 62, 0.12), transparent 55%),
    var(--mv-chat-panel);
}

.mv-chat-msg {
  max-width: 88%;
  padding: 0.65rem 0.8rem;
  border-radius: 0.95rem;
  font-size: 0.9rem;
  animation: mv-chat-in 0.28s ease both;
}
.mv-chat-msg.bot {
  align-self: flex-start;
  background: var(--mv-chat-bot);
  border: 1px solid var(--mv-chat-border);
  border-bottom-left-radius: 0.35rem;
}
.mv-chat-msg.user {
  align-self: flex-end;
  background: var(--mv-chat-user);
  border: 1px solid rgba(196, 92, 62, 0.35);
  border-bottom-right-radius: 0.35rem;
}
@keyframes mv-chat-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.mv-chat-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-radius: 0.95rem;
  background: var(--mv-chat-bot);
  border: 1px solid var(--mv-chat-border);
}
.mv-chat-typing[data-side="user"] {
  align-self: flex-end;
  background: var(--mv-chat-user);
  border-color: rgba(196, 92, 62, 0.35);
}
.mv-chat-typing span {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--mv-chat-muted);
  animation: mv-chat-dot 1.1s infinite ease-in-out;
}
.mv-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.mv-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes mv-chat-dot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.mv-chat-foot {
  padding: 0.65rem 0.75rem 0.8rem;
  border-top: 1px solid var(--mv-chat-border);
  background: #1a1513;
}
.mv-chat-input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--mv-chat-border);
  background: rgba(255,255,255,0.04);
  color: var(--mv-chat-muted);
  padding: 0.55rem 0.9rem;
  font-size: 0.82rem;
  cursor: not-allowed;
}
.mv-chat-input:disabled { opacity: 0.85; }

/* Cream / light pages (Hearth Folio) — soft inversion when host is light */
html[data-theme="folio"] .mv-chat-root,
html.hearth-folio .mv-chat-root,
body.hearth .mv-chat-root {
  --mv-chat-bg: #f7f1e8;
  --mv-chat-panel: #fffaf3;
  --mv-chat-border: rgba(40, 28, 18, 0.12);
  --mv-chat-text: #2a2118;
  --mv-chat-muted: rgba(42, 33, 24, 0.58);
  --mv-chat-bot: #f1e6d7;
  --mv-chat-user: #efe0cf;
  --mv-chat-shadow: 0 18px 40px rgba(60, 35, 18, 0.18);
}
html[data-theme="folio"] .mv-chat-head,
html.hearth-folio .mv-chat-head,
body.hearth .mv-chat-head,
html[data-theme="folio"] .mv-chat-foot,
html.hearth-folio .mv-chat-foot,
body.hearth .mv-chat-foot {
  background: #f3ebe0;
}

@media (prefers-reduced-motion: reduce) {
  .mv-chat-msg, .mv-chat-fab, .mv-chat-typing span { animation: none !important; transition: none !important; }
}


.mv-chat-root.mv-chat-light {
  --mv-chat-bg: #f7f1e8;
  --mv-chat-panel: #fffaf3;
  --mv-chat-border: rgba(40, 28, 18, 0.12);
  --mv-chat-text: #2a2118;
  --mv-chat-muted: rgba(42, 33, 24, 0.58);
  --mv-chat-bot: #f1e6d7;
  --mv-chat-user: #efe0cf;
  --mv-chat-shadow: 0 18px 40px rgba(60, 35, 18, 0.18);
}
.mv-chat-root.mv-chat-light .mv-chat-head,
.mv-chat-root.mv-chat-light .mv-chat-foot { background: #f3ebe0; }
.mv-chat-root.mv-chat-light .mv-chat-fab {
  background: linear-gradient(160deg, #d4893a 0%, #b46928 100%);
  color: #fffaf3;
}
.mv-chat-root.mv-chat-light .mv-chat-fab[aria-expanded="true"] {
  background: linear-gradient(160deg, #efe0cf, #e4d5c0);
  color: #2a2118;
}
