/* Rich bits inside the hero chat: screenshots, reactions, read receipts.
   Scoped to the conversation so nothing else on the page changes. */
#conversation {
  /* Critically damped spring: quick response, no bounce or overshoot. */
  --spring-smooth: cubic-bezier(.22, 1, .36, 1);
}
@supports (animation-timing-function: linear(0, 1)) {
  #conversation {
    --spring-smooth: linear(0, .0446, .1443, .2642, .3849, .4963, .594, .6768, .7452, .8009, .8454, .8807, .9084, .93, .9467, .9596, .9694, .9769, .9826, .987, .9902, .9927, .9946, .9959, .997, 1);
  }
}
#conversation .chat-message {
  animation: chat-message-in 480ms var(--spring-smooth) both;
  transition: opacity 420ms var(--spring-smooth);
}
#conversation .chat-bubble {
  transition-duration: 260ms;
  transition-timing-function: var(--spring-smooth);
}
@keyframes chat-message-in {
  from { opacity: 0; transform: translateY(.625rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes chat-reduced-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
#conversation .chat-shot {
  display: block;
  width: min(100%, 15rem);
  height: auto;
  border-radius: .75rem;
  box-shadow: 0 0 0 1px rgb(255 255 255 / .08);
}
#conversation .chat-reactions {
  position: absolute;
  bottom: -.6rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  padding: .1rem .32rem;
  border-radius: 999px;
  background: #181818;
  border: 1px solid #212121;
  box-shadow: 0 1px 3px rgb(0 0 0 / .45);
  font-size: .75rem;
  line-height: 1.2;
  animation: chat-reaction-in 340ms var(--spring-smooth);
}
@keyframes chat-reaction-in {
  from { opacity: 0; transform: translateY(.25rem) scale(.85); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
#conversation .chat-status {
  margin-top: .15rem;
  padding-right: .25rem;
  font-size: .75rem;
  color: var(--muted-foreground);
  animation: chat-status-in 260ms var(--spring-smooth);
}
@keyframes chat-status-in {
  from { opacity: 0; transform: translateY(.2rem); }
  to { opacity: 1; transform: translateY(0); }
}
/* Leave room for a badge hanging off the last bubble of a turn. */
#conversation .hero-chat-mask { padding-bottom: .5rem; }

/* Earning widgets arrive like attachments, with no surrounding message bubble.
   Expanding the grid track makes the older messages slide up at the same time. */
#conversation .chat-widget-frame {
  display: grid;
  grid-template-rows: 0fr;
  width: 20rem;
  max-width: 100%;
  filter: drop-shadow(0 10px 12px rgb(0 0 0 / .24));
  animation: chat-widget-open 620ms var(--spring-smooth) forwards;
}
#conversation .chat-widget-inner { min-height: 0; overflow: hidden; }
#conversation .earning-widget {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 8.5rem;
  padding: .875rem 1rem;
  border: 1px solid #212121;
  border-radius: 1.25rem;
  background: #181818;
  color: #f0f0f0;
  transform-origin: center bottom;
  animation: chat-widget-rise 620ms var(--spring-smooth) both;
}
#conversation .earning-widget__layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
  height: 100%;
}
#conversation .earning-widget__content { flex: 1 1 58%; min-width: 0; }
#conversation .earning-widget__label {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  line-height: 1.25;
  white-space: nowrap;
}
#conversation .earning-widget__change { display: inline-flex; align-items: center; gap: .125rem; font-weight: 650; }
#conversation .earning-widget__amount {
  margin: .35rem 0 0;
  font-size: clamp(1.75rem, 7vw, 2.125rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  line-height: 1.05;
  white-space: nowrap;
}
#conversation .earning-widget__note {
  margin: .3rem 0 0;
  overflow: hidden;
  font-size: .75rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#conversation .earning-widget__chart { flex: 0 0 38%; width: 38%; height: 3.75rem; min-width: 0; }
#conversation .earning-widget__chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
@keyframes chat-widget-open {
  from { grid-template-rows: 0fr; }
  to { grid-template-rows: 1fr; }
}
@keyframes chat-widget-rise {
  from { opacity: 0; transform: translateY(1rem) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #conversation .chat-message,
  #conversation .chat-reactions,
  #conversation .chat-status,
  #conversation .earning-widget { animation: chat-reduced-fade 180ms ease-out; }
  #conversation .chat-message,
  #conversation .chat-bubble { transition: none; }
  #conversation .chat-bubble,
  #conversation .earning-widget { transform: none !important; }
  #conversation .chat-widget-frame { grid-template-rows: 1fr; animation: none; }
}

/* t460u: more room for the hero chat, heading + CTA lower */
#conversation { max-height: 58vh; }
#conversation + div { margin-top: auto; padding-top: 1.5rem; padding-bottom: 2.5rem; }
@media (min-width: 1024px) {
  #conversation { max-height: none; }
  #conversation .hero-chat-mask { height: 30rem; }
  #conversation + div { top: 66%; margin-top: 0; padding: 0; }
}
@media (min-width: 1024px) {
  main section > #conversation + div { top: auto !important; bottom: 7vh !important; }
  main section > #conversation .hero-chat-mask { height: min(30rem, calc(100vh - 25rem)) !important; }
}
/* Two absolutely positioned blocks collided: the chat's last avatar sat on
   top of the h1 first line at 1440, 1280 and 1024. Lay them out in flow
   instead, so the chat can only ever occupy the space above the headline.
   The chat still bottom-aligns inside its own column, so the newest message
   sits just above the heading at every height. */
@media (min-width: 1024px) {
  main section { display: flex !important; flex-direction: column; }
  main section > #conversation {
    position: static !important;
    transform: none !important;
    translate: none !important;
    inset: auto !important;
    display: flex;
    align-items: flex-end;
    align-self: center;
    flex: 1 1 auto;
    min-height: 0;
    width: min(40rem, 57%);
    max-height: none;
    margin: 1.5rem 0 0 !important;
  }
  main section > #conversation .hero-chat-mask { height: 100% !important; max-height: 30rem; }
  main section > #conversation + div {
    position: static !important;
    inset: auto !important;
    flex: 0 0 auto;
    margin: 1.5rem 0 7vh 5rem !important;
  }
}
