/**
 * JobRelay legal pages.
 *
 * Matches the jobrelay.io block theme: the colours, type scale, spacing
 * and radii below come from the theme's theme.json, and the header,
 * banner, sheet, links and footer follow its assets/css/theme.css.
 */

/* ---------- Fonts ---------- */

@font-face {
	font-display: swap;
	font-family: Inter;
	font-style: normal;
	font-weight: 400;
	src: url("../fonts/inter/inter-400.woff2") format("woff2");
}

@font-face {
	font-display: swap;
	font-family: Inter;
	font-style: normal;
	font-weight: 500;
	src: url("../fonts/inter/inter-500.woff2") format("woff2");
}

@font-face {
	font-display: swap;
	font-family: Inter;
	font-style: normal;
	font-weight: 600;
	src: url("../fonts/inter/inter-600.woff2") format("woff2");
}

@font-face {
	font-display: swap;
	font-family: Inter;
	font-style: normal;
	font-weight: 700;
	src: url("../fonts/inter/inter-700.woff2") format("woff2");
}

@font-face {
	font-display: swap;
	font-family: Inter;
	font-style: normal;
	font-weight: 800;
	src: url("../fonts/inter/inter-800.woff2") format("woff2");
}

/* ---------- Design tokens (theme.json) ---------- */

:root {
	--navy: #272F4F;
	--mint: #00D6A5;
	--mint-dark: #00805F;
	--mint-light: #E3FAF3;
	--white: #FFFFFF;
	--grey-light: #F5F5F5;
	--grey: #EBEBEB;
	--grey-dark: #5C5C5C;

	--space-20: 8px;
	--space-30: 12px;
	--space-40: 20px;
	--space-50: 32px;
	--space-60: clamp(40px, 5vw, 56px);
	--space-70: clamp(48px, 6vw, 72px);
	--space-80: clamp(72px, 9vw, 112px);

	--font-x-small: 14px;
	--font-small: 15px;
	--font-medium: 17px;
	--font-large: clamp(18px, 1.2vw + 13px, 19px);
	--font-x-large: clamp(21px, 1vw + 17px, 24px);
	--font-xx-large: clamp(32px, 2.5vw + 22px, 44px);
	--font-huge: clamp(40px, 4vw + 24px, 60px);

	--radius-small: 4px;
	--radius-medium: 6px;
	--radius-large: 10px;
	--radius-x-large: 14px;

	--content-size: 760px;
	--wide-size: 1100px;
	--gutter: var(--space-40);
	--sheet-overlap: clamp(48px, 6vw, 80px);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

body {
	background-color: var(--white);
	color: var(--navy);
	font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: var(--font-medium);
	line-height: 1.6;
	margin: 0;
	-webkit-font-smoothing: antialiased;
}

img {
	display: block;
	height: auto;
	max-width: 100%;
}

a {
	color: var(--navy);
}

a:hover {
	color: #00A07B;
}

:focus-visible {
	outline: 2px solid var(--mint-dark);
	outline-offset: 2px;
}

h1,
h2,
h3,
h4 {
	font-weight: 800;
	letter-spacing: -0.025em;
	line-height: 1.12;
	margin: 0;
}

h1 {
	font-size: var(--font-huge);
	letter-spacing: -0.03em;
	line-height: 1.05;
}

h2 {
	font-size: var(--font-xx-large);
}

h3 {
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.3;
}

h4 {
	font-size: var(--font-large);
	font-weight: 700;
	letter-spacing: 0;
}

/* Wide area: lines up with the header, banner and footer. */
.wrap {
	margin-inline: auto;
	max-width: var(--wide-size);
	width: 100%;
}

.skip-link {
	background: var(--mint);
	border-radius: var(--radius-medium);
	color: var(--navy);
	font-weight: 700;
	left: var(--gutter);
	padding: 10px 16px;
	position: absolute;
	top: -100px;
	z-index: 100;
}

.skip-link:focus {
	top: 12px;
}

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

.site-header {
	background-color: var(--white);
	border-bottom: 1px solid var(--grey);
	padding: 16px var(--gutter);
	position: relative;
	z-index: 10;
}

.site-header__row {
	align-items: center;
	display: flex;
	gap: 16px 32px;
	justify-content: space-between;
}

.site-header__logo {
	flex-shrink: 0;
}

.site-header__logo img {
	width: 96px;
}

.site-header__actions {
	align-items: center;
	display: flex;
	gap: 28px;
}

/*
 * Back to the main site, with a left arrow. A mint line swipes in
 * underneath on hover, like the site's header links.
 */
.site-header__back {
	align-items: center;
	background-image: linear-gradient(var(--mint), var(--mint));
	background-position: 0 100%;
	background-repeat: no-repeat;
	background-size: 0% 2px;
	color: var(--navy);
	display: inline-flex;
	font-size: var(--font-small);
	font-weight: 600;
	gap: 8px;
	padding-bottom: 4px;
	padding-top: 4px;
	text-decoration: none;
	transition: background-size 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.site-header__back::before {
	background: currentColor;
	content: "";
	flex-shrink: 0;
	height: 16px;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5'/%3E%3Cpath d='m11 6-6 6 6 6'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5'/%3E%3Cpath d='m11 6-6 6 6 6'/%3E%3C/svg%3E") no-repeat center / contain;
	width: 16px;
}

.site-header__back:is(:hover, :focus-visible) {
	background-size: 100% 2px;
	color: var(--navy);
}

@media (prefers-reduced-motion: reduce) {
	.site-header__back {
		transition: none;
	}
}

/* On phones there's only room for the logo and the back link. */
@media (max-width: 599px) {
	.site-header__actions .button {
		display: none;
	}
}

/* ---------- Buttons ---------- */

/* Mint button; a slightly deeper mint swipes in from the left on hover. */
.button {
	background-color: var(--mint);
	background-image: linear-gradient(#00c496, #00c496);
	background-position: left center;
	background-repeat: no-repeat;
	background-size: 0% 100%;
	border-radius: var(--radius-medium);
	color: var(--navy);
	display: inline-block;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.5;
	padding: 14px 26px;
	text-decoration: none;
	transition: background-size 0.4s cubic-bezier(0.65, 0, 0.35, 1), transform 0.2s ease;
}

.button:is(:hover, :focus-visible) {
	background-size: 100% 100%;
	color: var(--navy);
	transform: translate(1px, -1px);
}

@media (prefers-reduced-motion: reduce) {
	.button {
		transition: none;
	}
}

/* ---------- Banner ---------- */

/* Faint white dot grid over a navy background. */
.is-style-dots {
	isolation: isolate;
	position: relative;
}

.is-style-dots::before {
	background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1.4px);
	background-size: 22px 22px;
	content: "";
	inset: 0;
	pointer-events: none;
	position: absolute;
	z-index: -1;
}

/*
 * Navy page title banner with the relay arrows from the logo on the
 * right. The extra bottom padding makes room for the white sheet that
 * overlaps it (see .page-sheet).
 */
.page-banner {
	background-color: var(--navy);
	color: var(--white);
	overflow: hidden;
	padding: var(--space-70) var(--gutter) calc(var(--space-70) + var(--sheet-overlap));
}

.page-banner::after {
	aspect-ratio: 460 / 222;
	background: url("../img/relay-mark.svg") no-repeat center / contain;
	content: "";
	height: 110%;
	max-width: 45%;
	opacity: 0.12;
	pointer-events: none;
	position: absolute;
	right: max(var(--gutter), calc((100% - var(--wide-size)) / 2));
	top: 50%;
	transform: translateY(-50%);
	z-index: -1;
}

@media (max-width: 781px) {
	.page-banner::after {
		display: none;
	}
}

.page-banner .wrap > * + * {
	margin-top: 24px;
}

.page-banner h1 {
	max-width: var(--content-size);
	text-wrap: balance;
}

/* Pill above the title, like the "Documentation" badge on the site. */
.banner-badge {
	background: rgba(0, 214, 165, 0.14);
	border-radius: 999px;
	color: #5BF0CB;
	display: inline-block;
	font-size: var(--font-x-small);
	font-weight: 600;
	line-height: 1.5;
	margin: 0 0 12px;
	padding: 6px 14px;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

a.banner-badge:is(:hover, :focus-visible) {
	background: rgba(0, 214, 165, 0.24);
	color: #5BF0CB;
}

.page-banner .wrap > .banner-badge + h1 {
	margin-top: 0;
}

.banner-intro {
	color: rgba(255, 255, 255, 0.82);
	font-size: var(--font-medium);
	margin-bottom: 0;
	max-width: 620px;
}

.banner-updated {
	font-size: var(--font-small);
	margin-bottom: 0;
	opacity: 0.8;
}

/* Banner entrance: contents fade in and rise, one after another. */
@media (prefers-reduced-motion: no-preference) {
	.page-banner .wrap > * {
		animation: banner-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
	}

	.page-banner .wrap > :nth-child(2) {
		animation-delay: 0.08s;
	}

	.page-banner .wrap > :nth-child(n + 3) {
		animation-delay: 0.16s;
	}

	.page-banner::after {
		animation: fade-in 1.2s ease 0.2s both;
	}
}

@keyframes banner-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
}

@keyframes fade-in {
	from {
		opacity: 0;
	}
}

/* ---------- Sheet ---------- */

/*
 * The content sits on a white panel with rounded top corners that
 * overlaps the bottom of the banner, as on the site's pages.
 */
.page-sheet {
	margin-top: calc(-1 * var(--sheet-overlap));
	padding: var(--space-60) var(--gutter) var(--space-80);
	position: relative;
	z-index: 1;
}

.page-sheet::before {
	background-color: var(--white);
	border-radius: var(--radius-x-large) var(--radius-x-large) 0 0;
	content: "";
	height: calc(var(--sheet-overlap) + 1px);
	left: max(0px, calc((100% - var(--wide-size)) / 2 - var(--space-60)));
	position: absolute;
	right: max(0px, calc((100% - var(--wide-size)) / 2 - var(--space-60)));
	top: 0;
	z-index: -1;
}

/* Contents list beside the text on wide screens, above it on phones. */
.legal-layout {
	display: grid;
	gap: var(--space-50) var(--space-70);
	grid-template-columns: minmax(0, var(--content-size));
}

@media (min-width: 960px) {
	.legal-layout--toc {
		grid-template-columns: minmax(0, var(--content-size)) 260px;
		justify-content: space-between;
	}

	.legal-layout--toc .legal-toc {
		grid-column: 2;
		grid-row: 1;
	}
}

/* ---------- Content ---------- */

.legal-content > * {
	margin-bottom: 0;
	margin-top: 24px;
}

.legal-content > :first-child {
	margin-top: 0;
}

.legal-content > h2 {
	margin-top: var(--space-70);
	scroll-margin-top: 24px;
}

.legal-content > h3 {
	margin-top: var(--space-50);
	scroll-margin-top: 24px;
}

.legal-content > :is(h2, h3) + :is(h2, h3) {
	margin-top: var(--space-40);
}

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

/*
 * Numbered sections: a small mint "01" above each heading, as the
 * original pages numbered their sections.
 */
.legal-content {
	counter-reset: section;
}

.legal-content .is-style-section-title-count {
	counter-increment: section;
	font-size: clamp(26px, 1.5vw + 20px, 32px);
}

.legal-content .is-style-section-title-count::before {
	color: var(--mint-dark);
	content: counter(section, decimal-leading-zero);
	display: block;
	font-size: var(--font-x-small);
	font-weight: 700;
	letter-spacing: 0.08em;
	margin-bottom: 10px;
}

/* Lists: space between items, but not after the last one. */
.legal-content :where(ul, ol) {
	padding-left: 1.3em;
}

.legal-content :where(ul, ol) > li + li,
.legal-content li > :where(ul, ol) {
	margin-top: var(--space-20);
}

.legal-content li::marker {
	color: var(--mint-dark);
}

.legal-content ol > li::marker {
	font-weight: 700;
}

.legal-content address {
	background-color: var(--grey-light);
	border-radius: var(--radius-large);
	font-style: normal;
	padding: 20px 24px;
}

/*
 * Links: navy text with a soft mint underline. On hover a solid mint
 * line swipes across from the left.
 */
.legal-content a,
.legal-cards a {
	background-image:
		linear-gradient(var(--mint), var(--mint)),
		linear-gradient(rgba(0, 214, 165, 0.35), rgba(0, 214, 165, 0.35));
	background-position: 0 100%, 0 100%;
	background-repeat: no-repeat;
	background-size: 0% 3px, 100% 3px;
	color: var(--navy);
	overflow-wrap: anywhere;
	padding-bottom: 2px;
	text-decoration: none;
	transition: background-size 0.4s cubic-bezier(0.65, 0, 0.35, 1), color 0.15s ease;
}

.legal-content a:is(:hover, :focus-visible) {
	background-size: 100% 3px, 100% 3px;
	color: var(--navy);
}

@media (prefers-reduced-motion: reduce) {
	.legal-content a {
		transition: color 0.15s ease;
	}
}

/* ---------- Contents list ---------- */

/*
 * White card with a grey border. A grey line runs down the left and the
 * section you're reading gets a mint marker (set by assets/js/legal.js).
 * On wide screens it stays in view as you scroll.
 */
.legal-toc {
	align-self: start;
	background-color: var(--white);
	border: 1px solid var(--grey);
	border-radius: var(--radius-large);
	padding: 0;
}

.legal-toc > summary {
	color: var(--grey-dark);
	cursor: pointer;
	font-size: var(--font-x-small);
	font-weight: 700;
	letter-spacing: 0.08em;
	list-style: none;
	padding: 18px 24px;
	position: relative;
	text-transform: uppercase;
}

.legal-toc > summary::-webkit-details-marker {
	display: none;
}

.legal-toc > summary::after {
	border-bottom: 2px solid currentColor;
	border-right: 2px solid currentColor;
	content: "";
	height: 8px;
	position: absolute;
	right: 24px;
	top: 50%;
	transform: translateY(-75%) rotate(45deg);
	transition: transform 0.2s ease;
	width: 8px;
}

.legal-toc[open] > summary::after {
	transform: translateY(-25%) rotate(-135deg);
}

.legal-toc ol {
	border-left: 2px solid var(--grey);
	display: flex;
	flex-direction: column;
	gap: 2px;
	list-style: none;
	margin: 0 24px 24px;
	padding: 0;
}

.legal-toc a {
	border-left: 2px solid transparent;
	color: var(--navy);
	display: block;
	font-size: var(--font-small);
	font-weight: 500;
	line-height: 1.4;
	margin-left: -2px;
	padding: 6px 0 6px 14px;
	text-decoration: none;
}

.legal-toc a:hover {
	color: var(--mint-dark);
}

.legal-toc a[aria-current="location"] {
	border-left-color: var(--mint);
	color: var(--mint-dark);
	font-weight: 700;
}

@media (min-width: 960px) {
	.legal-toc {
		max-height: calc(100vh - 48px);
		overflow-y: auto;
		position: sticky;
		top: 24px;
	}

	.legal-toc > summary {
		cursor: default;
		padding-bottom: 12px;
		pointer-events: none;
	}

	.legal-toc > summary::after {
		content: none;
	}
}

/* ---------- Index cards ---------- */

.legal-cards {
	display: grid;
	gap: var(--space-40);
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.legal-cards a {
	background: var(--white);
	border: 1px solid var(--grey);
	border-radius: var(--radius-large);
	display: flex;
	flex-direction: column;
	gap: 8px;
	height: 100%;
	padding: 24px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.legal-cards a:is(:hover, :focus-visible) {
	border-color: var(--mint);
	box-shadow: 0 12px 28px rgba(39, 47, 79, 0.08);
	color: var(--navy);
	transform: translateY(-2px);
}

.legal-cards strong {
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
}

.legal-cards span {
	color: var(--grey-dark);
	font-size: var(--font-small);
}

/* "Read" with an arrow, pushed to the bottom of the card. */
.legal-cards em {
	align-items: center;
	color: var(--mint-dark);
	display: inline-flex;
	font-size: var(--font-small);
	font-style: normal;
	font-weight: 700;
	gap: 8px;
	margin-top: auto;
	padding-top: 8px;
}

.legal-cards em::after {
	background: currentColor;
	content: "";
	height: 16px;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m13 6 6 6-6 6'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m13 6 6 6-6 6'/%3E%3C/svg%3E") no-repeat center / contain;
	transition: transform 0.2s ease;
	width: 16px;
}

.legal-cards a:hover em::after {
	transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
	.legal-cards a,
	.legal-cards em::after {
		transition: none;
	}
}

/*
 * Card entrance: after the banner, the cards fade in and rise 12px,
 * one after another, the same way as the banner's contents.
 */
@media (prefers-reduced-motion: no-preference) {
	.legal-cards > li {
		animation: banner-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
		animation-delay: 0.3s;
	}

	.legal-cards > li:nth-child(2) {
		animation-delay: 0.38s;
	}

	.legal-cards > li:nth-child(3) {
		animation-delay: 0.46s;
	}

	.legal-cards > li:nth-child(4) {
		animation-delay: 0.54s;
	}
}

/* ---------- Footer ---------- */

.site-footer {
	background-color: var(--navy);
	color: rgba(255, 255, 255, 0.8);
	font-size: var(--font-small);
	padding: 72px var(--gutter) 40px;
}

.site-footer a {
	color: inherit;
	text-decoration: none;
}

.site-footer a:is(:hover, :focus) {
	color: var(--white);
	text-decoration: underline;
}

.site-footer__grid {
	display: grid;
	gap: 40px;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
}

.site-footer__grid p {
	margin: 24px 0 0;
}

.site-footer__logo img {
	width: 110px;
}

.footer-links {
	display: flex;
	flex-direction: column;
	gap: 10px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.footer-legal {
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	color: rgba(255, 255, 255, 0.7);
	font-size: var(--font-x-small);
	margin: 48px auto 0;
	padding-top: 24px;
}
