/* ============================================================================
   Anthares 44 — DOCS SOLUTIONS (layout de documentação · folha compartilhada)
   ----------------------------------------------------------------------------
   Layout de 3 colunas: sidebar fixa · conteúdo central · índice da página.
   Escopo .dx-* → não colide com nada existente no projeto.
   Herda os tokens do site: var(--page-background), --brand-dark, cards brancos,
   bordas rgba(15,16,18,.06), sombras neutras, Inter (texto) + Poppins (títulos).
   ========================================================================== */

/* scroll suave ao clicar na sidebar / índice (respeita reduced-motion no fim) */
html { scroll-behavior: smooth; }

.dx {
    background: var(--page-background);
    color: #16171b;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================== ESTRUTURA ================================= */
.dx-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr) 232px;
    gap: clamp(28px, 3.4vw, 64px);
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 clamp(20px, 3vw, 44px);
    align-items: start;
}

/* ======================= NAVBAR FIXA (só nas docs) ========================
   Na Home/About a navbar é absolute (sobrepõe o hero). Nas páginas de
   documentação ela precisa acompanhar o scroll → position: fixed.
   Escopo em body.dx para não afetar o resto do site.
   --dx-nav-h centraliza a altura: usada pelo spacer, pela sidebar, pelo
   índice e pelo scroll-margin das seções (âncoras). */
body.dx {
    --dx-nav-h: 64px;
    --dx-nav-gap: 24px;                       /* respiro abaixo da navbar */
}

/* ÚNICA mudança: absolute → fixed. Nada de fundo, blur, borda, sombra,
   padding, altura ou cor — tudo continua vindo de navbar.css (= Home). */
body.dx .navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%;
    z-index: 1000;                            /* acima da sidebar/índice/conteúdo */
}

/* spacer que empurra todo o conteúdo para baixo da navbar fixa */
.dx-top-offset { height: var(--dx-nav-h, 64px); }

/* ------------------------------ SIDEBAR ---------------------------------- */
.dx-side {
    position: sticky;
    top: calc(var(--dx-nav-h, 64px) + var(--dx-nav-gap, 24px));
    align-self: start;
    max-height: calc(100vh - var(--dx-nav-h, 64px) - var(--dx-nav-gap, 24px) - 20px);
    overflow-y: auto;
    padding: 8px 0 40px;
    scrollbar-width: thin;
}
.dx-side::-webkit-scrollbar { width: 6px; }
.dx-side::-webkit-scrollbar-thumb { background: rgba(15,16,18,.12); border-radius: 999px; }

.dx-side-brand {
    display: flex; align-items: center; gap: 9px;
    padding: 0 12px 16px;
    font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #9aa0a6;
}
.dx-side-group { margin-bottom: 18px; }
.dx-side-title {
    display: block; padding: 0 12px 9px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #9aa0a6;
}

/* ------------------- categorias expansíveis (accordion) ------------------- */
.dx-side-cat { margin-bottom: 4px; }
.dx-side-cat > summary {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 7px 12px; border-radius: 9px; cursor: pointer; list-style: none;
    font-size: 13px; font-weight: 600; letter-spacing: .01em; color: #35383f;
    transition: background .16s ease, color .16s ease;
}
.dx-side-cat > summary::-webkit-details-marker { display: none; }
.dx-side-cat > summary:hover { background: #f1f1ee; color: #101114; }
.dx-side-cat > summary::after {
    content: ""; flex: 0 0 auto;
    width: 7px; height: 7px; margin-right: 3px;
    border-right: 1.5px solid #a8adb5; border-bottom: 1.5px solid #a8adb5;
    transform: rotate(-45deg);
    transition: transform .2s ease;
}
.dx-side-cat[open] > summary::after { transform: rotate(45deg); }
.dx-side-cat[open] > summary { color: #101114; }
.dx-side-cat > div { padding: 2px 0 8px 8px; margin-left: 12px; border-left: 1px solid rgba(15,16,18,.08); }
.dx-side-cat a { font-size: 13px; padding: 6px 10px; }
.dx-side a {
    display: block;
    padding: 7px 12px;
    border-radius: 9px;
    border-left: 2px solid transparent;
    font-size: 13.5px; font-weight: 450; line-height: 1.45;
    color: #5c6068; text-decoration: none;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.dx-side a:hover { background: #f1f1ee; color: #101114; }
.dx-side a.is-current {
    background: #ffffff;
    border-left-color: #101114;
    color: #101114; font-weight: 600;
    box-shadow: 0 1px 2px rgba(15,16,18,.04);
}

/* ------------------------------ CONTEÚDO --------------------------------- */
.dx-main { min-width: 0; padding: 8px 0 clamp(64px, 8vh, 110px); }

/* breadcrumb */
.dx-crumb {
    display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
    margin: 0 0 clamp(18px, 2vw, 26px);
    font-size: 12.5px; color: #8a8f98;
}
.dx-crumb a { color: #6a6d76; text-decoration: none; transition: color .18s ease; }
.dx-crumb a:hover { color: #101114; }
.dx-crumb span[aria-current] { color: #101114; font-weight: 500; }
.dx-crumb-sep { color: #c6c9ce; }

/* hero da página */
.dx-hero { padding: 0 0 clamp(30px, 3.6vw, 46px); border-bottom: 1px solid rgba(15,16,18,.07); margin-bottom: clamp(34px, 4vw, 54px); }
.dx-hero h1 {
    margin: 0;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 500;
    font-size: clamp(2rem, 3.8vw, 3rem);
    line-height: 1.1; letter-spacing: -0.025em;
    color: #101114;
}
.dx-lead {
    margin: clamp(14px, 1.6vw, 20px) 0 0;
    max-width: 680px;
    font-size: clamp(1.02rem, 1.35vw, 1.19rem);
    line-height: 1.6; color: #6a6d76;
}
.dx-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

/* ---------------------------- TIPOGRAFIA --------------------------------- */
.dx-main section { scroll-margin-top: calc(var(--dx-nav-h, 64px) + 28px); }
.dx-main h2 {
    margin: clamp(48px, 5vw, 76px) 0 16px;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 500;
    font-size: clamp(1.5rem, 2.4vw, 1.95rem);
    line-height: 1.22; letter-spacing: -0.02em; color: #101114;
    scroll-margin-top: calc(var(--dx-nav-h, 64px) + 28px);
}
.dx-main h3 {
    margin: clamp(30px, 3vw, 40px) 0 12px;
    font-size: clamp(1.08rem, 1.4vw, 1.22rem); font-weight: 600;
    letter-spacing: -0.01em; color: #101114;
    scroll-margin-top: calc(var(--dx-nav-h, 64px) + 28px);
}
.dx-main h4 { margin: 26px 0 10px; font-size: 15px; font-weight: 600; color: #101114; }
.dx-main p { margin: 0 0 16px; font-size: 15.5px; line-height: 1.72; color: #4e525a; max-width: 74ch; }
.dx-main a:not(.dx-btn):not(.dx-card) { color: #101114; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(16,17,20,.28); }
.dx-main a:not(.dx-btn):not(.dx-card):hover { text-decoration-color: rgba(16,17,20,.7); }
.dx-main strong { color: #26282e; font-weight: 600; }

.dx-main ul, .dx-main ol { margin: 0 0 18px; padding-left: 22px; max-width: 74ch; }
.dx-main li { margin: 0 0 9px; font-size: 15.5px; line-height: 1.7; color: #4e525a; }
.dx-main li::marker { color: #a8adb5; }

.dx-main code {
    font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .875em;
    padding: 2px 6px; border-radius: 6px;
    background: #f1f1ee; border: 1px solid #e7e7e3; color: #26282e;
    overflow-wrap: break-word; word-break: break-word;   /* tokens longos não estouram a coluna no mobile */
}

.dx-hr { height: 1px; background: rgba(15,16,18,.07); border: 0; margin: clamp(40px, 4.5vw, 64px) 0; }

/* =============================== BADGES =================================== */
.dx-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    background: #f4f4f2; border: 1px solid #e7e7e3;
    font-size: 11.5px; font-weight: 600; letter-spacing: .03em; color: #5c6068;
    white-space: nowrap;
}
.dx-badge--dark  { background: #101114; border-color: #101114; color: #f4f6ee; }
.dx-badge--lime  { background: #f4ffcc; border-color: #e4f7a0; color: #4a5c00; }
.dx-badge--soft  { background: #ffffff; }

/* =============================== CALLOUTS ================================= */
.dx-callout {
    display: flex; gap: 13px;
    margin: 24px 0;
    padding: 16px 18px;
    border: 1px solid rgba(15,16,18,.08);
    border-left: 3px solid #101114;
    border-radius: 12px;
    background: #ffffff;
    max-width: 74ch;
}
.dx-callout svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; color: #101114; }
.dx-callout-body { min-width: 0; }
.dx-callout-title { display: block; margin-bottom: 5px; font-size: 13.5px; font-weight: 600; color: #101114; }
.dx-callout p { margin: 0; font-size: 14.5px; line-height: 1.65; color: #55596180; color: #555961; }
.dx-callout p + p { margin-top: 10px; }
.dx-callout--info  { border-left-color: #3b6fd4; } .dx-callout--info svg  { color: #3b6fd4; }
.dx-callout--warn  { border-left-color: #c98a12; } .dx-callout--warn svg  { color: #c98a12; }
.dx-callout--ok    { border-left-color: #2f8a5b; } .dx-callout--ok svg    { color: #2f8a5b; }
.dx-callout--tip   { border-left-color: #7a5cd0; } .dx-callout--tip svg   { color: #7a5cd0; }

/* ================================ CARDS =================================== */
.dx-cards { display: grid; gap: 14px; margin: 24px 0; }
.dx-cards--2 { grid-template-columns: repeat(2, 1fr); }
.dx-cards--3 { grid-template-columns: repeat(3, 1fr); }
.dx-card {
    display: block;
    padding: 18px 20px;
    background: #ffffff;
    border: 1px solid rgba(15,16,18,.06);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15,16,18,.03);
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
a.dx-card:hover { transform: translateY(-2px); border-color: rgba(15,16,18,.11); box-shadow: 0 2px 4px rgba(15,16,18,.04), 0 18px 40px -24px rgba(15,16,18,.24); }
.dx-card-ic {
    width: 34px; height: 34px; display: grid; place-items: center; margin-bottom: 12px;
    border-radius: 10px; border: 1px solid #ececea; background: #fafafa; color: #3a3a3a;
}
.dx-card-ic svg { width: 17px; height: 17px; }
.dx-card h4, .dx-card h3 { margin: 0 0 6px; font-size: 14.5px; font-weight: 600; color: #101114; }
.dx-card p { margin: 0; font-size: 13.5px; line-height: 1.6; color: #6a6d76; }

/* ================================= STEPS ================================== */
.dx-steps { margin: 26px 0; padding: 0; list-style: none; counter-reset: dxstep; }
.dx-steps > li {
    position: relative;
    margin: 0; padding: 0 0 26px 44px;
    border-left: 1px solid rgba(15,16,18,.10);
    counter-increment: dxstep;
    max-width: 72ch;
}
.dx-steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.dx-steps > li::before {
    content: counter(dxstep);
    position: absolute; left: -14px; top: -2px;
    width: 28px; height: 28px; display: grid; place-items: center;
    border-radius: 999px; background: #101114; color: #fff;
    font-size: 12.5px; font-weight: 600;
}
.dx-steps h4 { margin: 2px 0 7px; font-size: 15px; }
.dx-steps p  { margin: 0; font-size: 14.5px; }

/* ================================= TABS =================================== */
.dx-tabs { margin: 24px 0; }
.dx-tablist {
    display: flex; gap: 4px; flex-wrap: wrap;
    padding: 4px;
    background: #f1f1ee; border: 1px solid #e7e7e3; border-radius: 12px;
    width: fit-content; max-width: 100%;
}
.dx-tab {
    padding: 7px 15px; border: 0; border-radius: 9px;
    background: transparent; color: #5c6068; cursor: pointer;
    font-family: inherit; font-size: 13.5px; font-weight: 500;
    transition: background .18s ease, color .18s ease;
}
.dx-tab:hover { color: #101114; }
.dx-tab[aria-selected="true"] { background: #ffffff; color: #101114; font-weight: 600; box-shadow: 0 1px 2px rgba(15,16,18,.06); }
.dx-tabpanel { margin-top: 16px; }
.dx-tabpanel[hidden] { display: none; }

/* ============================== ACCORDION ================================= */
.dx-acc { margin: 24px 0; max-width: 74ch; border-top: 1px solid rgba(15,16,18,.08); }
.dx-acc details { border-bottom: 1px solid rgba(15,16,18,.08); }
.dx-acc summary {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 2px; cursor: pointer; list-style: none;
    font-size: 15px; font-weight: 550; color: #101114;
    transition: color .18s ease;
}
.dx-acc summary::-webkit-details-marker { display: none; }
.dx-acc summary:hover { color: #000; }
.dx-acc summary::after {
    content: ""; flex: 0 0 auto;
    width: 9px; height: 9px; margin-right: 4px;
    border-right: 1.6px solid #9aa0a6; border-bottom: 1.6px solid #9aa0a6;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .22s ease;
}
.dx-acc details[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.dx-acc details > *:not(summary) { margin-bottom: 16px; }
.dx-acc p { font-size: 14.5px; }

/* ============================= BLOCO DE CÓDIGO ============================ */
.dx-code {
    position: relative;
    margin: 22px 0;
    border-radius: 14px;
    background: var(--brand-dark, #101114);
    border: 1px solid rgba(255,255,255,.06);
    overflow: hidden;
}
.dx-code-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.dx-code-name {
    font-family: 'Roboto Mono', ui-monospace, monospace;
    font-size: 12px; color: rgba(244,246,238,.62); letter-spacing: .02em;
}
.dx-copy {
    padding: 5px 11px; border-radius: 8px; cursor: pointer;
    background: rgba(244,246,238,.08); border: 1px solid rgba(244,246,238,.14);
    color: rgba(244,246,238,.86); font-family: inherit; font-size: 11.5px; font-weight: 500;
    transition: background .18s ease;
}
.dx-copy:hover { background: rgba(244,246,238,.16); }
.dx-code pre {
    margin: 0; padding: 16px 18px; overflow-x: auto;
    font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px; line-height: 1.7; color: #e8ebe0;
    tab-size: 2;
}
.dx-code pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

/* --------------------------- syntax highlight ---------------------------- */
/* Tokens marcados por assets/js/docs-solutions.js. Paleta derivada da marca:
   lima (--primary-color) para palavras-chave, neutros quentes para o resto.
   Contraste verificado sobre #101114 (todos acima de 4.5:1). */
.dx-t-com { color: #6f7680; font-style: italic; }   /* comentário */
.dx-t-str { color: #c3e88d; }                        /* string     */
.dx-t-num { color: #f2b880; }                        /* número     */
.dx-t-key { color: #ccff00; font-weight: 500; }      /* palavra-chave (lima da marca) */
.dx-t-fun { color: #8fd0ff; }                        /* função     */
.dx-t-typ { color: #ffd479; }                        /* tipo/classe */
.dx-t-var { color: #e8ebe0; }                        /* identificador */
.dx-t-op  { color: #a8b0bd; }                        /* operador/pontuação */
.dx-t-atr { color: #b3a1ff; }                        /* atributo/chave JSON */

/* ================================ TABELA ================================== */
.dx-table-wrap { margin: 24px 0; overflow-x: auto; border: 1px solid rgba(15,16,18,.08); border-radius: 12px; background: #fff; }
.dx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dx-table th, .dx-table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(15,16,18,.07); }
.dx-table th { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #8a8f98; background: #fbfbfa; white-space: nowrap; }
.dx-table tr:last-child td { border-bottom: 0; }
.dx-table td { color: #4e525a; line-height: 1.6; }
.dx-table code { white-space: nowrap; }

/* =============================== DIAGRAMA ================================= */
/* Fluxo horizontal de caixas ligadas por seta — CSS puro, sem imagem. */
.dx-diagram {
    margin: 26px 0; padding: clamp(20px, 2.4vw, 30px);
    background: #ffffff; border: 1px solid rgba(15,16,18,.07); border-radius: 16px;
    overflow-x: auto;
}
.dx-flow { display: flex; align-items: stretch; gap: 0; min-width: min-content; }
.dx-flow-node {
    flex: 1 1 0; min-width: 132px;
    padding: 14px 16px;
    background: var(--page-background); border: 1px solid rgba(15,16,18,.08); border-radius: 12px;
    text-align: center;
}
.dx-flow-node strong { display: block; font-size: 13.5px; font-weight: 600; color: #101114; margin-bottom: 4px; }
.dx-flow-node span   { display: block; font-size: 12px; line-height: 1.5; color: #7a7e86; }
.dx-flow-node--accent { background: #101114; border-color: #101114; }
.dx-flow-node--accent strong { color: #f4f6ee; }
.dx-flow-node--accent span   { color: rgba(244,246,238,.66); }
.dx-flow-arrow {
    flex: 0 0 34px; display: grid; place-items: center;
    color: #c2c6cc; font-size: 17px; line-height: 1;
}
/* pilha vertical de camadas (arquitetura) */
.dx-stack { display: grid; gap: 10px; margin: 26px 0; }
.dx-layer {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 15px 18px;
    background: #ffffff; border: 1px solid rgba(15,16,18,.07); border-radius: 12px;
}
.dx-layer-name { font-size: 14px; font-weight: 600; color: #101114; }
.dx-layer-desc { font-size: 13px; color: #6a6d76; flex: 1 1 320px; }
.dx-layer--edge { background: #101114; border-color: #101114; }
.dx-layer--edge .dx-layer-name { color: #f4f6ee; }
.dx-layer--edge .dx-layer-desc { color: rgba(244,246,238,.66); }

/* ============================ ÍNDICE (direita) ============================ */
.dx-toc {
    position: sticky; top: calc(var(--dx-nav-h, 64px) + var(--dx-nav-gap, 24px)); align-self: start;
    max-height: calc(100vh - var(--dx-nav-h, 64px) - var(--dx-nav-gap, 24px) - 20px); overflow-y: auto;
    padding: 8px 0 40px;
    scrollbar-width: thin;
}
.dx-toc::-webkit-scrollbar { width: 6px; }
.dx-toc::-webkit-scrollbar-thumb { background: rgba(15,16,18,.12); border-radius: 999px; }
.dx-toc-title { display: block; margin-bottom: 12px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #9aa0a6; }
.dx-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid rgba(15,16,18,.09); }
.dx-toc li { margin: 0; }
.dx-toc a {
    display: block; padding: 6px 0 6px 14px; margin-left: -1px;
    border-left: 1.5px solid transparent;
    font-size: 13px; line-height: 1.45; color: #8a8f98; text-decoration: none;
    transition: color .16s ease, border-color .16s ease;
}
.dx-toc a:hover { color: #101114; }
.dx-toc a.is-active { color: #101114; font-weight: 550; border-left-color: #101114; }
.dx-toc a.dx-toc--sub { padding-left: 26px; font-size: 12.5px; }

/* ============================ NAV ANTERIOR/PRÓXIMA ======================== */
.dx-pager { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: clamp(48px, 5vw, 72px); }
.dx-pager a {
    display: block; padding: 16px 18px;
    background: #fff; border: 1px solid rgba(15,16,18,.07); border-radius: 14px;
    text-decoration: none; transition: border-color .2s ease, transform .2s ease;
}
.dx-pager a:hover { border-color: rgba(15,16,18,.14); transform: translateY(-2px); }
.dx-pager span { display: block; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: #9aa0a6; margin-bottom: 5px; }
.dx-pager strong { font-size: 14.5px; font-weight: 600; color: #101114; }
.dx-pager a:last-child { text-align: right; }

/* =============================== RESPONSIVO ============================== */
@media (max-width: 1180px) {
    .dx-shell { grid-template-columns: 240px minmax(0, 1fr); }
    .dx-toc { display: none; }                       /* índice some antes da sidebar */
}
@media (max-width: 900px) {
    .dx-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .dx-side {
        position: static; max-height: none; overflow: visible;
        margin-bottom: 28px; padding: 18px 0 0;
        border-bottom: 1px solid rgba(15,16,18,.08);
    }
    .dx-side-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
    .dx-cards--3, .dx-cards--2 { grid-template-columns: 1fr; }
    .dx-pager { grid-template-columns: 1fr; }
    .dx-pager a:last-child { text-align: left; }
}
@media (max-width: 620px) {
    /* a navbar cresce para 70px neste breakpoint (navbar.css) */
    body.dx { --dx-nav-h: 70px; }
    .dx-side-groups { grid-template-columns: 1fr; }
    .dx-flow { flex-direction: column; }
    .dx-flow-arrow { flex: 0 0 26px; transform: rotate(90deg); }
    .dx-tablist { width: 100%; }
}

@media (max-width: 390px) {
    body.dx { --dx-nav-h: 64px; }            /* volta a 64px (navbar.css) */
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .dx-card, .dx-pager a { transition: none; }
    a.dx-card:hover, .dx-pager a:hover { transform: none; }
}

/* Touch: navegação lateral, abas e botão copiar com alvo maior. */
@media (pointer: coarse) {
    .dx-side a, .dx-side-cat > summary { min-height: 44px; }
    .dx-tab { min-height: 44px; }
    .dx-copy { min-height: 40px; }
}
