/* AW Floating Table of Contents (TWI port: TWI ink, amber accent, Inter) */
.aw-ftoc {
	--aw-ftoc-ink: #1F2328;
	--aw-ftoc-parchment: #FBFAF7;
	--aw-ftoc-brass: #E6A83C;
	--aw-ftoc-line: rgba(31, 35, 40, 0.14);
	--aw-ftoc-top: 110px;
	--aw-ftoc-width: 260px;
	--aw-ftoc-left: auto;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
	line-height: 1.35;
	color: var(--aw-ftoc-ink);
	z-index: 9990;
}

.aw-ftoc[hidden] { display: none !important; }

.aw-ftoc *,
.aw-ftoc *::before,
.aw-ftoc *::after { box-sizing: border-box; }

/* ---------- Panel (shared) ---------- */
.aw-ftoc__panel {
	background: var(--aw-ftoc-parchment);
	border: 1px solid var(--aw-ftoc-line);
	border-top: 4px solid var(--aw-ftoc-brass);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	border-radius: 4px;
}

.aw-ftoc__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px 8px 16px;
}

.aw-ftoc__title {
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.aw-ftoc__close {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--aw-ftoc-ink);
	font-size: 26px;
	line-height: 1;
	width: 34px;
	height: 34px;
	cursor: pointer;
	border-radius: 2px;
}
.aw-ftoc__close:hover { background: rgba(31, 35, 40, 0.07); }

.aw-ftoc__progress {
	height: 3px;
	margin: 0 16px 6px;
	background: var(--aw-ftoc-line);
}
.aw-ftoc__progress span {
	display: block;
	height: 100%;
	width: 0;
	background: var(--aw-ftoc-brass);
	transition: width 0.15s linear;
}

.aw-ftoc__list {
	list-style: none;
	margin: 0;
	padding: 4px 0 12px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}

.aw-ftoc__item { margin: 0; padding: 0; }
.aw-ftoc__item::before,
.aw-ftoc__item::marker { content: none; }

.aw-ftoc__item a {
	display: block;
	padding: 7px 14px 7px 16px;
	border-left: 4px solid transparent;
	color: var(--aw-ftoc-ink);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease;
}
.aw-ftoc__item--h3 a {
	padding-left: 30px;
	font-size: 13px;
	opacity: 0.85;
}
.aw-ftoc__item a:hover { background: rgba(31, 35, 40, 0.05); }
.aw-ftoc__item a:focus-visible {
	outline: 2px solid var(--aw-ftoc-ink);
	outline-offset: -2px;
}
.aw-ftoc__item a.is-active {
	border-left-color: var(--aw-ftoc-brass);
	background: rgba(230, 168, 60, 0.16);
	font-weight: 700;
	opacity: 1;
}

/* ---------- Toggle button (compact mode) ---------- */
.aw-ftoc__toggle {
	appearance: none;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	border: 0;
	border-radius: 4px;
	background: var(--aw-ftoc-ink);
	color: #ffffff;
	font-family: inherit;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding: 12px 18px;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.aw-ftoc__toggle:focus-visible { outline: 3px solid var(--aw-ftoc-brass); outline-offset: 2px; }
.aw-ftoc__toggle-icon,
.aw-ftoc__toggle-icon::before,
.aw-ftoc__toggle-icon::after {
	display: block;
	width: 16px;
	height: 2px;
	background: currentColor;
	position: relative;
}
.aw-ftoc__toggle-icon::before,
.aw-ftoc__toggle-icon::after { content: ""; position: absolute; left: 0; }
.aw-ftoc__toggle-icon::before { top: -5px; }
.aw-ftoc__toggle-icon::after { top: 5px; }

/* ---------- Docked mode: beside the article on wide screens ---------- */
.aw-ftoc.is-docked {
	position: fixed;
	top: var(--aw-ftoc-top);
	left: var(--aw-ftoc-left);
	width: var(--aw-ftoc-width);
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
}
.aw-ftoc.is-docked.is-visible {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}
.aw-ftoc.is-docked .aw-ftoc__toggle,
.aw-ftoc.is-docked .aw-ftoc__close { display: none; }
.aw-ftoc.is-docked .aw-ftoc__panel { max-height: calc(100vh - var(--aw-ftoc-top) - 24px); }

/* ---------- Compact mode: button in the corner, panel slides up ---------- */
.aw-ftoc.is-compact {
	position: fixed;
	bottom: 18px;
	right: 18px;
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
}
.aw-ftoc.is-compact[data-side="left"] { right: auto; left: 18px; }
.aw-ftoc.is-compact.is-visible {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}
.aw-ftoc.is-compact .aw-ftoc__panel {
	position: fixed;
	left: 12px;
	right: 12px;
	bottom: 12px;
	max-height: min(70vh, 560px);
	transform: translateY(calc(100% + 24px));
	visibility: hidden;
	transition: transform 0.25s ease, visibility 0s linear 0.25s;
}
.aw-ftoc.is-compact.is-open .aw-ftoc__panel {
	transform: none;
	visibility: visible;
	transition: transform 0.25s ease, visibility 0s;
}
.aw-ftoc.is-compact.is-open .aw-ftoc__toggle { visibility: hidden; }

@media (min-width: 600px) {
	.aw-ftoc.is-compact .aw-ftoc__panel {
		left: auto;
		right: 18px;
		bottom: 18px;
		width: 340px;
	}
	.aw-ftoc.is-compact[data-side="left"] .aw-ftoc__panel { right: auto; left: 18px; }
}

.aw-ftoc__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(31, 35, 40, 0.35);
	z-index: 9989;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}
.aw-ftoc__backdrop.is-open { opacity: 1; pointer-events: auto; }

/* Headings land below sticky headers when jumped to. */
.aw-ftoc-target { scroll-margin-top: var(--aw-ftoc-scroll-offset, 90px); }

@media (prefers-reduced-motion: reduce) {
	.aw-ftoc,
	.aw-ftoc *,
	.aw-ftoc__backdrop { transition: none !important; }
}

@media print {
	.aw-ftoc,
	.aw-ftoc__backdrop { display: none !important; }
}
