/* Cortex API Docs — camada de marca sobre o Scalar.
   Espelha a estrutura da referência do ClickUp (ReadMe): topbar clara com
   busca, sidebar de navegação, rodapé por operação e rodapé do documento. */

:root {
  /* Marca — amostrada das logomarcas oficiais */
  --cx-navy-900: #061220;
  --cx-navy-800: #0b2038;
  --cx-navy: #0e2847;
  --cx-navy-600: #1b3a60;
  --cx-yellow: #f0eb65;
  --cx-mint: #a9eb67;
  --cx-lime: #69ed43;
  --cx-ink-green: #2a8317; /* verde legível sobre branco (AA 4.8:1) */
  --cx-grad: linear-gradient(110deg, #f0eb65 0%, #a9eb67 46%, #69ed43 100%);

  --cx-header-h: 56px;
  --cx-font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cx-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --cx-ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* Superfícies do chrome — sobrescritas no modo escuro */
  --cx-surface: #ffffff;
  --cx-surface-2: #f6f8f4;
  --cx-line: rgba(14, 40, 71, 0.12);
  --cx-text: #0e2847;
  --cx-text-2: #5c6b7e;
  --cx-accent: var(--cx-ink-green);
}

body.dark-mode {
  --cx-surface: #071527;
  --cx-surface-2: #0b1f36;
  --cx-line: rgba(148, 186, 218, 0.18);
  --cx-text: #eaf2f8;
  --cx-text-2: #a9bacd;
  --cx-accent: #8cf06a;
}

.cx-doc {
  margin: 0;
  font-family: var(--cx-font);
}

/* ---------------------------------------------------------------- topbar */

.cx-top {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--cx-header-h);
  padding: 0 16px 0 32px;
  background: var(--cx-surface);
  color: var(--cx-text);
  border-bottom: 1px solid var(--cx-line);
  font-family: var(--cx-font);
}

.cx-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--cx-grad);
  opacity: 0.9;
}

.cx-skip {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 1100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--cx-navy);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s var(--cx-ease);
}

.cx-skip:focus {
  top: 10px;
}

/* Marca: wordmark no claro, ícone + texto no escuro (o wordmark é navy). */
.cx-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  text-decoration: none;
  color: inherit;
  margin-right: 6px;
}

.cx-brand__wordmark {
  height: 36px;
  width: auto;
}

/* Cada tema usa seu próprio wordmark. Claro → logo-cortex.png; escuro →
   logo-cortex-dark.jpg (com fundo preto + ícone ciano). */
.cx-brand__wordmark--dark {
  display: none;
}
body.dark-mode .cx-brand__wordmark--light {
  display: none;
}
body.dark-mode .cx-brand__wordmark--dark {
  display: block;
}

.cx-brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: none;
}

.cx-brand__txt {
  display: none;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cx-brand__txt b {
  font-weight: 800;
  color: var(--cx-accent);
}

.cx-title {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 24px 0 16px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--cx-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cx-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: none;
}

/* Botão de busca movido da sidebar pro header. Mantém os listeners do Scalar
   (abre o modal de busca) — só recebe um visual coerente com o resto da barra. */
#cx-search-slot {
  display: flex;
  align-items: center;
}
.cx-search-topbar {
  min-width: 220px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--cx-line);
  border-radius: 9px;
  background: var(--cx-surface-2);
  color: var(--cx-text-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.cx-search-topbar:hover {
  border-color: var(--cx-accent);
  color: var(--cx-text);
}
.cx-search-topbar svg {
  width: 15px;
  height: 15px;
  flex: none;
}
.cx-search-topbar kbd,
.cx-search-topbar span[class*="uppercase"] {
  display: none !important;
}
/* Garante que o texto acessível do Scalar não vaze no top bar (a regra
   `sr-only` depende de Tailwind, que não está carregado aqui). */
.cx-search-topbar .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.cx-search-topbar span[class*="leading-none"] {
  margin-right: auto;
}

.cx-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--cx-line);
  border-radius: 9px;
  background: var(--cx-surface);
  color: var(--cx-text-2);
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.cx-icon-btn:hover {
  color: var(--cx-text);
  border-color: var(--cx-accent);
}

.cx-icon-btn svg {
  width: 17px;
  height: 17px;
}

/* Toggle de tema: mostra a lua quando está no claro, o sol quando está no
   escuro. O JS alterna a classe `dark-mode` no <body>, igual ao resto da
   referência, então é só esconder/mostrar cada SVG pelo tema. */
.cx-theme__sun {
  display: none;
}
.dark-mode .cx-theme__moon {
  display: none;
}
.dark-mode .cx-theme__sun {
  display: block;
}

.cx-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--cx-line);
  color: var(--cx-text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition:
    border-color 0.15s,
    transform 0.15s var(--cx-ease);
}

.cx-btn:hover {
  border-color: var(--cx-accent);
  transform: translateY(-1px);
}

.cx-btn--solid {
  background: var(--cx-grad);
  border-color: transparent;
  color: var(--cx-navy);
}

.cx-btn--solid:hover {
  filter: brightness(1.06);
}

.cx-top a:focus-visible,
.cx-top button:focus-visible {
  outline: 2px solid var(--cx-accent);
  outline-offset: 2px;
}

@media (max-width: 1080px) {
}

@media (max-width: 720px) {
  .cx-btn--solid {
    display: none;
  }
}

/* Em telas estreitas o próprio Scalar mostra um cabeçalho com o nome da
   operação: as abas sairiam por baixo dos botões de ação. */
@media (max-width: 640px) {
}

/* -------------------------------------------- rodapé de cada operação */

.cx-opfoot {
  margin: 8px 0 4px;
  padding-top: 20px;
  border-top: 1px solid var(--cx-line);
  font-family: var(--cx-font);
  color: var(--cx-text-2);
  font-size: 13.5px;
}

/* ------------------------------------------------ botão "copiar markdown" */

.cx-optools {
  display: flex;
  justify-content: flex-start;
  margin: 10px 0 12px;
}

.cx-copy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--cx-line);
  border-radius: 8px;
  background: var(--cx-surface);
  color: var(--cx-text);
  font-family: var(--cx-font);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.15s,
    color 0.15s;
}

.cx-copy:hover {
  border-color: var(--cx-accent);
}

.cx-copy svg {
  width: 14px;
  height: 14px;
}

/* ------------------------------------- linha do endpoint sob o título */

.cx-endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  padding: 7px 8px 7px 7px;
  border: 1px solid var(--cx-line);
  border-radius: 9px;
  background: var(--cx-surface-2);
  font-family: var(--cx-font);
}

.cx-endpoint code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  font-family: var(--cx-mono);
  font-size: 13px;
  color: var(--cx-text-2);
}

.cx-endpoint code::-webkit-scrollbar {
  display: none;
}

.cx-method {
  flex: none;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--cx-text-2);
}

.cx-method--get {
  background: var(--cx-ink-green);
}
.cx-method--post {
  background: #1f6feb;
}
.cx-method--put,
.cx-method--patch {
  background: #b45309;
}
.cx-method--delete {
  background: #c1121f;
}

.cx-copyurl {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--cx-text-2);
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.cx-copyurl svg {
  width: 15px;
  height: 15px;
}

.cx-copyurl:hover {
  color: var(--cx-text);
  border-color: var(--cx-line);
}

.cx-copyurl.is-done {
  color: var(--cx-accent);
  border-color: var(--cx-accent);
}

/* --------------------------------------------- card de requisição */

/* O Scalar limita cada filho de `.examples` a metade da altura da viewport.
   Em vez de estourar esse teto (e ser pintado por cima do card de resposta), o
   card se organiza em coluna: cabeçalho e rodapé fixos, snippet rolando por
   dentro — assim o "Copiar" continua sempre visível. */
.cx-request {
  display: flex;
  flex-direction: column;
  min-height: 0;
  font-family: var(--cx-font);
  margin-bottom: 16px;
}

/* O Scalar limita a altura dos filhos de `.examples` a metade da viewport
   (`.examples > * { max-height: calc((--refs-viewport-height - 60px) / 2) }`),
   pra controlar os sticky cards da sidebar. Mas a nossa caixa de código
   precisa crescer com o conteúdo (Python/PHP/Ruby têm mais linhas) — sem
   esse override, as linhas extras vazam pra fora do card em viewports
   menores. */
.cx-request {
  max-height: none !important;
}

.cx-lang {
  flex: none;
}

.cx-lang__title {
  display: block;
  margin-bottom: 8px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--cx-text-2);
}

.cx-lang__row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cx-lang__row::-webkit-scrollbar {
  display: none;
}

.cx-lang__item {
  flex: 1 1 0;
  min-width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 9px 4px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--cx-text-2);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background-color 0.15s,
    color 0.15s;
}

.cx-lang__item:hover {
  color: var(--cx-text);
  background: var(--cx-surface-2);
}

.cx-lang__item.is-active {
  border-color: var(--cx-line);
  background: var(--cx-surface);
  color: var(--cx-text);
  font-weight: 700;
  box-shadow: 0 2px 8px -4px rgba(14, 40, 71, 0.35);
}

.cx-lang__icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--cx-grad);
  color: var(--cx-navy);
}

.cx-lang__icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.cx-lang__item:not(.is-active) .cx-lang__icon {
  background: var(--cx-surface-2);
  color: var(--cx-text-2);
  box-shadow: inset 0 0 0 1px var(--cx-line);
}

.cx-card {
  display: flex;
  flex-direction: column;
  flex: 0 1 auto;
  min-height: 0;
  border-radius: 12px;
  background: var(--cx-navy-900);
  color: #dbe6f2;
  box-shadow: 0 18px 40px -30px rgba(6, 18, 32, 0.9);
}

.cx-card__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 186, 218, 0.14);
}

.cx-card__variant {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8fa6bf;
}

.cx-card__examples {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8fa6bf;
  cursor: pointer;
}
.cx-card__examples:hover {
  color: #dbe6f2;
}

.cx-code {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 14px;
  flex: none;
  margin: 0;
  padding: 12px 14px 12px 4px;
  overflow: auto;
  scrollbar-width: none;
  font-family: var(--cx-mono);
  font-size: 12.5px;
  line-height: 1.65;
}

/* Cada linha do código é uma subgrid de 1×2 (número + texto). Isso mantém o
   alinhamento perfeito entre as linhas mesmo com sticky nos números. */
.cx-code__row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  min-height: 1.5em;
  align-items: start;
}
.cx-code::-webkit-scrollbar {
  display: none;
}

.cx-code__n {
  position: sticky;
  left: 4px;
  /* sticky com a mesma cor do fundo da caixa — mascara o que passa por trás
     quando rola horizontalmente */
  background: var(--cx-navy-900);
  display: inline-block;
  width: 28px;
  padding-right: 6px;
  text-align: right;
  color: #5a6b80;
  font-weight: 500;
  user-select: none;
  z-index: 1;
  /* cada linha tem a mesma altura do line-height — sem isso, linhas vazias
     colapsam e os números vizinhos saem do lugar */
  height: calc(var(--cx-mono) * 1.65);
  line-height: 1.65;
  vertical-align: top;
}

.cx-code__t {
  white-space: pre;
  font-family: inherit;
  display: inline-block;
  height: calc(var(--cx-mono) * 1.65);
  line-height: 1.65;
  vertical-align: top;
}

.cx-code__t {
  white-space: pre;
  font-family: inherit;
}

.cx-code__t .s {
  color: var(--cx-yellow);
  font-style: normal;
}

.cx-code__t .f {
  color: var(--cx-mint);
  font-style: normal;
}

.cx-code__t .c {
  color: #6e8399;
  font-style: normal;
}

.cx-card__foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid rgba(148, 186, 218, 0.14);
}

/* Botão de copiar agora fica no rodapé do card (esquerda), como na referência
   do ClickUp. É só um ícone — sem texto. */
.cx-card__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(148, 186, 218, 0.22);
  border-radius: 7px;
  background: none;
  color: #b6c7da;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s,
    background-color 0.15s;
}
.cx-card__copy svg {
  width: 14px;
  height: 14px;
}
.cx-card__copy span {
  display: none;
}
.cx-card__copy:hover {
  color: #fff;
  border-color: var(--cx-mint);
  background: rgba(105, 237, 67, 0.08);
}
.cx-card__copy.is-ok {
  color: var(--cx-mint);
  border-color: var(--cx-mint);
}
.cx-card__copy.is-fail {
  color: #ff6b6b;
  border-color: #ff6b6b;
}

.cx-card__copy:focus-visible,
.cx-lang__item:focus-visible {
  outline: 2px solid var(--cx-lime);
  outline-offset: 2px;
}

/* ------------------------------------------------- rodapé do documento */

.cx-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-top: 40px;
  padding: 22px 0 48px;
  border-top: 1px solid var(--cx-line);
  font-family: var(--cx-font);
  font-size: 13px;
  color: var(--cx-text-2);
}

.cx-footer a {
  color: var(--cx-text-2);
  text-decoration: none;
  font-weight: 600;
}

.cx-footer a:hover {
  color: var(--cx-accent);
}

.cx-footer__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-weight: 700;
  color: var(--cx-text);
}

.cx-footer__brand img {
  width: 20px;
  height: 20px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
