/*
 * Legal / policy document layout — Terms, Privacy, Cookies, Shipping,
 * Returns, Legal Notice. Rendered by page-templates/legal-document.php.
 *
 * Built entirely on the existing tokens in main.css (colors, type scale,
 * spacing scale, radii) and the same breakpoints used everywhere else:
 * mobile <600px · tablet 600–959px · desktop >=960px.
 *
 * The reading column is capped at ~70 characters. Long legal text is the
 * one place on this site where line length matters more than filling the
 * 1400px container.
 */

.ff-legal {
	padding-block: var(--space-section);
}

/* ---------- Header ---------- */

.ff-legal__header {
	max-width: 46rem;
	margin-bottom: var(--space-2xl);
}

.ff-legal__title {
	font-size: var(--text-2xl);
	margin-bottom: var(--space-xs);
}

.ff-legal__updated {
	display: inline-block;
	margin-bottom: var(--space-md);
	padding: var(--space-3xs) var(--space-sm);
	border-radius: var(--radius-pill);
	background-color: var(--color-grey-light);
	font-size: var(--text-xs);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.ff-legal__intro {
	font-size: var(--text-md);
	line-height: 1.6;
}

.ff-legal__intro p:last-child {
	margin-bottom: 0;
}

/* ---------- Layout ---------- */

.ff-legal__layout {
	display: grid;
	gap: var(--space-xl);
}

@media (min-width: 960px) {
	.ff-legal__layout {
		grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
		gap: var(--space-3xl);
		align-items: start;
	}
}

/* ---------- Table of contents ---------- */

.ff-legal__toc {
	padding: var(--space-md);
	border-radius: var(--radius-md);
	background-color: var(--color-grey-light);
}

@media (min-width: 960px) {
	.ff-legal__toc {
		position: sticky;
		top: var(--space-lg);
		max-height: calc(100vh - var(--space-2xl));
		overflow-y: auto;
		overscroll-behavior: contain;
	}
}

.ff-legal__toc-heading {
	margin-bottom: var(--space-sm);
	font-family: var(--font-body);
	font-size: var(--text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.ff-legal__toc-list {
	counter-reset: ff-toc;
	font-size: var(--text-sm);
	line-height: 1.4;
}

.ff-legal__toc-list li {
	counter-increment: ff-toc;
	margin-bottom: var(--space-2xs);
}

.ff-legal__toc-list li:last-child {
	margin-bottom: 0;
}

.ff-legal__toc-list a {
	display: block;
	padding: var(--space-3xs) 0;
	border-bottom: 1px solid transparent;
}

.ff-legal__toc-list a::before {
	content: counter(ff-toc) ". ";
	font-weight: 600;
}

.ff-legal__toc-list a:hover,
.ff-legal__toc-list a:focus-visible {
	border-bottom-color: currentColor;
}

/* ---------- Document body ---------- */

.ff-legal__body {
	max-width: 44rem;
	font-size: var(--text-base);
	line-height: 1.7;
}

/*
 * Sections are focus targets so that following a TOC link moves keyboard
 * focus into the section, not just the viewport. scroll-margin keeps the
 * heading clear of the sticky site header.
 */
.ff-legal__section {
	margin-bottom: var(--space-2xl);
	scroll-margin-top: var(--space-xl);
}

.ff-legal__section:focus {
	outline: none;
}

.ff-legal__section:focus-visible {
	outline: 2px solid var(--color-black);
	outline-offset: var(--space-sm);
	border-radius: var(--radius-sm);
}

.ff-legal__section-title {
	margin-bottom: var(--space-sm);
	padding-top: var(--space-sm);
	border-top: 2px solid var(--color-black);
	font-size: var(--text-xl);
}

.ff-legal__body h3 {
	margin-top: var(--space-lg);
	margin-bottom: var(--space-2xs);
	font-family: var(--font-body);
	font-size: var(--text-md);
	font-weight: 600;
}

.ff-legal__body a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
	text-decoration-thickness: 1px;
}

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

/* ---------- Lists ---------- */

.ff-legal__list {
	margin: 0 0 1em;
	padding-left: var(--space-md);
	list-style: disc;
}

.ff-legal__list--numbered {
	list-style: decimal;
}

.ff-legal__list li {
	margin-bottom: var(--space-2xs);
	padding-left: var(--space-3xs);
}

.ff-legal__list li::marker {
	color: var(--color-black);
	font-weight: 600;
}

/* ---------- Callout ---------- */

.ff-legal__callout {
	margin: var(--space-md) 0;
	padding: var(--space-md);
	border-left: 4px solid var(--color-gold);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	background-color: var(--color-grey-light);
	font-size: var(--text-sm);
}

.ff-legal__callout:last-child {
	margin-bottom: 0;
}

/* ---------- Tables ---------- */

/* Wide tables scroll inside their own box; the page body never does. */
.ff-legal__table-wrap {
	margin: var(--space-md) 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.ff-legal__table {
	width: 100%;
	min-width: 32rem;
	border-collapse: collapse;
	font-size: var(--text-sm);
	text-align: left;
}

.ff-legal__table th,
.ff-legal__table td {
	padding: var(--space-sm);
	border-bottom: 1px solid var(--color-grey-light);
	vertical-align: top;
}

.ff-legal__table thead th {
	border-bottom: 2px solid var(--color-black);
	font-weight: 700;
	white-space: nowrap;
}

.ff-legal__table tbody th {
	font-weight: 600;
}

.ff-legal__table code {
	font-size: 0.9em;
	overflow-wrap: anywhere;
}

/* ---------- Address block (Legal Notice) ---------- */

.ff-legal__address {
	margin: 0 0 1em;
	padding: var(--space-md);
	border-radius: var(--radius-md);
	background-color: var(--color-grey-light);
	font-style: normal;
	line-height: 1.7;
}

/* ---------- Back to top ---------- */

.ff-legal__back-to-top {
	margin-top: var(--space-xl);
	font-size: var(--text-sm);
	font-weight: 600;
}

/* ---------- Related pages ---------- */

.ff-legal__related {
	margin-top: var(--space-2xl);
	padding: var(--space-lg);
	border-radius: var(--radius-lg);
	background-color: var(--color-grey-light);
}

.ff-legal__related-heading {
	margin-bottom: var(--space-sm);
	font-family: var(--font-body);
	font-size: var(--text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.ff-legal__related-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2xs) var(--space-md);
	margin-bottom: var(--space-md);
	font-size: var(--text-sm);
	font-weight: 600;
}

.ff-legal__related-list a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.ff-legal__related-contact {
	margin-bottom: 0;
	font-size: var(--text-sm);
}

.ff-legal__related-contact a {
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

