/* ========================================================================
 * ChatDrawer — right-side chat drawer for the storefront.
 * Matches docs/storefront-hero-drawer.html State 3.
 * Colors use Daylight tokens via the bridge (`--cream`, `--ink`, `--accent`).
 * ======================================================================== */

/* ---- Backdrop ---- */
.cd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(59, 47, 47, 0.35);
  z-index: 50;
}

/* ---- Drawer shell ---- */
.cd-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  z-index: 51;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  box-shadow:
    -24px 0 64px -20px rgba(107, 74, 53, 0.14),
    -8px 0 16px rgba(107, 74, 53, 0.08),
    -1px 0 0 rgba(107, 74, 53, 0.08);
  border-radius: 14px 0 0 14px;
}

/* ---- Mobile drag handle (decorative) ---- */
.cd-drag-handle {
  display: none;
}

/* ---- Header ---- */
.cd-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(107, 74, 53, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--cream);
  position: relative;
  flex-shrink: 0;
  border-radius: 14px 0 0 0;
}
.cd-head::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 22px;
  width: 28px;
  height: 1px;
  background: var(--accent);
}
.cd-head-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cd-head-eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}
.cd-head-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
}
.cd-head-title em {
  font-style: normal;
}
.cd-head-meta {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: rgba(59, 47, 47, 0.42);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cd-persona-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 2px;
  background: var(--cream-2);
  border: 1px solid rgba(107, 74, 53, 0.08);
  border-radius: 100px;
}
.cd-persona-av {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  
  font-size: 13px;
  font-weight: 500;
}
.cd-persona-name {
  color: var(--ink);
  font-family: var(--sans);
  
  font-size: 13px;
}
.cd-meta-sep {
  color: rgba(59, 47, 47, 0.22);
}
.cd-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: rgba(59, 47, 47, 0.66);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 180ms ease-out,
    color 180ms ease-out;
}
.cd-close:hover {
  background: rgba(59, 47, 47, 0.06);
  color: var(--ink);
}

/* ---- Body ---- */
.cd-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 14px;
  background: var(--cream);
  min-height: 0;
}
.cd-empty-state {
  font-family: var(--sans);
  
  font-size: 15px;
  color: rgba(59, 47, 47, 0.66);
  line-height: 1.5;
  text-align: center;
  padding: 48px 24px;
}

/* ---- Footer ---- */
.cd-foot {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(107, 74, 53, 0.08);
  background: var(--cream);
  flex-shrink: 0;
}
.cd-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cream);
  border: 1px solid var(--cream-2);
  border-radius: 100px;
  padding: 6px 6px 6px 16px;
}
.cd-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--sans);
  
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}
.cd-input::placeholder {
  color: rgba(59, 47, 47, 0.42);
  font-style: normal;
}
.cd-input:disabled {
  opacity: 0.5;
}
.cd-send {
  background: var(--ink);
  color: var(--cream);
  border: none;
  padding: 7px 16px;
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 180ms ease-out;
}
.cd-send:disabled {
  opacity: 0.4;
  cursor: default;
}
.cd-foot-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  color: rgba(59, 47, 47, 0.42);
  letter-spacing: 0.05em;
}

/* ---- Closed-state continue / clear control ---- */
.cd-continue-shell {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 39;
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border-radius: 999px;
  background: var(--ink);
  box-shadow:
    0 4px 16px rgba(31, 20, 16, 0.2),
    0 2px 6px rgba(31, 20, 16, 0.1);
}
.cd-continue-main,
.cd-continue-clear {
  border: none;
  font-family: var(--sans);
  color: var(--cream-warm);
  cursor: pointer;
  transition:
    background 160ms ease-out,
    opacity 160ms ease-out;
}
.cd-continue-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 12px 18px;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
}
.cd-continue-clear {
  padding: 0 14px;
  background: rgba(247, 243, 238, 0.08);
  border-left: 1px solid rgba(247, 243, 238, 0.16);
  font-size: 13px;
  font-weight: 500;
}
.cd-continue-main:hover,
.cd-continue-clear:hover {
  background: rgba(247, 243, 238, 0.12);
}
.cd-continue-key {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.6;
}

/* ---- Mobile bottom sheet (< 768px) ---- */
@media (max-width: 767.98px) {
  .cd-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 80dvh;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -24px 64px -20px rgba(107, 74, 53, 0.14), 0 -8px 16px rgba(107, 74, 53, 0.08);
  }
  .cd-head {
    border-radius: 14px 14px 0 0;
  }
  .cd-drag-handle {
    display: flex;
    justify-content: center;
    padding: 8px 0 0;
    background: var(--cream);
    border-radius: 14px 14px 0 0;
  }
  .cd-drag-handle::after {
    content: "";
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(59, 47, 47, 0.22);
  }
  .cd-continue-shell {
    right: 16px;
    bottom: 16px;
  }
}
