/* Tool pages (MCP server, sentiment analyzer, entity search). Builds on home.css and its tokens. */

[hidden] {
  display: none !important;
}
.tag.pos {
  color: var(--green-300);
  background: #16a34a26;
}
.tag.neg {
  color: var(--red-300);
  background: #e3000433;
}
.note {
  font-size: 13px;
  color: var(--ink-400);
  margin-top: 16px;
}
/* a real logo covers the monogram; the script removes the image if it fails to load */
.plogo {
  position: relative;
  overflow: hidden;
}
.plogo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* brand icon: a single-colour SVG used as a mask, coloured by the text colour */
.bi {
  display: inline-block;
  flex: none;
  width: 1em;
  height: 1em;
  background: currentColor;
  -webkit-mask: var(--m) center/contain no-repeat;
  mask: var(--m) center/contain no-repeat;
  vertical-align: -0.12em;
}
.src .bi {
  width: 58%;
  height: 58%;
}
.code-box {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--ink-700);
  border-radius: var(--r-md);
  background: var(--ink-950);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* hero: text on the left, a card with the facts on the right */
.hero.tool {
  padding-bottom: 72px;
}
.hero.tool .hero-top {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: center;
}
.hero.tool .lead {
  margin-top: 20px;
  max-width: 58ch;
}
.spec {
  padding: 20px 24px;
  display: grid;
  gap: 14px;
}
.spec dl {
  margin: 0;
  display: grid;
}
.spec dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--ink-800);
  font-size: 14px;
}
.spec dd {
  margin: 0;
  color: var(--white);
  text-align: right;
}
.url-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--blue-300);
  border-radius: var(--r-md);
  background: #011ef41f;
  color: var(--white);
  overflow-wrap: anywhere;
}
.copy {
  flex: none;
  white-space: nowrap;
}
.clients {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.clients .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

/* MCP demo: question, tool call and answer side by side; each line comes in at its delay --t */
.ag {
  overflow: hidden;
  background: var(--ink-950);
}
.ag .ag-body {
  padding: 20px 24px 24px;
}
.ag-session {
  display: none;
  grid-template-columns: minmax(0, 3fr) minmax(0, 5fr) minmax(0, 4fr);
  gap: 20px;
  align-items: start;
}
.ag-session.is-current {
  display: grid;
}
.ag-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.ag-col > .q-lbl {
  color: var(--orange);
}
.ag-line.user {
  background: var(--ink-800);
  color: var(--white);
  font: 600 18px/1.35 var(--sans);
  padding: 16px;
}
.ag-line.out {
  white-space: pre;
  overflow: auto;
}
.ag-line.say {
  background: none;
  padding: 0;
  font: 15px/1.55 var(--sans);
  color: var(--ink-200);
}
.ag-card {
  border: 1px solid var(--ink-700);
  background: var(--ink-900);
  padding: 4px 12px;
}
.ag-card .ag-row {
  grid-template-columns: minmax(0, 1fr) 64px 40px;
  border-bottom: 1px solid var(--ink-800);
}
.ag-card .ag-row:last-child {
  border: 0;
}
.ag-row .src {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 12px;
}
.ag .meter i {
  transform-origin: 0 50%;
  scale: 0 1;
}
.ag.is-playing .ag-line {
  opacity: 1;
  transform: none;
  transition-delay: var(--t);
}
.ag.is-playing .meter i {
  scale: 1 1;
  transition: scale 0.9s var(--ease) var(--t);
}

/* terminal lines: shown at --t, the question typed over --n characters */
.term-out[data-term] {
  min-height: 0;
  overflow-wrap: anywhere;
}
.tl {
  display: block;
  min-height: 1.7em;
}
.tl.m {
  color: var(--ink-400);
}
.tl.r {
  color: var(--ink-300);
}
.tl.j {
  color: var(--orange);
}
.tl.e {
  color: var(--red-300);
}
.tl-in {
  display: inline-block;
  vertical-align: top;
}
.in .tl {
  animation: tl-show 1ms var(--t) both;
}
.in .tl-in {
  animation: tl-type calc(var(--n) * 22ms) steps(var(--n)) var(--t) both;
}
@keyframes tl-show {
  from {
    opacity: 0;
  }
}
@keyframes tl-type {
  from {
    clip-path: inset(0 100% 0 0);
  }
}

/* two ways to connect */
.ways {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.way {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.way ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  color: var(--ink-200);
}
.way ol li::marker {
  color: var(--orange);
  font-family: var(--mono);
}
.way p {
  color: var(--ink-300);
  font-size: 15px;
}
.way code,
.flow code,
.qa code,
.pl-copy code,
.tool-more code {
  color: var(--white);
}
.way-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--ink-800);
  font-size: 14px;
}
.way-foot b {
  color: var(--white);
  font-weight: 500;
}

/* session player: pick a session above, read about it on the left, watch it on the right */
.player {
  overflow: hidden;
}
.player .tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0 12px;
  border-bottom: 1px solid var(--ink-800);
}
.player .tabs button {
  white-space: nowrap;
}
.pl-panel {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  min-height: 400px;
}
.pl-copy {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pl-copy p {
  font-size: 15px;
  color: var(--ink-300);
}
.pl-panel pre {
  border-left: 1px solid var(--ink-800);
  background: var(--ink-950);
  padding: 24px;
}
.res {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--ink-800);
  font-size: 14px;
}
.res-row {
  display: grid;
  grid-template-columns: 24px 84px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
.res-row .src {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 12px;
}
.res b {
  color: var(--white);
  font-weight: 500;
}
.res-row .meter i {
  width: var(--w);
}
.res-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.res-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.res-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
}

/* three numbered boxes in a row */
.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  counter-reset: step;
}
.flow li {
  position: relative;
  counter-increment: step;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  font-size: 15px;
  color: var(--ink-300);
}
.flow li::before {
  content: counter(step, decimal-leading-zero);
  font: 500 12px var(--mono);
  color: var(--orange);
}
.flow li + li::after {
  content: '→';
  position: absolute;
  left: -24px;
  top: 50%;
  width: 24px;
  text-align: center;
  color: var(--ink-400);
}
.flow.plain li::before,
.flow.plain li + li::after {
  content: none;
}
.flow b {
  color: var(--white);
  font-size: 17px;
}
.flow .textlink {
  margin-top: auto;
}
.flow + .code-box,
.ways + .note {
  margin-top: 24px;
}

/* MCP tools: one table, a filter above it, parameters behind each row */
.tool-list {
  overflow: hidden;
}
.tool-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink-800);
  font-size: 14px;
}
.tool {
  border-bottom: 1px solid var(--ink-800);
}
.tool summary {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 250px 56px;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
}
.tool summary::-webkit-details-marker,
.qa summary::-webkit-details-marker {
  display: none;
}
.tool summary code {
  color: var(--white);
}
.tool summary code::before {
  content: '+ ';
  color: var(--orange);
}
.tool[open] summary code::before {
  content: '− ';
}
.tool summary .mono {
  font-size: 12px;
  color: var(--ink-400);
}
.tool summary .tag {
  justify-self: end;
}
.tool[open],
.tool summary:hover {
  background: var(--ink-850);
}
.tool-more {
  padding: 0 20px 20px;
  display: grid;
  gap: 12px;
  font-size: 14px;
  color: var(--ink-300);
}

/* questions: two columns of native disclosure rows */
.qa {
  columns: 2;
  column-gap: 48px;
}
.qa details {
  break-inside: avoid;
  border-top: 1px solid var(--ink-700);
}
.qa summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  cursor: pointer;
  list-style: none;
  color: var(--white);
  font-weight: 600;
  font-size: 17px;
}
.qa summary::after {
  content: '+';
  font: 20px/1 var(--mono);
  color: var(--orange);
}
.qa details[open] summary::after {
  content: '−';
}
.qa p {
  padding-bottom: 20px;
  color: var(--ink-300);
}

/* analyzer: the sentence with its marks, a bar per score, the response next to it */
.an {
  overflow: hidden;
}
.an-pick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--ink-800);
}
.an-pick button {
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--ink-700);
  border-radius: var(--r-md);
  background: var(--ink-850);
  color: var(--ink-200);
  font-size: 14px;
  line-height: 1.4;
  transition:
    border-color var(--dur),
    background var(--dur);
}
.an-pick button[aria-pressed='true'] {
  border-color: var(--blue-300);
  background: #011ef424;
  color: var(--white);
}
.an-pick small {
  display: block;
  margin-top: 6px;
  font: 12px var(--mono);
  color: var(--ink-400);
}
.an-body,
.sr {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
}
.an-read {
  padding: 28px 24px;
  display: grid;
  gap: 24px;
  align-content: start;
}
.an-text {
  font-size: 24px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--white);
}
.an-text mark,
.xt mark,
.sr-card mark {
  background: #f9871540;
  color: var(--orange);
  border-radius: 3px;
  padding: 0 2px;
}
.an-text u {
  text-decoration: underline 3px var(--green-300);
  text-underline-offset: 5px;
}
.an-text u.neg {
  text-decoration-color: var(--red-300);
}
.dv-list {
  display: grid;
  gap: 12px;
}
.dv-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 52px 76px;
  gap: 12px;
  align-items: center;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.dv-row .who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--white);
}
.dv-row .who span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dv-axis .axis {
  padding: 0;
}
.dv-row > :nth-child(3) {
  text-align: right;
  color: var(--white);
}
/* the bar starts at zero in the middle and grows left or right; the lighter band is neutral */
.dv {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--ink-800) 0 32.5%,
    var(--ink-600) 32.5% 67.5%,
    var(--ink-800) 67.5%
  );
}
.dv i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--l, 50%);
  width: var(--w, 0%);
  border-radius: 999px;
  background: var(--c, var(--ink-300));
  transition:
    left 0.6s var(--ease),
    width 0.6s var(--ease);
}
.dv::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -4px;
  bottom: -4px;
  width: 1px;
  background: var(--white);
}
.an-facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--ink-800);
}
.an-facts dd {
  margin: 4px 0 0;
  color: var(--white);
  font-size: 15px;
  overflow-wrap: anywhere;
}
.code-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-left: 1px solid var(--ink-800);
  background: var(--ink-950);
}
.code-pane pre {
  flex: 1;
  max-height: 560px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* entity search: the query on top, a card per result, the response next to them */
.q-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  margin-top: 40px;
  padding: 0 20px;
  border: 1px solid var(--ink-600);
  border-radius: var(--r-lg);
  background: var(--ink-950);
  font: 24px var(--mono);
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
}
.q-field .q-lbl {
  font-size: 16px;
  color: var(--orange);
}
.q-field .caret {
  width: 2px;
  margin-left: -8px;
}
.q-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.q-picks button {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--ink-700);
  border-radius: 999px;
  background: var(--ink-900);
  font: 14px var(--mono);
  color: var(--white);
}
.q-picks button span {
  font: 13px var(--sans);
  color: var(--ink-400);
}
.q-picks button[aria-pressed='true'] {
  border-color: var(--blue-300);
  background: #011ef424;
}
.sr {
  gap: 16px;
  align-items: start;
  margin-top: 24px;
}
.sr-cards {
  display: grid;
  gap: 12px;
}
.sr-card {
  padding: 20px;
  display: grid;
  gap: 14px;
  animation: rise 0.4s var(--ease) calc(var(--i) * 80ms) both;
}
@keyframes rise {
  from {
    opacity: 0;
    translate: 0 8px;
  }
}
.sr-top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.sr-top b {
  display: block;
  color: var(--white);
  font-size: 18px;
}
.sr-top small {
  font: 13px var(--mono);
  color: var(--ink-400);
}
.sr-top .tag {
  margin-left: auto;
}
.sr-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--ink-800);
}
.sr-stats dd {
  margin: 2px 0 0;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.sr .code-pane {
  border: 1px solid var(--ink-800);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.sr-skel {
  height: 150px;
  opacity: 0.5;
}
.xt {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 40px;
  align-items: start;
}
.xt-text {
  padding: 16px 20px;
  font-size: 16px;
  color: var(--white);
  border-bottom: 1px solid var(--ink-800);
}
.xt-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--ink-800);
  font-size: 14px;
}
.xt-row b {
  display: block;
  color: var(--white);
}
.xt-row small {
  color: var(--ink-400);
}

/* closing: one row, the shared footer follows */
.closing.short {
  padding-bottom: 104px;
}

@media (max-width: 900px) {
  .hero.tool .hero-top,
  .ag-session,
  .ways,
  .pl-panel,
  .flow,
  .an-body,
  .sr,
  .xt {
    grid-template-columns: 1fr;
  }
  .qa {
    columns: 1;
  }
  .flow li + li::after {
    content: none;
  }
  .pl-panel pre,
  .code-pane {
    border-left: 0;
    border-top: 1px solid var(--ink-800);
  }
  .an-pick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tool summary {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .tool summary .tag {
    justify-self: start;
  }
  .ag .ag-body {
    padding: 16px;
  }
}
@media (max-width: 560px) {
  .an-pick {
    grid-template-columns: 1fr;
  }
  .dv-row {
    grid-template-columns: minmax(0, 1fr) 52px 76px;
  }
  .dv-row .dv,
  .dv-axis .axis {
    grid-column: 1 / -1;
    order: 2;
  }
  .an-text {
    font-size: 20px;
  }
  .q-field {
    font-size: 18px;
    min-height: 56px;
  }
  .sr-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .xt-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }
  .xt-row > :nth-child(4) {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ag .meter i {
    scale: 1 1;
  }
}

/* sentiment analyzer: the live form above the examples */
.an-form {
  display: grid;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid var(--ink-800);
}
.an-form textarea,
.an-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--ink-600);
  border-radius: var(--r-md);
  background: var(--ink-950);
  color: var(--white);
  font: 16px/1.5 var(--sans);
}
.an-form textarea {
  resize: vertical;
}
.an-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
}
.an-form-row > div:first-child {
  flex: 1 1 200px;
  display: grid;
  gap: 6px;
}
.an-form .btn {
  border: 0;
  cursor: pointer;
}
.an-form .btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
