/* candyfactory.ai /contact — Chunk intake panel (BON-1542)
   Consumes the Parlor tokens declared inline by contact/index.html
   (--bg, --paper, --ink, --butter, --hot, --accent, --mono, --display, --body).

   Mobile-keyboard contract:
   • Panel height keys off --vvh (set from window.visualViewport by intake.js)
     with a 100dvh fallback — never bare 100vh, so the on-screen keyboard
     shrinks the panel instead of hiding the composer.
   • .intake-scroll is the ONLY scrolling region (independent of the page).
   • Composer font-size is 16px — below that iOS zooms the page on focus.
   • Send button sits bottom-right: thumb-reachable on handsets. */

.intake {
  display: flex;
  flex-direction: column;
  height: min(560px, calc(var(--vvh, 100dvh) - 300px));
  min-height: 320px;
  max-width: 100%;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
  overflow: hidden;
  margin: 6px 0 0;
}

.intake-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.intake-bar .intake-brand { font-weight: 600; }
.intake-status { color: var(--accent); }
.intake-status.is-offline { color: var(--hot); }

/* The conversation log — the one independently scrolling region. */
.intake-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px;
  background: var(--bg);
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg-assistant {
  align-self: flex-start;
  background: var(--paper);
  border-bottom-left-radius: 4px;
}
.msg-user {
  align-self: flex-end;
  background: var(--butter);
  border-bottom-right-radius: 4px;
}
.msg-error {
  align-self: flex-start;
  background: #fff0f3;
  border-color: var(--hot);
  font-family: var(--mono);
  font-size: 12.5px;
}
.msg-error a { color: var(--ink); font-weight: 700; }
.msg-thinking {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  border-style: dashed;
  background: var(--paper);
}

/* Lead confirmation card — appears when Chunk has gathered the lead. */
.intake-lead {
  flex: 0 0 auto;
  border-top: 2px dashed var(--ink);
  background: var(--bg-soft);
  padding: 12px 16px;
}
.intake-lead-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 8px;
}
.intake-lead-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 8px;
}
.intake-lead-fields div { display: flex; gap: 6px; }
.intake-lead-fields dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  align-self: center;
}
.intake-lead-fields dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.intake-lead-summary {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}
.intake-lead button {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  padding: 10px 16px;
  color: var(--paper);
  background: var(--hot);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
}
.intake-lead button:hover { background: var(--pop); }
.intake-lead button:active { transform: translate(3px, 3px); box-shadow: none; }
.intake-lead button:disabled { opacity: 0.6; cursor: wait; }

/* Composer — input ≥16px (iOS zoom guard), send button thumb-side. */
.intake-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px;
  border-top: 2px solid var(--ink);
  background: var(--paper);
}
.intake-composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  padding: 11px 13px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--bg);
  resize: none;
  min-height: 46px;
  max-height: 120px;
}
.intake-composer textarea:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 3px 3px 0 var(--pink);
}
.intake-composer button {
  flex: 0 0 auto;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  padding: 11px 18px;
  min-height: 46px;
  min-width: 74px;
  color: var(--paper);
  background: var(--hot);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
}
.intake-composer button:hover { background: var(--pop); }
.intake-composer button:active { transform: translate(3px, 3px); box-shadow: none; }
.intake-composer button:disabled { opacity: 0.6; cursor: wait; }

/* Honeypot: visually removed, still in the form for bots that fill fields. */
.intake-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Privacy note + email fallback under the panel. */
.intake-privacy {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  max-width: 64ch;
  margin: 16px 0 0;
}
.intake-privacy a { color: var(--ink); }
.intake-fallback { margin: 26px 0 0; }
.intake-fallback .sub { margin-bottom: 14px; }

@media (max-width: 640px) {
  .intake {
    height: min(540px, calc(var(--vvh, 100dvh) - 230px));
    min-height: 280px;
    border-width: 2px;
    border-radius: 14px;
    box-shadow: 4px 4px 0 var(--ink);
  }
  .intake-scroll { padding: 14px 12px; }
  .msg { max-width: 92%; }
  .intake-composer { padding: 10px; gap: 8px; }
  .intake-lead-fields { gap: 4px 12px; }
}
