/* ============================================================
   product-dock-layout.css — product-page top dock, LAYOUT ONLY.
   Positional, state-height (handle / input / max) and
   layout-constraint rules. Theme + shared components (surface,
   message bubbles, input/button chrome, scrollbars) live in
   chat-core.css and are loaded alongside this file.

   The `max` state stops strictly above the sticky buy bar so
   #purchaseBtn is never covered: JS measures .sticky-purchase and
   writes --eg-buy-bar-offset on <html>.
   ============================================================ */

:root {
  --topdock-handle-h: 16px; /* thin grab-handle height (mirrors product-top-dock.js HANDLE_H) */
  --topdock-input-h: 68px; /* input bar height (.ai-bar: 14px pad ×2 + 40px send button) */
  --eg-buy-bar-offset: 80px; /* fallback; JS refines to the real .sticky-purchase height */
}

/* Scroll-lock only while maximized (max state). */
html.eg-topdock-open,
body.eg-topdock-open {
  overflow: hidden !important;
  touch-action: none;
}
body.eg-topdock-open .ai-top-dock__log {
  touch-action: pan-y;
  overscroll-behavior: contain;
  background: #53191b;
}

/* Container: anchored to the very top, above the navbar. */
.ai-top-dock {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-topdock);
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  will-change: height;
  transition: var(--spring);
}

/* State 0: peek handle only. */
.ai-top-dock[data-state="handle"] {
  height: var(--topdock-handle-h);
}

/* State 1: handle + input bar. */
.ai-top-dock[data-state="input"] {
  height: calc(var(--topdock-handle-h) + var(--topdock-input-h));
}

/* State 2: expanded — sheds down over the header/navbar/imagery/variant
   selectors, but stops above the buy bar so #purchaseBtn stays visible. */
.ai-top-dock[data-state="max"] {
  height: calc(100vh - var(--eg-buy-bar-offset));
  height: calc(100dvh - var(--eg-buy-bar-offset));
  max-height: calc(100vh - var(--eg-buy-bar-offset));
  max-height: calc(100dvh - var(--eg-buy-bar-offset));
}

.ai-top-dock__bar-wrap {
      display: flex;
    flex-direction: column-reverse;
}
.ai-top-dock.is-dragging {
  transition: none;
}

/* Handle: peek bar + drag surface. */
.ai-top-dock__handle {
  flex: none;
  height: var(--topdock-handle-h);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: #53191b;
  cursor: ns-resize;
  touch-action: none;
  color: inherit;
}

/* Log: scrollable transcript between the handle and the input bar. */
.ai-top-dock__log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--ai-dark-line);
}
.ai-top-dock:not([data-state="max"]) .ai-top-dock__log {
  display: none;
}

/* Input bar (reuses .ai-bar / .ai-bar__input / .ai-bar__send from
   chat-core.css) — pinned to the bottom of the panel. */
.ai-top-dock__bar {
  flex: none;
  border-top: 1px solid var(--ai-dark-line);
  background: #cec8b3;
}

@media (prefers-reduced-motion: reduce) {
  .ai-top-dock {
    transition: none;
  }
}
