/* ==========================================================================
   DRS documentation (/docs)
   ========================================================================== */

/* ---------- index hero + search ---------- */
.docs-hero { padding: 64px 0 36px; text-align: center; }
.docs-hero h1 { margin-bottom: 12px; }
.docs-hero-lead { max-width: 640px; margin: 0 auto 28px; font-size: 1.05rem; }

.docs-search { position: relative; max-width: 640px; margin: 0 auto; text-align: left; }
.docs-search > svg { position: absolute; left: 18px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.docs-search input {
    width: 100%; height: 58px; padding: 0 56px 0 50px;
    border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font: inherit; font-size: 1.02rem;
    transition: border-color .15s ease, box-shadow .2s ease;
}
.docs-search input:focus { outline: none; border-color: var(--primary); box-shadow: var(--shadow-glow); }
.docs-search > kbd { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
.docs-search-results {
    position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 30;
    max-height: 420px; overflow-y: auto; padding: 6px;
    border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
    box-shadow: var(--shadow-soft);
}
.docs-search-results a { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); }
.docs-search-results a:hover, .docs-search-results a.is-focus { background: var(--surface-2); }
.docs-search-results small { color: var(--primary); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.docs-search-results span { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-search-results p { padding: 14px; margin: 0; }

.docs-stats { display: flex; justify-content: center; gap: 28px; margin-top: 22px; color: var(--muted); font-size: .9rem; flex-wrap: wrap; }
.docs-stats strong { color: var(--text); }

kbd {
    display: inline-block; min-width: 22px; padding: 1px 7px;
    border-radius: 6px; border: 1px solid var(--border); border-bottom-width: 2px;
    background: var(--surface-2); color: var(--text);
    font: 600 .8rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center;
}

/* ---------- index sections ---------- */
.docs-section-head { margin: 44px 0 16px; }
.docs-section-head:first-child { margin-top: 0; }
.docs-section-head h2 { font-size: 1.35rem; display: flex; align-items: center; gap: 10px; }
.docs-section-head p { margin-top: 6px; }
.docs-count { font-size: .78rem; font-weight: 700; color: var(--muted); padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); }

.docs-guides { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.docs-guide { display: grid; gap: 6px; padding: 20px; color: var(--text); }
.docs-guide-num { font: 800 .8rem var(--font-display); color: var(--primary); letter-spacing: .08em; }
.docs-guide strong { font-size: 1.02rem; }
.docs-guide span:last-child { color: var(--muted); font-size: .9rem; line-height: 1.5; }

.docs-scripts { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.docs-script { display: grid; grid-template-columns: 76px 1fr; gap: 14px; padding: 14px; color: var(--text); align-items: start; }
.docs-script-thumb { width: 76px; height: 76px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.docs-script-thumb img { width: 100%; height: 100%; object-fit: cover; }
.docs-script-body { display: grid; gap: 6px; min-width: 0; }
.docs-script-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.docs-script-desc { color: var(--muted); font-size: .88rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.docs-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.docs-tags > span {
    font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.docs-tags > span.is-free { color: var(--success); border-color: rgba(34, 197, 94, .35); }
.docs-version { font: 700 .74rem ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--primary); }
.docs-tags > .docs-version { color: var(--primary); border-color: rgba(99, 102, 241, .35); }
.docs-resource { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.docs-help { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 48px; padding: 24px 28px; flex-wrap: wrap; }
.docs-help h3 { margin-bottom: 4px; }

/* ---------- page layout ---------- */
.docs-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 40px; align-items: start; }
.docs-sidebar, .docs-toc { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; scrollbar-color: transparent transparent; }
.docs-sidebar::-webkit-scrollbar-thumb, .docs-toc::-webkit-scrollbar-thumb { background-color: transparent; }
.docs-sidebar:hover, .docs-toc:hover { scrollbar-color: #2A3040 transparent; }
.docs-sidebar:hover::-webkit-scrollbar-thumb, .docs-toc:hover::-webkit-scrollbar-thumb { background-color: #2A3040; }

.docs-nav { display: grid; gap: 18px; padding-bottom: 20px; }
.docs-nav-filter {
    width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem;
}
.docs-nav-filter:focus { outline: none; border-color: var(--primary); }
.docs-nav-group { display: grid; gap: 2px; }
.docs-nav-title {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text);
    margin: 0 0 6px; cursor: default; list-style: none;
}
summary.docs-nav-title { cursor: pointer; }
summary.docs-nav-title::-webkit-details-marker { display: none; }
.docs-nav-title span { color: var(--muted); font-weight: 600; }
.docs-nav-group a {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding: 6px 10px; border-radius: var(--radius-sm); border-left: 2px solid transparent;
    color: var(--muted); font-size: .9rem;
}
.docs-nav-group a:hover { color: var(--text); background: var(--surface); }
.docs-nav-group a.is-active { color: var(--text); background: var(--surface); border-left-color: var(--primary); font-weight: 600; }
.docs-free { font-style: normal; font-size: .66rem; font-weight: 700; color: var(--success); }
.docs-nav-toggle { display: none; width: 100%; margin-bottom: 12px; }

.docs-crumbs { display: flex; gap: 8px; font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.docs-crumbs a { color: var(--muted); }
.docs-crumbs a:hover { color: var(--text); }

.docs-head { display: flex; gap: 20px; align-items: flex-start; padding-bottom: 26px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.docs-head > div { flex: 1; min-width: 0; }
.docs-head h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: 8px; }
.docs-head-lead { font-size: 1.02rem; margin-bottom: 14px; }
.docs-head-img { width: 96px; height: 96px; border-radius: var(--radius); object-fit: cover; border: 1px solid var(--border); flex-shrink: 0; }
.docs-head-cta { flex-shrink: 0; }

/* ---------- article content ---------- */
.docs-content { color: #CBD5E1; font-size: 1rem; line-height: 1.75; }
.docs-content > * + * { margin-top: 16px; }
.docs-content p { color: #CBD5E1; }
.docs-content h2 { font-size: 1.5rem; margin-top: 44px; padding-top: 8px; color: var(--text); }
.docs-content h3 { font-size: 1.15rem; margin-top: 30px; color: var(--text); }
.docs-content h4 { font-size: 1rem; margin-top: 22px; color: var(--text); }
.doc-h { position: relative; scroll-margin-top: 100px; }
.doc-anchor { position: absolute; left: -22px; color: var(--primary); opacity: 0; text-decoration: none; font-weight: 400; }
.doc-h:hover .doc-anchor { opacity: 1; }
.docs-content a { color: #A5B4FC; text-decoration: underline; text-decoration-color: rgba(165, 180, 252, .35); text-underline-offset: 3px; }
.docs-content a:hover { text-decoration-color: currentColor; }
.docs-content strong { color: var(--text); }
.docs-content ul, .docs-content ol { padding-left: 22px; }
.docs-content ul { list-style: disc; }
.docs-content ol { list-style: decimal; }
.docs-content li + li { margin-top: 6px; }
.docs-content li > ul, .docs-content li > ol { margin-top: 6px; }
.docs-content li::marker { color: var(--primary); }
.docs-content hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.docs-content :not(pre) > code {
    padding: 2px 6px; border-radius: 6px; font-size: .86em;
    background: rgba(99, 102, 241, .12); border: 1px solid rgba(99, 102, 241, .22); color: #C7D2FE;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.docs-content blockquote { padding: 12px 18px; border-left: 3px solid var(--border); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.doc-code { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #0B0D13; }
.doc-code-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface);
    font: 600 .8rem ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted);
}
.doc-copy { border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); border-radius: 6px; padding: 3px 10px; font: 600 .75rem var(--font-sans); cursor: pointer; }
.doc-copy:hover { color: var(--text); border-color: var(--primary); }
.doc-copy.is-done { color: var(--success); }
.doc-code pre { margin: 0; padding: 16px; overflow-x: auto; max-height: 560px; }
.doc-code code { font: .86rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; color: #E2E8F0; white-space: pre; }
.doc-code .tok-c { color: #64748B; font-style: italic; }
.doc-code .tok-s { color: #86EFAC; }
.doc-code .tok-k { color: #C4B5FD; }
.doc-code .tok-n { color: #FCD34D; }

.doc-table { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.doc-table table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.doc-table th { text-align: left; padding: 10px 14px; background: var(--surface); color: var(--text); font-weight: 700; border-bottom: 1px solid var(--border); white-space: nowrap; }
.doc-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-table tr:last-child td { border-bottom: 0; }

.doc-callout { padding: 14px 18px; border-radius: var(--radius-sm); border: 1px solid; }
.doc-callout > * + * { margin-top: 8px; }
.doc-callout-title { font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.doc-callout-note { border-color: rgba(99, 102, 241, .35); background: rgba(99, 102, 241, .08); }
.doc-callout-note .doc-callout-title { color: #A5B4FC; }
.doc-callout-tip { border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .07); }
.doc-callout-tip .doc-callout-title { color: #4ADE80; }
.doc-callout-warning { border-color: rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .08); }
.doc-callout-warning .doc-callout-title { color: #FBBF24; }
.doc-callout-danger { border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .08); }
.doc-callout-danger .doc-callout-title { color: #F87171; }

/* ---------- toc + footer ---------- */
.docs-toc nav { display: grid; gap: 2px; border-left: 1px solid var(--border); }
.docs-toc a { padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); font-size: .85rem; line-height: 1.4; }
.docs-toc a.lvl-3 { padding-left: 26px; font-size: .82rem; }
.docs-toc a:hover { color: var(--text); }
.docs-toc a.is-active { color: var(--text); border-left-color: var(--primary); }

.docs-foot { margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--border); }
.docs-foot > p { font-size: .85rem; }
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.docs-pager a { display: grid; gap: 4px; padding: 16px 18px; color: var(--text); }
.docs-pager a span { color: var(--muted); font-size: .8rem; }
.docs-pager a.is-next { text-align: right; grid-column: 2; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
    .docs-layout { grid-template-columns: 240px minmax(0, 1fr); }
    .docs-toc { display: none; }
}
@media (max-width: 900px) {
    .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .docs-sidebar { position: static; max-height: none; overflow: visible; }
    .docs-nav-toggle { display: inline-flex; justify-content: center; }
    .docs-sidebar .docs-nav { display: none; }
    .docs-sidebar.is-open .docs-nav { display: grid; }
    .docs-head { flex-wrap: wrap; }
    .docs-head-img { width: 64px; height: 64px; }
    .docs-scripts { grid-template-columns: 1fr; }
    .doc-anchor { display: none; }
}
@media (max-width: 560px) {
    .docs-hero { padding-top: 40px; }
    .docs-search > kbd { display: none; }
    .docs-pager { grid-template-columns: 1fr; }
    .docs-pager a.is-next { grid-column: 1; }
    .docs-script { grid-template-columns: 56px 1fr; }
    .docs-script-thumb { width: 56px; height: 56px; }
}
