/* =========================================================
   AFULINK DOCS — Layout estilo GitBook
   (usa as variáveis de cor e tipografia de styles.css)
   ========================================================= */

/* ---------- Header: título "Documentação" ao lado do logo ---------- */
.docs-brand { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.docs-brand-sep { width: 1px; height: 26px; background: var(--border-color); }
.docs-brand-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-decoration: none;
  padding: 6px 10px;
  margin-left: -10px;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.docs-brand-title:hover { background: var(--accent-soft); color: var(--accent-primary); }
.docs-body .site-header .container { max-width: 1440px; }

/* ---------- Estrutura em três colunas ---------- */
.docs-main { border-top: 1px solid var(--border-color); }
.docs-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 220px;
  gap: 48px;
  min-height: calc(100vh - 72px);
}

/* ---------- Menu lateral ---------- */
.docs-sidebar {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 28px 12px 40px 0;
  border-right: 1px solid var(--border-color);
  scrollbar-width: thin;
}

.docs-search {
  position: sticky;
  top: -28px;
  z-index: 5;
  margin: -28px 12px 14px 0;
  padding: 28px 0 8px;
  background: var(--bg-primary);
}
.docs-search > svg {
  position: absolute;
  left: 12px;
  top: calc(50% + 10px);
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.docs-search input {
  width: 100%;
  padding: 10px 38px 10px 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.docs-search input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 4px var(--accent-soft); }
.docs-search kbd {
  position: absolute;
  right: 10px;
  top: calc(50% + 10px);
  transform: translateY(-50%);
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--bg-tertiary);
}
.docs-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  z-index: 60;
  padding: 6px;
}
.docs-search-results a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-primary);
}
.docs-search-results a:hover,
.docs-search-results a.focused { background: var(--accent-soft); }
.docs-search-results strong { display: block; font-size: 0.92rem; font-weight: 600; }
.docs-search-results small { display: block; color: var(--text-muted); font-size: 0.76rem; margin-top: 2px; }
.docs-search-results p { margin-top: 4px; color: var(--text-secondary); font-size: 0.82rem; line-height: 1.5; }
.docs-search-results mark { background: color-mix(in srgb, var(--accent-primary) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.docs-search-empty { padding: 14px; color: var(--text-muted); font-size: 0.88rem; }

.docs-nav ul { list-style: none; }
.docs-nav > ul > li { margin-bottom: 2px; }
.docs-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.docs-nav a:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.docs-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-weight: 600;
}
.nav-home-icon {
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.docs-nav details > summary {
  list-style: none;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.docs-nav details > summary::-webkit-details-marker { display: none; }
.docs-nav details > summary > a { flex: 1; }
.docs-nav .depth-1 > details > summary > a {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 14px;
}
.docs-nav .depth-1 > details > summary > a.active { color: var(--accent-primary); }
.nav-caret {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: background-color 0.2s ease;
}
.depth-1 > details > summary .nav-caret { margin-top: 14px; }
.nav-caret::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--text-muted);
  border-bottom: 1.6px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.25s ease;
}
.nav-caret:hover { background: var(--bg-tertiary); }
.docs-nav details[open] > summary .nav-caret::before { transform: rotate(45deg); }
.docs-nav details ul {
  margin: 2px 0 6px 12px;
  padding-left: 10px;
  border-left: 1px solid var(--border-color);
}
.docs-nav details ul a.active { position: relative; }
.docs-nav details ul a.active::before {
  content: "";
  position: absolute;
  left: -11px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent-primary);
}

/* ---------- Conteúdo ---------- */
.docs-content { min-width: 0; padding: 36px 0 72px; max-width: 800px; }
.docs-menu-btn { display: none; }

.docs-breadcrumb { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.docs-breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.docs-breadcrumb a:hover { color: var(--accent-primary); }
.docs-breadcrumb .sep { color: var(--border-color); }

.docs-header { margin-bottom: 8px; }
.docs-header h1,
.docs-prose > h1:first-child {
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
}
.docs-lead { font-size: 1.1rem; color: var(--text-secondary); max-width: 680px; }
.docs-eyebrow { display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-primary); margin-bottom: 10px; }

.docs-prose { margin-top: 24px; font-size: 1rem; line-height: 1.75; }
.docs-prose > *:first-child { margin-top: 0; }
.docs-prose h2 { padding-top: 12px; margin-top: 2.2em; font-size: 1.45rem; }
.docs-prose h2 + * { margin-top: 0.8em; }
.docs-prose h1, .docs-prose h2, .docs-prose h3, .docs-prose h4 { position: relative; scroll-margin-top: 90px; }
.heading-anchor {
  position: absolute;
  left: -1.1em;
  color: var(--accent-primary);
  text-decoration: none;
  opacity: 0;
  font-weight: 500;
  transition: opacity 0.2s ease;
}
.docs-prose h2:hover .heading-anchor,
.docs-prose h3:hover .heading-anchor,
.docs-prose h4:hover .heading-anchor { opacity: 0.8; }
.docs-prose h1 .heading-anchor { display: none; }
.docs-prose li > ul, .docs-prose li > ol { margin-top: 0.4em; }
.docs-prose li.task { list-style: none; margin-left: -1.3em; }
.docs-prose code { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Blocos de código */
.code-block {
  position: relative;
  margin: 1.1em 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  overflow: hidden;
}
.code-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}
.code-block pre { margin: 0; border: 0; border-radius: 0; background: transparent; }
.code-copy {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.code-block:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { background: var(--accent-soft); color: var(--accent-primary); }
.code-copy.copied { opacity: 1; color: #15803d; border-color: #86efac; }

/* Avisos (:::tip, :::warning...) */
.admonition {
  margin: 1.4em 0;
  border-radius: var(--radius-md);
  border: 1px solid;
  border-left-width: 4px;
  padding: 14px 18px;
  --adm: #2563eb;
  border-color: color-mix(in srgb, var(--adm) 30%, transparent);
  border-left-color: var(--adm);
  background: color-mix(in srgb, var(--adm) 7%, var(--bg-secondary));
}
.admonition-tip { --adm: #16a34a; }
.admonition-warning { --adm: #d97706; }
.admonition-danger { --adm: #dc2626; }
.admonition-note { --adm: #64748b; }
.admonition-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.admonition-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: var(--adm);
  -webkit-mask: var(--adm-icon) center / contain no-repeat;
          mask: var(--adm-icon) center / contain no-repeat;
  --adm-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
}
.admonition-tip .admonition-icon { --adm-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4M12 3a6 6 0 0 0-4 10.5c.7.7 1 1.5 1 2.5h6c0-1 .3-1.8 1-2.5A6 6 0 0 0 12 3z'/%3E%3C/svg%3E"); }
.admonition-warning .admonition-icon,
.admonition-danger .admonition-icon { --adm-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l10 18H2z'/%3E%3Cpath d='M12 10v5M12 18h.01'/%3E%3C/svg%3E"); }
.admonition-body { font-size: 0.95rem; color: var(--text-secondary); }
.admonition-body > * + * { margin-top: 0.6em; }

/* Cards (início e índices de seção) */
.docs-section-title { font-size: 1.15rem; margin: 44px 0 14px; }
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 14px;
  margin-top: 28px;
}
.docs-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.25s ease, transform 0.3s var(--ease), box-shadow 0.3s ease;
}
.docs-card:hover {
  border-color: color-mix(in srgb, var(--accent-primary) 45%, var(--border-color));
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.docs-card strong { font-size: 1rem; font-weight: 600; }
.docs-card-desc { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.55; }
.docs-card-count { margin-top: auto; padding-top: 6px; font-size: 0.78rem; color: var(--text-muted); }
.docs-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-primary);
  margin-bottom: 6px;
}
.docs-card-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.docs-home-header { padding: 18px 0 4px; }
.docs-quick { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 8px; }
.docs-quick a {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--text-primary);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.docs-quick a:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent-primary) 40%, var(--border-color)); }
.docs-quick span { font-weight: 500; font-size: 0.94rem; }
.docs-quick small { color: var(--text-muted); font-size: 0.78rem; }

.docs-updated { margin-top: 48px; font-size: 0.82rem; color: var(--text-muted); }

/* Anterior / Próximo */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; padding-top: 24px; border-top: 1px solid var(--border-color); }
.docs-pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.docs-pager a:hover { border-color: color-mix(in srgb, var(--accent-primary) 45%, var(--border-color)); background: var(--accent-soft); }
.docs-pager small { color: var(--text-muted); font-weight: 500; font-size: 0.78rem; }
.docs-pager .pager-prev small::before { content: "← "; }
.docs-pager .pager-next { text-align: right; }
.docs-pager .pager-next small::after { content: " →"; }

/* ---------- Índice "Nesta página" ---------- */
.docs-toc {
  position: sticky;
  top: 72px;
  align-self: start;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 40px 0 32px;
  font-size: 0.84rem;
}
.docs-toc-title { font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 10px; }
.docs-toc ul { list-style: none; border-left: 1px solid var(--border-color); }
.docs-toc a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.docs-toc .toc-l3 a { padding-left: 26px; font-size: 0.8rem; }
.docs-toc a:hover { color: var(--text-primary); }
.docs-toc a.active { color: var(--accent-primary); border-left-color: var(--accent-primary); font-weight: 500; }

/* 404 */
.docs-nf { padding: 40px 0; }
.docs-nf .btn-primary { margin-top: 24px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) {
  .docs-layout { grid-template-columns: 260px minmax(0, 1fr); gap: 40px; }
  .docs-toc { display: none; }
}

@media (max-width: 1060px) {
  .docs-brand-sep, .docs-brand-title { display: inline-block; }
}

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; padding: 0 20px; }
  .docs-sidebar {
    position: fixed;
    z-index: 90;
    top: 64px;
    left: 0;
    bottom: 0;
    height: auto;
    width: min(320px, 86vw);
    background: var(--bg-primary);
    padding: 20px 14px 40px 20px;
    box-shadow: var(--shadow-card);
    transform: translateX(-105%);
    transition: transform 0.35s var(--ease);
  }
  .docs-sidebar.open { transform: none; }
  body.docs-nav-open::after {
    content: "";
    position: fixed;
    inset: 64px 0 0 0;
    background: rgba(10, 12, 18, 0.35);
    z-index: 80;
  }
  .docs-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
  }
  .docs-menu-btn:hover { background: var(--accent-soft); color: var(--accent-primary); }
  .docs-menu-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .docs-content { padding-top: 22px; }
  .heading-anchor { display: none; }
}

@media (max-width: 560px) {
  .docs-brand { gap: 8px; }
  .docs-brand .brand-logo img { height: 22px; }
  .docs-brand-title { font-size: 0.88rem; padding: 4px 6px; margin-left: -6px; }
  .docs-brand-sep { height: 18px; }
  .docs-body .nav-wrap { gap: 6px; }
  .docs-pager { grid-template-columns: 1fr; }
}

@media (max-width: 380px) { .docs-brand-sep, .docs-brand-title { display: none; } }

/* ---------- Sem índice à direita: conteúdo ocupa mais espaço ---------- */
.docs-layout.no-toc { grid-template-columns: 280px minmax(0, 1fr); }
.docs-layout.no-toc .docs-content { max-width: 1040px; }
@media (max-width: 1200px) { .docs-layout.no-toc { grid-template-columns: 260px minmax(0, 1fr); } }
@media (max-width: 900px) { .docs-layout.no-toc { grid-template-columns: 1fr; } }

/* ---------- Barras de rolagem discretas ---------- */
html { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text-muted) 35%, transparent) transparent; }
.docs-sidebar, .docs-toc, .docs-search-results, .code-block pre { scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color 0.3s ease; }
.docs-sidebar:hover, .docs-toc:hover, .docs-search-results:hover, .code-block pre:hover { scrollbar-color: color-mix(in srgb, var(--text-muted) 40%, transparent) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-muted) 30%, transparent); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-muted) 55%, transparent); background-clip: padding-box; }
.docs-sidebar::-webkit-scrollbar-thumb, .docs-toc::-webkit-scrollbar-thumb { background: transparent; }
.docs-sidebar:hover::-webkit-scrollbar-thumb, .docs-toc:hover::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-muted) 35%, transparent); background-clip: padding-box; }
#scroll-progress { height: 2px; opacity: 0.6; }

/* ---------- Página inicial: arte animada (estilo de linhas do site) ---------- */
.docs-home-header { position: relative; padding: 28px 0 8px; min-height: 260px; }
.docs-home-header > :not(.docs-hero-art) { position: relative; z-index: 1; max-width: 560px; }
.docs-hero-art {
  position: absolute;
  inset: -36px -40px auto auto;
  width: 520px;
  height: 340px;
  pointer-events: none;
  z-index: 0;
}
.docs-hero-art > div {
  position: absolute;
  background: var(--accent-primary);
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
}
.hero-lines {
  inset: 40px -120px 20px -60px;
  opacity: 0.18;
  -webkit-mask-image: url("assets/linhas-fita.svg"); mask-image: url("assets/linhas-fita.svg");
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  animation: hero-lines 16s ease-in-out infinite alternate;
}
.hero-brain, .hero-synapses { width: 300px; height: 300px; right: 10px; top: 0; }
.hero-brain {
  opacity: 0.5;
  -webkit-mask-image: url("assets/arte-cerebro.svg"); mask-image: url("assets/arte-cerebro.svg");
  animation: hero-float 10s ease-in-out infinite alternate;
}
.hero-synapses {
  opacity: 0;
  -webkit-mask-image: url("assets/arte-sinapses.svg"); mask-image: url("assets/arte-sinapses.svg");
  animation: hero-float 10s ease-in-out infinite alternate, hero-pulse 2.8s ease-in-out infinite;
}
.hero-book {
  width: 200px;
  height: 200px;
  right: 250px;
  top: 150px;
  opacity: 0.4;
  background: color-mix(in srgb, var(--accent-primary) 70%, var(--text-muted));
  -webkit-mask-image: url("assets/arte-livro.svg"); mask-image: url("assets/arte-livro.svg");
  animation: hero-rise 8s ease-in-out infinite alternate;
}
@keyframes hero-float { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-12px) rotate(2deg); } }
@keyframes hero-pulse { 0%, 100% { opacity: 0; } 50% { opacity: 0.7; } }
@keyframes hero-rise { from { transform: translateY(0); } to { transform: translateY(-10px); } }
@keyframes hero-lines { from { transform: translateX(-4%) rotate(-6deg); } to { transform: translateX(4%) rotate(-2deg); } }

/* Cards da página inicial entram um a um */
.docs-home-header ~ .docs-cards .docs-card { animation: card-in 0.6s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms + 120ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) { .docs-hero-art { opacity: 0.55; inset: -30px -60px auto auto; } }
@media (max-width: 700px) {
  .docs-hero-art { width: 300px; height: 230px; inset: -20px -80px auto auto; opacity: 0.4; }
  .hero-brain, .hero-synapses { width: 200px; height: 200px; }
  .hero-book { display: none; }
  .docs-home-header { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .docs-hero-art > div, .docs-card { animation: none !important; }
}

/* =========================================================
   Versões de produto
   ========================================================= */
.nav-version {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 4px 12px;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nav-version select {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 0.84rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  background: var(--bg-secondary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 8px center / 14px no-repeat;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.nav-version select:hover { border-color: var(--accent-primary); }
.nav-version select:focus-visible { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-soft); }
.nav-version select option { background: var(--bg-secondary); color: var(--text-primary); }

.docs-version-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 0 0 22px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, #e0a73a 45%, var(--border-color));
  background: color-mix(in srgb, #e0a73a 10%, transparent);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-primary);
}
.docs-version-notice a { color: var(--accent-primary); font-weight: 600; text-decoration: none; }
.docs-version-notice a:hover { text-decoration: underline; }

/* =========================================================
   Página de resultados da busca
   ========================================================= */
.docs-search-all {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent-primary) !important;
}
.docs-search-all kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 1px 6px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
}
.docs-search-page {
  position: relative;
  display: flex;
  gap: 10px;
  margin: 8px 0 14px;
}
.docs-search-page > svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.docs-search-page input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px 12px 42px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.docs-search-page input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 4px var(--accent-soft); }
.docs-search-page .btn-primary { flex-shrink: 0; }
.docs-search-count { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 18px; min-height: 1.4em; }
.docs-search-list { list-style: none; display: grid; gap: 12px; padding: 0; margin: 0; }
.docs-search-list > li {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 12px);
  background: var(--bg-secondary);
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  animation: card-in 0.45s ease forwards;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.docs-search-list > li:hover { border-color: color-mix(in srgb, var(--accent-primary) 55%, var(--border-color)); }
.docs-search-hit { display: block; padding: 16px 18px; text-decoration: none; color: inherit; }
.docs-search-hit .hit-trail { display: block; font-size: 0.76rem; color: var(--text-muted); margin-bottom: 4px; }
.docs-search-hit strong { display: block; font-size: 1.05rem; font-weight: 600; color: var(--text-primary); }
.docs-search-hit:hover strong { color: var(--accent-primary); }
.docs-search-hit p { margin-top: 6px; font-size: 0.9rem; line-height: 1.6; color: var(--text-secondary); }
.docs-search-list mark { background: color-mix(in srgb, var(--accent-primary) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.hit-sections { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 14px; }
.hit-sections a {
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 3px 10px;
}
.hit-sections a::before { content: "# "; color: var(--text-muted); }
.hit-sections a:hover { color: var(--accent-primary); border-color: var(--accent-primary); }
@media (max-width: 560px) {
  .docs-search-page { flex-direction: column; }
  .docs-search-page > svg { top: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .docs-search-list > li { animation: none; opacity: 1; transform: none; }
}

/* Celular: no lugar do logo completo, só o símbolo (o header cabe sem rolagem lateral) */
.brand-mark { display: none; }
@media (max-width: 560px) {
  .docs-brand .brand-logo img:not(.brand-mark) { display: none; }
  .docs-brand .brand-logo .brand-mark { display: block; width: 28px; height: 28px; }
}
@media (max-width: 560px) { .docs-brand { gap: 6px; } .toolbar-controls { gap: 6px; } }

/* ---------- Linhas da arte: atravessam até o fim da área de conteúdo ---------- */
.docs-main { overflow-x: clip; }
.docs-hero-art .hero-lines {
  top: 70px;
  bottom: 10px;
  left: -60px;
  right: calc(-1 * (100vw - 100%));
  opacity: 0.28;
  -webkit-mask-image: url("assets/linhas-fita.svg"), linear-gradient(90deg, transparent 0%, #000 22%, #000 100%);
          mask-image: url("assets/linhas-fita.svg"), linear-gradient(90deg, transparent 0%, #000 22%, #000 100%);
  -webkit-mask-size: 100% 100%, 100% 100%;
          mask-size: 100% 100%, 100% 100%;
  -webkit-mask-composite: source-in;
          mask-composite: intersect;
  transform-origin: 30% 50%;
  animation: hero-wave 14s ease-in-out infinite alternate;
}
.docs-hero-art .hero-lines-b {
  opacity: 0.18;
  animation: hero-wave-b 18s ease-in-out infinite alternate;
}
.docs-home-header .docs-hero-art {
  left: 0;
  right: 0;
  width: auto;
  inset-block-start: -36px;
}
.docs-home-header .hero-brain, .docs-home-header .hero-synapses { right: -10px; }
.docs-home-header .hero-book { right: 200px; }
@keyframes hero-wave {
  0%   { transform: translate3d(-2%, 0, 0) scaleY(1)    skewY(-2deg); }
  50%  { transform: translate3d(0, -8px, 0) scaleY(0.82) skewY(0deg); }
  100% { transform: translate3d(2%, 4px, 0) scaleY(1.08) skewY(2deg); }
}
@keyframes hero-wave-b {
  0%   { transform: translate3d(3%, 10px, 0) scaleY(-0.9)  skewY(3deg); }
  50%  { transform: translate3d(0, 0, 0)     scaleY(-1.05) skewY(0deg); }
  100% { transform: translate3d(-3%, -6px, 0) scaleY(-0.85) skewY(-2deg); }
}
@media (max-width: 1100px) { .docs-home-header .docs-hero-art { inset: -30px 0 auto 0; } }
@media (max-width: 700px) {
  .docs-home-header .docs-hero-art { inset: -20px 0 auto 0; width: auto; height: 230px; }
  .docs-home-header .hero-brain, .docs-home-header .hero-synapses { right: -60px; }
}

/* ---------- Pouco conteúdo: Anterior/Próximo descem para o fim da página ---------- */
.docs-content {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 74px);
}
.docs-content > .docs-pager { margin-top: auto; }
.docs-content > :has(+ .docs-pager) { margin-bottom: 20px; }
.docs-content > * { flex-shrink: 0; }
.docs-content > .docs-menu-btn { align-self: flex-start; }
.docs-hero-only { min-height: 200px; margin-bottom: -200px; }
.docs-layout.has-toc .docs-home-header .docs-hero-art { opacity: 0.85; }

/* Menu lateral no celular/tablet: altura da tela e rolagem com o dedo.
   (align-self:start do desktop fazia a gaveta crescer até o tamanho do conteúdo e não rolar) */
@media (max-width: 900px) {
  .docs-sidebar {
    align-self: stretch;
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  body.docs-nav-open { overflow: hidden; }
}

/* Livro da arte: maior e mais esticado na horizontal */
.docs-hero-art .hero-book {
  width: 460px;
  height: 215px;
  top: 118px;
  opacity: 0.5;
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
}
.docs-home-header .hero-book { right: 170px; }
@media (max-width: 1100px) { .docs-hero-art .hero-book { width: 340px; height: 170px; top: 150px; } }
@media (max-width: 900px) { .docs-search { top: -20px; margin-top: -20px; padding-top: 20px; } }

/* Arte mais alta: passa por baixo do texto e dos cards */
.docs-home-header .docs-hero-art { height: 560px; }
.docs-home-header .docs-hero-art .hero-lines { top: 40px; bottom: 0; }
.docs-home-header .hero-brain, .docs-home-header .hero-synapses { width: 380px; height: 380px; top: 10px; }
.docs-home-header .docs-hero-art .hero-book { width: 520px; height: 230px; top: 120px; right: 230px; }
.docs-home-header ~ *, .docs-hero-only ~ * { position: relative; z-index: 1; }
.docs-hero-only { position: relative; }
@media (max-width: 1100px) {
  .docs-home-header .docs-hero-art { height: 460px; }
  .docs-home-header .hero-brain, .docs-home-header .hero-synapses { width: 300px; height: 300px; }
  .docs-home-header .docs-hero-art .hero-book { width: 400px; height: 190px; top: 130px; right: 160px; }
}
@media (max-width: 700px) {
  .docs-home-header .docs-hero-art { height: 340px; }
  .docs-home-header .hero-brain, .docs-home-header .hero-synapses { width: 210px; height: 210px; }
  .docs-home-header .docs-hero-art .hero-book { display: none; }
}

/* Livro esticado na horizontal (versão recortada do desenho, sem manter proporção) */
.docs-hero-art .hero-book {
  -webkit-mask-image: url("assets/arte-livro-larga.svg");
          mask-image: url("assets/arte-livro-larga.svg");
}
.docs-home-header .docs-hero-art .hero-book { width: 540px; height: 320px; top: 10px; right: 260px; }
@media (max-width: 1100px) { .docs-home-header .docs-hero-art .hero-book { width: 420px; height: 260px; top: 40px; right: 170px; } }
.docs-home-header .docs-hero-art .hero-book { width: 470px; height: 240px; top: 46px; right: 290px; opacity: 0.32; }
@media (max-width: 1100px) { .docs-home-header .docs-hero-art .hero-book { width: 380px; height: 210px; top: 90px; right: 190px; } }

/* =========================================================
   Topo: só as linhas. Cérebro e livro: no fim do conteúdo
   ========================================================= */
.docs-home-header .docs-hero-art { height: 440px; }
.docs-home-header .docs-hero-art .hero-lines { top: 30px; bottom: 0; }

.docs-foot-art {
  position: relative;
  height: 340px;
  margin: 48px 0 8px;
  pointer-events: none;
}
.docs-content > .docs-foot-art { margin-top: auto; padding-top: 48px; box-sizing: content-box; }
.docs-content > .docs-foot-art + .docs-pager { margin-top: 0; }
.docs-foot-art > div {
  position: absolute;
  background: var(--accent-primary);
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
}
.docs-foot-art .hero-brain, .docs-foot-art .hero-synapses { width: 340px; height: 340px; right: 4%; top: 0; }
.docs-foot-art .hero-book {
  width: 520px;
  height: 260px;
  right: calc(4% + 260px);
  bottom: 0;
  top: auto;
  opacity: 0.45;
  -webkit-mask-image: url("assets/arte-livro-larga.svg"); mask-image: url("assets/arte-livro-larga.svg");
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
@media (max-width: 1100px) {
  .docs-foot-art { height: 280px; }
  .docs-foot-art .hero-brain, .docs-foot-art .hero-synapses { width: 270px; height: 270px; right: 0; }
  .docs-foot-art .hero-book { width: 400px; height: 210px; right: 200px; }
}
@media (max-width: 700px) {
  .docs-foot-art { height: 220px; margin-top: 32px; }
  .docs-foot-art .hero-brain, .docs-foot-art .hero-synapses { width: 200px; height: 200px; right: -10px; }
  .docs-foot-art .hero-book { width: 260px; height: 150px; right: 120px; }
}
@media (prefers-reduced-motion: reduce) { .docs-foot-art > div { animation: none !important; } }

/* Livro no canto esquerdo, cérebro no canto direito (ou na coluna do menu "Nesta página") */
.docs-foot-art .hero-book { left: 0; right: auto; }
.docs-foot-art .hero-brain, .docs-foot-art .hero-synapses { right: 0; left: auto; }
.docs-foot-art.at-toc .hero-brain, .docs-foot-art.at-toc .hero-synapses { right: auto; left: var(--brain-x, auto); }
