/* A single chapter on the existing TideField; no extra background renderer. */
#contenido > .assistant-section {
  --assistant-phase: 0;
  --assistant-reading-runway: clamp(420px,92svh,760px);
  position: relative;
  box-sizing: border-box;
  height: calc(380svh + var(--assistant-reading-runway));
  min-height: calc(2060px + var(--assistant-reading-runway));
  padding: 0;
  overflow: clip;
  color: #f2f8fa;
  background: linear-gradient(180deg,rgba(3,14,24,.28),rgba(3,14,24,.1) 32%,rgba(3,14,24,.2) 82%,rgba(3,14,24,.28));
}
.assistant-section::before { content: none; }
.assistant-section .assistant-stage {
  position: sticky;
  top: 0;
  box-sizing: border-box;
  height: 100svh;
  min-height: 550px;
  display: grid;
  align-items: center;
  isolation: isolate;
  padding: 80px max(24px,calc((100vw - 1220px)/2)) 22px;
}
/* Keep all copy and the full demo readable when JavaScript is unavailable. */
.assistant-section:not(.assistant-animated) .assistant-copy h2 [data-assistant-word],
.assistant-section:not(.assistant-animated) .assistant-copy > p,
.assistant-section:not(.assistant-animated) .assistant-chat,
.assistant-section:not(.assistant-animated) .assistant-message { opacity: 1; }
.assistant-section .assistant-copy {
  position: relative;
  z-index: 1;
  width: min(900px,74vw);
  max-width: none;
  margin-inline: auto;
  transform: translateX(calc(var(--assistant-phase) * -170px)) scale(calc(1 - var(--assistant-phase) * .25));
  transform-origin: left center;
  will-change: transform;
}
.assistant-reveal-stage { display: contents; }
.assistant-eyebrow { display: block; margin-bottom: 20px; color: #72cdd4; font-size: 11px; font-weight: 700; letter-spacing: .18em; }
.assistant-section .assistant-copy h2 {
  max-width: 23ch;
  margin: 0;
  color: #f2f8fa;
  font-size: clamp(46px,5.1vw,69px);
  font-weight: 630;
  line-height: 1.09;
  letter-spacing: -.055em;
  text-wrap: balance;
}
.assistant-copy h2 [data-assistant-word] { color: inherit; opacity: var(--assistant-word-opacity,.15); }
.assistant-copy h2 [data-assistant-word]:nth-child(-n+4) { color: #79dce0; }
.assistant-section .assistant-copy > p { max-width: 61ch; margin: 24px 0 0; color: #bdd2d8; font-size: 17px; line-height: 1.55; opacity: var(--assistant-phase,0); }
.assistant-section .assistant-chat {
  position: absolute;
  z-index: 2;
  right: max(28px,calc((100vw - 1220px)/2));
  top: 50%;
  box-sizing: border-box;
  width: min(520px,43vw);
  height: min(470px,calc(100svh - 144px));
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(111,208,217,.29);
  border-radius: 25px;
  background: linear-gradient(150deg,rgba(15,48,62,.96),rgba(5,25,37,.97) 55%,rgba(7,33,46,.97));
  box-shadow: 0 28px 74px rgba(0,8,18,.42),0 0 38px rgba(42,174,190,.09),inset 0 1px rgba(185,245,247,.12);
  opacity: var(--assistant-phase,0);
  transform: translateY(calc(-50% + (1 - var(--assistant-phase)) * 24px)) scale(calc(.975 + var(--assistant-phase) * .025));
  pointer-events: none;
}
.assistant-chat-head { flex: none; display: flex; align-items: center; gap: 11px; min-height: 67px; box-sizing: border-box; padding: 13px 20px; border-bottom: 1px solid rgba(128,196,205,.16); }
.assistant-chat-head img { display: block; width: 34px; height: 34px; }
.assistant-chat-head strong,.assistant-chat-head small { display: block; }
.assistant-chat-head strong { font-size: 14px; letter-spacing: .02em; }
.assistant-chat-head strong em { color: #6cdae0; font-style: normal; }
.assistant-chat-head small { margin-top: 2px; color: #9fbec7; font-size: 11px; }
.assistant-chat-mark { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: #62c9cd; box-shadow: 0 0 9px rgba(98,201,205,.42); }
.assistant-transcript { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 16px 18px 8px; overflow-y: auto; scrollbar-width: none; list-style: none; }
.assistant-transcript::-webkit-scrollbar { display: none; }
.assistant-message { max-width: 87%; margin: 0; opacity: 0; transform: translateY(9px); transition: opacity 340ms cubic-bezier(.22,1,.36,1),transform 340ms cubic-bezier(.22,1,.36,1); }
.assistant-message[data-visible="true"] { opacity: 1; transform: none; }
.assistant-message span { display: block; padding: 9px 13px; border-radius: 13px; font-size: 13px; line-height: 1.37; }
.assistant-message--user { align-self: flex-end; }
.assistant-message--user span { border: 1px solid rgba(121,216,222,.36); border-bottom-right-radius: 5px; background: rgba(42,114,130,.36); color: #eefafb; }
.assistant-message--ai { align-self: flex-start; }
.assistant-message--ai span { border: 1px solid rgba(123,172,185,.17); border-bottom-left-radius: 5px; background: rgba(9,34,48,.91); color: #dfedef; }
.assistant-typing { position: absolute; z-index: 3; bottom: 53px; display: flex; align-items: center; gap: 4px; width: max-content; height: 26px; margin: 0 18px; padding: 0 11px; border: 1px solid rgba(123,172,185,.17); border-radius: 12px; background: rgba(9,34,48,.96); opacity: 0; }
.assistant-typing[data-visible="true"] { opacity: 1; }
.assistant-typing i { width: 4px; height: 4px; border-radius: 50%; background: #71cbd1; animation: assistant-dot 900ms ease-in-out infinite alternate; }
.assistant-typing i:nth-child(2) { animation-delay: 150ms; }
.assistant-typing i:nth-child(3) { animation-delay: 300ms; }
@keyframes assistant-dot { to { opacity: .3; transform: translateY(-3px); } }
.assistant-composer { flex: none; box-sizing: border-box; min-height: 42px; margin: 0 12px 4px; padding: 5px 5px 5px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid rgba(121,216,222,.22); border-radius: 13px; background: rgba(3,20,31,.8); color: #8eb1bc; font-size: 12px; }
.assistant-composer-send { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: #5bcbd2; color: #062332; }
.assistant-composer-send svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) {
  #contenido > .assistant-section { height: 300svh; min-height: 2020px; }
  .assistant-section .assistant-stage { min-height: 640px; padding: 70px 18px 18px; display: flex; flex-direction: column; justify-content: center; gap: 0; }
  .assistant-section .assistant-copy { flex: none; width: 100%; margin: 0; transform: none; }
  .assistant-eyebrow { margin-bottom: 15px; }
  .assistant-section .assistant-copy h2 { max-width: 18ch; font-size: calc(38px - var(--assistant-phase) * 11px); line-height: 1.12; }
  .assistant-section .assistant-copy > p { margin-top: 15px; font-size: 13px; line-height: 1.42; }
  .assistant-section .assistant-chat { position: relative; top: auto; right: auto; width: 100%; height: min(410px,52svh); min-height: 330px; margin-top: calc(var(--assistant-phase) * 15px); transform: translateY(calc((1 - var(--assistant-phase)) * 16px)); }
  .assistant-chat-head { min-height: 54px; padding: 9px 13px; }
  .assistant-chat-head img { width: 30px; height: 30px; }
  .assistant-transcript { gap: 7px; padding: 10px 11px 4px; }
  .assistant-message span { padding: 7px 10px; font-size: 12px; line-height: 1.34; }
  .assistant-typing { margin-left: 11px; bottom: 52px; }
  .assistant-composer { min-height: 40px; margin: 0 9px 4px; }
}
@media (max-width: 380px) and (max-height: 760px) {
  .assistant-section .assistant-stage { padding-top: 62px; padding-bottom: 10px; }
  .assistant-section .assistant-copy h2 { font-size: calc(36px - var(--assistant-phase) * 11px); }
  .assistant-section .assistant-chat { height: 365px; }
}
@media (prefers-reduced-motion: reduce) {
  #contenido > .assistant-section { height: auto; min-height: 0; padding: 100px 0; }
  .assistant-section .assistant-stage { position: relative; height: auto; min-height: 0; display: flex; align-items: center; flex-direction: row; gap: 40px; padding: 0 24px; }
  .assistant-section .assistant-copy { flex: 1; transform: none; }
  .assistant-copy h2 [data-assistant-word] { opacity: 1 !important; }
  .assistant-section .assistant-copy > p,.assistant-section .assistant-chat { opacity: 1; }
  .assistant-section .assistant-chat { position: relative; top: auto; right: auto; flex: 1; width: min(520px,45vw); height: auto; min-height: 440px; transform: none; }
  .assistant-message { opacity: 1; transform: none; transition: none; }
  .assistant-typing { display: none; }
  .assistant-typing i { animation: none; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  #contenido > .assistant-section { padding: 80px 0; }
  .assistant-section .assistant-stage { flex-direction: column; align-items: stretch; }
  .assistant-section .assistant-copy h2 { font-size: 34px; }
  .assistant-section .assistant-chat { width: 100%; height: auto; min-height: 450px; margin-top: 22px; }
}
/* On touch viewports the sticky reading beat ends before the full-size transcript. */
@media (max-width: 760px) and (prefers-reduced-motion: no-preference) {
  #contenido > .assistant-section { height: auto; min-height: 0; overflow: visible; }
  .assistant-section .assistant-stage { position: relative; height: auto; min-height: 0; display: block; padding: 0 18px 84px; }
  .assistant-reveal-stage { display: block; height: 180svh; }
  .assistant-section .assistant-copy { position: sticky; top: 0; box-sizing: border-box; height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: 76px 0 20px; }
  .assistant-section .assistant-copy h2 { font-size: calc(34px - var(--assistant-phase) * 7px); }
  .assistant-section .assistant-chat { width: 100%; height: auto; min-height: 0; margin: 0; opacity: 1; transform: none; }
  .assistant-transcript { flex: none; overflow: visible; }
  .assistant-typing { min-height: 26px; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .assistant-reveal-stage { display: contents; }
  .assistant-section .assistant-chat { min-height: 0; }
  .assistant-transcript { flex: none; overflow: visible; }
}
