/*
 * Legal Document template — Terms, Privacy, Cookies, Acceptable Use, Refunds.
 *
 * Replaces the orphaned .legal-* block in page-templates.css, which was
 * scoped to the deleted page-legal.php draft skeleton and therefore never
 * loaded on the real pages. Two rules from it are deliberately NOT carried
 * over: the amber "DRAFT PLACEHOLDER" banner (these documents are live and
 * binding) and `.legal-section p { font-style: italic }` (that italic said
 * "this is filler" -- real clauses must not be italic).
 *
 * Sticky ToC on the left at >=980px, collapsed above the text below that.
 * .site-content is max-width 1200px, which is right for dashboards and far
 * too wide for prose -- the body column is capped near 70ch instead.
 */

.legal-doc {
	padding-bottom: var(--section-pad-lg);
}

/* ---- Header ---- */
.legal-doc__header {
	max-width: 70ch;
	padding-bottom: 1.5rem;
	margin-bottom: 2.5rem;
	border-bottom: 1px solid rgba(13, 19, 43, 0.1);
}

.legal-doc__eyebrow {
	font-family: var(--font-heading);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-purple-primary);
	margin: 0 0 0.5rem;
}

.legal-doc__title {
	font-size: clamp(2rem, 5vw, 3rem);
	line-height: 1.15;
	text-wrap: balance;
	margin: 0 0 0.6rem;
}

.legal-doc__meta {
	font-size: 0.875rem;
	color: var(--color-navy-dark);
	opacity: 0.6;
	margin: 0;
}

/* ---- Layout: ToC rail + body ---- */
.legal-doc__layout {
	display: grid;
	gap: 2.5rem;
	align-items: start;
}

@media (min-width: 980px) {
	.legal-doc__layout {
		grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
		gap: 3.5rem;
	}
}

/* ---- Table of contents ---- */
.legal-doc__toc {
	background: var(--color-grey-light);
	border: 1px solid rgba(13, 19, 43, 0.06);
	border-radius: 14px;
	padding: 1.25rem 1.4rem;
}

@media (min-width: 980px) {
	.legal-doc__toc {
		position: sticky;
		top: 6rem;
		max-height: calc(100vh - 8rem);
		overflow-y: auto;
	}
}

.legal-doc__toc-heading {
	font-family: var(--font-heading);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.55;
	margin: 0 0 0.75rem;
}

.legal-doc__toc-list {
	margin: 0;
	padding-left: 1.1rem;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

@media (max-width: 979px) {
	.legal-doc__toc-list {
		columns: 2;
		column-gap: 1.5rem;
		display: block;
	}

	.legal-doc__toc-list li {
		break-inside: avoid;
		margin-bottom: 0.4rem;
	}
}

.legal-doc__toc-list a {
	font-size: 0.875rem;
	line-height: 1.45;
	color: var(--color-navy-dark);
	opacity: 0.8;
	text-decoration: none;
}

.legal-doc__toc-list a:hover,
.legal-doc__toc-list a:focus-visible {
	opacity: 1;
	color: var(--color-purple-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---- Document body ---- */
.legal-doc__body {
	max-width: 70ch;
}

.legal-doc__body p,
.legal-doc__body li {
	font-size: 1rem;
	line-height: 1.7;
	color: var(--color-navy-dark);
	opacity: 0.88;
}

.legal-doc__body p {
	margin: 0 0 1.1rem;
}

.legal-doc__body ul,
.legal-doc__body ol {
	margin: 0 0 1.4rem;
	padding-left: 1.4rem;
}

.legal-doc__body li {
	margin-bottom: 0.5rem;
}

/*
 * Section headings. The template injects .legal-doc__heading onto whichever
 * level a document uses for sections (h3 on Terms/Privacy/Cookies/AUP, h2 on
 * the Refund policy), so this one rule covers both.
 */
.legal-doc__body .legal-doc__heading {
	font-size: 1.2rem;
	line-height: 1.35;
	text-wrap: balance;
	margin: 2.5rem 0 0.85rem;
	padding-top: 1.6rem;
	border-top: 1px solid rgba(13, 19, 43, 0.07);
	scroll-margin-top: 6rem;
}

.legal-doc__body .legal-doc__heading:first-child {
	margin-top: 0;
	padding-top: 0;
	border-top: none;
}

/* The lone h2 doc-title inside Terms/Privacy/Cookies/AUP content. */
.legal-doc__body > h2:not(.legal-doc__heading) {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.legal-doc__body strong {
	font-weight: 700;
	opacity: 1;
}

.legal-doc__body a {
	color: var(--color-purple-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.legal-doc__body a:hover,
.legal-doc__body a:focus-visible {
	text-decoration-thickness: 2px;
}

.legal-doc__body table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 1.5rem;
	font-size: 0.9375rem;
}

.legal-doc__body th,
.legal-doc__body td {
	text-align: left;
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid rgba(13, 19, 43, 0.08);
	vertical-align: top;
}

/* Wide content must scroll inside itself, never the page. */
.legal-doc__body > figure,
.legal-doc__body > .wp-block-table {
	overflow-x: auto;
}

/* ---- Contact / cross-links footer ---- */
.legal-doc__contact {
	margin-top: 3rem;
	padding: 1.4rem 1.5rem;
	background: var(--color-grey-light);
	border-radius: 14px;
}

.legal-doc__contact h2 {
	font-size: 1rem;
	margin: 0 0 0.5rem;
}

.legal-doc__contact p {
	font-size: 0.9375rem;
	line-height: 1.65;
	margin: 0;
	opacity: 0.85;
}
