/* sphinx_autodoc_fastmcp — color layer for FastMCP tool badges.
 *
 * Base metrics and sizing come from sphinx_ux_badges.css (gp-sphinx-badge--dense class).
 * This file matches sphinx-gp-theme custom.css rules for .sd-badge[aria-label^="Safety tier:"]
 * (colors and theme --gp-sphinx-fastmcp-safety-* variables).
 *
 * Safety palette: same tokens as sphinx_gp_theme/theme/static/css/custom.css
 * so readonly / mutating / destructive match production regardless of load order.
 *
 * Type badge palette (tool / prompt / resource): one variable set per type;
 * dark mode overrides the same variables in a scoped block — no -dark suffix antipattern.
 */

:root {
  /* ── Safety tier (kept in sync with sphinx_gp_theme/custom.css) ── */
  --gp-sphinx-fastmcp-safety-readonly-bg: #1f7a3f;
  --gp-sphinx-fastmcp-safety-readonly-border: #2a8d4d;
  --gp-sphinx-fastmcp-safety-readonly-text: #f3fff7;
  --gp-sphinx-fastmcp-safety-mutating-bg: #b96a1a;
  --gp-sphinx-fastmcp-safety-mutating-border: #cf7a23;
  --gp-sphinx-fastmcp-safety-mutating-text: #fff8ef;
  --gp-sphinx-fastmcp-safety-destructive-bg: #b4232c;
  --gp-sphinx-fastmcp-safety-destructive-border: #cb3640;
  --gp-sphinx-fastmcp-safety-destructive-text: #fff5f5;

  /* ── Type: tool — teal ── */
  --gp-sphinx-fastmcp-type-tool-bg: #0e7490;
  --gp-sphinx-fastmcp-type-tool-fg: #ffffff;
  --gp-sphinx-fastmcp-type-tool-border: #0f766e;

  /* ── Type: prompt — muted violet ── */
  --gp-sphinx-fastmcp-type-prompt-bg: #5b21b6;
  --gp-sphinx-fastmcp-type-prompt-fg: #ffffff;
  --gp-sphinx-fastmcp-type-prompt-border: #4c1d95;

  /* ── Type: resource (fixed URI) — steel blue ── */
  --gp-sphinx-fastmcp-type-resource-bg: #1e40af;
  --gp-sphinx-fastmcp-type-resource-fg: #ffffff;
  --gp-sphinx-fastmcp-type-resource-border: #1e3a8a;

  /* ── Type: resource-template (parameterised URI) — sky blue ── */
  --gp-sphinx-fastmcp-type-resource-template-bg: #0369a1;
  --gp-sphinx-fastmcp-type-resource-template-fg: #ffffff;
  --gp-sphinx-fastmcp-type-resource-template-border: #075985;

  /* ── MIME / tag ghost pill ── */
  --gp-sphinx-fastmcp-mime-bg: transparent;
  --gp-sphinx-fastmcp-mime-fg: #6b7280;
  --gp-sphinx-fastmcp-mime-border: #d1d5db;
}

/* ── Safety badges: gp-sphinx-badge--dense provides compact metrics; restore inline-flex for icon gap ── */
.gp-sphinx-badge.gp-sphinx-badge--dense.gp-sphinx-fastmcp__safety {
  display: inline-flex !important;
}

/*
 * Matte safety colors: literal hex + !important so sphinx-design (loaded after
 * this file) cannot skew var() resolution or shorthands. Keeps parity with
 * :root --gp-sphinx-fastmcp-safety-* above; override there + copy here if you change the palette.
 */
.gp-sphinx-badge.gp-sphinx-fastmcp__safety-readonly:not(.gp-sphinx-badge--inline-icon) {
  background-color: #1f7a3f !important;
  color: #f3fff7 !important;
  border: 1px solid #2a8d4d !important;
  box-shadow: var(--gp-sphinx-badge-buff-shadow) !important;
}

.gp-sphinx-badge.gp-sphinx-fastmcp__safety-mutating:not(.gp-sphinx-badge--inline-icon) {
  background-color: #b96a1a !important;
  color: #fff8ef !important;
  border: 1px solid #cf7a23 !important;
  box-shadow: var(--gp-sphinx-badge-buff-shadow) !important;
}

.gp-sphinx-badge.gp-sphinx-fastmcp__safety-destructive:not(.gp-sphinx-badge--inline-icon) {
  background-color: #b4232c !important;
  color: #fff5f5 !important;
  border: 1px solid #cb3640 !important;
  box-shadow: var(--gp-sphinx-badge-buff-shadow) !important;
}

/* ── Type badges: use variables; dark mode re-declares the same vars in a scoped block ── */

.gp-sphinx-badge.gp-sphinx-fastmcp__type-tool:not(.gp-sphinx-badge--inline-icon) {
  background-color: var(--gp-sphinx-fastmcp-type-tool-bg) !important;
  color: var(--gp-sphinx-fastmcp-type-tool-fg) !important;
  border: 1px solid var(--gp-sphinx-fastmcp-type-tool-border) !important;
  box-shadow: var(--gp-sphinx-badge-buff-shadow) !important;
}

.gp-sphinx-badge.gp-sphinx-fastmcp__type-prompt:not(.gp-sphinx-badge--inline-icon) {
  background-color: var(--gp-sphinx-fastmcp-type-prompt-bg) !important;
  color: var(--gp-sphinx-fastmcp-type-prompt-fg) !important;
  border: 1px solid var(--gp-sphinx-fastmcp-type-prompt-border) !important;
  box-shadow: var(--gp-sphinx-badge-buff-shadow) !important;
}

.gp-sphinx-badge.gp-sphinx-fastmcp__type-resource:not(.gp-sphinx-badge--inline-icon) {
  background-color: var(--gp-sphinx-fastmcp-type-resource-bg) !important;
  color: var(--gp-sphinx-fastmcp-type-resource-fg) !important;
  border: 1px solid var(--gp-sphinx-fastmcp-type-resource-border) !important;
  box-shadow: var(--gp-sphinx-badge-buff-shadow) !important;
}

.gp-sphinx-badge.gp-sphinx-fastmcp__type-resource-template:not(.gp-sphinx-badge--inline-icon) {
  background-color: var(--gp-sphinx-fastmcp-type-resource-template-bg) !important;
  color: var(--gp-sphinx-fastmcp-type-resource-template-fg) !important;
  border: 1px solid var(--gp-sphinx-fastmcp-type-resource-template-border) !important;
  box-shadow: var(--gp-sphinx-badge-buff-shadow) !important;
}

/* MIME type and tag pills: ghost outline — whispers rather than shouts */
.gp-sphinx-badge.gp-sphinx-fastmcp__mime:not(.gp-sphinx-badge--inline-icon),
.gp-sphinx-badge.gp-sphinx-fastmcp__tag:not(.gp-sphinx-badge--inline-icon) {
  background-color: var(--gp-sphinx-fastmcp-mime-bg) !important;
  color: var(--gp-sphinx-fastmcp-mime-fg) !important;
  border: 1px solid var(--gp-sphinx-fastmcp-mime-border) !important;
  box-shadow: none !important;
}

/* ── Dark mode: override variables only; selectors above need not repeat ── */

@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) {
    --gp-sphinx-fastmcp-type-tool-bg: #0d9488;
    --gp-sphinx-fastmcp-type-tool-fg: #ffffff;
    --gp-sphinx-fastmcp-type-tool-border: #14b8a6;

    --gp-sphinx-fastmcp-type-prompt-bg: #7c3aed;
    --gp-sphinx-fastmcp-type-prompt-fg: #ffffff;
    --gp-sphinx-fastmcp-type-prompt-border: #8b5cf6;

    --gp-sphinx-fastmcp-type-resource-bg: #2563eb;
    --gp-sphinx-fastmcp-type-resource-fg: #ffffff;
    --gp-sphinx-fastmcp-type-resource-border: #3b82f6;

    --gp-sphinx-fastmcp-type-resource-template-bg: #0284c7;
    --gp-sphinx-fastmcp-type-resource-template-fg: #ffffff;
    --gp-sphinx-fastmcp-type-resource-template-border: #0ea5e9;

    --gp-sphinx-fastmcp-mime-fg: #9ca3af;
    --gp-sphinx-fastmcp-mime-border: #4b5563;
  }
}

body[data-theme="dark"] {
  --gp-sphinx-fastmcp-type-tool-bg: #0d9488;
  --gp-sphinx-fastmcp-type-tool-fg: #ffffff;
  --gp-sphinx-fastmcp-type-tool-border: #14b8a6;

  --gp-sphinx-fastmcp-type-prompt-bg: #7c3aed;
  --gp-sphinx-fastmcp-type-prompt-fg: #ffffff;
  --gp-sphinx-fastmcp-type-prompt-border: #8b5cf6;

  --gp-sphinx-fastmcp-type-resource-bg: #2563eb;
  --gp-sphinx-fastmcp-type-resource-fg: #ffffff;
  --gp-sphinx-fastmcp-type-resource-border: #3b82f6;

  --gp-sphinx-fastmcp-type-resource-template-bg: #0284c7;
  --gp-sphinx-fastmcp-type-resource-template-fg: #ffffff;
  --gp-sphinx-fastmcp-type-resource-template-border: #0ea5e9;

  --gp-sphinx-fastmcp-mime-fg: #9ca3af;
  --gp-sphinx-fastmcp-mime-border: #4b5563;
}

/* Safety dark-mode box-shadow (safety badges intentionally keep hardcoded hex — see note above) */
@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) .gp-sphinx-badge.gp-sphinx-fastmcp__safety-readonly:not(.gp-sphinx-badge--inline-icon),
  body:not([data-theme="light"]) .gp-sphinx-badge.gp-sphinx-fastmcp__safety-mutating:not(.gp-sphinx-badge--inline-icon),
  body:not([data-theme="light"]) .gp-sphinx-badge.gp-sphinx-fastmcp__safety-destructive:not(.gp-sphinx-badge--inline-icon) {
    box-shadow: var(--gp-sphinx-badge-buff-shadow-dark-ui) !important;
  }
}

body[data-theme="dark"] .gp-sphinx-badge.gp-sphinx-fastmcp__safety-readonly:not(.gp-sphinx-badge--inline-icon),
body[data-theme="dark"] .gp-sphinx-badge.gp-sphinx-fastmcp__safety-mutating:not(.gp-sphinx-badge--inline-icon),
body[data-theme="dark"] .gp-sphinx-badge.gp-sphinx-fastmcp__safety-destructive:not(.gp-sphinx-badge--inline-icon) {
  box-shadow: var(--gp-sphinx-badge-buff-shadow-dark-ui) !important;
}

/* ── Emoji fallback (CSS ::before) when data-icon absent ── */
.gp-sphinx-fastmcp__safety-readonly:not([data-icon])::before {
  content: "\1F50D";
}

.gp-sphinx-fastmcp__safety-mutating:not([data-icon])::before {
  content: "\270F\FE0F";
}

.gp-sphinx-fastmcp__safety-destructive:not([data-icon])::before {
  content: "\1F4A3";
}

/* ── Tool section card ──────────────────────────────────── */
section.gp-sphinx-fastmcp__tool-section {
  padding: 0;
  overflow: clip;
}

section.gp-sphinx-fastmcp__tool-section > .gp-sphinx-fastmcp__tool-entry > .gp-sphinx-api-header .gp-sphinx-api-signature {
  min-width: 0;
  font-family: var(--font-stack--monospace);
}

section.gp-sphinx-fastmcp__tool-section > .gp-sphinx-fastmcp__tool-entry > .gp-sphinx-api-content > .gp-sphinx-fastmcp__body-section + .gp-sphinx-fastmcp__body-section {
  margin-top: 0.75rem;
}

/* Hide type badges in TOC sidebar (redundant — the section title already names the item). */
.toc-tree .gp-sphinx-fastmcp__type-tool,
.toc-tree .gp-sphinx-fastmcp__type-prompt,
.toc-tree .gp-sphinx-fastmcp__type-resource,
.toc-tree .gp-sphinx-fastmcp__type-resource-template {
  display: none !important;
}

/* ── Prompt / resource section cards ──────────────────────── */
section.gp-sphinx-fastmcp__prompt-section,
section.gp-sphinx-fastmcp__resource-section {
  padding: 0;
  overflow: clip;
}

section.gp-sphinx-fastmcp__prompt-section > .gp-sphinx-fastmcp__prompt-entry > .gp-sphinx-api-header .gp-sphinx-api-signature,
section.gp-sphinx-fastmcp__resource-section > .gp-sphinx-fastmcp__resource-entry > .gp-sphinx-api-header .gp-sphinx-api-signature {
  min-width: 0;
  font-family: var(--font-stack--monospace);
}

.gp-sphinx-fastmcp__visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
