/* Copy buttons and hover-to-reveal card descriptions for the MCP tool guide.
   Uses the guide's colour tokens, so light and dark both work. */

/* ---- Card wrapper (mcp-copy.js wraps each card) ---- */
#business-tool-guide .mcp-card-wrap {
  position: relative;
  display: flex;
}

#business-tool-guide .mcp-card-wrap > .bt-card {
  flex: 1;
  padding-bottom: 20px;
}

/* Keep the card's hover look while the pointer is on its copy button */
#business-tool-guide .mcp-card-wrap:hover > .bt-card {
  border-color: var(--accent);
  box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 9%, transparent);
}

/* ---- Descriptions: hidden until hover or keyboard focus (pointer devices only) ---- */
@media (hover: hover) and (pointer: fine) {
  #business-tool-guide .mcp-card-wrap .bt-card-description {
    flex: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: -11px; /* cancels the card's gap while hidden */
    transition: max-height 200ms ease, opacity 200ms ease, margin-top 200ms ease;
  }

  #business-tool-guide .mcp-card-wrap:hover .bt-card-description,
  #business-tool-guide .mcp-card-wrap:focus-within .bt-card-description {
    max-height: 9em;
    opacity: 1;
    margin-top: 0;
  }

  /* Keeps "Learn more" at the bottom so the cards in a row line up */
  #business-tool-guide .mcp-card-wrap .bt-card-title {
    flex: 1;
  }
}

/* ---- Copy button, shared look ---- */
#business-tool-guide .mcp-copy {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

#business-tool-guide .mcp-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#business-tool-guide .mcp-copy.is-copied {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--green);
}

#business-tool-guide .mcp-copy-icon {
  display: flex;
}

#business-tool-guide .mcp-copy svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Prompt preview tooltip on hover / keyboard focus */
#business-tool-guide .mcp-copy[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 5;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  width: max-content;
  max-width: 280px;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 150ms ease, transform 150ms ease;
}

#business-tool-guide .mcp-copy[data-tooltip]:hover::after,
#business-tool-guide .mcp-copy[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Placement ---- */
#business-tool-guide .mcp-copy-card {
  position: absolute;
  right: 16px;
  bottom: 16px;
}

/* On cards the preview opens below the button, so it never covers the card's own text */
#business-tool-guide .mcp-copy-card[data-tooltip]::after {
  top: calc(100% + 8px);
  bottom: auto;
  z-index: 6;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transform: translateY(-4px);
}

#business-tool-guide .mcp-copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
}

#business-tool-guide .mcp-copy-hint {
  font-size: 12px;
  color: var(--muted);
}

#business-tool-guide .mcp-copy-primary {
  min-height: 40px;
  padding: 6px 14px;
  border-color: var(--accent);
  color: var(--accent);
  font-size: 13px;
}

#business-tool-guide .mcp-copy-inline {
  margin-left: 10px;
  vertical-align: middle;
}

#business-tool-guide .mcp-pre-wrap {
  position: relative;
}

/* Room for the copy button so it never covers the first line */
#business-tool-guide .mcp-pre-wrap pre {
  padding-top: 48px;
}

#business-tool-guide .mcp-copy-pre {
  position: absolute;
  top: 8px;
  right: 8px;
}

/* Screen-reader announcement area */
.mcp-copy-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  #business-tool-guide .mcp-copy,
  #business-tool-guide .mcp-copy::after,
  #business-tool-guide .mcp-card-wrap .bt-card-description {
    transition: none;
  }
}
