/* ==========================================================================
   Legal pages (12.6.1, decision P10): Privacy Policy, Terms & Conditions.
   Reading layout — 720px text, "On this page" from the H2s, "Last updated".
   Loaded only on legal pages (inc/assets.php).
   ========================================================================== */

.pgs-legal__grid {
	display: grid;
	grid-template-columns: minmax(0, 720px);
	justify-content: center;
	gap: 32px;
}

/* From 1024px: the list beside the text, staying in view while reading. */
@media (min-width: 1024px) {
	.pgs-legal__grid:not(.pgs-legal__grid--single) {
		grid-template-columns: 240px minmax(0, 720px);
		gap: 56px;
		align-items: start;
	}

	.pgs-legal-toc {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 104px);
		max-height: calc(100vh - 128px);
		overflow-y: auto;
	}

	/* Always open on desktop: the summary is a plain title there. */
	.pgs-legal-toc__summary {
		pointer-events: none;
	}

	.pgs-legal-toc__chevron {
		display: none;
	}
}

/* ---- On this page ---- */
.pgs-legal-toc__box {
	border: 1px solid var(--pgs-border);
	border-radius: var(--pgs-radius);
	background: var(--pgs-bg-alt);
}

.pgs-legal-toc__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 48px;
	padding: 0 18px;
	color: var(--pgs-text);
	font-weight: 700;
	list-style: none;
	cursor: pointer;
}

.pgs-legal-toc__summary::-webkit-details-marker {
	display: none;
}

.pgs-legal-toc__chevron {
	width: 18px;
	height: 18px;
	transition: transform var(--pgs-duration) var(--pgs-ease);
}

.pgs-legal-toc__box[open] .pgs-legal-toc__chevron {
	transform: rotate(180deg);
}

.pgs-legal-toc__list {
	display: grid;
	gap: 2px;
	margin: 0;
	padding: 0 10px 14px 36px;
	color: var(--pgs-text-muted);
	font-size: var(--pgs-fs-small);
}

.pgs-legal-toc__list a {
	display: block;
	padding: 6px 8px;
	border-radius: var(--pgs-radius-sm);
	color: var(--pgs-text-body);
	line-height: 1.45;
	text-decoration: none;
}

.pgs-legal-toc__list a:hover {
	background: var(--pgs-tint-green);
	color: var(--pgs-text);
}

/* ---- Text ---- */
.pgs-legal__article {
	min-width: 0;
}

.pgs-legal__updated {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 24px;
	padding: 8px 14px;
	border-radius: var(--pgs-radius-pill);
	background: var(--pgs-fill);
	color: var(--pgs-text-body);
	font-size: var(--pgs-fs-small);
}

.pgs-legal__updated .pgs-icon {
	width: 16px;
	height: 16px;
	color: var(--pgs-accent);
}

.pgs-legal__text {
	max-width: none;
}

/* Section headings get a little more room and a thin rule above, for easy scanning. */
.pgs-legal__text h2 {
	margin-top: 2em;
	padding-top: 1.2em;
	border-top: 1px solid var(--pgs-border);
	font-size: clamp(1.25rem, 1.15rem + .5vw, 1.5rem);
}

.pgs-legal__text > h2:first-child {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}
