/*! Financial Core · Table of contents [est_toc]
 * Scoped under .est-contents, built on the shared tokens (assets/css/base.css) and the same card,
 * accent bar and type as the calculators. Doubled classes outrank the theme's generic list and
 * link rules without !important. No JavaScript: expanding and collapsing is a native <details>.
 */
.est-contents {
	--est-contents-pad: 24px;
	--est-contents-indent: 34px;
	container-type: inline-size;
	box-sizing: border-box;
	margin: 2em 0;
	font-family: var(--est-font);
	font-size: 15px;
	line-height: 1.5;
	color: var(--est-ink);
}
.est-contents *, .est-contents *::before, .est-contents *::after { box-sizing: border-box; }

.est-contents .est-contents__box {
	margin: 0; padding: 0;
	background: var(--est-surface);
	border: 1px solid var(--est-grid);
	border-radius: var(--est-radius);
}

/* Head: the whole row expands and collapses the list; accent bar above, toggle level with the title */
.est-contents .est-contents__head {
	display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px;
	margin: 0; padding: 20px var(--est-contents-pad);
	list-style: none; cursor: pointer;
	border-radius: var(--est-radius);
	-webkit-tap-highlight-color: transparent;
}
.est-contents .est-contents__box[open] > .est-contents__head { border-radius: var(--est-radius) var(--est-radius) 0 0; }
.est-contents .est-contents__head::-webkit-details-marker { display: none; }
.est-contents .est-contents__head::marker { content: ""; }
.est-contents .est-contents__head:focus { outline: 0; }
.est-contents .est-contents__head:focus-visible { outline: 2px solid var(--est-primary); outline-offset: -2px; }

.est-contents .est-contents__head::before {
	content: ""; grid-column: 1 / -1; display: block; width: 32px; height: 4px; margin: 0 0 12px;
	border-radius: 2px; background: var(--est-primary);
}
.est-contents .est-contents__heading { min-width: 0; }
.est-contents .est-contents__title {
	font-size: 17px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; color: var(--est-ink);
}
.est-contents .est-contents__count {
	margin-left: 6px; font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--est-ink-2); white-space: nowrap;
}

.est-contents .est-contents__toggle {
	position: relative; width: 34px; height: 34px;
	border: 1px solid var(--est-grid); border-radius: var(--est-radius-sm); background: var(--est-surface);
	transition: border-color .15s;
}
.est-contents .est-contents__toggle::before {
	content: ""; position: absolute; top: 50%; left: 50%;
	width: 8px; height: 8px; margin: -6px 0 0 -4px;
	border-right: 2px solid var(--est-ink-2); border-bottom: 2px solid var(--est-ink-2);
	transform: rotate(45deg); transition: transform .2s ease, border-color .15s;
}
.est-contents .est-contents__box[open] .est-contents__toggle::before { transform: translateY(3px) rotate(-135deg); }

/* List */
.est-contents.est-contents .est-contents__list {
	margin: 0 var(--est-contents-pad); padding: 8px 0 14px;
	border: 0; border-top: 1px solid var(--est-grid);
	list-style: none; background: none;
}
.est-contents.est-contents .est-contents__item {
	margin: 0; padding: 0; list-style: none; background: none;
	font-size: 15px; line-height: 1.45;
}
.est-contents.est-contents .est-contents__item::before,
.est-contents.est-contents .est-contents__item::after { content: none; }
.est-contents.est-contents .est-contents__item::marker { content: ""; }

.est-contents.est-contents .est-contents__link {
	display: flex; align-items: baseline; gap: 12px;
	margin: 0; padding: 9px 0;
	border: 0; box-shadow: none; background: none;
	font-family: var(--est-font); font-size: inherit; font-weight: 500; line-height: inherit;
	color: var(--est-ink); text-decoration: none;
	transition: color .15s;
}
.est-contents .est-contents__num {
	flex: 0 0 auto; min-width: 22px; text-align: right;
	font-weight: 600; color: var(--est-primary-text); font-variant-numeric: tabular-nums;
}
.est-contents .est-contents__text {
	flex: 1 1 auto; min-width: 0;
	text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
	text-decoration-color: transparent; transition: text-decoration-color .15s;
}
.est-contents.est-contents .est-contents__link:hover { color: var(--est-primary-text); }
.est-contents .est-contents__link:hover .est-contents__text { text-decoration-color: currentColor; }
.est-contents.est-contents .est-contents__link:focus { outline: 0; }
.est-contents.est-contents .est-contents__link:focus-visible { outline: 2px solid var(--est-primary); outline-offset: 2px; border-radius: 4px; }

/* Without numbers: the small square of the calculators' brand mark */
.est-contents:not(.est-contents--numbered) { --est-contents-indent: 20px; }
.est-contents:not(.est-contents--numbered) .est-contents__list:not(.est-contents__list--sub) > .est-contents__item > .est-contents__link::before {
	content: ""; flex: 0 0 auto; align-self: flex-start; width: 8px; height: 8px; margin-top: calc(0.725em - 4px); border-radius: 2px; background: var(--est-primary);
}

/* Subsections: a guide line under the text column */
.est-contents.est-contents .est-contents__list--sub {
	margin: -2px 0 6px var(--est-contents-indent); padding: 0 0 0 14px;
	border: 0; border-left: 1px solid var(--est-grid);
}
.est-contents.est-contents .est-contents__list--sub .est-contents__item { font-size: 14px; }
.est-contents.est-contents .est-contents__list--sub .est-contents__link {
	align-items: center; gap: 8px; padding: 6px 0; font-weight: 400; color: var(--est-ink-2);
}
.est-contents.est-contents .est-contents__list--sub .est-contents__link:hover { color: var(--est-primary-text); }
.est-contents .est-contents__icon {
	flex: 0 0 auto; display: block; width: 16px; height: 16px;
	fill: none; stroke: var(--est-primary); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

/* Smooth open and close where the browser can animate <details> on its own */
@media (prefers-reduced-motion: no-preference) {
	@supports (interpolate-size: allow-keywords) {
		.est-contents { interpolate-size: allow-keywords; }
		.est-contents .est-contents__box::details-content {
			height: 0; overflow: clip;
			transition: height .25s ease, content-visibility .25s allow-discrete;
		}
		.est-contents .est-contents__box[open]::details-content { height: auto; }
	}
}

/* Anchor targets clear the sticky header when the page opens on a #fragment */
:is(h2, h3, h4, h5, h6)[id], .est-calc[id] { scroll-margin-top: var(--est-anchor-offset); }

@container (max-width: 479px) {
	.est-contents .est-contents__box { --est-contents-pad: 16px; }
	.est-contents .est-contents__head { padding-top: 18px; padding-bottom: 16px; }
	.est-contents .est-contents__title { font-size: 16px; }
	.est-contents.est-contents .est-contents__link { padding: 10px 0; }
	.est-contents.est-contents .est-contents__list--sub .est-contents__link { padding: 8px 0; }
}
@media (hover: none) {
	.est-contents .est-contents__link:hover .est-contents__text { text-decoration-color: transparent; }
}
@media (hover: hover) {
	.est-contents .est-contents__head:hover .est-contents__toggle { border-color: var(--est-primary); }
	.est-contents .est-contents__head:hover .est-contents__toggle::before { border-color: var(--est-primary); }
}
@media (prefers-reduced-motion: reduce) {
	.est-contents .est-contents__toggle, .est-contents .est-contents__toggle::before,
	.est-contents .est-contents__link, .est-contents .est-contents__text { transition: none; }
}
@media (forced-colors: active) {
	.est-contents .est-contents__head::before { background: CanvasText; }
	.est-contents .est-contents__toggle::before { border-color: CanvasText; }
}
@media print {
	.est-contents { display: none; }
}
