/* The legal and support pages built by tools/build_pages.py, on top of main.min.css: the site's header, glows, glass
   card and footer; a readable column for long texts (the site's red is kept for titles, the text itself is a deep brown
   that reads on cream for pages at a time). */
/* main.css hides the sideways overflow with "hidden", which makes html and body scroll containers and keeps the table
   of contents from sticking; "clip" cuts the same overflow without that */
html,
body {
	overflow-x: clip;
}

.legal {
	--legal-text: #4a221d;
	position: relative;
	padding-top: 72px;
}

/* The home page's language switcher: FR | NL | EN, the chosen one bold */
.legal-languages {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-right: 15px;
	font-size: 0.9rem;
	color: rgba(160, 62, 52, 0.3);
}

.legal-languages .lang-btn {
	color: var(--color-primary);
	opacity: 0.7;
}

.legal-languages .lang-btn.active {
	font-weight: bold;
	opacity: 1;
}

/* The logo as on the home page: mark and name side by side */
.legal-logo,
.site-footer .footer-logo {
	display: flex;
	align-items: center;
	gap: var(--spacing-sm);
}

.legal-logo img,
.site-footer .footer-logo img {
	height: 40px;
	width: auto;
}

/* Title band: the home page's hero, quieter; its glows spread over the page behind the text */
.legal-hero {
	position: relative;
	padding: var(--spacing-xl) 0 var(--spacing-lg);
	text-align: center;
}

.legal-glow {
	position: absolute;
	border-radius: 50%;
	filter: blur(140px);
	opacity: 0.18;
	pointer-events: none;
}

.legal-glow-red {
	top: -220px;
	right: -5%;
	width: 520px;
	height: 520px;
	background: var(--color-primary);
}

.legal-glow-orange {
	top: 40px;
	left: -8%;
	width: 440px;
	height: 440px;
	background: var(--color-secondary);
}

.legal-hero-inner,
.legal-layout {
	position: relative;
	z-index: 1;
}

.legal-hero h1 {
	font-size: clamp(2rem, 5vw, 3.25rem);
	margin: 0 auto var(--spacing-sm);
	max-width: 22ch;
}

.legal-meta {
	color: var(--color-text-secondary);
	font-size: 0.95rem;
	margin-bottom: var(--spacing-lg);
}

.legal-hero h1 + .legal-switcher {
	margin-top: var(--spacing-md);
}

/* Switching between the three documents: the app's filter chips */
.legal-switcher {
	display: inline-flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px;
	padding: 5px;
	border-radius: var(--radius-full);
	background: rgba(160, 62, 52, 0.08);
	border: 1px solid rgba(160, 62, 52, 0.12);
}

.legal-switcher a {
	padding: 0.5rem 1.1rem;
	border-radius: var(--radius-full);
	color: var(--color-primary);
	font-size: 0.95rem;
}

.legal-switcher a:hover {
	background: rgba(160, 62, 52, 0.08);
}

.legal-switcher a[aria-current="page"] {
	background: #fff;
	box-shadow: var(--shadow-sm);
}

/* Table of contents beside the text */
.legal-layout {
	display: grid;
	grid-template-columns: 15rem minmax(0, 1fr);
	gap: var(--spacing-xl);
	align-items: start;
	max-width: calc(15rem + 52rem + var(--spacing-xl) + 2 * var(--spacing-md));
	padding-bottom: var(--spacing-2xl);
}

.legal-layout:not(:has(.legal-toc)) {
	grid-template-columns: minmax(0, 1fr);
	max-width: 52rem;
}

.legal-toc {
	position: sticky;
	top: 96px;
	font-size: 0.92rem;
}

.legal-toc summary {
	color: var(--color-primary);
	font-weight: 700;
	margin-bottom: var(--spacing-sm);
	cursor: pointer;
}

.legal-toc ol {
	list-style: none;
	display: grid;
	gap: 2px;
	border-left: 1px solid rgba(160, 62, 52, 0.15);
}

.legal-toc a {
	display: block;
	padding: 0.3rem 0 0.3rem var(--spacing-md);
	margin-left: -1px;
	border-left: 1px solid transparent;
	color: var(--color-text-secondary);
	line-height: 1.35;
}

.legal-toc a:hover {
	color: var(--color-primary);
	border-left-color: var(--color-primary);
}

/* The text */
.legal-article {
	max-width: 52rem;
	padding: clamp(1.5rem, 4vw, 3rem);
	color: var(--legal-text);
	font-size: 1.05rem;
	line-height: 1.7;
	overflow-wrap: anywhere;
}

.legal-article > * + * {
	margin-top: var(--spacing-md);
}

.legal-article h2 {
	margin-top: var(--spacing-xl);
	font-size: 1.45rem;
	scroll-margin-top: 96px;
}

.legal-article h2:first-child {
	margin-top: 0;
}

.legal-article h3 {
	margin-top: var(--spacing-lg);
	font-size: 1.1rem;
	color: var(--legal-text);
}

.legal-article p,
.legal-article li {
	max-width: 70ch;
}

.legal-article ul {
	list-style: disc;
	padding-left: 1.25rem;
}

.legal-article li + li {
	margin-top: var(--spacing-xs);
}

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

.legal-article strong {
	color: var(--color-text-primary);
}

.legal-article code {
	font-size: 0.9em;
	background: var(--color-bg-dark);
	padding: 0 0.25em;
	border-radius: var(--radius-sm);
}

.legal-article table {
	display: block;
	overflow-x: auto;
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
	line-height: 1.5;
}

.legal-article th,
.legal-article td {
	padding: var(--spacing-sm) var(--spacing-md);
	border-bottom: 1px solid rgba(160, 62, 52, 0.12);
	text-align: left;
	vertical-align: top;
}

.legal-article th {
	color: var(--color-primary);
	background: rgba(254, 241, 239, 0.7);
}

.legal-article blockquote {
	padding: var(--spacing-md);
	border: 1px solid rgba(160, 62, 52, 0.18);
	border-radius: var(--radius-md);
	background: rgba(254, 241, 239, 0.7);
}

/* Footer: the site's, with the three documents */
.legal-footer-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--spacing-xs) var(--spacing-md);
	margin-top: var(--spacing-xs);
}

.legal-footer-links a:hover {
	color: var(--color-primary);
}

.legal :focus-visible,
.site-header :focus-visible,
.site-footer :focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

@media (max-width: 900px) {
	.legal-layout {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--spacing-md);
	}

	.legal-toc {
		position: static;
		padding: var(--spacing-md);
		border-radius: var(--radius-lg);
		background: rgba(255, 255, 255, 0.6);
		border: 1px solid rgba(160, 62, 52, 0.12);
	}

	.legal-toc summary {
		margin-bottom: 0;
	}

	.legal-toc details[open] summary {
		margin-bottom: var(--spacing-sm);
	}
}

@media (max-width: 768px) {
	.legal {
		padding-top: 60px;
	}

	/* Three equal segments rather than chips wrapping into a blob */
	.legal-switcher {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		width: 100%;
		border-radius: var(--radius-lg);
	}

	.legal-switcher a {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 0.5rem 0.4rem;
		border-radius: var(--radius-md);
		font-size: 0.85rem;
		line-height: 1.25;
		text-align: center;
	}

	.site-footer .footer-content {
		grid-template-columns: 1fr;
		justify-items: center;
		text-align: center;
	}

	.site-footer .footer-right {
		justify-self: center;
	}
}
