/*
 * Post Table of Contents — shared editor + frontend styles.
 * Plain CSS — no Sass / Vite style entry.
 * Visual: Figma BLOG-POST Desktop — What's In This Guide (53:10).
 * Frame 729×821; blue stamp 605×770; postmark 450×206 overhangs top-right.
 *
 * Padding lives on __inner (not __panel) so % values resolve against the
 * stamp width — panel % padding would use the wider TOC frame as CB.
 */

.lwt-post-toc {
	position: relative;
	isolation: isolate;
	box-sizing: border-box;
	width: 100%;
	max-width: 45.5625rem; /* 729px frame */
	/* Reserve space for postmark above the stamp (Figma: ~51px). */
	padding-top: 3.171875rem;
	margin: 0;
	color: var(--wp--preset--color--black);
	overflow: visible;
}

.lwt-post-toc *,
.lwt-post-toc *::before,
.lwt-post-toc *::after {
	box-sizing: border-box;
}

.lwt-post-toc__panel {
	position: relative;
	z-index: 1;
	width: 88%;
	max-width: 34rem; /* slightly smaller than Figma 605px */
	height: auto;
	padding: 0;
	overflow: visible;
	background-color: transparent;
	background-image: url(../../assets/images/post-toc-stamp.svg);
	background-position: center bottom;
	background-repeat: no-repeat;
	background-size: 100% 100%;
}

/* Postmark sits on the stamp and overhangs into the 729px frame width. */
.lwt-post-toc__postmark {
	position: absolute;
	z-index: 2;
	/* Figma: postmark overhangs stamp by ~50.73px */
	top: -3.171875rem;
	/* Figma: postmark left 279 / stamp 605 */
	left: 46.12%;
	display: block;
	/* Figma: postmark width 450 / stamp 605 */
	width: 74.38%;
	height: auto;
	aspect-ratio: 450 / 206;
	margin: 0;
	pointer-events: none;
	user-select: none;
}

.lwt-post-toc__postmark-lines,
.lwt-post-toc__postmark-circle {
	position: absolute;
	display: block;
	margin: 0;
	border: 0;
	pointer-events: none;
	object-fit: contain;
}

/* Figma group 2:66 — lines at 0,0 within postmark, 292.67 / 450 wide. */
.lwt-post-toc__postmark-lines {
	top: 0;
	left: 0;
	width: 65.04%;
	height: auto;
}

/* Figma group 2:849 — circle at 249.4, 5.26 within 450×206. */
.lwt-post-toc__postmark-circle {
	top: 2.55%;
	right: 0;
	width: 44.57%;
	height: auto;
	aspect-ratio: 1;
}

.lwt-post-toc__inner {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	width: 100%;
	max-width: none;
	/* Extra room under the last link so the stamp scallop clears the list. */
	padding: 4.5rem 11% 3.25rem 12%;
}

.lwt-post-toc__title {
	margin: 0 0 2.265625rem; /* Figma gap title→list ≈ 36px */
	padding: 0;
	color: var(--wp--preset--color--black);
	font-family: var(--wp--preset--font-family--editors-note);
	font-size: var(--wp--preset--font-size--heading-2); /* 45px */
	font-style: normal;
	font-weight: 200;
	letter-spacing: normal;
	line-height: 1.33;
	text-transform: none;
	word-break: break-word;
}

/* Beat post-content paragraph styles (Inter body) when nested in the article. */
.lwt-single-post__content .wp-block-post-content .lwt-post-toc__title,
.wp-block-post-content .lwt-post-toc__title {
	margin: 0 0 2.265625rem;
	color: var(--wp--preset--color--black);
	font-family: var(--wp--preset--font-family--editors-note);
	font-size: var(--wp--preset--font-size--heading-2);
	font-style: normal;
	font-weight: 200;
	letter-spacing: normal;
	line-height: 1.33;
	text-transform: none;
}

.lwt-post-toc__list {
	display: flex;
	flex-direction: column;
	gap: 1.875rem; /* 30px between links */
	margin: 0;
	padding: 0;
	padding-inline-start: 0;
	list-style: none;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
}

/* Beat post-content list indent when nested in the article. */
.lwt-single-post__content .wp-block-post-content .lwt-post-toc__list,
.wp-block-post-content .lwt-post-toc__list {
	display: flex;
	flex-direction: column;
	gap: 1.875rem;
	margin: 0;
	padding: 0;
	padding-inline-start: 0;
	list-style: none;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
}

.lwt-single-post__content .wp-block-post-content .lwt-post-toc__list--nested,
.wp-block-post-content .lwt-post-toc__list--nested {
	gap: 0;
	margin-left: 1.5625rem; /* 25px — beats .lwt-post-toc__list { margin: 0 } */
	padding-left: 1.25rem; /* 20px */
}

.lwt-post-toc__list--nested {
	gap: 0;
	margin: 0 0 0 1.5625rem; /* 25px */
	padding: 0 0 0 1.25rem; /* 20px indent — on list, not link, so underline stays text-width */
}

.lwt-post-toc__item {
	margin: 0;
	padding: 0;
}

.lwt-post-toc__link {
	/* Underline is text-decoration so it stays edge-to-edge with the label only. */
	display: inline;
	width: auto;
	max-width: 100%;
	padding: 0;
	border: 0;
	color: var(--wp--preset--color--black);
	font-family: var(--wp--preset--font-family--manrope);
	font-size: 1.125rem; /* 18px */
	font-style: normal;
	font-weight: 500;
	letter-spacing: 0.13em;
	line-height: 1.35;
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--moss);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
	text-underline-position: under;
	text-transform: uppercase;
	transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

/* Beat post-content / theme.json link element styles when nested in the article. */
.lwt-single-post__content .wp-block-post-content .lwt-post-toc__link,
.wp-block-post-content .lwt-post-toc__link {
	color: var(--wp--preset--color--black);
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--moss);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.2em;
	text-underline-position: under;
}

.lwt-post-toc__link:hover,
.lwt-post-toc__link:focus-visible,
.lwt-single-post__content .wp-block-post-content .lwt-post-toc__link:hover,
.lwt-single-post__content .wp-block-post-content .lwt-post-toc__link:focus-visible,
.wp-block-post-content .lwt-post-toc__link:hover,
.wp-block-post-content .lwt-post-toc__link:focus-visible {
	color: var(--wp--preset--color--moss);
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--moss);
}

.lwt-post-toc__link:focus-visible {
	outline: 2px solid var(--wp--preset--color--sea);
	outline-offset: 3px;
}

.lwt-post-toc__list--nested .lwt-post-toc__link {
	font-size: 0.9375rem; /* 15px */
	letter-spacing: 0.1em;
}

/* Ordered list numbers when enabled in the inspector. */
.lwt-post-toc ol.lwt-post-toc__list {
	list-style: none;
	counter-reset: lwt-toc;
}

.lwt-post-toc ol.lwt-post-toc__list > .lwt-post-toc__item {
	counter-increment: lwt-toc;
}

.lwt-post-toc ol.lwt-post-toc__list > .lwt-post-toc__item > .lwt-post-toc__link::before {
	content: counter(lwt-toc) ". ";
}

.lwt-post-toc-editor {
	width: 100%;
}

@media (max-width: 781px) {
	/* Figma Mobile What's In This Guide (2024:33) — ~321×433 panel. */
	.lwt-post-toc {
		padding-top: 2rem;
		max-width: 22.25rem;
		margin-inline: auto;
	}

	.lwt-post-toc__panel {
		min-height: 0;
		width: 94%;
		max-width: 18.5rem;
		margin-inline: auto;
	}

	.lwt-post-toc__inner {
		padding: 3rem 1.5rem 2.25rem 2rem;
	}

	.lwt-post-toc__postmark {
		top: -2.5rem;
		width: 65%;
	}

	.lwt-post-toc__title,
	.lwt-single-post__content .wp-block-post-content .lwt-post-toc__title,
	.wp-block-post-content .lwt-post-toc__title {
		margin-bottom: 1.25rem;
		font-size: 1.4556rem; /* ~23.29px */
		line-height: 1.941rem; /* ~31px */
	}

	.lwt-post-toc__link {
		font-size: 0.8125rem; /* 13px */
		line-height: 1.6;
	}

	.lwt-post-toc__list--nested .lwt-post-toc__link {
		font-size: 0.75rem; /* 12px */
	}
}
