/* MCP flow — You ↔ uistash ↔ Agent diagram + capability grid */

.mcp-section {
  --accent: var(--page-insights);
  --icon: 72px;
  --logo-px: 36px;
  --ease-in-out-strong: cubic-bezier(0.77, 0, 0.175, 1);
}

.mcp-section .section-lead {
  max-width: 52ch;
  text-wrap: pretty;
}

.mcp-flow-wrap {
  border: 1px solid var(--hairline);
  background: var(--bg);
  overflow: hidden;
}

.mcp-flow-diagram {
  position: relative;
  background: var(--void);
  border-bottom: 1px solid var(--hairline);
  overflow: hidden;
}

.mcp-flow-grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(var(--hairline) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  mask-image: radial-gradient(ellipse 75% 70% at 50% 44%, #000 0%, transparent 100%);
}

.mcp-flow-dither {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.7;
  mask-image: radial-gradient(ellipse 80% 75% at 50% 42%, #000 15%, transparent 72%);
}

.mcp-flow-dither .d-cell { fill: var(--faint); opacity: 0.14; }
.mcp-flow-dither .d-cell--warm { fill: var(--accent); opacity: 0.28; }

.mcp-flow-body {
  position: relative;
  z-index: 1;
  padding: 44px 20px 28px;
}

.mcp-flow-assembly {
  max-width: 560px;
  margin: 0 auto;
}

.mcp-flow-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

@media (max-width: 719px) {
  .mcp-flow-body { padding: 32px 16px 24px; }
  .mcp-flow-track {
    flex-direction: column;
    align-items: center;
  }
}

.mcp-flow-slot {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: var(--icon);
}

.mcp-flow-slot--hub { width: var(--icon); }

@media (max-width: 719px) {
  .mcp-flow-slot,
  .mcp-flow-slot--hub { width: var(--icon); }
}

.mcp-flow-icon {
  width: var(--icon);
  height: var(--icon);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--hairline);
  flex: none;
  overflow: hidden;
}

.mcp-flow-icon--hub {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--hairline));
  background: var(--bg);
}

.mcp-flow-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  line-height: 1;
  min-height: 9px;
  text-align: center;
  white-space: nowrap;
}

.mcp-flow-tag--hub { color: var(--accent); }

.mcp-flow-user-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--dim);
  stroke-width: 1.5;
  stroke-linecap: square;
}

.mcp-flow-app-icon {
  display: block;
  width: calc(var(--icon) - 16px);
  height: calc(var(--icon) - 16px);
  object-fit: contain;
}

.mcp-flow-agent {
  position: relative;
  width: 100%;
  height: 100%;
}

.mcp-flow-agent-logo {
  position: absolute;
  inset: 0;
  margin: auto;
  width: var(--logo-px);
  height: var(--logo-px);
  object-fit: contain;
  opacity: 0;
  transform: scale(0.97);
  filter: blur(2px);
  animation: mcp-agent-cycle 17.5s var(--ease-in-out-strong) infinite;
}

.mcp-flow-agent-logo:nth-child(1) { animation-delay: 0s; }
.mcp-flow-agent-logo:nth-child(2) { animation-delay: 2.5s; }
.mcp-flow-agent-logo:nth-child(3) { animation-delay: 5s; }
.mcp-flow-agent-logo:nth-child(4) { animation-delay: 7.5s; }
.mcp-flow-agent-logo:nth-child(5) { animation-delay: 10s; }
.mcp-flow-agent-logo:nth-child(6) { animation-delay: 12.5s; }
.mcp-flow-agent-logo:nth-child(7) { animation-delay: 15s; }

@keyframes mcp-agent-cycle {
  0%, 2% { opacity: 0; transform: scale(0.97); filter: blur(2px); }
  6%, 14% { opacity: 1; transform: scale(1); filter: blur(0); }
  18%, 100% { opacity: 0; transform: scale(0.97); filter: blur(2px); }
}

@media (prefers-reduced-motion: reduce) {
  .mcp-flow-agent-logo {
    animation: none;
    opacity: 0;
    filter: none;
    transform: none;
  }
  .mcp-flow-agent-logo:first-child { opacity: 1; }
}

.mcp-flow-bridge {
  flex: 1 1 56px;
  width: 56px;
  max-width: 128px;
  height: var(--icon);
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 1;
}

@media (max-width: 719px) {
  .mcp-flow-bridge {
    width: var(--icon);
    height: 40px;
    flex: none;
  }
}

.mcp-flow-bridge-channel {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 12px;
  margin-top: -6px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--hairline) 28%, transparent);
}

@media (max-width: 719px) {
  .mcp-flow-bridge-channel {
    top: 0;
    bottom: 0;
    left: 50%;
    right: auto;
    width: 12px;
    height: auto;
    margin-top: 0;
    margin-left: -6px;
    border-top: 0;
    border-bottom: 0;
    border-left: 1px solid var(--hairline);
    border-right: 1px solid var(--hairline);
  }
}

.mcp-flow-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--dim);
  opacity: 0;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  top: 50%;
  margin-top: -1px;
}

.mcp-flow-particle--accent { background: var(--accent); }

.mcp-flow-bridge .mcp-flow-particle--fwd {
  animation-name: mcp-fwd-h;
  animation-duration: 2.4s;
}

.mcp-flow-bridge .mcp-flow-particle--rev {
  margin-top: 2px;
  animation-name: mcp-rev-h;
  animation-duration: 2.8s;
  opacity: 0;
}

@keyframes mcp-fwd-h {
  0% { left: 2px; opacity: 0; }
  8% { opacity: 0.85; }
  92% { opacity: 0.85; }
  100% { left: calc(100% - 5px); opacity: 0; }
}

@keyframes mcp-rev-h {
  0% { right: 2px; left: auto; opacity: 0; }
  8% { opacity: 0.5; }
  92% { opacity: 0.5; }
  100% { right: calc(100% - 5px); left: auto; opacity: 0; }
}

@media (max-width: 719px) {
  .mcp-flow-particle { top: auto; left: 50%; margin-top: 0; margin-left: -1px; }
  .mcp-flow-bridge .mcp-flow-particle--fwd {
    margin-left: -2px;
    animation-name: mcp-fwd-v;
  }
  .mcp-flow-bridge .mcp-flow-particle--rev {
    margin-left: 1px;
    animation-name: mcp-rev-v;
  }
}

@keyframes mcp-fwd-v {
  0% { top: 2px; opacity: 0; }
  8% { opacity: 0.85; }
  92% { opacity: 0.85; }
  100% { top: calc(100% - 5px); opacity: 0; }
}

@keyframes mcp-rev-v {
  0% { bottom: 2px; top: auto; opacity: 0; }
  8% { opacity: 0.5; }
  92% { opacity: 0.5; }
  100% { bottom: calc(100% - 5px); top: auto; opacity: 0; }
}

.mcp-flow-bridge .mcp-flow-particle:nth-child(2) { animation-delay: 0s; }
.mcp-flow-bridge .mcp-flow-particle:nth-child(3) { animation-delay: 1.2s; }
.mcp-flow-bridge .mcp-flow-particle:nth-child(4) { animation-delay: 0.5s; }
.mcp-flow-bridge .mcp-flow-particle:nth-child(5) { animation-delay: 1.7s; }

@media (prefers-reduced-motion: reduce) {
  .mcp-flow-particle { animation: none; opacity: 0.35; }
}

.mcp-flow-meta {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.mcp-flow-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.mcp-flow-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mcp-flow-legend i {
  display: block;
  width: 4px;
  height: 4px;
  background: var(--dim);
  font-style: normal;
}

.mcp-flow-legend i.is-accent { background: var(--accent); }

.mcp-cap-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--hairline);
}

@media (min-width: 720px) {
  .mcp-cap-grid { grid-template-columns: repeat(4, 1fr); }
}

.mcp-cap-cell {
  position: relative;
  background: var(--bg);
  padding: 24px 20px;
  overflow: hidden;
  transition: background-color 200ms var(--ease-out);
}

.mcp-cap-cell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.mcp-cap-cell-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 2;
  stroke-linecap: square;
  transition: stroke 200ms var(--ease-out);
}

.mcp-cap-cell-num {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--faint);
  transition: color 200ms var(--ease-out);
}

/* Pixel sweep on hover — the Download button's stepped shimmer, cell-sized. */
.mcp-cap-cell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    repeating-linear-gradient(90deg,
      color-mix(in srgb, var(--accent) 16%, transparent) 0 5px,
      transparent 5px 9px),
    repeating-linear-gradient(0deg,
      color-mix(in srgb, var(--accent) 16%, transparent) 0 5px,
      transparent 5px 9px);
  -webkit-mask-image: linear-gradient(100deg, transparent 32%, #000 46%, #000 54%, transparent 68%);
  mask-image: linear-gradient(100deg, transparent 32%, #000 46%, #000 54%, transparent 68%);
  -webkit-mask-size: 260% 100%;
  mask-size: 260% 100%;
  -webkit-mask-position: 130% 0;
  mask-position: 130% 0;
}

@media (hover: hover) {
  .mcp-cap-cell:hover {
    background: color-mix(in srgb, var(--accent) 5%, var(--bg));
  }
  .mcp-cap-cell:hover .mcp-cap-cell-icon {
    stroke: var(--accent);
  }
  .mcp-cap-cell:hover .mcp-cap-cell-num {
    color: var(--accent);
  }
  .mcp-cap-cell:hover .mcp-cap-cell-title {
    color: var(--accent);
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .mcp-cap-cell:hover::after {
    opacity: 1;
    -webkit-mask-position: -130% 0;
    mask-position: -130% 0;
    transition:
      opacity 140ms var(--ease-out),
      -webkit-mask-position 520ms steps(12),
      mask-position 520ms steps(12);
  }
}

.mcp-cap-cell-title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  transition: color 200ms var(--ease-out);
}

.mcp-cap-cell-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--faint);
}

.mcp-cap-cell-body {
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--dim);
  line-height: 1.55;
  text-wrap: pretty;
}

/* ---- Onboard-your-agent clipboard CTA ---- */
.mcp-onboard {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-top: 1px solid var(--hairline);
  background: var(--bg);
}

.mcp-onboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 18px;
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color 180ms var(--ease-out),
    color 180ms var(--ease-out),
    background-color 180ms var(--ease-out);
}

.mcp-onboard-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.mcp-onboard-btn.is-copied {
  border-color: var(--accent);
  color: var(--accent);
}

.mcp-onboard-icon {
  width: 15px;
  height: 15px;
}

.mcp-onboard-note {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  color: var(--faint);
}
