/**
 * On this page (Figma Privacy, left column): front end and editor.
 *
 * Desktop (≥782px, core Columns side-by-side): sticky TOC column below the admin bar.
 * Stacked (≤781px): JS builds a labelled <select> from the links; the list stays in
 * the DOM for no-JS. Only the select wrapper sticks (label scrolls away). JS moves the
 * wrap to a sibling of the TOC column so its sticky containing block is the tall
 * Columns row (full policy), not the short TOC column.
 */

/*
 * Sticky offset on the Columns row (and nav) so both resolve --on-this-page-top.
 * Top is admin bar only — no spacing for the Crisis tab; Crisis stays fixed at the
 * viewport top (z-index 100 / 102) and overlaps the sticky TOC (z-index 40).
 * Header is overlaid and scrolls away, so it is not added here.
 */
.wp-block-columns:has(.wp-block-a-paul-singh-on-this-page),
.wp-block-a-paul-singh-on-this-page {
	--on-this-page-top: var(--wp-admin--admin-bar--height, 0px);
}

.wp-block-a-paul-singh-on-this-page {
	--on-this-page-link-color: #5a7270;
	--on-this-page-active-color: var(--wp--preset--color--mid-green-blue);
}

/* Label: Figma "h5" text style. */
.wp-block-a-paul-singh-on-this-page__label {
	margin: 0 0 2.1875rem;
	font-family: var(--wp--preset--font-family--serrif);
	font-size: var(--wp--preset--font-size--heading-5);
	font-weight: var(--wp--custom--font-weight--regular);
	line-height: var(--wp--custom--line-height--heading);
	letter-spacing: var(--wp--custom--letter-spacing--tight);
}

.wp-block-a-paul-singh-on-this-page__list {
	display: flex;
	flex-direction: column;
	gap: 0.6875rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wp-block-a-paul-singh-on-this-page__list > li {
	margin: 0;
}

/* Links: Figma "Body Link - Button"; the active link is darker with an 8px dot in the gutter. */
.wp-block-a-paul-singh-on-this-page__link {
	position: relative;
	display: inline-block;
	color: var(--on-this-page-link-color);
	font-family: var(--wp--preset--font-family--season-sans);
	font-size: var(--wp--preset--font-size--body);
	font-weight: var(--wp--custom--font-weight--medium);
	line-height: 1.25;
	letter-spacing: var(--wp--custom--letter-spacing--body);
	text-decoration: none;
	transition: color var(--wp--custom--motion--duration--quick, 200ms)
		var(--wp--custom--motion--easing--out, ease-out);
}

.wp-block-a-paul-singh-on-this-page__link:hover,
.wp-block-a-paul-singh-on-this-page__link:focus-visible {
	color: var(--on-this-page-active-color);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.wp-block-a-paul-singh-on-this-page__link[aria-current="true"] {
	color: var(--on-this-page-active-color);
}

.wp-block-a-paul-singh-on-this-page__link[aria-current="true"]::before {
	content: "";
	position: absolute;
	top: calc(0.625em - 0.25rem);
	left: -1.3125rem;
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: currentColor;
}

/* Select is injected by view.js; hidden until stacked mode ([hidden] / display). */
.wp-block-a-paul-singh-on-this-page__select-wrap {
	display: none;
	margin: 0;
}

.wp-block-a-paul-singh-on-this-page__select {
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0.75rem 2.5rem 0.75rem 1rem;
	border: 1px solid var(--wp--preset--color--mid-green-blue);
	border-radius: 0;
	background-color: var(--wp--preset--color--page);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23475B59' d='M1.41 0 6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	background-size: 0.75rem 0.5rem;
	color: var(--wp--preset--color--mid-green-blue);
	font-family: var(--wp--preset--font-family--season-sans);
	font-size: var(--wp--preset--font-size--body);
	font-weight: var(--wp--custom--font-weight--medium);
	line-height: 1.25;
	letter-spacing: var(--wp--custom--letter-spacing--body);
	appearance: none;
	cursor: pointer;
}

.wp-block-a-paul-singh-on-this-page__select:focus-visible {
	outline: 2px solid var(--wp--preset--color--mid-green-blue);
	outline-offset: 2px;
}

/*
 * Flex columns stretch to equal height, which breaks position:sticky on the column.
 * Keep the TOC column content-sized so it can stick while the content scrolls.
 * overflow: visible so no ancestor clips sticky.
 */
.wp-block-columns:has(.wp-block-a-paul-singh-on-this-page),
.wp-block-column:has(.wp-block-a-paul-singh-on-this-page) {
	overflow: visible;
}

/*
 * Reveal leaves translate3d(0,0,0) on .aps-reveal, which disables position:sticky.
 * Drop the transform once revealed so sticky (column or select wrap) can engage.
 */
html.aps-reveal-js .wp-block-a-paul-singh-on-this-page.aps-reveal.is-revealed {
	transform: none !important;
}

/*
 * Desktop: stick the TOC column (not the nav). The nav may keep a reveal transform;
 * the column is content-sized (align-self) inside the tall Columns row, so it can stick
 * while the content column scrolls. z-index 40 sits above page content and below the
 * Crisis tab (100 / 102). Stacked mode overrides this — see max-width: 781px.
 */
.wp-block-columns:has(.wp-block-a-paul-singh-on-this-page)
	> .wp-block-column:has(.wp-block-a-paul-singh-on-this-page) {
	align-self: flex-start;
	position: sticky;
	top: var(--on-this-page-top);
	z-index: 40;
}

@media (min-width: 782px) {
	.wp-block-a-paul-singh-on-this-page {
		max-height: calc(100vh - var(--on-this-page-top) - var(--wp--preset--spacing--40));
		overflow-y: auto;
		overscroll-behavior: contain;
		margin-inline-start: -1.5rem;
		padding-inline-start: 1.5rem;
	}
}

/*
 * Stacked columns (core ≤781px): JS adds .is-stacked-toc, shows the select, hides the
 * list (list remains in the DOM for no-JS). Column sticky is off; the select wrap
 * (reparented beside the TOC column) sticks through the full Columns / policy height.
 *
 * Reparent leaves the wrap as a Columns flex sibling, so the Columns block gap would
 * sit between the title column and the select — kill that gap. Title→select spacing is
 * the wrap’s top padding (spacing-30); label margin-bottom is 0 so it does not double.
 */
@media (max-width: 781px) {
	.wp-block-columns:has(.wp-block-a-paul-singh-on-this-page.is-stacked-toc) {
		gap: 0 !important;
	}

	.wp-block-columns:has(.wp-block-a-paul-singh-on-this-page)
		> .wp-block-column:has(.wp-block-a-paul-singh-on-this-page) {
		position: static;
		top: auto;
		z-index: auto;
		align-self: stretch;
		width: 100%;
		flex-basis: 100% !important;
	}

	.wp-block-a-paul-singh-on-this-page.is-stacked-toc {
		margin-inline-start: 0;
		padding-inline-start: 0;
		/* Top pad around the title only — no bottom pad (select is a sibling now). */
		padding-block: var(--wp--preset--spacing--30) 0;
		max-height: none;
		overflow: visible;
		background-color: transparent;
	}

	/*
	 * Title→select gap: wrap padding-top is spacing-30 (breathing room when stuck).
	 * Label margin is 0 so that pad alone is the visual gap (~21px), not pad + margin.
	 */
	.wp-block-a-paul-singh-on-this-page.is-stacked-toc .wp-block-a-paul-singh-on-this-page__label {
		margin-bottom: 0;
	}

	.wp-block-a-paul-singh-on-this-page.is-stacked-toc .wp-block-a-paul-singh-on-this-page__list {
		display: none;
	}

	/*
	 * Select wrap: sticky chrome only. Lives as a Columns child after JS reparent
	 * (fallback: still inside the nav). Outside the reveal nav so transform cannot
	 * break sticky; tall Columns parent keeps it stuck for the whole policy.
	 * padding-block spacing-30 (v0.38.51): top pad = title gap when unstuck and
	 * breathing room under the viewport / admin bar when stuck.
	 */
	.wp-block-columns:has(.wp-block-a-paul-singh-on-this-page.is-stacked-toc)
		> .wp-block-a-paul-singh-on-this-page__select-wrap,
	.wp-block-a-paul-singh-on-this-page.is-stacked-toc
		> .wp-block-a-paul-singh-on-this-page__select-wrap {
		display: block;
		position: sticky;
		top: var(--on-this-page-top);
		z-index: 40;
		width: 100%;
		flex-basis: 100%;
		box-sizing: border-box;
		padding-block: var(--wp--preset--spacing--30);
		background-color: var(--wp--preset--color--page);
		box-shadow: 0 1px 0
			color-mix(in srgb, var(--wp--preset--color--mid-green-blue) 12%, transparent);
	}

	/*
	 * Clear the sticky select when jumping to a heading. Root scroll-padding-top
	 * already covers the admin bar; this adds the select bar height + breathing room.
	 */
	html:has(.wp-block-a-paul-singh-on-this-page.is-stacked-toc)
		:where(.wp-block-heading[id], .wp-block-a-paul-singh-content-section) {
		scroll-margin-top: calc(
			var(--on-this-page-bar-height, 5rem) + var(--wp--preset--spacing--30)
		);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wp-block-a-paul-singh-on-this-page__link {
		transition: none;
	}
}

/* Smooth jumps to sections; :root scroll-padding-top already clears the admin bar. */
@media (prefers-reduced-motion: no-preference) {
	html:has(.wp-block-a-paul-singh-on-this-page) {
		scroll-behavior: smooth;
	}
}
