/* Bhesh Chat, Phase 1 (12 Nov 2026): the chat screen, /app#chat. Uses the app's
   own tokens (style.css), so light and dark both follow the app's theme. */

/* flex: none, or #app's column flex ignores the height and the log never scrolls. */
.screen.chat {
  flex: none; padding: 0; width: 100%; max-width: 640px; margin: 0 auto;
  height: 100dvh; min-height: 0; overflow: hidden;
}
.screen.chat.on > * { animation: none; }

/* The chat itself, a column whose log scrolls: the whole of a guest's s-chat,
   or the main screen's Chat tab once signed in (chat.js moves it). */
.ch-box { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; }

/* Chat tab: the main screen stops being a page that scrolls and becomes one
   window high, top bar above, answers and composer at the bottom: the shape
   every messenger has (Jacob's law). */
#s-main.chat-on { flex: none; height: 100dvh; overflow: hidden; padding-bottom: 0; }
#s-main > #tab-chat {
  flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0;
  margin: 0 calc(-1 * var(--pad));          /* edge to edge on a phone */
}
#tab-chat .ch-top { padding-top: 12px; background: none; }
@media (min-width: 900px) {
  #s-main > #tab-chat { width: 100%; max-width: 720px; margin: 0 auto; }
}

.ch-top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: var(--bg);
}
.ch-av {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--ink); color: var(--on-ink-brand);
  font-family: "Bricolage Grotesque", -apple-system, sans-serif; font-weight: 800; font-size: 18px;
}
.ch-who b { display: block; font-family: "Bricolage Grotesque", -apple-system, sans-serif; font-size: 18px; line-height: 1.1; }
.ch-who span { font-size: 12px; color: var(--soft); }
.ch-alm {
  margin-left: auto; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  background: var(--surface); border: none; border-radius: 999px; min-height: 40px;
  padding: 8px 16px; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ch-alm.bump { animation: ch-bump .6s var(--ease); }
@keyframes ch-bump { 40% { transform: scale(1.08); border-color: var(--ok); } }

.ch-log {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px 12px 8px;
  display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain;
}
.ch-msg {
  max-width: 86%; font-size: 16px; line-height: 1.5; padding: 8px 12px; border-radius: 18px;
  overflow-wrap: anywhere; animation: ch-pop .22s var(--ease) both;
}
.ch-msg.bot { align-self: flex-start; background: var(--surface); color: var(--ink); border-bottom-left-radius: 6px; }
.ch-msg.me { align-self: flex-end; background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 6px; }
.ch-msg.me.pic { padding: 0; background: none; }
.ch-msg.me.pic img { display: block; width: 150px; max-height: 220px; object-fit: cover; border-radius: 18px; border-bottom-right-radius: 6px; }
/* The roast stands apart from the chat around it (Von Restorff). */
.ch-roast {
  display: block; margin-top: 12px; padding: 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--bad) 8%, var(--bg));
  font-weight: 700; font-size: 16px; line-height: 1.4;
}
.ch-roast small { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--bad); }

/* Hello: the whole chat in four steps, one quiet line (minimal pass 13 Nov:
   boxes inside a bubble read as clutter, so no borders, no fills). */
.ch-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ch-steps li { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--soft); }
.ch-steps li + li::before { content: "→"; margin-right: 8px; color: var(--dim); }
.ch-steps b { font-size: 14px; font-weight: 400; line-height: 1; }

/* The read's progress (CH_STAGES): a line that changes and a bar that moves. */
.ch-stage { min-width: 220px; }
.ch-stage span { display: block; }
.ch-bar { display: block; height: 3px; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.ch-bar::before {
  content: ""; display: block; height: 100%; background: var(--ink); transform-origin: left;
  transform: scaleX(.04); animation: ch-fill 7s cubic-bezier(.15, .7, .3, 1) forwards;
}
@keyframes ch-fill { to { transform: scaleX(.94); } }
@keyframes ch-pop { from { opacity: .3; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.ch-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 12px; border-radius: 18px; background: var(--surface); }
.ch-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); animation: ch-blink 1s infinite; }
.ch-typing i:nth-child(2) { animation-delay: .15s; }
.ch-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ch-blink { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.ch-look {
  margin-top: 12px; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center;
  background: none; border: none; padding: 0;
}
.ch-pcs { display: flex; gap: 4px; min-width: 0; }
.ch-pc { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2);   /* keeps white clothes visible */ display: grid; place-items: center; overflow: hidden; flex: none; }
.ch-pc img { width: 100%; height: 100%; object-fit: contain; }
.ch-pc .sw { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-firm); }
.ch-sc { font-family: "Bricolage Grotesque", -apple-system, sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-sc b { font-size: 24px; }
.ch-sc span { font-size: 12px; color: var(--soft); }
.ch-look.bad .ch-sc b { color: var(--bad); }
.ch-look.good .ch-sc b { color: var(--ok); }
.ch-look p { grid-column: 1 / -1; margin: 0; font-size: 14px; line-height: 1.4; color: var(--soft); }
.ch-sc .ch-up { display: block; font-style: normal; font-size: 12px; font-weight: 800; color: var(--ok); text-align: right; animation: ch-pop .3s 1.1s var(--ease) both; }
/* Details as plain text, not pills: labels are supporting content (RUI p44). */
.ch-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0; margin-top: -4px; }
.ch-tags span { font-size: 14px; color: var(--soft); }
.ch-tags span + span::before { content: " · "; white-space: pre; }
.ch-strip { margin-top: 8px; }

.ch-shops { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ch-shops a {
  font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink);
  background: var(--bg); border-radius: 999px; padding: 12px 16px;   /* secondary: one black button per screen */
}
.ch-fine { margin: 8px 0 0; font-size: 12px; color: var(--dim); }

.ch-chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px 4px; min-height: 46px;
  scrollbar-width: none;
}
.ch-chips::-webkit-scrollbar { display: none; }
.ch-chips.wrap { flex-wrap: wrap; overflow: visible; }
.ch-chip {
  flex: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--surface-2);
  border: none; border-radius: 999px; padding: 8px 16px; min-height: 44px; cursor: pointer; white-space: nowrap;
}
.ch-chip:hover { background: var(--surface); }
.ch-chip:active { transform: scale(.97); }
/* The answer most people want: filled, and big enough to hit with a thumb (Fitts). */
.ch-chip.main { background: var(--go); color: var(--on-go); border-color: var(--go); font-size: 16px; padding: 12px 24px; }
.ch-chip.main:hover { background: var(--go-dk); opacity: 1; }
/* The way out: a text link, not a third button (tertiary weight, PUI p306). */
.ch-chip.quiet { background: none; color: var(--soft); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 8px 8px; }
.ch-chip.sw::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border-radius: 50%; background: var(--sw); border: 1px solid var(--line-firm);
}
.ch-chips.busy .ch-chip { opacity: .4; pointer-events: none; }

.ch-comp {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bg);
}
.ch-cam, .ch-send {
  width: 44px; height: 44px; border-radius: 50%; border: none; display: grid; place-items: center;
  cursor: pointer; flex: none;
}
.ch-cam { background: var(--surface-2); color: var(--ink); }
.ch-send { background: var(--go); color: var(--on-go); }
.ch-cam svg, .ch-send svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-comp input[type="text"] {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: none; border-radius: 999px; padding: 12px 16px;
}
.ch-comp input[type="text"]:focus { outline: 2px solid var(--line-firm); outline-offset: 0; }
.ch-cam:focus-visible, .ch-send:focus-visible, .ch-chip:focus-visible, .ch-alm:focus-visible, .ch-shops a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* --- calmer chat (13 Nov 2026, founder: "mobile pe bahut complicated") --------
   Inside the Chat tab the app's own bar already says Bhesh, so the chat's header
   is one thin line; chips are smaller and an empty chip row takes no room. */
#tab-chat .ch-top { padding: 2px 16px 8px; gap: 8px; }
#tab-chat .ch-av { width: 26px; height: 26px; font-size: 14px; }
#tab-chat .ch-who { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
#tab-chat .ch-who b { font-size: 16px; }
#tab-chat .ch-who span { font-size: 12px; white-space: nowrap; }
#tab-chat .ch-alm { padding: 4px 12px; font-size: 12px; }
.ch-chips { min-height: 0; padding: 8px 12px 2px; }
.ch-chips:empty { display: none; }
.ch-chip { font-size: 14px; padding: 8px 16px; }
.ch-chip.main { font-size: 14px; padding: 8px 20px; }
.ch-log { padding-top: 12px; }

/* --- chat v2 mockup (13 Nov 2026): Bhesh speaks on the page, no bubble (ChatGPT
   style); only the person's own messages are bubbles. The outfit is the one
   container: big pieces, score, two quiet actions. Empty chat = 3 starters. */
.ch-msg.bot { background: none; padding: 0 4px; max-width: 100%; border-radius: 0; }
.ch-typing { background: none; padding: 8px 4px; }
.ch-log { gap: 12px; padding-left: 16px; padding-right: 16px; }
.ch-look {
  background: var(--surface); border-radius: 16px; padding: 12px;
  grid-template-columns: 1fr auto; align-items: end;
}
.ch-pcs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ch-pc { width: 100%; height: auto; aspect-ratio: 3 / 4; border-radius: 12px; background: var(--bg); }
.ch-pc .sw { width: 44%; height: auto; aspect-ratio: 1; }
.ch-look p { grid-column: 1; grid-row: 2; font-size: 14px; color: var(--ink); }
.ch-sc { grid-column: 2; grid-row: 2; text-align: right; }
.ch-sc b { font-size: 32px; }
.ch-tags { grid-row: 3; }
.ch-acts { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 4px; }
.ch-acts button {
  flex: 1; min-height: 44px; border: 0; border-radius: 999px; background: var(--bg);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.ch-chips.starters { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 16px; }
.ch-chips.starters .ch-chip {
  text-align: left; border-radius: 16px; padding: 12px 16px; min-height: 52px;
  background: var(--surface); font-size: 16px; font-weight: 600;
}
.ch-chips.starters .ch-chip small { display: block; font-size: 14px; font-weight: 400; color: var(--soft); }

@media (prefers-reduced-motion: reduce) {
  .ch-msg, .ch-sc .ch-up { animation: none; }
  .ch-typing i { animation: none; opacity: .7; }
  .ch-bar { display: none; }
}


/* --- chat full screen + Ask Bhesh button (founder, 13 Nov 2026) -----------------
   "Jab chat khole to poora chat hi khule, upar tabs na dikhe, ek back button ho."
   The chat tab hides the app's top bar; its own header carries a back arrow. The
   way in is one button at the bottom centre of every tab, in thumb reach. */
#s-main.chat-on .topbar, #s-main.chat-on .ask-fab { display: none; }
#tab-chat .ch-top { padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px 4px; gap: 8px; }
#tab-chat .ch-av { width: 32px; height: 32px; font-size: 16px; }
.ch-back {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%; color: var(--ink); cursor: pointer;
}
.ch-back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ch-back:active { background: var(--surface); }
.screen.chat > .ch-box .ch-back { display: none; }   /* a guest's chat is its own screen: nothing to go back to */

.ask-fab {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; z-index: 40;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 24px 8px 8px;
  border: 0; border-radius: 999px; background: var(--go); color: var(--on-go);
  font: inherit; font-size: 16px; font-weight: 650; white-space: nowrap; cursor: pointer;
  box-shadow: 0 12px 28px -10px rgba(31, 79, 216, .55), 0 2px 6px rgba(0, 0, 0, .12);
  transition: transform .2s var(--ease);
}
.ask-fab:active { transform: scale(.96); }
.ask-fab-b {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--go);
  font-family: "Bricolage Grotesque", -apple-system, sans-serif; font-weight: 800; font-size: 20px;
}
#s-main > [id^="tab-"]:not(#tab-chat) { padding-bottom: 112px; }   /* the last card clears the button */

/* --- minimal chat (founder, 15 Nov 2026) ---------------------------------------
   No starter buttons. An empty chat shows one faint line in the background, the
   way a watermark sits on paper; it fades out the moment he types or a message lands. */
.ch-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ch-wm {
  position: absolute; inset: 0; margin: 0; padding: 24px 32px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; pointer-events: none;
  font-family: "Bricolage Grotesque", -apple-system, sans-serif; font-weight: 800;
  font-size: 28px; line-height: 1.2; letter-spacing: -.01em;
  color: var(--ink); opacity: .14;
  transition: opacity .25s var(--ease);
}
.ch-wm small {
  display: block; margin-top: 12px; font-family: inherit; font-size: 16px; font-weight: 600; letter-spacing: 0;
}
.ch-wm.off { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .ch-wm { transition: none; } }

/* "Kya pehnu": 2-3 Looks cards side by side, swiped (15 Nov 2026). */
.ch-cards { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 4px 0 12px; padding: 2px 2px 6px; scrollbar-width: none; }
.ch-cards::-webkit-scrollbar { display: none; }
.ch-card { flex: 0 0 72%; max-width: 300px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; }
.ch-cards.one .ch-card { flex-basis: 80%; }
.ch-card img { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); }
.ch-ord { align-self: flex-start; font-size: 13px; font-weight: 800; color: var(--on-ink-brand); background: var(--ink); border-radius: 999px; padding: 4px 10px; }
.ch-card .ch-acts { margin-top: 0; flex-wrap: wrap; }
.ch-card .ch-wear { flex: 1 0 100%; font-weight: 700; background: var(--ink); color: var(--on-ink); border-radius: 999px; min-height: 44px; }
.ch-card .ch-acts button:not(.ch-wear) { flex: 1; }
.ch-cards.picked .ch-card:not(.on) { opacity: .45; }
.ch-cards.picked .ch-card:not(.on) button { pointer-events: none; }

/* --- "Naya" highlights (founder, 16 Nov 2026; tips.js) --------------------------
   Rapido-style: a soft blue ring that breathes around the one thing to tap next,
   a small NAYA tag on its corner, and a two-line note. One at a time, once each. */
.tip-ring, .tip-new, .tip-note { position: fixed; z-index: 60; opacity: 0; visibility: hidden; transition: opacity .25s var(--ease), visibility .25s; }
.tip-ring.on, .tip-new.on, .tip-note.on { opacity: 1; visibility: visible; }
.tip-ring {
  pointer-events: none; border-radius: 999px; border: 2px solid var(--go);
  animation: tip-pulse 1.6s ease-out infinite;
}
@keyframes tip-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(31, 79, 216, .45); }
  100% { box-shadow: 0 0 0 14px rgba(31, 79, 216, 0); }
}
.tip-new {
  pointer-events: none; padding: 2px 8px; border-radius: 999px;
  background: var(--go); color: var(--on-go);
  font-size: 10px; font-weight: 800; letter-spacing: .08em; line-height: 16px;
}
.tip-note {
  padding: 14px 16px 12px; border-radius: 16px;
  background: var(--ink); color: var(--on-ink);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, .35);
  transform: translateY(4px); transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
}
.tip-note.on { transform: none; }
.tip-note::after {
  content: ""; position: absolute; left: var(--ax, 50%); top: -6px; width: 12px; height: 12px;
  margin-left: -6px; background: inherit; transform: rotate(45deg); border-radius: 2px;
}
.tip-note.up::after { top: auto; bottom: -6px; }
.tip-h { display: block; font-size: 16px; font-weight: 700; }
.tip-p { margin: 4px 0 10px; font-size: 14px; line-height: 1.4; opacity: .85; }
.tip-ok {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--on-ink); color: var(--ink); font: inherit; font-size: 14px; font-weight: 650;
}
@media (prefers-reduced-motion: reduce) { .tip-ring { animation: none; } }

/* --- Premium at the wow moment (founder, 16 Nov 2026; upsell.js) ----------------- */
.up-bg {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: end center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, .45); opacity: 0; visibility: hidden;
  transition: opacity .25s var(--ease), visibility .25s;
}
.up-bg.on { opacity: 1; visibility: visible; }
.up-card {
  width: 100%; max-width: 420px; padding: 24px 20px 12px; border-radius: 24px;
  background: var(--bg); color: var(--ink); text-align: center;
  transform: translateY(24px); transition: transform .3s var(--out);
}
.up-bg.on .up-card { transform: none; }
.up-k { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--go); }
.up-card h2 {
  margin: 8px 0 16px; font-family: "Bricolage Grotesque", -apple-system, sans-serif;
  font-size: 28px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em;
}
.up-l { list-style: none; margin: 0 0 18px; padding: 0; text-align: left; display: grid; gap: 10px; }
.up-l li { position: relative; padding-left: 28px; font-size: 15px; font-weight: 600; }
.up-l li::before { content: "✓"; position: absolute; left: 0; color: var(--go); font-weight: 800; }
.up-go { width: 100%; }
.up-no { display: block; margin: 0 auto; min-height: 40px; }
.up-q { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.up-guess { display: flex; align-items: center; gap: 8px; }
.up-guess.hide, .up-reveal.hide, .up-q.hide, .up-skip.hide { display: none; }
.up-rs { font-size: 22px; font-weight: 800; }
.up-in { flex: 1; min-width: 0; min-height: 48px; font-size: 20px; font-weight: 700; }
.up-try { width: auto; flex: none; padding: 0 20px; min-height: 48px; margin: 0; }
.up-say { min-height: 22px; margin: 10px 0 0; font-size: 16px; font-weight: 700; color: var(--go); }
.up-price { margin: 4px 0 4px; font-size: 22px; }
.up-price b { font-size: 34px; font-family: "Bricolage Grotesque", -apple-system, sans-serif; font-weight: 800; }
.up-fine { margin: 0 0 14px; font-size: 13px; color: var(--soft); }
.up-skip { display: block; margin: 8px auto 0; min-height: 40px; color: var(--soft); }
