/* The Gardener chat panel and its bubbles, shared by the workspace and the
   public pages (moved from portal_home.css, 2026-10-27). */
/* ── Gardener chat panel (collapsible, LIMBBS pattern) ───────────
   Lives at the top of /manufacturers/. Default expanded; click the
   bar to collapse to a 50px stripe. State persisted in sessionStorage
   so it survives navigation. */
.mf-chat {
  background: var(--surface-raised);
  border-bottom: var(--border-thin) solid var(--border-default);
  display: flex;
  flex-direction: column;
  /* a height the reader drags (gardener_panel.js) wins over the default */
  height: var(--chat-h, 40vh);
  min-height: 12rem;
  max-height: var(--chat-max, 32rem);
  transition: height 0.25s ease, min-height 0.25s ease;
  position: relative;
  z-index: 5;
}
.mf-chat--empty {
  height: auto;
  min-height: 0;
  max-height: none;
}
.mf-chat.is-collapsed {
  height: 3rem;
  min-height: 3rem;
  max-height: 3rem;
}
.mf-chat.is-collapsed .mf-chat__body { display: none; }
/* The bar is one big button (Daniel 2026-10-27: an accent, and a signal
   across the whole bar that it shows and hides the chat). */
.mf-chat__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  padding: 0.7rem var(--space-6) 0.7rem calc(var(--space-6) - 4px);
  background: var(--color-kale-100);
  border: 0;
  border-left: 4px solid var(--color-dg-logo);
  border-bottom: 2px solid var(--color-dg-logo);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  user-select: none;
  transition: background var(--duration-fast) var(--ease-standard);
}
.mf-chat__bar:hover { background: var(--color-kale-200); }
.mf-chat__bar:focus-visible { outline: 3px solid var(--border-focus); outline-offset: -3px; }
.mf-chat__title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-dg-logo);
  min-width: 0;
}
/* the Data Garden mark in miniature: a 4 x 4 grid of dots */
.mf-chat__dot {
  flex: none;
  width: 1rem;
  height: 1rem;
  background: radial-gradient(circle, var(--color-dg-logo) 0 42%, transparent 46%) 0 0 / 25% 25%;
}
.mf-chat__hint {
  font-weight: var(--weight-regular);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-left: var(--space-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-chat__toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--color-dg-logo);
  background: var(--surface-raised);
  color: var(--color-dg-logo);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  transition:
    background var(--duration-fast) var(--ease-standard),
    color      var(--duration-fast) var(--ease-standard);
}
.mf-chat__bar:hover .mf-chat__toggle,
.mf-chat__bar:focus-visible .mf-chat__toggle {
  background: var(--color-dg-logo);
  color: var(--text-on-brand);
}
.mf-chat__toggle-chevron {
  display: inline-block;
  font-size: var(--text-base);
  line-height: 1;
  transform: rotate(180deg);       /* open: points up, "hide" */
  transition: transform 0.25s ease;
}
.mf-chat.is-collapsed .mf-chat__toggle-chevron { transform: none; }   /* closed: points down, "show" */
.mf-chat__bar:hover .mf-chat__toggle-chevron { transform: rotate(180deg) translateY(2px); }
.mf-chat.is-collapsed .mf-chat__bar:hover .mf-chat__toggle-chevron { transform: translateY(2px); }
@media (prefers-reduced-motion: reduce) { .mf-chat__toggle-chevron { transition: none; } }
/* Swap "Hide / Show" by collapsed state. */
.mf-chat__toggle-label--collapse { display: inline; }
.mf-chat__toggle-label--open     { display: none; }
.mf-chat.is-collapsed .mf-chat__toggle-label--collapse { display: none; }
.mf-chat.is-collapsed .mf-chat__toggle-label--open     { display: inline; }
@media (max-width: 600px) { .mf-chat__hint { display: none; } }

/* ── Chat actions row (above composer): New, Save, Email ── */
.mf-chat__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-6);
  border-top: 1px solid var(--border-divider);
  background: var(--surface-page);
  flex-wrap: wrap;
}
.mf-chat__action,
.mf-chat__action-form button {
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 0.3rem 0.7rem;
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.mf-chat__action:hover,
.mf-chat__action-form button:hover {
  border-color: var(--color-kale-300);
  background: var(--color-kale-50);
  color: var(--color-kale-700);
}
.mf-chat__action-form { margin: 0; display: inline-flex; }
/* New chat: the one filled button in the row (Daniel 2026-10-30) */
.mf-chat__action-form button.mf-chat__new {
  background: var(--color-dg-logo, var(--color-kale-600));
  border-color: transparent;
  color: #fff;
  font-weight: var(--weight-semibold, 600);
}
.mf-chat__action-form button.mf-chat__new:hover { background: var(--color-dg-logo, var(--color-kale-600)); color: #fff; filter: brightness(1.2); }
.mf-chat__actions-hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-faint, var(--text-muted));
  opacity: 0.7;
}
.mf-chat__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.mf-chat__transcript {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--surface-page);
}
.mf-chat__empty { padding: var(--space-4) 0; }
.mf-chat__empty-lead {
  margin: 0 0 var(--space-3) 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.mf-chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.mf-chat__chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4rem var(--space-4);
  border: var(--border-thin) solid var(--border-default);
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  font-family: inherit;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
}
.mf-chat__chip::before {
  content: "›";
  color: var(--color-accent);
  font-weight: var(--weight-semibold);
}
.mf-chat__chip:hover {
  border-color: var(--color-kale-300);
  color: var(--text-primary);
  background: var(--color-kale-50);
}
.mf-chat__anon {
  margin: var(--space-5) 0 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.mf-chat__anon code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--surface-sunken);
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-sm);
}

/* bubbles */
.mf-bubble {
  max-width: 44rem;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}
.mf-bubble--user {
  align-self: flex-end;
  background: var(--color-kale-700);
  color: var(--text-on-brand);
}
.mf-bubble--assistant {
  align-self: flex-start;
  background: var(--surface-raised);
  border: var(--border-thin) solid var(--border-default);
  color: var(--text-primary);
}
.mf-bubble__text { white-space: pre-wrap; }
.mf-bubble__media {
  display: block;
  margin-top: var(--space-3);
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: var(--border-thin) solid var(--border-default);
}

/* composer */
.mf-chat__composer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: var(--border-thin) solid var(--border-default);
  background: var(--surface-raised);
}
.mf-chat__input {
  flex: 1;
  resize: none;
  border: var(--border-thin) solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0.65rem var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--surface-page);
  outline: 0;
  transition: border-color var(--duration-fast) var(--ease-standard),
              box-shadow var(--duration-fast) var(--ease-standard);
}
.mf-chat__input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-kale-100);
}
.mf-chat__send {
  border: 0;
  background: var(--color-accent);
  color: var(--text-on-accent);
  font-family: inherit;
  font-weight: var(--weight-medium);
  font-size: var(--text-base);
  padding: 0 var(--space-5);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) var(--ease-standard);
}
.mf-chat__send:hover:not(:disabled) { background: var(--color-accent-hover); }
.mf-chat__send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--surface-page);
}


/* Gardener on the public pages (gardener_dock.html) */
.mf-chat__dock-actions { display: flex; gap: var(--space-3, 12px); align-items: center; margin: var(--space-2, 8px) 0; }
.mf-chat__dock-actions .mf-chat__send { text-decoration: none; }
.mf-chat__dock-link { font-weight: 600; }
.mf-chat--dock.mf-chat--empty .mf-chat__transcript { max-height: none; }

/* Gardener's Markdown, rendered (gardener_md.js) */
.mf-bubble__text.is-md { white-space: normal; }
.mf-bubble__text.is-md > :first-child { margin-top: 0; }
.mf-bubble__text.is-md > :last-child { margin-bottom: 0; }
.mf-bubble__text.is-md p, .mf-bubble__text.is-md ul, .mf-bubble__text.is-md ol, .mf-bubble__text.is-md blockquote { margin: 0 0 0.6em; }
.mf-bubble__text.is-md ul, .mf-bubble__text.is-md ol { padding-left: 1.3em; }
.mf-bubble__text.is-md li { margin-bottom: 0.2em; }
.mf-bubble__text.is-md h3, .mf-bubble__text.is-md h4, .mf-bubble__text.is-md h5, .mf-bubble__text.is-md h6 { font-size: 1em; margin: 0.8em 0 0.3em; }
.mf-bubble__text.is-md code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-sunken); padding: 0 4px; border-radius: 4px; }
.mf-bubble__text.is-md pre { background: var(--surface-sunken); padding: 8px 10px; border-radius: 6px; overflow-x: auto; }
.mf-bubble__text.is-md pre code { background: none; padding: 0; }
.mf-bubble__text.is-md blockquote { border-left: 3px solid var(--border-default); padding-left: 10px; color: var(--text-muted); }
.mf-bubble__text.is-md .md-table { overflow-x: auto; margin: 0 0 0.6em; }
.mf-bubble__text.is-md table { border-collapse: collapse; font-size: 0.92em; font-variant-numeric: tabular-nums; }
.mf-bubble__text.is-md th, .mf-bubble__text.is-md td { border-bottom: 1px solid var(--border-default); padding: 4px 10px 4px 0; text-align: left; vertical-align: top; }
.mf-bubble__text.is-md th { font-weight: 600; }
.mf-bubble__text.is-md a { color: var(--text-link); }

/* Resize grip along the panel's bottom edge (gardener_panel.js) */
.mf-chat__grip {
  flex: none;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  touch-action: none;
  background: var(--surface-raised);
  border-top: 1px solid var(--border-default);
}
.mf-chat__grip::before {
  content: "";
  width: 44px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-strong, #B9B6A8);
  transition: background var(--duration-fast) var(--ease-standard), width var(--duration-fast) var(--ease-standard);
}
.mf-chat__grip:hover::before, .mf-chat__grip.is-dragging::before, .mf-chat__grip:focus-visible::before {
  background: var(--color-dg-logo);
  width: 64px;
}
.mf-chat__grip:focus-visible { outline: 2px solid var(--border-focus); outline-offset: -2px; }
.mf-chat.is-collapsed .mf-chat__grip, .mf-chat--empty .mf-chat__grip { display: none; }
body.is-resizing-chat { cursor: ns-resize; user-select: none; }
body.is-resizing-chat .mf-chat { transition: none; }  /* follow the pointer exactly */

/* Gardener in its own window (/workspace/gardener) */
.mf-popout .site-header, .mf-popout .mf-layout { display: none; }
.mf-popout .mf-chat { height: 100vh; height: 100dvh; max-height: none; min-height: 0; }
.mf-popout .mf-chat__grip, .mf-popout .mf-chat__toggle, .mf-popout [data-popout] { display: none; }
.mf-popout .mf-chat__bar { cursor: default; }
.mf-chat__popped { padding: var(--space-4) var(--space-6); font-size: var(--text-sm); color: var(--text-muted); }

/* The open panel carries the bar's pale brand green, so it reads as part of
   Gardener, not of the page (Daniel 2026-10-27). */
.mf-chat { border-left: 4px solid var(--color-dg-logo); }
.mf-chat__bar { border-left: 0; padding-left: var(--space-6); }
.mf-chat__transcript { background: var(--color-kale-50); }
.mf-chat__actions { background: var(--color-kale-50); border-top-color: var(--color-kale-200); }
.mf-chat__composer { background: var(--color-kale-100); border-top-color: var(--color-kale-200); }
.mf-chat__grip { background: var(--color-kale-100); border-top-color: var(--color-kale-200); }
.mf-chat { border-bottom: 2px solid var(--color-dg-logo); }
.mf-chat.is-collapsed { border-bottom: 0; }
.mf-bubble--assistant { background: var(--surface-raised); }
.mf-popout .mf-chat { border-left: 0; }
