/* MCP — bespoke visuals for the single-page surface doc.
   The page's whole idea is an INVERSION: the model lives on the client, we are
   only a thin door that hands over one tool. So the hero is a left-to-right
   FLOW — Claude Code → the MCP port → the knowledge base — with a forward rail
   (search_knowledge) and a return rail (findings). Everything else (install,
   auth, governance) sits in three compact numbered cards below.
   Loaded by modules/mcp/index.html on top of module.css.
   Placement convention: a module's bespoke visuals live beside its index. §Styling */

/* ══════════════════════════════════════════
   HERO — display headline · lede
   Centered, on a warm radial wash so the page opens as a statement.
   ══════════════════════════════════════════ */
.mcp-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  padding: 1.6rem 0 2rem;
  background:
    radial-gradient(58% 70% at 50% 0%, var(--tint-15), transparent 68%),
    radial-gradient(36% 50% at 84% 14%, var(--tint-8), transparent 70%);
}

.mcp-title {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: clamp(1.9rem, 4.6vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--text);
  max-width: 18ch;
  margin: 0.1rem 0 0;
  text-wrap: balance;
}

.mcp-lede {
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 50ch;
  margin: 0;
}

/* ══════════════════════════════════════════
   FLOW — three stations joined by labelled rails
   Stations are flex cards; the port in the middle is the accent heart.
   Rails carry an animated dashed wire (forward = accent, back = muted).
   ══════════════════════════════════════════ */
.mcp-flow {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  margin: 0.6rem 0 1.4rem;
}

/* ── Station card ── */
.mcp-station {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding: 1.1rem 0.9rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.mcp-station--client {
  border-style: dashed;
  border-color: var(--accent-muted);
}
.mcp-station--port {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 24px -10px var(--accent);
}
.mcp-station--data {
  background: var(--tint-6);
  border-color: var(--tint-25);
}

.mcp-station__tag {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--pill-radius);
  padding: 0.08rem 0.45rem;
}
.mcp-station__tag--on {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.mcp-station__glyph {
  font-size: 1.7rem;
  line-height: 1;
  margin-top: 0.1rem;
}
.mcp-station--client .mcp-station__glyph {
  font-family: var(--mono);
  color: var(--accent);
  animation: mcp-caret 1.1s step-end infinite;
}
.mcp-station__glyph--graph {
  width: 40px;
  height: 40px;
}
.mcp-station__glyph--graph svg {
  width: 100%;
  height: 100%;
}
.mcp-station__glyph--graph line {
  stroke: var(--accent);
  stroke-width: 1.4;
  opacity: 0.4;
}
.mcp-station__glyph--graph circle {
  fill: var(--paper);
  stroke: var(--accent);
  stroke-width: 1.8;
}
.mcp-graph__hub {
  fill: var(--accent) !important;
}

.mcp-station__name {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--text);
}
.mcp-station--port .mcp-station__name {
  color: #fff;
}

.mcp-station__desc {
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.mcp-station--port .mcp-station__desc {
  color: rgba(255, 255, 255, 0.82);
}
.mcp-station__desc code {
  font-size: 0.72rem;
}
.mcp-station--port .mcp-station__desc code {
  color: #fff;
}

/* ── Rail — forward + return wires between stations ── */
.mcp-link {
  flex: 0 1 8.5rem;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0 0.1rem;
}
.mcp-link__rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.mcp-link__lbl {
  font-size: 0.66rem;
  line-height: 1.25;
  text-align: center;
  color: var(--text-dim);
}
.mcp-link__lbl code {
  font-size: 0.64rem;
  color: var(--accent);
}

/* the wire itself — a dashed, marching line with an arrowhead */
.mcp-link__wire {
  position: relative;
  width: 100%;
  height: 2px;
  background-image: linear-gradient(
    to right,
    var(--accent) 0 6px,
    transparent 6px 12px
  );
  background-size: 12px 2px;
  background-repeat: repeat-x;
  animation: mcp-march 0.9s linear infinite;
}
.mcp-link__wire::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -1px;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--accent);
}
/* return rail — muted, flows the other way */
.mcp-link__rail--back .mcp-link__wire {
  background-image: linear-gradient(
    to right,
    var(--accent-muted) 0 6px,
    transparent 6px 12px
  );
  animation-direction: reverse;
}
.mcp-link__rail--back .mcp-link__wire::after {
  right: auto;
  left: -1px;
  border-left: none;
  border-right: 6px solid var(--accent-muted);
}

/* ══════════════════════════════════════════
   THESIS — the concept's heart, one accented line
   ══════════════════════════════════════════ */
.mcp-thesis {
  margin: 0 0 1.8rem;
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-dim);
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
}
.mcp-thesis strong {
  color: var(--text);
}
.mcp-thesis .xref-module {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
}

/* ══════════════════════════════════════════
   CARDS — install · auth · governance (numbered)
   ══════════════════════════════════════════ */
.mcp-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}
.mcp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1.2rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.mcp-card__num {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.mcp-card__title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.15;
  color: var(--text);
  margin: 0;
}
.mcp-card__sub {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-dim);
  margin: 0;
}
.mcp-card__foot {
  margin: auto 0 0;
  padding-top: 0.3rem;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ── Install command — terminal-flavored ── */
.mcp-cmd {
  margin: 0.15rem 0;
  padding: 0.7rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.71rem;
  line-height: 1.65;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.mcp-cmd__cmd {
  color: var(--accent);
  font-weight: 600;
}
.mcp-cmd__url {
  color: var(--text);
}
.mcp-cmd__str {
  color: var(--s2);
}

/* ── Auth steps — sequenced now / later ── */
.mcp-steps {
  list-style: none;
  margin: 0.1rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.mcp-steps__item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 0.3rem 0.5rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--border);
}
.mcp-steps__item--now {
  border-left-color: var(--accent);
}
.mcp-steps__item > .iter {
  grid-column: 1;
  align-self: center;
}
.mcp-steps__link {
  grid-column: 2;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--tint-25);
}
.mcp-steps__link:hover {
  border-bottom-color: var(--accent);
}
.mcp-steps__link code {
  font-size: 0.8rem;
}
.mcp-steps__note {
  grid-column: 2;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--text-muted);
}

/* ── Governance — two controls ── */
.mcp-gov {
  list-style: none;
  margin: 0.1rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.mcp-gov__item {
  display: flex;
  gap: 0.6rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-dim);
}
.mcp-gov__item strong {
  color: var(--text);
}
.mcp-gov__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  background: var(--tint-8);
  border: 1px solid var(--tint-25);
  color: var(--accent);
}
.mcp-gov__icon svg {
  width: 0.95rem;
  height: 0.95rem;
}

/* ══════════════════════════════════════════
   Responsive — flow stacks to a column on narrow widths
   ══════════════════════════════════════════ */
@media (max-width: 680px) {
  .mcp-flow {
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
  }
  .mcp-link {
    flex-basis: auto;
    flex-direction: row;
    justify-content: center;
    gap: 1.4rem;
    padding: 0.35rem 0;
  }
  .mcp-link__rail {
    flex-direction: row;
    gap: 0.4rem;
  }
  .mcp-link__wire {
    width: 2px;
    height: 24px;
    background-image: linear-gradient(
      to bottom,
      var(--accent) 0 6px,
      transparent 6px 12px
    );
    background-size: 2px 12px;
    background-repeat: repeat-y;
  }
  .mcp-link__wire::after {
    top: auto;
    bottom: -1px;
    right: 50%;
    transform: translateX(50%);
    border: none;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid var(--accent);
  }
  .mcp-link__rail--back .mcp-link__wire {
    background-image: linear-gradient(
      to bottom,
      var(--accent-muted) 0 6px,
      transparent 6px 12px
    );
  }
  .mcp-link__rail--back .mcp-link__wire::after {
    top: -1px;
    bottom: auto;
    border-top: none;
    border-bottom: 6px solid var(--accent-muted);
  }
}

/* ══════════════════════════════════════════
   Entrance — staggered rise on load
   ══════════════════════════════════════════ */
.mcp-hero > *,
.mcp-flow,
.mcp-thesis,
.mcp-card {
  animation: mcp-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.mcp-title {
  animation-delay: 0.12s;
}
.mcp-lede {
  animation-delay: 0.22s;
}
.mcp-flow {
  animation-delay: 0.38s;
}
.mcp-thesis {
  animation-delay: 0.5s;
}
.mcp-cards .mcp-card:nth-child(1) {
  animation-delay: 0.58s;
}
.mcp-cards .mcp-card:nth-child(2) {
  animation-delay: 0.66s;
}
.mcp-cards .mcp-card:nth-child(3) {
  animation-delay: 0.74s;
}

@keyframes mcp-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes mcp-march {
  to {
    background-position: 12px 0;
  }
}
@keyframes mcp-caret {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mcp-hero > *,
  .mcp-flow,
  .mcp-thesis,
  .mcp-card,
  .mcp-link__wire,
  .mcp-station--client .mcp-station__glyph {
    animation: none;
  }
}

/* ── Deep-link landing flash — cross-module links land on the thesis / a card ── */
.mcp-thesis:target,
.mcp-card:target {
  animation: target-highlight 2.6s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .mcp-thesis:target,
  .mcp-card:target {
    animation: none;
    box-shadow: 0 0 0 2px var(--accent-muted);
  }
}
