/* A page turns over the conversation; the content and contact form stay put. */
.chat-topic-choice {
  display: inline-block; width: auto; max-width: 100%; min-height: 44px;
  margin: .25rem .15rem .25rem 0; padding: .35rem .5rem;
  border: 1px solid #b7a17a; border-radius: 6px;
  background: #faf4e7; color: var(--navy); font: inherit; font-weight: 600;
  cursor: pointer; vertical-align: baseline;
}
.chat-topic-choice:focus-visible { outline: 2px solid #a58243; outline-offset: 3px; }
.chat-message .chat-topic-line { white-space: normal; }
.chat-shell { position: relative; scroll-margin-top: 16px; }
.chat-shell[data-reading="true"] { height: min(82svh, 780px); min-height: 420px; }
.chat-shell[data-reading="true"] .chat-navigation { display: flex; }
.chat-shell[data-reading="true"] > :not(.chat-reader-stack) { opacity: .45; }
.chat-reader-stack { position: absolute; inset: 0; z-index: 20; overflow: hidden; }
.chat-reader-stack[data-transition="closing"] { pointer-events: none; }
.reader-stack-rail, .reader-page-spine {
  position: absolute; inset: 0 auto 0 0; z-index: 30; width: 32px;
  background: #e8e3d8; border-right: 1px solid #c9c5bb; color: #334056;
  writing-mode: vertical-rl; text-orientation: mixed; font: inherit; font-size: .78rem;
  letter-spacing: .015em; cursor: pointer; padding: 1.15rem .35rem;
  text-align: left; font-weight: 600;
}
.reader-page-spine { left: calc(var(--spine) * 32px); background: #f1ede4; }
.reader-stack-rail:hover, .reader-page-spine:hover { background: #e3d8c2; }
.reader-stack-rail:focus-visible, .reader-page-spine:focus-visible { outline: 2px solid #a58243; outline-offset: -3px; }
.reader-stack-page.chat-reader {
  position: absolute; inset: 0 0 0 calc(32px + var(--layer, 0) * 32px);
  height: 100%; min-height: 0; border-radius: 16px 0 0 16px;
  border-left: 1px solid #d9d4c8; background: #fffefa;
  box-shadow: -8px 0 25px #10213c18;
  transition: filter 250ms ease;
}
.reader-stack-page.is-underneath { filter: brightness(.94); }
.reader-stack-header {
  display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between;
  gap: .3rem; padding: .45rem .7rem .45rem 1rem; border-bottom: 1px solid #e8e3d9;
}
.reader-stack-back, .reader-stack-close {
  min-height: 44px; background: transparent; color: var(--navy); font: inherit;
  cursor: pointer; border-radius: 5px;
}
.reader-stack-back { display: flex; min-width: 0; align-items: center; gap: .55rem; text-align: left; font-size: .9rem; padding: .3rem 0; margin-right: auto; }
.reader-stack-back > span:first-child { font-size: 1.2rem; }
.reader-stack-back > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-stack-close { flex: 0 0 44px; font-size: 1.5rem; }
.reader-stack-page .chat-reader-scroll { margin: 0; padding: 1.6rem 1.4rem 2rem; flex: 1; animation: none; }
.reader-stack-page h2 { font-size: clamp(1.35rem, 2.2vw, 1.7rem); margin-bottom: 1.3rem; }
.reader-stack-page h2:focus { outline: none; }
.reader-stack-page .chat-reader-content { line-height: 1.7; }
.reader-stack-page .chat-reader-content > p { white-space: pre-line; }
.reader-stack-answer { display: grid; }
.reader-stack-answer > * { grid-area: 1 / 1; align-self: start; min-width: 0; }
.reader-paragraph-pending { visibility: hidden; }
.reader-stack-intro:not([hidden]) { display: flex; gap: .75rem; align-items: flex-start; padding-top: .1rem; }
.reader-stack-intro img { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; object-fit: cover; }
.reader-stack-page .reader-stack-intro p { margin: 0; color: var(--navy); font-size: 1rem; }
.reader-stack-intro small { display: block; color: #657080; font-size: .78rem; }
.reader-show-now { flex: 0 0 auto; min-height: 44px; padding: .4rem .25rem; color: #536074; background: none; font: inherit; font-size: .82rem; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.reader-show-now:focus-visible { outline: 2px solid #a58243; outline-offset: 1px; border-radius: 4px; }
.reader-typing-dots { display: inline-flex; gap: 3px; align-items: center; margin-left: .15rem; }
.reader-typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: #8f764a; animation: reader-typing-dot 1400ms ease-in-out infinite; }
.reader-typing-dots i:nth-child(2) { animation-delay: 180ms; }
.reader-typing-dots i:nth-child(3) { animation-delay: 360ms; }
@keyframes reader-typing-dot { 0%, 70%, 100% { opacity: .35; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }
.reader-stack-footer {
  flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; min-height: 0;
  gap: .3rem .85rem; padding: .7rem 1.2rem; border-top: 1px solid #e8e3d9;
  background: #fffefa;
}
.reader-stack-footer button { min-height: 44px; font: inherit; font-size: .9rem; cursor: pointer; }
.reader-stack-write { background: var(--navy); color: white; border-radius: 7px; padding: .5rem .85rem; }
.reader-stack-video { background: transparent; color: var(--navy); padding: .4rem 0; text-decoration: underline; text-underline-offset: .2em; }
.reader-stack-page .manuscript-price-sentence { font-size: 1.2rem; }
@media (max-width: 540px) {
  .chat-shell[data-reading="true"] { height: calc(100svh - 24px); min-height: 360px; max-height: 850px; scroll-margin-top: 12px; }
  .reader-stack-rail, .reader-page-spine { display: none; }
  .reader-stack-rail.is-nearest, .reader-page-spine.is-nearest { display: block; left: 0; width: 26px; font-size: .72rem; padding-inline: .25rem; }
  .reader-stack-page.chat-reader { left: 26px; border-left: 0; border-radius: 0; }
  .reader-stack-page .chat-reader-scroll { padding: 1.25rem .8rem 1.5rem; }
  .reader-stack-footer { padding: .55rem .8rem; gap: .15rem .65rem; }
  .reader-stack-header { padding-left: .85rem; }
  .chat-topic-choice { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .reader-stack-page.chat-reader { transition: none; }
  .reader-typing-dots i { animation: none; }
}
