/* Chat layout for the homepage and the buyer page: the page reads as one agent session.
   The visitor's questions sit on the right, Turnset's answers on the left with tool-call
   blocks, and the signup form is the message box at the bottom. Loaded after home.css,
   which still supplies the signup form and the agent logo masks. */



/* On wide screens the rail carries the logo, theme and action, so the page header goes. */
@media (min-width: 861px) {
  body.chat-page .top { display: none; }
}

/* The conversation fills the space right of the 16rem rail with equal margins that grow with the
   window, up to 100rem wide; past that the spare space splits evenly on both sides. */
body.chat-page {
  --chat-pad: clamp(2rem, 4vw, 4.5rem);
}

.chat {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  width: 100%;
  margin: 0;
  gap: 0;
}

/* The rail: logo and theme button at the top, the sections, then the call to action at the
   bottom. On wide screens it replaces the page header. */
.chat__side {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  padding: 1.3rem 1rem 1.5rem calc(var(--gutter) - 0.6rem);
  background: var(--paper-2);
  border-right: 1px solid var(--rule);
}

.chat__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0 2.2rem 0.6rem;
}

.chat__foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.9rem;
  margin-top: auto;
  padding: 1.5rem 0 0 0.6rem;
}

/* The site footer's links and owner line, at the bottom of the rail. */
.chat__legal {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: var(--text-sm);
}

.chat__legal a { color: var(--ink-45); text-decoration: none; }
.chat__legal a:hover { color: var(--ink); text-decoration: underline; }

.chat__owner {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--ink-45);
}

.chat__foot .chat__cta { flex: 1; justify-content: center; white-space: nowrap; }

/* The rail's theme button sits next to the logo; the action alone at the bottom. */

.chat__side small {
  display: block;
  margin: 0 0 0.6rem 0.6rem;
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-45);
}

/* A second group of links in the same rail starts with its own label. */
.chat__side nav small:not(:first-child) { margin-top: 1.5rem; }

/* Section links. The switch to the other page is a button (.btn), styled by styles.css. */
.chat__side nav a:not(.btn) {
  display: block;
  padding: 0.5rem 0.6rem;
  color: var(--ink-70);
  font-size: var(--text-sm);
  text-decoration: none;
}

.chat__side nav a:not(.btn):hover { color: var(--ink); background: var(--paper-2); }

.chat__side a.is-on {
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 600;
}

.chat__side .chat__switch {
  margin: 1.5rem 0 0 0.6rem;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 100rem;
  margin: 0 auto;
  padding: 1.5rem var(--chat-pad) 0;
}

/* The visitor speaks in the secondary colour, Turnset in green. */
.msg-you {
  position: relative;
  align-self: flex-end;
  max-width: 80%;
  margin: 1.1rem 0 0;
  padding: 0.7rem 1rem;
  border-radius: 16px 16px 4px 16px;
  background: color-mix(in srgb, var(--orange) 16%, var(--paper-2));
  color: var(--ink);
  font-size: var(--text-base);
  font-weight: 600;
  scroll-margin-top: 2.5rem;
}

:root[data-theme="dark"] .msg-you {
  background: color-mix(in srgb, var(--orange) 34%, var(--paper-2));
}

/* Who is speaking, like the avatar on Turnset's side. */
.msg-you::before {
  content: "you";
  position: absolute;
  right: 0.25rem;
  bottom: 100%;
  margin-bottom: 0.3rem;
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-45);
}

.msg-bot {
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr);
  gap: 0.9rem;
}

.msg-bot__av {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  background: var(--green);
  color: var(--paper-2);
  font: 600 13px/1 var(--mono);
}

.msg-bot h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(2.2rem, 4.4vw, 3.2rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.msg-bot h1 em { font-style: normal; color: var(--green); }

.msg-bot h2 {
  margin: 0.1rem 0 0.6rem;
  font-size: var(--text-2xl, 1.5rem);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.msg-bot p { margin: 0 0 0.7rem; color: var(--ink-70); }
.msg-bot p b { color: var(--ink); }

.msg-bot .msg-bot__label {
  margin: 1.6rem 0 0.55rem;
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-45);
}

/* The first group label follows the heading closely. */
.msg-bot h2 + .msg-bot__label { margin-top: 0.9rem; }

/* Agent chips with their logos. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.4rem;
  padding: 0;
  list-style: none;
}

.chips li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--ink-70);
  font-size: var(--text-sm);
}

/* Two- or three-column answers: tiers, comparisons, the provenance list. */
.rows {
  margin: 0.2rem 0 0.8rem;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}

.rows > div {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  border-top: 1px solid var(--rule);
}

.rows > div:first-child { border-top: 0; }
.rows--3 > div { grid-template-columns: 9rem minmax(0, 1.4fr) minmax(0, 1fr); }
.rows--wide > div { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }

.rows b, .rows dt { font-weight: 600; color: var(--ink); margin: 0; }
.rows span, .rows dd { margin: 0; color: var(--ink-70); font-size: var(--text-sm); }
.rows small { display: block; margin-top: 0.2rem; color: var(--ink-45); font-size: var(--text-xs); }

.rows__head {
  font: 600 11px/1.3 var(--mono) !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-45) !important;
}

.rows__head span { color: var(--ink-45); font-size: 11px; }

/* The message box: the last message in the thread. */
.composer {
  margin-top: 1rem;
  padding: 0 0 4rem;
}

.composer .signup {
  padding: 0.9rem;
  border: 1px solid var(--ink);
  background: var(--paper-2);
  box-shadow: var(--shadow);
}


@media (max-width: 860px) {
  .chat { grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* The rail becomes a panel opened by the menu button in the header. No animation. */
  .chat__side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(18rem, 86vw);
    height: 100dvh;
    padding: 1.3rem 1rem 1.5rem calc(var(--gutter) - 0.6rem);
    overflow-y: auto;
    visibility: hidden;
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }
  body.menu-open .chat__side { visibility: visible; transform: none; }
  body.menu-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 55;
    background: color-mix(in srgb, var(--ink) 35%, transparent);
  }
  .chat__top .theme { margin-left: auto; }
  /* The panel carries the theme button, so the phone header keeps menu, logo and action on one line. */
  body.chat-page .top .theme { display: none; }
  /* The site's phone header is a two-column grid; the menu button needs a third, in front. */
  body.chat-page .top__row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .msg-you { max-width: 92%; }
  .thread { padding-left: var(--gutter); padding-right: var(--gutter); }
  .rows > div, .rows--3 > div, .rows--wide > div { grid-template-columns: minmax(0, 1fr); gap: 0.25rem; }
}

/* Founders Circle: one-line mentions linking to /founders. */
.offer-line {
  margin: 0.2rem 0 0;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--orange);
  background: color-mix(in srgb, var(--orange) 8%, var(--paper));
  color: var(--ink-70);
}

.offer-line a { color: var(--green); font-weight: 600; }


/* Phone menu buttons: hidden on wide screens, where the rail is always there. */
@media (min-width: 861px) {
  .menu-btn, .menu-close { display: none !important; }
}

.menu-btn, .menu-close {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-right: 0.6rem;
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.menu-close { margin: 0 0 0 0.5rem; }

.menu-btn svg, .menu-close svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: square;
}

