/* ============================================================================
   The hero: a small two-pane workspace. In the file pane part of a file gets
   selected; the selection lands as a reference chip in the chat's composer,
   the message types and sends, the agent answers, and the file changes.
   Hand-built scenes with sample content, in the app's own pane, tab, chip,
   selection, transcript and composer language (web-ui/src/app.css,
   chat/Composer.svelte).
   ============================================================================ */

.hero {
  padding-top: clamp(36px, 5vw, 68px);
}
/* One row: the headline on the left, what to do on the right, both on the
   demo's edges. Narrow screens stack it: headline, demo, then the buttons. */
.hero__head {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px 40px;
}
.hero h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(31px, 4vw, 46px);
  line-height: 1.09;
  letter-spacing: -0.032em;
  text-wrap: balance;
}
.hero__actions {
  padding-bottom: 4px;
}
.hero__cta {
  justify-content: flex-end;
  align-items: center;
  margin-top: 0;
}
.hero__note {
  text-align: right;
}
@media (max-width: 940px) {
  .hero .wrap {
    display: flex;
    flex-direction: column;
  }
  .hero__head {
    display: contents;
  }
  .hero__actions {
    order: 3;
    margin-top: 26px;
    padding: 0;
  }
  .hero__cta {
    justify-content: flex-start;
  }
  .hero__note {
    text-align: left;
  }
}
.hero__cta .btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: 10px;
  font-size: 15.5px;
  gap: 10px;
}
.hero__cta .btn svg {
  width: 18px;
  height: 18px;
}
.hero__note {
  margin-top: 14px;
  font-size: 13px;
  color: var(--faint);
}
.hero__note a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--edge);
}
.hero__note a:hover {
  color: var(--fg);
}

/* --- Stage: the window ------------------------------------------------------- */
.ask-stage {
  margin: clamp(28px, 3.6vw, 40px) 0 0;
  text-align: left;
}
.ask-win {
  display: grid;
  grid-template-columns: 198px minmax(0, 0.62fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: clamp(390px, 40vw, 440px);
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* --- Rail: the workspace, its agents, its folders ---------------------------- */
.ask-rail {
  position: relative;
  min-width: 0;
  background: var(--rail-bg);
  border-right: 1px solid var(--edge);
  padding: 0 8px;
  font-size: 13px;
  overflow: hidden;
}
.ask-rail__ws {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 8px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}
.ask-rail__ws span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.ask-rail__ws svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ask-rail__label {
  padding: 14px 8px 6px;
  font-size: 11.5px;
  color: var(--faint);
}
.ask-rail__row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  white-space: nowrap;
}
.ask-rail__row[hidden] {
  display: none;
}
.ask-rail__row.is-active {
  background: var(--row-hover);
  color: var(--fg);
}
.ask-rail__row svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ask-rail__row.is-active .glyph {
  color: var(--accent);
}
.ask-rail__row--more {
  color: var(--faint);
}
.ask-rail__row--file {
  height: 26px;
  font: 12px/1 var(--mono);
}
/* A working agent's mark turns to the accent and breathes, as in the app. */
.ask-rail__row.is-busy {
  color: var(--fg);
}
.ask-rail__row.is-busy .glyph {
  color: var(--accent);
  animation: ask-pulse 1.6s ease-in-out infinite;
}
@keyframes ask-pulse {
  50% { opacity: 0.4; }
}
/* Where this workspace lives. */
.ask-rail__host {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.ask-rail__host i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.ask-rail__host small {
  font: 11px/1 var(--mono);
  color: var(--faint);
}

/* --- Chat -------------------------------------------------------------------- */
.ask-chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--edge);
}
.ask-chat__bar,
.ask-pane__bar {
  display: flex;
  align-items: stretch;
  flex: none;
  height: 40px;
  background: var(--rail-bg);
  border-bottom: 1px solid var(--edge);
}
.ask-chat__bar {
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}
.glyph {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ask-chat__bar .glyph {
  color: var(--accent);
}
.ask-chat__log {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 16px 14px;
  /* Older turns fade out under the bar instead of being cut. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
}
.ask-msg {
  flex: none;
}
.ask-msg {
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  animation: ask-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.ask-msg--you {
  align-self: flex-end;
  max-width: 94%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--row-hover);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 7px;
}
.ask-msg--work {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.ask-msg--work svg {
  width: 13px;
  height: 13px;
  flex: none;
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 55%, var(--muted));
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ask-msg--work.is-running svg {
  animation: ask-spin 0.9s linear infinite;
  stroke: var(--accent);
}

/* --- Composer ---------------------------------------------------------------- */
.ask-composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 0 12px 12px;
  min-height: 48px;
  padding: 9px 9px 9px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--edge));
  border-radius: 12px;
  background: var(--overlay-bg);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 18px rgba(0, 0, 0, 0.06);
}
.ask-composer__field {
  flex: 1;
  min-width: 0;
  min-height: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 7px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--fg);
}
.ask-composer__chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ask-composer__chips:empty {
  display: none;
}
.ask-chip {
  display: inline-block;
  font: 500 11.5px/1 var(--mono);
  color: color-mix(in srgb, var(--accent) 75%, var(--fg));
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--edge));
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 5px 7px;
  white-space: nowrap;
  vertical-align: 1px;
}
/* Only the reference chips drop in. A name inside the typed text is redrawn
   with every letter, so it must not animate. */
.ask-composer__chips .ask-chip {
  animation: ask-pop 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.ask-chip--agent {
  color: var(--fg);
  border-color: var(--edge);
  background: color-mix(in srgb, var(--fg) 7%, transparent);
}
.ask-composer__caret {
  flex: none;
  width: 2px;
  height: 1.2em;
  margin-left: -5px;
  background: var(--accent);
  animation: ask-blink 1.05s steps(1) infinite;
}
.ask-composer[data-typing="true"] .ask-composer__caret {
  animation: none;
}
.ask-composer__send {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--bg);
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.ask-composer[data-empty="true"] .ask-composer__send {
  opacity: 0.4;
}
.ask-composer.is-sending .ask-composer__send {
  transform: scale(0.86);
}
.ask-composer__send svg {
  width: 15px;
  height: 15px;
}

.ask-stage figcaption {
  margin: 22px auto 0;
  text-align: center;
  max-width: 760px;
  font-size: 16.5px;
  letter-spacing: -0.005em;
  line-height: 1.45;
  color: var(--fg);
  text-wrap: balance;
  transition: opacity 0.3s ease;
}
.ask-stage figcaption.is-out {
  opacity: 0;
}

@keyframes ask-blink {
  50% { opacity: 0; }
}
@keyframes ask-pop {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
}
@keyframes ask-in {
  from { opacity: 0; transform: translateY(8px); }
}
@keyframes ask-spin {
  to { transform: rotate(360deg); }
}

/* --- File pane --------------------------------------------------------------- */
.ask-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--overlay-bg);
}
.ask-pane__bar {
  padding: 0 6px;
}
.ask-pane__tabs {
  position: relative;
  display: flex;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ask-pane__tabs::-webkit-scrollbar {
  display: none;
}
.ask-pane__tabs button {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font: 500 12px/1 var(--mono);
  color: var(--muted);
  padding: 0 12px;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent;
  transition: color 0.15s ease, box-shadow 0.15s ease;
}
.ask-pane__tabs button:hover {
  color: var(--fg);
}
.ask-pane__tabs button[aria-pressed="true"] {
  color: var(--fg);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.ask-pane__tabs button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -4px;
  border-radius: 6px;
}
.ask-pane__body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  /* The slide and the figure size themselves to whichever of the pane's
     width or height runs out first. */
  container-type: size;
}
.ask-scene {
  position: absolute;
  inset: 0;
  --px: 28px;
  --py: 26px;
  padding: var(--py) var(--px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.ask-scene[hidden] {
  display: none;
}
.ask-scene.is-shown {
  opacity: 1;
}
.ask-sel {
  transition:
    opacity 0.32s ease,
    transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1),
    background-color 0.32s ease,
    box-shadow 0.32s ease;
}
/* Before and after: what the agent's answer changes in the file. */
.ask-b4,
.ask-af {
  transition: opacity 0.5s ease;
}
svg .ask-af {
  opacity: 0;
}
.is-done svg .ask-af {
  opacity: 1;
}
.is-done svg .ask-b4 {
  opacity: 0;
}
span.ask-af {
  display: none;
}
.is-done span.ask-af {
  display: inline;
  animation: ask-fade 0.5s ease both;
}
.is-done span.ask-b4 {
  display: none;
}
@keyframes ask-fade {
  from { opacity: 0; }
}

/* --- Slide --------------------------------------------------------------------- */
.ask-slide {
  flex: none;
  width: min(100cqw - 2 * var(--px), (100cqh - 2 * var(--py)) * 16 / 9);
  aspect-ratio: 16 / 9;
  background: #fdfdfb;
  color: #232327;
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 12px 34px rgba(0, 0, 0, 0.2);
  padding: 4.6% 5.5% 3%;
  display: flex;
  flex-direction: column;
  container-type: inline-size;
}
.ask-slide__title {
  font-size: 5.1cqw;
  font-weight: 650;
  letter-spacing: -0.022em;
  line-height: 1.15;
}
.ask-slide__cols {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 6%;
  align-items: center;
  margin-top: 3.5%;
}
.ask-slide__chart {
  position: relative;
  height: 100%;
  min-height: 0;
}
.ask-slide__chart svg {
  width: 100%;
  height: 100%;
  display: block;
}
.ask-slide__points {
  list-style: none;
  font-size: 3cqw;
  line-height: 1.35;
  color: #3b3b40;
  display: grid;
  gap: 1em;
}
.ask-slide__points li {
  padding-left: 1.1em;
  position: relative;
}
.ask-slide__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.48em;
  width: 0.42em;
  height: 0.42em;
  border-radius: 50%;
  background: #2e9e6b;
}
.ask-slide__foot {
  display: flex;
  justify-content: space-between;
  font-size: 2cqw;
  color: #8a8a93;
  margin-top: 2%;
}
.ask-sel--shape {
  position: absolute;
  inset: -3% -2.5%;
  border: 1.5px solid #2e9e6b;
  border-radius: 2px;
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
}
.ask-sel--shape i {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #fdfdfb;
  border: 1.5px solid #2e9e6b;
  border-radius: 1px;
}
.ask-sel--shape i:nth-child(1) { left: -4px; top: -4px; }
.ask-sel--shape i:nth-child(2) { right: -4px; top: -4px; }
.ask-sel--shape i:nth-child(3) { left: -4px; bottom: -4px; }
.ask-sel--shape i:nth-child(4) { right: -4px; bottom: -4px; }
.is-on .ask-sel--shape {
  opacity: 1;
  transform: none;
}

/* --- Figure -------------------------------------------------------------------- */
.ask-figure {
  position: relative;
  flex: none;
  width: min(100cqw - 2 * var(--px), (100cqh - 2 * var(--py)) * 520 / 220);
  aspect-ratio: 520 / 220;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}
.ask-figure svg {
  width: 100%;
  height: 100%;
  display: block;
}
.ask-sel--area {
  position: absolute;
  border: 1.5px dashed #2e9e6b;
  background: rgba(46, 158, 107, 0.1);
  border-radius: 2px;
  opacity: 0;
  transform: scale(0.15);
  transform-origin: 0 0;
  pointer-events: none;
}
.is-on .ask-sel--area {
  opacity: 1;
  transform: none;
}

/* --- Table --------------------------------------------------------------------- */
.ask-scene[data-scene="table"],
.ask-scene[data-scene="notes"] {
  align-items: flex-start;
  padding: 14px 0 0;
}
.ask-table {
  border-collapse: collapse;
  font: 12.5px/1 var(--mono);
  color: var(--fg);
  width: 100%;
}
.ask-table th,
.ask-table td {
  text-align: right;
  padding: 11px 11px;
  border-bottom: 1px solid var(--edge);
  white-space: nowrap;
  transition: background-color 0.32s ease, box-shadow 0.32s ease, color 0.32s ease;
}
.ask-table th {
  font-weight: 500;
  color: var(--muted);
}
.ask-table th:nth-child(2),
.ask-table td:nth-child(2),
.ask-table th:nth-child(3),
.ask-table td:nth-child(3) {
  text-align: left;
}
.ask-table td:first-child,
.ask-table th:first-child {
  color: var(--faint);
  width: 1%;
  padding-inline: 14px 4px;
}
.is-on .ask-table .ask-sel--row td {
  background: var(--accent-soft);
}
.is-on .ask-table .ask-sel--row td:first-child {
  color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}
.is-done .ask-table .ask-hit {
  color: var(--accent);
  font-weight: 600;
}

/* --- PDF page ------------------------------------------------------------------ */
.ask-scene[data-scene="pdf"] {
  align-items: flex-start;
  padding-bottom: 0;
}
.ask-page {
  width: min(100%, 520px);
  min-height: 130%;
  background: #fff;
  color: #2a2a2e;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
  padding: 32px 40px;
  font: 13.5px/1.62 Georgia, "Times New Roman", serif;
}
.ask-page__h {
  font: 600 16px/1.3 Georgia, "Times New Roman", serif;
  margin-bottom: 12px;
}
.ask-page p + p {
  margin-top: 11px;
}
.ask-sel--text {
  border-radius: 2px;
  box-shadow: 0 0 0 3px transparent;
}
.is-on .ask-sel--text {
  background: rgba(46, 158, 107, 0.24);
  box-shadow: 0 0 0 3px rgba(46, 158, 107, 0.24);
}

/* --- Genome tracks ------------------------------------------------------------- */
.ask-scene[data-scene="genome"] {
  padding: 18px 0 14px;
}
.ask-genome {
  position: relative;
  width: 100%;
  height: 100%;
}
.ask-genome__tracks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.ask-genome__axis {
  stroke: var(--edge);
  fill: none;
  vector-effect: non-scaling-stroke;
}
.ask-genome__cov {
  fill: color-mix(in srgb, #3a7fc4 60%, transparent);
}
.ask-genome__var {
  stroke: #e0a13a;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}
.ask-genome__var--hit {
  stroke: var(--accent);
  stroke-width: 3.5;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.ask-genome__gene-line {
  stroke: var(--faint);
  vector-effect: non-scaling-stroke;
}
.ask-genome__gene {
  fill: var(--muted);
  transition: fill 0.4s ease;
}
.ask-genome__label {
  position: absolute;
  font: 500 11px/1 var(--mono);
  color: var(--faint);
  white-space: nowrap;
  transition: color 0.4s ease;
}
.is-done .ask-genome__var--hit {
  opacity: 1;
}
.is-done .ask-genome__gene--hit {
  fill: var(--accent);
}
.is-done .ask-genome__label--hit {
  color: var(--accent);
}
.ask-sel--band {
  position: absolute;
  top: 9%;
  bottom: 0;
  background: var(--accent-soft);
  border-inline: 1.5px solid var(--accent);
  opacity: 0;
  transform: scaleX(0.1);
  pointer-events: none;
}
.is-on .ask-sel--band {
  opacity: 1;
  transform: none;
}

/* --- Notes --------------------------------------------------------------------- */
.ask-notes {
  font: 12.5px/1.4 var(--mono);
  color: var(--fg);
  width: 100%;
}
.ask-notes > div {
  display: flex;
  gap: 16px;
  padding: 8px 16px 8px 0;
  transition: background-color 0.32s ease, box-shadow 0.32s ease;
}
.ask-notes b {
  flex: none;
  width: 34px;
  text-align: right;
  font-weight: 400;
  color: var(--faint);
}
.ask-notes__h {
  color: var(--muted);
}
.is-on .ask-notes .ask-sel--row {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.is-done .ask-notes .ask-af {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

/* Narrower: the rail lies down as a strip (the workspace, then its agents)
   above the chat and the file. */
@media (max-width: 980px) {
  .ask-win {
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: clamp(440px, 60vw, 500px);
  }
  .ask-rail {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 42px;
    padding: 0 8px;
    border-right: 0;
    border-bottom: 1px solid var(--edge);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .ask-rail::-webkit-scrollbar {
    display: none;
  }
  .ask-rail__label,
  .ask-rail__row--file {
    display: none;
  }
  .ask-rail__ws {
    height: auto;
    flex: none;
    margin-right: 8px;
  }
  .ask-rail__row {
    flex: none;
    height: 28px;
  }
  .ask-rail__host {
    position: static;
    flex: none;
    height: auto;
    margin-left: auto;
    padding: 0 8px;
  }
}
/* Narrow: the file on top, the conversation under it. */
@media (max-width: 700px) {
  .ask-win {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 300px auto;
    height: auto;
  }
  .ask-pane {
    grid-row: 2;
    border-bottom: 1px solid var(--edge);
  }
  .ask-chat {
    grid-row: 3;
    border-right: 0;
  }
  .ask-chat__bar {
    display: none;
  }
  .ask-chat__log {
    height: 178px;
    flex: none;
  }
  .ask-scene {
    --px: 14px;
    --py: 16px;
  }
  .ask-scene[data-scene="table"],
  .ask-scene[data-scene="notes"] {
    padding: 2px 0 0;
  }
  .ask-table {
    font-size: 11.5px;
  }
  .ask-table th,
  .ask-table td {
    padding: 8px 8px;
  }
  .ask-table th:nth-child(4),
  .ask-table td:nth-child(4),
  .ask-table th:nth-child(7),
  .ask-table td:nth-child(7) {
    display: none;
  }
  .ask-page {
    padding: 20px 22px;
    font-size: 12px;
  }
  .ask-notes {
    font-size: 11px;
  }
  .ask-notes > div {
    gap: 10px;
    padding-block: 7px;
  }
  .ask-stage figcaption {
    font-size: 16px;
    min-height: 2.8em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ask-composer__caret,
  .ask-chip,
  .ask-rail__row.is-busy .glyph,
  .ask-msg,
  .ask-msg--work.is-running svg,
  .is-done span.ask-af {
    animation: none;
  }
  .ask-stage figcaption,
  .ask-chat__log,
  .ask-scene,
  .ask-sel,
  .ask-b4,
  .ask-af,
  .ask-table td,
  .ask-notes > div {
    transition: none;
  }
}

/* Below this width a caption can wrap, so two lines are reserved and a longer
   one never moves the page under it. */
@media (max-width: 900px) {
  .ask-stage figcaption { min-height: 2.9em; }
}
@media (max-width: 480px) {
  .ask-stage figcaption { min-height: 4.35em; }
}
