/*
 * The MCP server page (/mcp-server/): Crux's MCP server, connected to Claude,
 * ChatGPT, Cursor or any MCP app. The home page's hero and film frame (crux.css),
 * the tools' story, and the home page's closing band, on EMIAC's site.css tokens.
 * Nothing here has a gradient, a blur or a shadow of its own.
 */

/* ---------- Tools: the story ----------
   The home page's story (site.js [data-story]): steps at the left, a sticky
   stage at the right whose scene follows the step in the middle of the
   screen. Each scene is a conversation in Claude that plays from the
   question each time it comes in (crux-mcp-server.js). */

.apps-story .story-head {
  max-width: 640px;
}

.apps-story .story-stage {
  aspect-ratio: 16 / 12.4;
}

.apps-story .step:first-child {
  aspect-ratio: 16 / 17.98;
}

.apps-step-tool {
  align-self: flex-start;
  margin-bottom: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--wash);
  color: var(--brand-deep);
  font: 500 13px/1.4 var(--mono);
}

.apps-chat .apps-log {
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  align-content: start;
  padding: 22px 24px;
  gap: 8px;
}

.apps-chat .crux-mcp-ask {
  margin-bottom: 4px;
  font-size: 15px;
}

.apps-viz {
  margin-top: 8px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.apps-viz-label {
  margin-bottom: 12px;
  color: var(--muted);
  font: 500 11.5px/1.4 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.apps-viz-foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.apps-up {
  margin-right: 6px;
  color: #15803d;
  font-weight: 500;
}

/* Bars: a name, a bar drawn to --w, a figure. */
.apps-bars {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.apps-bar-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  color: var(--ink-2);
  font-size: 14px;
}

.apps-bar-row > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apps-bar-row > i {
  display: block;
  width: var(--w);
  height: 8px;
  border-radius: 999px;
  background: var(--sheet-2);
  transform-origin: left center;
}

.apps-bar-row.is-you {
  color: var(--brand-deep);
}

.apps-bar-row.is-you > i {
  background: var(--brand);
}

.apps-bar-row b {
  font: 500 13px/1 var(--mono);
  text-align: right;
}

.apps-fav {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--sheet-2);
  color: var(--ink-2);
  font: 500 10px/1 var(--mono);
  font-style: normal;
}

/* Questions: two bars per question, the reader's own in blue. */
.apps-duels {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.apps-duels li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
}

.apps-duels p {
  color: var(--ink);
  font-size: 14px;
}

.apps-duels em {
  font-size: 12.5px;
  font-style: normal;
  font-weight: 500;
}

.apps-duels em.is-lose {
  color: var(--muted);
}

.apps-duels em.is-win {
  color: #15803d;
}

.apps-duel {
  display: grid;
  grid-column: 1 / -1;
  gap: 4px;
}

.apps-duel span {
  display: block;
  width: var(--w);
  min-width: max-content;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--sheet-2);
  color: var(--ink-2);
  font: 500 11px/1.5 var(--mono);
  white-space: nowrap;
  transform-origin: left center;
}

.apps-duel span.is-you {
  background: var(--wash);
  color: var(--brand-deep);
}

/* Where to publish: a site, its kind, and the gap. */
.apps-pubs {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.apps-pubs li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.apps-pubs li:first-child {
  padding-top: 0;
  border-top: 0;
}

.apps-pub-site {
  display: grid;
  color: var(--ink);
  font-size: 14px;
}

.apps-pub-site small {
  color: var(--muted);
  font-size: 12px;
}

.apps-pub-gap {
  display: grid;
  justify-items: end;
  color: var(--muted);
  font-size: 12.5px;
}

.apps-pub-gap b {
  color: var(--brand-deep);
  font-weight: 500;
}

/* One answer, as read in Crux. */
.apps-answer > p:not([class]) {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.7;
}

.apps-answer sup {
  margin-left: 2px;
  color: var(--brand);
  font: 500 10px/1 var(--mono);
}

.apps-answer .crux-hit::after {
  content: none;
}

.apps-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.apps-sources span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 12.5px;
}

.apps-sources i {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--wash);
  color: var(--brand-deep);
  font: 500 10px/1 var(--mono);
  font-style: normal;
}

/* A change made: the question now tracked. */
.apps-done-q {
  color: var(--ink);
  font-size: 18px;
}

.apps-done-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.apps-done-facts li {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sheet);
  color: var(--ink-2);
  font-size: 12.5px;
}

/* The play: the question, then each tool call running and ticking, then the
   result drawing in. Hidden only when the script has said it will run it. */
html.apps-motion .apps-scene .apps-in {
  opacity: 0;
  transform: translateY(6px);
}

html.apps-motion .apps-scene .crux-mcp-done {
  opacity: 0;
}

html.apps-motion .apps-scene .apps-bar-row > i,
html.apps-motion .apps-scene .apps-duel span {
  transform: scaleX(0);
}

html.apps-motion .apps-scene.is-run .apps-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease);
}

html.apps-motion .apps-scene.is-run .apps-in:nth-child(2) {
  transition-delay: 0.45s;
}

html.apps-motion .apps-scene.is-run .apps-in:nth-child(3) {
  transition-delay: 0.85s;
}

html.apps-motion .apps-scene.is-run .apps-in:nth-child(4) {
  transition-delay: 1.25s;
}

html.apps-motion .apps-scene.is-run .crux-mcp-done {
  opacity: 1;
  transition: opacity 0.25s var(--ease) 1.05s;
}

html.apps-motion .apps-scene.is-run .apps-bar-row > i,
html.apps-motion .apps-scene.is-run .apps-duel span {
  transform: none;
  transition: transform 0.7s var(--ease) 1.45s;
}

html.apps-motion .apps-scene.is-run .apps-bar-row:nth-child(2) > i,
html.apps-motion .apps-scene.is-run .apps-duels li:nth-child(2) .apps-duel span {
  transition-delay: 1.55s;
}

html.apps-motion .apps-scene.is-run .apps-bar-row:nth-child(3) > i,
html.apps-motion .apps-scene.is-run .apps-duels li:nth-child(3) .apps-duel span {
  transition-delay: 1.65s;
}

html.apps-motion .apps-scene.is-run .apps-bar-row:nth-child(4) > i {
  transition-delay: 1.75s;
}

/* Inline on narrow screens: each conversation under its step, full height,
   and no wider than the screen however long a tool's name is. */
.apps-story .story-steps,
.apps-story .step {
  min-width: 0;
}

/* The first step's desktop height would otherwise hold here and push its
   text up into the heading. */
.apps-story.is-inline .step:first-child {
  aspect-ratio: auto;
}

.apps-story.is-inline .scene {
  aspect-ratio: auto;
}

.apps-story.is-inline .scene > .panel-ui {
  height: auto;
}

/* ---------- Narrower screens ---------- */

@media (max-width: 720px) {
  .apps-bar-row {
    grid-template-columns: 136px minmax(0, 1fr) 30px;
    font-size: 13px;
  }

  .apps-chat .apps-log {
    padding: 18px 16px;
  }
}
