/* =====================================================
   HONESTLY, E — Companion Chat Widget (marketing / anonymous)
   The Sophie-style pill → hero-alongside-thread panel, themed per
   companion via --cc-accent. Self-contained: no dependency on the
   page's own layout, so it survives any companion-page restructure.

   Drives the anonymous Take-5 chat + the in-widget "be remembered"
   verify funnel (phone → SMS code → email → recognized identity).
   ===================================================== */

:root {
  --cc-accent: #8B6B4A;          /* overridden per companion at init */
  --cc-on-accent: #fff;          /* text on accent buttons; flipped to dark for light accents at init */
  --cc-ink: #2b2622;
  --cc-paper: #faf8f5;
  --cc-them-bg: #f1ece5;
  --cc-line: rgba(0,0,0,0.08);
  --cc-shadow: 0 18px 50px rgba(40,30,20,0.28);
  /* EB Garamond / Inter match the focused sites; Cormorant / Source Sans the generalist pages — whichever the page loads wins. */
  --cc-serif: 'EB Garamond', 'Cormorant Garamond', Georgia, serif;
  --cc-sans: 'Inter', 'Source Sans 3', system-ui, sans-serif;
}

/* Accent-colored controls use the contrast-aware on-accent color (later rule
   overrides the literal #fff in the blocks below, without touching hero text). */
.cc-pill, .cc-send, .cc-remember__cta, .cc-verify__action { color: var(--cc-on-accent, #fff); }

/* ---- Launcher pill ------------------------------------------------ */
.cc-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px 7px 7px;
  border: none;
  border-radius: 999px;
  background: var(--cc-accent);
  color: #fff;
  font-family: var(--cc-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--cc-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s ease;
}
.cc-pill:hover { transform: translateY(-2px); box-shadow: 0 22px 56px rgba(40,30,20,0.34); }
.cc-pill__avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.25);
  flex: 0 0 auto;
}
.cc-pill[hidden] { display: none; }

/* ---- Panel -------------------------------------------------------- */
.cc-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483000;
  width: 460px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 48px);
  display: flex;
  overflow: hidden;
  border-radius: 18px;
  background: var(--cc-paper);
  box-shadow: var(--cc-shadow);
  font-family: var(--cc-sans);
  color: var(--cc-ink);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.cc-panel.cc-open { opacity: 1; transform: none; }
.cc-panel[hidden] { display: none; }

/* Hero column (the companion's presence) */
.cc-hero {
  position: relative;
  flex: 0 0 38%;
  background-size: cover;
  background-position: center top;
  background-color: var(--cc-accent);
}
.cc-hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 45%, rgba(0,0,0,0.55) 100%);
}
.cc-hero__id {
  position: absolute;
  left: 16px; bottom: 16px; right: 12px;
  z-index: 1;
  color: #fff;
}
.cc-hero__name {
  font-family: var(--cc-serif);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.05;
}
.cc-hero__role {
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0.9;
  margin-top: 2px;
}

/* Main column */
.cc-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.cc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 12px 18px;
  border-bottom: 1px solid var(--cc-line);
}
.cc-head__title { font-family: var(--cc-serif); font-size: 1.25rem; font-weight: 600; }
.cc-close {
  border: none; background: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--cc-ink); opacity: 0.5;
  padding: 4px 6px; border-radius: 8px;
}
.cc-close:hover { opacity: 1; background: rgba(0,0,0,0.05); }

/* Thread */
.cc-thread {
  flex: 1 1 auto; overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex; flex-direction: column; gap: 12px;
}
.cc-msg { max-width: 86%; font-size: 0.92rem; line-height: 1.5; white-space: pre-wrap; }
.cc-msg__bubble { padding: 10px 13px; border-radius: 14px; }
.cc-msg--them { align-self: flex-start; }
.cc-msg--them .cc-msg__bubble { background: var(--cc-them-bg); border-bottom-left-radius: 5px; }
.cc-msg--you { align-self: flex-end; }
.cc-msg--you .cc-msg__bubble {
  background: color-mix(in srgb, var(--cc-accent) 16%, #fff);
  border-bottom-right-radius: 5px;
}
.cc-typing { align-self: flex-start; color: var(--cc-ink); opacity: 0.5; font-size: 0.9rem; padding: 4px 2px; }

/* Compose */
.cc-compose {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--cc-line);
}
.cc-input {
  flex: 1 1 auto; resize: none;
  border: 1px solid var(--cc-line); border-radius: 12px;
  padding: 10px 12px; font-family: var(--cc-sans); font-size: 0.92rem;
  line-height: 1.4; max-height: 96px; background: #fff; color: var(--cc-ink);
}
.cc-input:focus { outline: none; border-color: var(--cc-accent); }
.cc-send {
  flex: 0 0 auto;
  border: none; border-radius: 999px; cursor: pointer;
  padding: 10px 18px; font-family: var(--cc-sans); font-weight: 600; font-size: 0.9rem;
  background: var(--cc-accent); color: #fff;
}
.cc-send:disabled { opacity: 0.45; cursor: default; }

/* ---- Remember banner + verify funnel ----------------------------- */
.cc-remember {
  margin: 4px 16px 0;
  padding: 11px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--cc-accent) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--cc-accent) 30%, transparent);
  font-size: 0.86rem; line-height: 1.45;
}
.cc-remember__cta {
  margin-top: 8px; border: none; border-radius: 999px; cursor: pointer;
  padding: 8px 16px; font-family: var(--cc-sans); font-weight: 600; font-size: 0.85rem;
  background: var(--cc-accent); color: #fff;
}
.cc-remember[hidden] { display: none; }

.cc-verify {
  position: absolute; inset: 0; z-index: 2;
  background: var(--cc-paper);
  display: flex; flex-direction: column;
  padding: 22px 20px;
}
.cc-verify[hidden] { display: none; }
.cc-verify__back {
  align-self: flex-start; border: none; background: none; cursor: pointer;
  font-size: 0.85rem; color: var(--cc-ink); opacity: 0.6; padding: 0 0 10px;
}
.cc-verify__title { font-family: var(--cc-serif); font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.cc-verify__copy { font-size: 0.9rem; line-height: 1.5; margin-top: 8px; opacity: 0.85; }
.cc-field { margin-top: 16px; }
.cc-field label { display: block; font-size: 0.78rem; font-weight: 600; opacity: 0.7; margin-bottom: 5px; }
.cc-field input {
  width: 100%; border: 1px solid var(--cc-line); border-radius: 10px;
  padding: 11px 13px; font-family: var(--cc-sans); font-size: 0.95rem; background: #fff; color: var(--cc-ink);
}
.cc-field input:focus { outline: none; border-color: var(--cc-accent); }
.cc-verify__action {
  margin-top: 18px; border: none; border-radius: 999px; cursor: pointer;
  padding: 12px 18px; font-family: var(--cc-sans); font-weight: 600; font-size: 0.95rem;
  background: var(--cc-accent); color: #fff;
}
.cc-verify__action:disabled { opacity: 0.45; cursor: default; }
.cc-verify__note { font-size: 0.78rem; opacity: 0.6; margin-top: 12px; line-height: 1.4; }
.cc-verify__error { font-size: 0.83rem; color: #9b2d30; margin-top: 12px; min-height: 1em; }
.cc-verify__success { text-align: center; margin: auto 0; }
.cc-verify__success .cc-verify__title { margin-top: 10px; }

/* ---- Mobile: hero becomes a top strip ---------------------------- */
@media (max-width: 520px) {
  .cc-panel { flex-direction: column; height: calc(100vh - 24px); bottom: 12px; right: 12px; }
  .cc-hero { flex: 0 0 96px; }
  .cc-hero__name { font-size: 1.25rem; }
  .cc-pill { bottom: 16px; right: 16px; }
}
