/* Swift TOC - Lightweight RTL/LTR Native HTML5 Table of Contents */
:root {
	--stoc-accent: #0b8876;
	--stoc-accent-soft: rgba(11, 136, 118, 0.10);
	--stoc-bg: #f8fafc;
	--stoc-surface: #ffffff;
	--stoc-border: #e2e8f0;
	--stoc-text: #1e293b;
	--stoc-muted: #64748b;
	--stoc-radius: 12px;
	--stoc-scroll-offset: 90px;
}

html {
	scroll-behavior: smooth;
}

h1[id],
h2[id],
h3[id],
h4[id],
h5[id],
h6[id] {
	scroll-margin-top: var(--stoc-scroll-offset);
}

.stoc-box {
	margin: 1.5em 0 2em;
	background: var(--stoc-bg);
	border: 1px solid var(--stoc-border);
	border-inline-start: 4px solid var(--stoc-accent);
	border-radius: var(--stoc-radius);
	color: var(--stoc-text);
	box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
	overflow: hidden;
}

.stoc-details {
	margin: 0;
}

.stoc-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 18px;
	cursor: pointer;
	list-style: none;
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--stoc-text);
	user-select: none;
	transition: background-color 0.15s ease;
}

.stoc-summary::-webkit-details-marker {
	display: none;
}

.stoc-summary:hover {
	background: rgba(15, 23, 42, 0.03);
}

.stoc-summary__title {
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.stoc-icon-list {
	color: var(--stoc-accent);
	flex-shrink: 0;
}

.stoc-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 22px;
	padding: 0 7px;
	border-radius: 999px;
	background: var(--stoc-accent-soft);
	color: var(--stoc-accent);
	font-size: 0.78rem;
	font-weight: 700;
}

.stoc-chevron {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	background: var(--stoc-surface);
	border: 1px solid var(--stoc-border);
	color: var(--stoc-muted);
	flex-shrink: 0;
	transition: transform 0.2s ease, color 0.2s ease;
}

.stoc-details[open] .stoc-chevron {
	transform: rotate(180deg);
	color: var(--stoc-accent);
}

.stoc-body {
	padding: 4px 18px 16px;
	border-top: 1px solid var(--stoc-border);
	background: var(--stoc-surface);
}

.stoc-list,
.stoc-sublist {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.stoc-list--root {
	margin-top: 10px !important;
}

.stoc-sublist {
	margin-inline-start: 18px !important;
	padding-inline-start: 12px !important;
	border-inline-start: 1px dashed var(--stoc-border);
	margin-top: 4px !important;
	margin-bottom: 6px !important;
}

.stoc-item {
	margin: 0 !important;
	padding: 2px 0 !important;
}

.stoc-item::before,
.stoc-sublist li::before {
	content: none !important;
}

.stoc-link {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	padding: 4px 6px;
	border-radius: 6px;
	color: var(--stoc-text);
	text-decoration: none !important;
	font-size: 0.94rem;
	line-height: 1.65;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.stoc-item--level-2 > .stoc-link {
	font-weight: 600;
}

.stoc-item--level-3 > .stoc-link,
.stoc-item--level-4 > .stoc-link {
	font-size: 0.89rem;
	color: #475569;
}

.stoc-link:hover,
.stoc-link:focus-visible {
	color: var(--stoc-accent);
	background: var(--stoc-accent-soft);
}

.stoc-num {
	color: var(--stoc-accent);
	font-weight: 700;
	font-size: 0.86em;
	flex-shrink: 0;
}

@media (max-width: 640px) {
	.stoc-box {
		margin: 1.2em 0 1.6em;
	}
	.stoc-summary {
		padding: 12px 14px;
		font-size: 0.95rem;
	}
	.stoc-body {
		padding: 4px 14px 14px;
	}
	.stoc-sublist {
		margin-inline-start: 12px !important;
		padding-inline-start: 10px !important;
	}
}
