/* Estilos de leitura da documentação (usa os tokens de shared.css). */
body.docs { overflow-x: visible; }
body.docs nav.topbar { position: sticky; top: 0; z-index: 200; }
body.docs .nav-inner { max-width: 1400px; }
nav.side, nav.pn { position: static; background: none; backdrop-filter: none; border: 0; z-index: auto; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 999; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent3); outline-offset: 2px; border-radius: 4px; }

.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr) 224px; gap: 0 44px; max-width: 1400px; margin: 0 auto; padding: 0 28px; align-items: start; }

/* ── Menu lateral ── */
.rail { position: sticky; top: 57px; height: calc(100vh - 57px); overflow-y: auto; padding: 24px 0 40px; scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
.search { position: relative; margin-bottom: 18px; }
.search input { width: 100%; padding: 10px 12px; background: var(--card); color: var(--fg); border: 1px solid var(--border2); border-radius: var(--radius); font: inherit; font-size: 14px; }
.search input::placeholder { color: var(--fg3); }
.results { list-style: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; background: var(--card2); border: 1px solid var(--border2); border-radius: var(--radius); box-shadow: var(--shadow2); max-height: 60vh; overflow: auto; }
.results li a { display: block; padding: 10px 12px; text-decoration: none; color: var(--fg); border-bottom: 1px solid var(--border); }
.results li:last-child a { border-bottom: 0; }
.results li a:hover, .results li a.sel { background: rgba(108,99,255,.14); }
.results b { display: block; font-size: 14px; }
.results small { display: block; color: var(--fg2); font-size: 12px; margin-top: 2px; line-height: 1.45; }
.results .none { padding: 12px; color: var(--fg2); font-size: 13px; }
.side-home { display: block; padding: 7px 10px; margin-bottom: 8px; color: var(--fg); font-weight: 700; font-size: 14px; text-decoration: none; border-radius: 8px; }
.side-home:hover, .side-home.is-current { background: rgba(108,99,255,.14); }
.side-group { margin-bottom: 6px; }
.side-group summary { cursor: pointer; list-style: none; padding: 8px 10px; font-size: 13px; font-weight: 700; color: var(--fg2); border-radius: 8px; display: flex; justify-content: space-between; }
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary::after { content: "+"; color: var(--fg3); font-weight: 400; }
.side-group[open] > summary::after { content: "–"; }
.side-group summary:hover { color: var(--fg); }
.side-group ul { list-style: none; margin: 2px 0 8px 10px; border-left: 1px solid var(--border2); }
.side-group li a { display: block; padding: 5px 12px; font-size: 14px; color: var(--fg2); text-decoration: none; margin-left: -1px; border-left: 2px solid transparent; }
.side-group li a:hover { color: var(--fg); }
.side-group li a.is-current { color: var(--accent2); border-left-color: var(--accent); font-weight: 600; background: rgba(108,99,255,.08); }

/* ── Conteúdo ── */
.doc { min-width: 0; padding: 36px 0 24px; }
.doc:focus { outline: none; }
.rail-toggle { display: none; margin-bottom: 18px; background: var(--card); color: var(--fg); border: 1px solid var(--border2); border-radius: var(--radius); padding: 9px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.prose { max-width: 78ch; font-size: 16px; line-height: 1.75; color: var(--fg); }
.prose h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.15; letter-spacing: -.025em; font-weight: 800; margin: 0 0 22px; }
.prose h2 { font-size: 26px; letter-spacing: -.015em; font-weight: 800; margin: 52px 0 14px; padding-top: 28px; border-top: 1px solid var(--border); line-height: 1.25; scroll-margin-top: 76px; }
.prose h3 { font-size: 20px; font-weight: 700; margin: 34px 0 10px; line-height: 1.3; scroll-margin-top: 76px; }
.prose h4 { font-size: 16px; font-weight: 700; margin: 24px 0 8px; color: var(--accent2); scroll-margin-top: 76px; }
.prose h1 + hr, .prose hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
.prose h2 + hr { display: none; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose .table-wrap, .prose pre { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li { margin: 4px 0; }
.prose li > ul, .prose li > ol { margin: 4px 0 4px; }
.prose a { color: var(--accent3); text-decoration: underline; text-decoration-color: rgba(56,189,248,.35); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose strong { font-weight: 700; color: #fff; }
.anchor { margin-left: 8px; font-weight: 400; font-size: .7em; color: var(--fg3); text-decoration: none !important; opacity: 0; }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
.prose blockquote { padding: 12px 18px; border-left: 3px solid var(--accent); background: rgba(108,99,255,.07); border-radius: 0 var(--radius) var(--radius) 0; color: var(--fg2); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose code { font-family: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace; font-size: .88em; background: var(--card2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; color: #d9d4ff; }
.prose pre { position: relative; background: #05050f; border: 1px solid var(--border2); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; }
.prose pre code { background: none; border: 0; padding: 0; color: #dbe4f3; font-size: inherit; }
.copy { position: absolute; top: 8px; right: 8px; background: var(--card2); color: var(--fg2); border: 1px solid var(--border2); border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.prose pre:hover .copy, .copy:focus { opacity: 1; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border2); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.prose th { text-align: left; background: var(--card2); color: var(--fg); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border2); white-space: nowrap; }
.prose td { padding: 9px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.prose tr:nth-child(even) td { background: rgba(255,255,255,.015); }
.prose td code { white-space: nowrap; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }
.prose details { margin: 0 0 16px; padding: 10px 16px; border: 1px solid var(--border2); border-radius: var(--radius); background: var(--card); }
.prose summary { cursor: pointer; font-weight: 600; }
.prose kbd { font: inherit; font-size: .85em; padding: 1px 6px; border: 1px solid var(--border2); border-bottom-width: 2px; border-radius: 5px; background: var(--card2); }

/* ── Anterior / próxima ── */
.pager { max-width: 78ch; margin-top: 56px; }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pn a { display: block; padding: 14px 18px; border: 1px solid var(--border2); border-radius: var(--radius); background: var(--card); color: var(--fg); text-decoration: none; font-weight: 700; transition: border-color .2s; }
.pn a:hover { border-color: var(--accent); }
.pn small { display: block; color: var(--fg3); font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.pn .next { text-align: right; grid-column: 2; }
.pn .prev { grid-column: 1; }
.edit { margin-top: 22px; font-size: 13px; color: var(--fg3); }
.edit a { color: var(--fg2); }

/* ── Nesta página ── */
.toc { position: sticky; top: 57px; max-height: calc(100vh - 57px); overflow-y: auto; padding: 36px 0 40px; font-size: 13px; scrollbar-width: thin; }
.toc-t { font-weight: 700; color: var(--fg2); margin-bottom: 10px; }
.toc ul { list-style: none; border-left: 1px solid var(--border2); }
.toc li a { display: block; padding: 4px 12px; color: var(--fg3); text-decoration: none; margin-left: -1px; border-left: 2px solid transparent; line-height: 1.4; }
.toc li.l3 a { padding-left: 24px; }
.toc li a:hover { color: var(--fg); }
.toc li a.on { color: var(--accent2); border-left-color: var(--accent); }

.site-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; max-width: 1400px; margin: 40px auto 0; padding: 22px 28px; border-top: 1px solid var(--border); color: var(--fg3); font-size: 13px; }
.site-foot a { color: var(--fg2); }

@media (max-width: 1180px) { .shell { grid-template-columns: 250px minmax(0, 1fr); } .toc { display: none; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 0 18px; }
  .rail { position: static; height: auto; display: none; padding: 16px 0 0; }
  .rail.open { display: block; }
  .rail-toggle { display: inline-block; }
  .nav-links a:not(.nav-cta) { display: none; }
  .pn { grid-template-columns: 1fr; } .pn .next, .pn .prev { grid-column: 1; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
