/* AI_GEN frontend: TOC, FAQ, related links */
:root { --aigen-accent: #4f46e5; }
html { scroll-behavior: smooth; }

.aigen-toc {
	margin: 1.6em 0;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, .08);
	border-left: 4px solid var(--aigen-accent);
	border-radius: 12px;
	background: rgba(127, 127, 127, .04);
	font-size: .95em;
	line-height: 1.5;
}
.aigen-toc__details { padding: 14px 20px; }
.aigen-toc__title {
	cursor: pointer;
	font-weight: 700;
	font-size: 1.05em;
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	user-select: none;
}
.aigen-toc__title::-webkit-details-marker { display: none; }
.aigen-toc__title::after {
	content: "";
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform .2s;
	opacity: .6;
	margin-right: 4px;
}
.aigen-toc__details[open] > .aigen-toc__title::after { transform: rotate(-135deg); }
.aigen-toc__details[open] > .aigen-toc__title { margin-bottom: 10px; }

.aigen-toc ol { list-style: none; margin: 0; padding: 0; }
.aigen-toc ol ol { padding-left: 1.15em; margin: 2px 0 4px; border-left: 1px dashed rgba(0, 0, 0, .12); }
.aigen-toc li { margin: 0; padding: 0; }
.aigen-toc a {
	display: block;
	padding: 4px 10px;
	border-radius: 6px;
	text-decoration: none !important;
	color: inherit;
	opacity: .85;
	transition: background .15s, color .15s, opacity .15s;
}
.aigen-toc a:hover { background: rgba(127, 127, 127, .1); opacity: 1; color: var(--aigen-accent); }
.aigen-toc a.is-active { color: var(--aigen-accent); font-weight: 600; opacity: 1; background: rgba(127, 127, 127, .08); }
.aigen-toc__item--h2 > a { font-weight: 600; }
.aigen-toc__item--h4 > a, .aigen-toc__item--h5 > a, .aigen-toc__item--h6 > a { font-size: .94em; }

/* Numbering 1, 1.1, 1.1.1 */
.aigen-toc--numbered ol { counter-reset: aigen-toc; }
.aigen-toc--numbered li { counter-increment: aigen-toc; }
.aigen-toc--numbered li > a::before {
	content: counters(aigen-toc, ".") ". ";
	color: var(--aigen-accent);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	margin-right: 2px;
}

/* Images */
.aigen-figure { margin: 1.5em 0; }
.aigen-figure img { max-width: 100%; height: auto; border-radius: 10px; display: block; }

/* Related links */
.aigen-related {
	margin: 1.6em 0;
	padding: 14px 20px;
	border-radius: 12px;
	background: rgba(127, 127, 127, .06);
	border: 1px solid rgba(0, 0, 0, .06);
}
.aigen-related__title { margin: 0 0 6px !important; }
.aigen-related__list { margin: 0 !important; padding-left: 1.2em !important; }
.aigen-related__list li { margin: 3px 0; }
.aigen-related__list a { color: var(--aigen-accent); }

/* FAQ */
.aigen-faq { margin: 2em 0 1em; }
.aigen-faq__item {
	border: 1px solid rgba(0, 0, 0, .1);
	border-radius: 10px;
	margin: 8px 0;
	background: rgba(127, 127, 127, .03);
	overflow: hidden;
}
.aigen-faq__q {
	cursor: pointer;
	padding: 12px 44px 12px 16px;
	font-weight: 600;
	list-style: none;
	position: relative;
}
.aigen-faq__q::-webkit-details-marker { display: none; }
.aigen-faq__q::after {
	content: "+";
	position: absolute;
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 1.3em;
	color: var(--aigen-accent);
	transition: transform .2s;
}
.aigen-faq__item[open] .aigen-faq__q::after { transform: translateY(-50%) rotate(45deg); }
.aigen-faq__a { padding: 0 16px 12px; }
.aigen-faq__a p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
}
