/* /terms page styling. Extracted from the page's inline <style> when the
   Chinese version arrived: two copies of 149 lines would have drifted apart,
   and an external file is cacheable where an inline block is not. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
	background: var(--bg);
	transition: background-color var(--theme-dur) ease;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--nav-h) + 16px);
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.6;
	transition: background-color var(--theme-dur) ease, color var(--theme-dur) ease;
}

a { color: var(--accent); text-decoration: none; transition: color var(--theme-dur) ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code {
	font-family: var(--mono);
	font-size: 14px;
	background: var(--surface);
	padding: 1px 6px;
	border-radius: 4px;
	border: 1px solid var(--border);
}


/* ---------- Main content ---------- */
main {
	max-width: 760px;
	margin: 0 auto;
	padding: 40px 20px 0;
}

h1 {
	font-size: 32px;
	font-weight: 700;
	margin: 0 0 8px;
	letter-spacing: -.5px;
}
.subtitle {
	color: var(--text-muted);
	font-size: 16px;
	margin: 0 0 8px;
}
.doc-meta {
	color: var(--text-muted);
	font-size: 14px;
	margin: 0 0 36px;
}

h2 {
	font-size: 20px;
	font-weight: 700;
	margin: 36px 0 12px;
}
p { margin: 0 0 14px; }
ul { margin: 0 0 14px; padding-left: 22px; }
li { margin-bottom: 8px; }
strong { font-weight: 600; }

.callout {
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 4px solid var(--accent);
	border-radius: 6px;
	padding: 14px 18px;
	margin: 20px 0;
	color: var(--text);
	box-shadow: 0 1px 4px var(--shadow-soft);
}


/* ---------- Left-rail Table of Contents (HackMD-style) ----------
   Fixed left side, vertically centred; thin horizontal line per heading.
   Hover the rail → labels slide in. "active" item = section in viewport.
   Hidden below 960px (narrow screens just scroll). */
.toc-rail-wrap {
	display: none;
	position: fixed;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	padding: 16px 20px 16px 14px;
	z-index: 30;
	max-height: 80vh;
	overflow-y: auto;
	scrollbar-width: none;
}
.toc-rail-wrap::-webkit-scrollbar { display: none; }
@media (min-width: 960px) {
	.toc-rail-wrap { display: block; }
}
.toc-rail {
	display: flex;
	flex-direction: column;
	gap: 7px;
}
.toc-item {
	display: flex;
	align-items: center;
	height: 18px;
	color: var(--text-muted);
	text-decoration: none;
	cursor: pointer;
}
.toc-item .line {
	display: block;
	height: 2px;
	width: 26px;
	background: var(--border);
	border-radius: 1px;
	flex-shrink: 0;
	transition: background-color .15s ease, width .15s ease;
}
.toc-item .label {
	display: none;
	margin-left: 12px;
	font-size: 13px;
	white-space: nowrap;
	color: var(--text);
	pointer-events: none;
	transition: color var(--theme-dur) ease;
}
.toc-rail-wrap.expanded .toc-item .label,
.toc-rail-wrap:focus-within .toc-item .label {
	display: inline;
	animation: tocLabelFadeIn .18s ease;
}
@keyframes tocLabelFadeIn {
	from { opacity: 0; transform: translateX(-6px); }
	to   { opacity: 1; transform: translateX(0); }
}
.toc-item:hover .line,
.toc-item.active .line {
	background: var(--accent);
	width: 32px;
}
.toc-item:hover .label { color: var(--accent); }
.toc-item, .toc-item:hover { text-decoration: none; }
