/* LegendScripts docs */
body.docs { --sidebar-w: 280px; }
.docs-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.docs-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem 0.85rem; background: #090c12; border-right: 1px solid var(--border); }
.docs-brand { display: flex; justify-content: space-between; align-items: center; padding: 0.25rem 0.35rem 0.5rem; }
.docs-brand a { text-decoration: none; }
.docs-brand .logo-text { font-size: 1.05rem; }
.docs-close { display: none; }
.docs-search-btn { display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 40px; padding: 0.45rem 0.7rem; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 0.92rem; }
.docs-search-btn span { flex: 1; text-align: left; }
.docs-search-btn:hover { color: #fff; border-color: rgba(96, 165, 250, 0.5); }
.section-switch { position: relative; }
.section-current { display: flex; align-items: center; gap: 0.55rem; width: 100%; min-height: 44px; padding: 0.5rem 0.7rem; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: #fff; font-weight: 700; cursor: pointer; }
.section-current span { flex: 1; text-align: left; }
.section-current .icon:first-child { color: #93c5fd; }
.section-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; max-height: 60vh; overflow-y: auto; list-style: none; margin: 0; padding: 0.35rem; background: #0f1522; border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); }
.section-menu a { display: flex; gap: 0.55rem; align-items: center; padding: 0.5rem 0.6rem; border-radius: 8px; color: #cbd5e1; text-decoration: none; font-size: 0.93rem; }
.section-menu a:hover, .section-menu a:focus-visible, .section-menu a[aria-current="true"] { background: rgba(59, 130, 246, 0.16); color: #fff; }
.docs-pages { list-style: none; padding: 0; margin: 0.25rem 0; display: grid; gap: 0.1rem; }
.docs-pages a { display: flex; gap: 0.5rem; align-items: center; padding: 0.45rem 0.7rem; border-radius: 8px; color: #b5bfcf; text-decoration: none; font-size: 0.93rem; }
.docs-pages a:hover { color: #fff; background: rgba(148, 163, 184, 0.08); }
.docs-pages a[aria-current="page"] { color: #fff; background: rgba(59, 130, 246, 0.18); font-weight: 700; box-shadow: inset 2px 0 0 #60a5fa; }
.docs-sidebar-foot { margin-top: auto; display: grid; gap: 0.15rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.docs-sidebar-foot a { display: flex; gap: 0.5rem; align-items: center; padding: 0.45rem 0.6rem; color: var(--muted); text-decoration: none; border-radius: 8px; font-size: 0.9rem; }
.docs-sidebar-foot a:hover { color: #fff; background: rgba(148, 163, 184, 0.08); }
.docs-main { min-width: 0; background: radial-gradient(60% 40% at 50% -10%, rgba(37, 99, 235, 0.16), transparent 70%); }
.docs-topbar { display: none; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; background: rgba(7, 9, 14, 0.92); backdrop-filter: blur(10px); }
.docs-content-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 2.5rem; max-width: 1160px; margin: 0 auto; padding: 2.5rem 2rem 2rem; }
.docs-home { grid-column: 1 / -1; }
.docs-hero { text-align: center; padding: 2rem 0 3rem; }
.docs-hero h1 { font-size: clamp(2rem, 4vw, 3rem); max-width: 18ch; margin: 0 auto 0.75rem; }
.docs-hero .lead { margin: 0 auto 1.75rem; }
.hero-search { display: inline-flex; align-items: center; gap: 0.75rem; width: min(560px, 100%); min-height: 52px; padding: 0.6rem 1rem; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 1rem; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); }
.hero-search span { flex: 1; text-align: left; }
.hero-search:hover { border-color: rgba(96, 165, 250, 0.5); color: #fff; }
.docs-home h2 { font-size: 1.25rem; margin: 2rem 0 1rem; }
.solution-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 0.75rem; }
.solution-card { display: grid; gap: 0.35rem; height: 100%; padding: 1rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: inherit; text-decoration: none; transition: border-color 0.2s, transform 0.2s; }
.solution-card .icon { color: #93c5fd; margin-bottom: 0.35rem; }
.solution-card strong { color: #fff; }
.solution-card span { color: var(--muted); font-size: 0.88rem; }
.solution-card:hover { border-color: rgba(96, 165, 250, 0.5); transform: translateY(-2px); color: inherit; }
.guide-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 1rem; }
.guide-card { display: flex; flex-direction: column; height: 100%; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); background: var(--surface); color: inherit; text-decoration: none; position: relative; transition: border-color 0.2s, transform 0.25s var(--ease); }
.guide-card:hover { border-color: rgba(96, 165, 250, 0.5); transform: translateY(-3px); color: inherit; }
.guide-art img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.guide-meta { display: grid; gap: 0.2rem; padding: 0.85rem 2.5rem 1rem 1rem; }
.guide-meta strong { color: #fff; }
.guide-meta span { color: var(--muted); font-size: 0.86rem; }
.guide-card > .icon { position: absolute; right: 1rem; bottom: 1.1rem; color: #93c5fd; }

.doc-article { min-width: 0; }
.doc-eyebrow { display: flex; align-items: center; gap: 0.45rem; color: #93c5fd; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.5rem; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.doc-head h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); margin-bottom: 0.35rem; }
.doc-lead { color: var(--muted); font-size: 1.1rem; margin-bottom: 1.5rem; }
.doc-body { border-top: 1px solid var(--border); padding-top: 1.25rem; }
.doc-body h2 { font-size: 1.4rem; margin-top: 2.2rem; scroll-margin-top: 1.5rem; }
.doc-body h3 { scroll-margin-top: 1.5rem; }
.doc-body h2 .anchor, .doc-body h3 .anchor { color: #475569; text-decoration: none; margin-right: 0.4rem; opacity: 0; transition: opacity 0.2s; }
.doc-body h2:hover .anchor, .doc-body h3:hover .anchor { opacity: 1; }
.code-block { margin: 1.1rem 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #0a0e16; }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 0.35rem 0.5rem 0.35rem 0.9rem; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.copy-btn { background: transparent; border: 1px solid var(--border-strong); color: #cbd5e1; border-radius: 6px; padding: 0.2rem 0.6rem; font-size: 0.78rem; cursor: pointer; min-height: 30px; }
.copy-btn:hover { color: #fff; border-color: #60a5fa; }
.code-block pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; line-height: 1.55; }
.code-block code { background: none; border: 0; padding: 0; color: #dbe7ff; font-size: 0.88rem; }
.tok-c { color: #7c8aa3; font-style: italic; }
.tok-s { color: #a5e3a1; }
.tok-k { color: #c4a7ff; }
.tok-n { color: #ffcb8b; }
.tok-f { color: #82c7ff; }
.doc-updated { margin-top: 2.5rem; font-size: 0.86rem; }
.doc-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.25rem; }
.pager-card { display: grid; gap: 0.2rem; padding: 0.9rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit; background: var(--surface); transition: border-color 0.2s; }
.pager-card span { color: var(--muted); font-size: 0.85rem; display: inline-flex; gap: 0.3rem; align-items: center; }
.pager-card strong { color: #fff; }
.pager-card.next { text-align: right; justify-items: end; }
.pager-card:hover { border-color: rgba(96, 165, 250, 0.5); color: inherit; }
.docs-toc { position: sticky; top: 2rem; align-self: start; font-size: 0.88rem; }
.docs-toc h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 0.75rem; }
.docs-toc ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.15rem; border-left: 1px solid var(--border); }
.docs-toc a { display: block; padding: 0.3rem 0.8rem; color: var(--muted); text-decoration: none; margin-left: -1px; border-left: 2px solid transparent; }
.docs-toc .lvl-3 a { padding-left: 1.5rem; font-size: 0.84rem; }
.docs-toc a:hover { color: #fff; }
.docs-toc a.active { color: #fff; border-left-color: #60a5fa; }
.docs-footer { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }
.docs-footer p { margin: 0.25rem 0; }

.search-dialog { position: fixed; inset: 0; z-index: 110; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 1rem 1rem; background: rgba(2, 4, 8, 0.7); backdrop-filter: blur(4px); }
.search-dialog[hidden] { display: none; }
.search-box { width: min(640px, 100%); max-height: 72vh; display: flex; flex-direction: column; background: #0f1522; border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.search-input { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--border); }
.search-input input { border: 0; background: transparent; box-shadow: none !important; padding: 0.5rem 0; font-size: 1.05rem; }
.search-input .icon { color: #93c5fd; }
.search-results { list-style: none; margin: 0; padding: 0.5rem; overflow-y: auto; }
.search-results a { display: grid; gap: 0.15rem; padding: 0.65rem 0.8rem; border-radius: 10px; text-decoration: none; color: inherit; }
.search-results a small { color: #93c5fd; font-weight: 700; font-size: 0.78rem; }
.search-results a span { color: var(--muted); font-size: 0.86rem; }
.search-results a strong { color: #fff; }
.search-results a[aria-selected="true"], .search-results a:hover { background: rgba(59, 130, 246, 0.16); }
.search-results mark { background: rgba(250, 204, 21, 0.3); color: inherit; border-radius: 3px; }
.search-empty { padding: 1rem 1.2rem; color: var(--muted); margin: 0; }

@media (max-width: 1100px) { .docs-content-wrap { grid-template-columns: minmax(0, 1fr); } .docs-toc { display: none; } }
@media (max-width: 860px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .docs-sidebar { position: fixed; z-index: 60; inset: 0 auto 0 0; width: min(320px, 88vw); transform: translateX(-100%); transition: transform 0.3s var(--ease); }
  .docs-sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, 0.6); }
  .docs-close { display: inline-flex; }
  .docs-topbar { display: flex; }
  .docs-content-wrap { padding: 1.5rem 1.1rem; }
  .doc-pager { grid-template-columns: 1fr; }
}
