/* Mintlify-style contextual menu for GP docs */
.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.page-title-row h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.page-header-main > .page-description {
  margin-top: 0.75rem;
}

.gp-contextual-wrap {
  position: relative;
  flex-shrink: 0;
  align-self: center;
}

.gp-contextual-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
  background: var(--bg-subtle, #fff);
  border: 1px solid var(--border-default, rgba(0, 0, 0, 0.12));
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.gp-contextual-trigger:hover,
.gp-contextual-trigger[aria-expanded="true"] {
  color: var(--text-primary, #0f172a);
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
  border-color: var(--border-default, rgba(0, 0, 0, 0.18));
}

.gp-contextual-trigger svg {
  width: 14px;
  height: 14px;
  opacity: 0.75;
}

.gp-contextual-trigger .gp-chevron {
  transition: transform 0.15s;
}

.gp-contextual-trigger[aria-expanded="true"] .gp-chevron {
  transform: rotate(180deg);
}

.gp-contextual-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 200;
  min-width: 17.5rem;
  max-width: 22rem;
  padding: 0.35rem;
  background: var(--bg-subtle, #fff);
  border: 1px solid var(--border-default, rgba(0, 0, 0, 0.1));
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.gp-contextual-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.gp-contextual-section + .gp-contextual-section {
  border-top: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  margin-top: 0.25rem;
  padding-top: 0.25rem;
}

.gp-contextual-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  text-align: left;
  font-family: inherit;
  font-size: 0.8125rem;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  text-decoration: none;
}

.gp-contextual-item:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.gp-contextual-icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
  opacity: 0.85;
}

.gp-contextual-text {
  flex: 1;
  min-width: 0;
}

.gp-contextual-title {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  line-height: 1.3;
}

.gp-contextual-desc {
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
  line-height: 1.35;
}

.gp-contextual-external {
  width: 0.75rem;
  height: 0.75rem;
  opacity: 0.5;
}

.gp-contextual-toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  padding: 0.65rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary, #0f172a);
  background: var(--bg-subtle, #fff);
  border: 1px solid var(--border-default, rgba(0, 0, 0, 0.12));
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.gp-contextual-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px) {
  .page-title-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .gp-contextual-wrap {
    margin-left: auto;
  }

  .gp-contextual-menu {
    right: 0;
    left: auto;
    max-width: min(22rem, calc(100vw - 1.5rem));
  }
}

/* ── Fleet-wide custom-development CTA bar (#gp-cta-bar) ──────────────────────
   The bar itself is rendered at runtime by the fomo-notices worker's cta.ts; this
   only maps it onto each docs site's own tokens and reserves space for it.
   Every docs site is dark-themed but with a different palette, so the bar reads
   from --bg-subtle / --text-primary / --border-default rather than hard-coding.
   The button inverts that same pair, which is guaranteed high-contrast on any of
   them — unlike the per-site --primary accent, which ranges from #80CD78 to
   #2F81F7 and would fail WCAG with white text on the lighter ones. */
:root {
  --gp-cta-bg: var(--bg-subtle, #161B22);
  --gp-cta-fg: var(--text-primary, #E6EDF3);
  --gp-cta-border: var(--border-default, rgba(255, 255, 255, 0.14));
  --gp-cta-btn-bg: var(--text-primary, #E6EDF3);
  --gp-cta-btn-fg: var(--bg-subtle, #161B22);
}

/* The sidebar is position:sticky at calc(100vh - header) with its own scroll, so a
   fixed bottom bar would permanently cover the sidebar CTA block at its foot. */
.sidebar {
  padding-bottom: calc(2rem + var(--gp-cta-h, 0px));
}

/* Keep the contextual toast above the bar (it is bottom:1.25rem by default). */
.gp-contextual-toast {
  bottom: calc(1.25rem + var(--gp-cta-h, 0px));
}

/* The mobile drawer is z-index:40 and the bar is 9997, so the bar would otherwise
   render over an open navigation drawer. */
@media (max-width: 1024px) {
  body:has(.sidebar.open) #gp-cta-bar { display: none; }
}

@media print {
  #gp-cta-bar { display: none !important; }
}
