/* Tantech Docs — Workspace Blue 1.0 adapted for documentation. */
:root {
	--blue: #1d4ed8;
	--blue-2: #2563eb;
	--navy: #172554;
	--sky: #0ea5e9;
	--hero: linear-gradient(125deg, #172554 0%, #1d4ed8 58%, #0ea5e9 100%);
	--card: #ffffff;
	--surface: #f8fafc;
	--chip: #eff6ff;
	--chip-border: #bfdbfe;
	--text: #1d2327;
	--muted: #59636e;
	--list: #4b5563;
	--border: #dfe3e8;
	--divider: #edf0f3;
	--ok: #166534; --ok-bg: #dcfce7;
	--warn: #92400e; --warn-bg: #fef3c7;
	--err: #991b1b; --err-bg: #fee2e2;
	--neutral: #475569; --neutral-bg: #e2e8f0;
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
	--top: 60px;
	--radius: 10px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--card); color: var(--text); font: 15px/1.65 var(--font); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 2px; border-radius: 4px; }
.icon { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: 11px/1 var(--mono); padding: 3px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--card); color: var(--muted); }

/* Header */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1440px; height: 100%; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--navy); }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--hero); color: #fff; }
.platform-nav { display: flex; gap: 4px; }
.platform-nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; font-size: 14px; }
.platform-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.platform-nav a[aria-current] { background: var(--chip); color: var(--blue); }
.search-btn { margin-left: auto; display: flex; align-items: center; gap: 8px; width: 260px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.search-btn:hover { border-color: var(--chip-border); }
.search-btn kbd { margin-left: auto; }
.lang-switch { display: flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); }
.lang-switch .icon { width: 16px; height: 16px; margin-right: 2px; }
.lang-switch button { height: 28px; min-width: 36px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--card); color: var(--blue); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface); }
.menu-btn { display: none; margin-left: -8px; }

/* Hero and index pages */
.hero { background: var(--hero); color: #fff; }
.hero-inner { max-width: 1120px; margin: 0 auto; padding: 64px 24px 72px; }
.hero .eyebrow { color: #bfdbfe; }
.hero h1 { margin: 6px 0 12px; font-size: 40px; line-height: 1.15; font-weight: 650; letter-spacing: -.02em; }
.hero p { max-width: 620px; margin: 0; color: #dbeafe; font-size: 17px; }
.hero-search { margin-top: 28px; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 520px; height: 48px; padding: 0 16px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 10px; background: rgba(255, 255, 255, .12); color: #fff; font: inherit; font-size: 15px; cursor: pointer; text-align: left; }
.hero-search:hover { background: rgba(255, 255, 255, .2); }
.hero-search kbd { margin-left: auto; background: transparent; color: #dbeafe; border-color: rgba(255, 255, 255, .4); }
.hero-compact .hero-inner { padding: 40px 24px 44px; }
.hero-compact h1 { font-size: 32px; }
.back-hero { display: inline-flex; align-items: center; gap: 6px; color: #dbeafe; font-size: 14px; }
.back-hero:hover { color: #fff; }

.index { max-width: 1120px; margin: 0 auto; padding: 48px 24px 72px; }
.index > section + section { margin-top: 56px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 22px; font-weight: 600; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { display: flex; flex-direction: column; padding: 24px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; }
a.card:hover { text-decoration: none; border-color: var(--chip-border); box-shadow: 0 10px 30px -18px rgba(29, 78, 216, .45); transform: translateY(-2px); }
.card h3 { margin: 14px 0 6px; font-size: 17px; font-weight: 600; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-meta, .card-link { margin-top: auto; padding-top: 16px; font-size: 13px; font-weight: 500; }
.card-meta { color: var(--muted); }
.card-link { display: inline-flex; align-items: center; gap: 6px; color: var(--blue); }
.card-link .icon { width: 15px; height: 15px; }
.is-planned { background: var(--surface); }
.is-planned .chip { background: var(--neutral-bg); color: var(--neutral); border-color: transparent; }
.chip { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--chip); border: 1px solid var(--chip-border); color: var(--blue); font-weight: 650; font-size: 13px; letter-spacing: .02em; }
.chip-lg { width: 44px; height: 44px; }
.chip-lg .icon { width: 22px; height: 22px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--chip); border: 1px solid var(--chip-border); color: var(--blue); font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-neutral { background: var(--neutral-bg); border-color: transparent; color: var(--neutral); }
.empty { grid-column: 1 / -1; padding: 48px 24px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.empty .chip { margin: 0 auto; }
.empty h3 { margin: 14px 0 6px; font-size: 17px; }
.empty p { margin: 0; color: var(--muted); font-size: 14px; }

/* Documentation layout */
.layout { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 280px minmax(0, 1fr) 220px; }
.sidebar { position: sticky; top: var(--top); height: calc(100vh - var(--top)); overflow-y: auto; border-right: 1px solid var(--border); background: var(--surface); }
.sidebar-inner { padding: 20px 16px 40px; }
.back-link { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.back-link .icon { width: 15px; height: 15px; }
.project-switch { width: 100%; height: 40px; margin-top: 14px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; font-weight: 600; font-size: 14px; }
.version { margin: 6px 2px 0; color: var(--muted); font-size: 12px; }
.nav-group { margin-top: 22px; }
.nav-title { margin: 0 0 6px; padding: 0 10px; color: var(--navy); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.nav-group ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.nav-group a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--list); font-size: 14px; line-height: 1.4; }
.nav-group a:hover { background: var(--card); color: var(--text); text-decoration: none; }
.nav-group a[aria-current] { background: var(--chip); color: var(--blue); font-weight: 600; box-shadow: inset 2px 0 0 var(--blue); }

.doc-col { min-width: 0; padding: 28px 48px 72px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb [aria-current] { color: var(--text); }
.eyebrow { margin: 0; color: var(--blue); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; }

.doc { max-width: 780px; padding-top: 18px; }
.doc h1 { margin: 6px 0 10px; font-size: 32px; line-height: 1.2; font-weight: 650; letter-spacing: -.015em; }
.doc .lead { margin: 0 0 28px; color: var(--muted); font-size: 17px; }
.doc h2 { margin: 44px 0 12px; padding-top: 20px; border-top: 1px solid var(--divider); font-size: 22px; line-height: 1.3; font-weight: 600; }
.doc h3 { margin: 28px 0 8px; font-size: 17px; font-weight: 600; }
.doc p, .doc ul, .doc ol { margin: 0 0 14px; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc li::marker { color: var(--muted); }
.doc strong { font-weight: 600; }
.anchor { margin-left: 4px; color: var(--chip-border); font-weight: 400; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
.doc code { padding: 1px 6px; border-radius: 5px; background: var(--surface); border: 1px solid var(--divider); font: 13px var(--mono); color: var(--navy); word-break: break-word; }
.doc pre { margin: 0 0 16px; padding: 16px 18px; overflow-x: auto; border-radius: var(--radius); background: #0f172a; color: #e2e8f0; font: 13px/1.6 var(--mono); }
.doc pre code { padding: 0; border: 0; background: none; color: inherit; }
.ui { font-weight: 600; color: var(--text); }
.path { font-weight: 600; color: var(--navy); }

.table-wrap { margin: 0 0 18px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc th, .doc td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--divider); }
.doc th { background: var(--surface); font-weight: 600; font-size: 13px; color: var(--navy); white-space: nowrap; }
.doc tr:last-child td { border-bottom: 0; }
.doc td.yes { color: var(--ok); font-weight: 600; }
.doc td.no { color: var(--muted); }

.callout { display: flex; gap: 12px; margin: 0 0 18px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--chip-border); background: var(--chip); font-size: 14px; }
.callout::before { content: "i"; flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; font: 700 12px/1 var(--font); }
.callout > div > :last-child { margin-bottom: 0; }
.callout strong:first-child { color: var(--navy); }
.callout.warn { border-color: #fcd34d; background: var(--warn-bg); }
.callout.warn::before { content: "!"; background: var(--warn); }
.callout.ok { border-color: #86efac; background: var(--ok-bg); }
.callout.ok::before { content: "✓"; background: var(--ok); }
.plan { display: inline-block; margin-left: 4px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 20px; vertical-align: 3px; letter-spacing: .02em; }
.plan-basic { background: var(--chip); color: var(--blue); border: 1px solid var(--chip-border); }
.plan-advanced { background: var(--navy); color: #fff; }
.plan-next { background: var(--warn-bg); color: var(--warn); }

ol.steps { list-style: none; padding: 0; counter-reset: step; }
ol.steps > li { position: relative; margin: 0; padding: 0 0 18px 44px; counter-increment: step; }
ol.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--chip); border: 1px solid var(--chip-border); color: var(--blue); font-weight: 650; font-size: 13px; }
ol.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 32px; bottom: 4px; width: 1px; background: var(--chip-border); }

/* Screenshots are captured at a 1440 px viewport and scaled down to the column. */
.shot { margin: 4px 0 22px; }
.shot a { display: block; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px -22px rgba(23, 37, 84, .45); }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { margin-top: 8px; color: var(--muted); font-size: 13px; text-align: center; }

.link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.link-grid a { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.link-grid a:hover { border-color: var(--chip-border); background: var(--chip); text-decoration: none; }
.link-grid strong { display: block; color: var(--blue); font-size: 14px; }
.link-grid span { display: block; color: var(--muted); font-size: 13px; }

.pager { max-width: 780px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); }
.pager a:hover { border-color: var(--chip-border); text-decoration: none; }
.pager span { display: block; color: var(--muted); font-size: 12px; }
.pager strong { font-weight: 600; }
.pager-next { text-align: right; }

.toc { position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 32px 20px 32px 0; }
.toc .nav-title { padding: 0; }
.toc a { display: block; padding: 4px 0 4px 12px; border-left: 1px solid var(--border); color: var(--muted); font-size: 13px; line-height: 1.4; }
.toc .toc-h3 a { padding-left: 24px; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.is-active { color: var(--blue); border-left-color: var(--blue); font-weight: 500; }

/* Search dialog */
.search-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 96px)); margin: 72px auto auto; padding: 0; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 24px 60px -20px rgba(23, 37, 84, .45); overflow: hidden; }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.search-box { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--divider); color: var(--muted); }
.search-box input { flex: 1; min-width: 0; height: 40px; border: 0; outline: 0; font: inherit; font-size: 16px; color: var(--text); background: transparent; }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.search-results a:hover, .search-results [aria-selected] a { background: var(--chip); text-decoration: none; }
.search-results strong { display: block; font-size: 14px; }
.search-results span { display: block; color: var(--blue); font-size: 12px; }
.search-results em { display: block; color: var(--muted); font-size: 13px; font-style: normal; }
.search-empty { padding: 24px; text-align: center; color: var(--muted); }
.search-hint { margin: 0; padding: 10px 16px; border-top: 1px solid var(--divider); color: var(--muted); font-size: 12px; }
.search-hint kbd { margin-right: 2px; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 22px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.footer-inner nav { display: flex; gap: 18px; }
.footer-inner a { color: var(--muted); }
.scrim { position: fixed; inset: var(--top) 0 0; z-index: 19; background: rgba(15, 23, 42, .4); }

/* Responsive */
@media (max-width: 1200px) {
	.layout { grid-template-columns: 260px minmax(0, 1fr); }
	.toc { display: none; }
}
@media (max-width: 1000px) {
	.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
	.menu-btn { display: grid; }
	.platform-nav { display: none; }
	.layout { display: block; }
	.sidebar { position: fixed; top: var(--top); left: 0; z-index: 20; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s; }
	.sidebar.is-open { transform: none; box-shadow: 12px 0 30px -12px rgba(15, 23, 42, .3); }
	.doc-col { padding: 20px 16px 56px; }
	.search-btn { width: auto; }
	.search-btn span, .search-btn kbd { display: none; }
}
@media (max-width: 700px) {
	.topbar-inner { padding: 0 16px; gap: 10px; }
	.brand span:last-child { display: none; }
	.lang-switch { padding-left: 4px; }
	.lang-switch .icon { display: none; }
	.grid, .link-grid, .pager { grid-template-columns: 1fr; }
	.hero-inner, .hero-compact .hero-inner { padding: 40px 16px 44px; }
	.hero h1 { font-size: 30px; }
	.index { padding: 32px 16px 56px; }
	.doc h1 { font-size: 26px; }
	.pager-next { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
