/**
 * Highrise Digital legal documents.
 *
 * Styles for the terms, policies and agreements in this repository, and for
 * client addendums rendered to PDF from the same markup.
 *
 * The design follows the Highrise Digital website theme
 * (wp-content/themes/highrise in the website repository). The colours,
 * fonts, font sizes and spacing below are copied from that theme's
 * theme.json, and the tables, lists, eyebrows and pixel cards follow its
 * block stylesheets, so the documents look like part of the website.
 *
 * If the website's design tokens change, update the custom properties in
 * :root to match.
 */

/* ------------------------------------------------------------------------
 * Fonts.
 *
 * The same self-hosted files the website uses.
 * --------------------------------------------------------------------- */

@font-face {
	font-family: "Montserrat";
	font-style: normal;
	font-weight: 400 800;
	font-display: swap;
	src: url("../fonts/montserrat-latin-variable.woff2") format("woff2");
}

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

@font-face {
	font-family: "Space Mono";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/space-mono-latin-400.woff2") format("woff2");
}

@font-face {
	font-family: "Space Mono";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/space-mono-latin-700.woff2") format("woff2");
}

/* ------------------------------------------------------------------------
 * Design tokens, from the website's theme.json.
 * --------------------------------------------------------------------- */

:root {
	/* Colours. */
	--color-ink: #211F37;
	--color-ink-muted: #5B6178;
	--color-midnight: #191728;
	--color-navy: #262E4D;
	--color-navy-light: #2F3A60;
	--color-mint: #00D6A5;
	--color-mint-bright: #28F0C0;
	--color-paper: #F4F5F2;
	--color-paper-dark: #ECEEE9;
	--color-mist: #C9CEE0;
	--color-white: #FFFFFF;
	--color-warning: #F2B705;
	--color-alert: #D93F3F;

	/* Thin lines: Ink at 12%, as under the website's header. */
	--color-line: color-mix(in srgb, var(--color-ink) 12%, transparent);

	/* Fonts. */
	--font-heading: "Montserrat", system-ui, sans-serif;
	--font-body: "Inter", system-ui, sans-serif;
	--font-mono: "Space Mono", ui-monospace, monospace;

	/* Font sizes. */
	--font-size-x-small: 0.75rem;
	--font-size-small: 0.875rem;
	--font-size-medium: 1rem;
	--font-size-large: clamp(1.125rem, 1.07rem + 0.25vw, 1.25rem);
	--font-size-x-large: clamp(1.3125rem, 1.11rem + 0.87vw, 1.75rem);
	--font-size-xx-large: clamp(1.75rem, 1.28rem + 2vw, 2.75rem);
	--font-size-xxx-large: clamp(2.375rem, 1.68rem + 2.98vw, 3.875rem);

	/* Spacing. */
	--space-10: 0.25rem;
	--space-20: 0.5rem;
	--space-30: 0.75rem;
	--space-40: 1rem;
	--space-50: clamp(1.25rem, 2.5vw, 1.625rem);
	--space-60: clamp(1.5rem, 3vw, 2rem);
	--space-70: clamp(2rem, 5vw, 3.375rem);
	--space-80: clamp(3.75rem, 8vw, 5.75rem);

	/* Layout. */
	--content-size: 720px;
	--wide-size: 1180px;
}

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

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

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

/* A column layout, so the footer sits at the bottom of short pages. */
body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	margin: 0;
	background-color: var(--color-paper);
	color: var(--color-ink-muted);
	font-family: var(--font-body);
	font-size: var(--font-size-medium);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

img,
svg {
	max-width: 100%;
	height: auto;
}

:focus-visible {
	outline: 2.5px solid var(--color-ink);
	outline-offset: 3px;
}

/* ------------------------------------------------------------------------
 * Skip link.
 * --------------------------------------------------------------------- */

.skip-link a {
	position: absolute;
	top: var(--space-30);
	left: var(--space-30);
	z-index: 200;
	padding: 0.875rem 1.375rem;
	background-color: var(--color-mint);
	color: var(--color-ink);
	font-size: var(--font-size-small);
	font-weight: 600;
	text-decoration: none;
	transform: translateY(-200%);
}

.skip-link a:focus {
	transform: none;
}

/* ------------------------------------------------------------------------
 * Header.
 *
 * As on the website: the logo on Paper, with a thin line underneath.
 * --------------------------------------------------------------------- */

.site-header {
	border-bottom: 1px solid var(--color-line);
	padding: var(--space-40) var(--space-50);
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-50);
	max-width: var(--wide-size);
	min-height: 74px;
	margin: 0 auto;
}

.site-info__logo {
	display: block;
	width: 150px;
}

.site-title__logo {
	display: block;
	width: 150px;
	height: auto;
}

.site-header__label {
	margin: 0;
	color: var(--color-ink-muted);
	font-family: var(--font-mono);
	font-size: var(--font-size-x-small);
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

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

.site-header__label a:hover {
	color: var(--color-ink);
}

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

.entry-content {
	flex: 1 0 auto;
	width: 100%;
	max-width: calc(var(--content-size) + 2 * var(--space-50));
	margin: 0 auto;
	padding: var(--space-70) var(--space-50) var(--space-80);
	counter-reset: sectionCounter;
}

.entry-content > * {
	margin-block: 0;
}

.entry-content > * + * {
	margin-block-start: var(--space-40);
}

/* ------------------------------------------------------------------------
 * Headings.
 * --------------------------------------------------------------------- */

h1,
h2,
h3,
h4,
h5,
h6 {
	color: var(--color-ink);
	font-family: var(--font-heading);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.05;
	text-wrap: balance;
}

h1 {
	font-size: var(--font-size-xxx-large);
}

h2 {
	font-size: var(--font-size-x-large);
	line-height: 1.15;
}

h3 {
	font-size: var(--font-size-large);
	line-height: 1.25;
}

h4 {
	font-size: var(--font-size-medium);
	line-height: 1.35;
}

h5,
h6 {
	font-size: var(--font-size-small);
	line-height: 1.35;
}

.entry-content > h1 {
	margin-block-end: var(--space-60);
}

.entry-content > h2 {
	margin-block-start: var(--space-70);
}

.entry-content > :is(h3, h4, h5, h6) {
	margin-block-start: var(--space-60);
}

/* Content straight after a heading sits a little closer to it. */
.entry-content > :is(h2, h3, h4, h5, h6) + * {
	margin-block-start: var(--space-30);
}

/**
 * Eyebrow.
 *
 * The website's Eyebrow pixel style: small Space Mono text after an 8px
 * Mint square, sitting above the page title.
 */
.is-style-eyebrow {
	color: var(--color-ink-muted);
	font-family: var(--font-mono);
	font-size: var(--font-size-x-small);
	font-weight: 400;
	letter-spacing: 0.16em;
	line-height: 1.6;
	text-transform: uppercase;
}

.is-style-eyebrow::before {
	content: "";
	display: inline-block;
	width: 8px;
	height: 8px;
	margin-inline-end: 10px;
	background-color: var(--color-mint);
	vertical-align: 0.05em;
}

.entry-content > .is-style-eyebrow + h1 {
	margin-block-start: var(--space-30);
}

/**
 * Numbered section headings.
 *
 * Each section heading gets a thin line above it and its number in Space
 * Mono, written like the website's code-comment labels ("// 01"), with
 * the number in Ink after a Mint square. The numbers are generated, so
 * they always match the order of the sections.
 */
.is-style-section-title-count,
.is-style-section-title-count-reset {
	counter-increment: sectionCounter;
	padding-block-start: var(--space-60);
	border-top: 1px solid var(--color-line);
}

.is-style-section-title-count-reset {
	counter-reset: sectionCounter;
}

.is-style-section-title-count::before,
.is-style-section-title-count-reset::before {
	content: counter(sectionCounter, decimal-leading-zero);
	display: block;
	width: fit-content;
	margin-block-end: var(--space-30);
	padding: 0.15em 0.6em;
	background-color: var(--color-ink);
	color: var(--color-mint);
	font-family: var(--font-mono);
	font-size: var(--font-size-x-small);
	font-weight: 700;
	letter-spacing: 0.16em;
	line-height: 1.6;
}

/* ------------------------------------------------------------------------
 * Text.
 * --------------------------------------------------------------------- */

strong,
b {
	color: var(--color-ink);
	font-weight: 600;
}

a {
	color: var(--color-ink);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

a:hover {
	color: var(--color-navy-light);
	text-decoration: none;
}

hr {
	height: 1px;
	margin-block: var(--space-60);
	border: 0;
	background-color: var(--color-line);
}

blockquote {
	margin-inline: 0;
	padding-inline-start: var(--space-50);
	border-inline-start: 3px solid var(--color-mint);
	color: var(--color-ink);
}

code {
	padding: 0.1em 0.35em;
	background-color: var(--color-paper-dark);
	border-radius: 2px;
	font-family: var(--font-mono);
	font-size: 0.875em;
}

/* ------------------------------------------------------------------------
 * Lists.
 *
 * Bulleted lists use the website's Pixel list style: an 8px Mint square
 * for each item, and a hollow square for nested items. Numbered lists keep
 * their numbers, in Ink.
 * --------------------------------------------------------------------- */

ul,
ol {
	padding-inline-start: 0;
}

li + li,
li > :is(ul, ol) {
	margin-block-start: var(--space-20);
}

ul {
	list-style: none;
}

ul > li {
	position: relative;
	padding-inline-start: 22px;
}

ul > li::before {
	content: "";
	position: absolute;
	top: calc(0.8em - 4px);
	left: 0;
	width: 8px;
	height: 8px;
	background-color: var(--color-mint);
}

ul ul > li::before {
	border: 2px solid var(--color-mint);
	background-color: transparent;
}

ol {
	padding-inline-start: 1.75em;
}

ol > li {
	padding-inline-start: 0.25em;
}

ol > li::marker {
	color: var(--color-ink);
	font-family: var(--font-mono);
	font-size: var(--font-size-small);
	font-weight: 700;
}

/**
 * Definition lists.
 *
 * Each term in Ink, with its definition indented beside a thin Mint line.
 */
dl {
	padding: 0;
}

dt {
	color: var(--color-ink);
}

dt + dd {
	margin-block-start: var(--space-10);
}

dd {
	margin: 0 0 var(--space-40);
	padding-inline-start: var(--space-40);
	border-inline-start: 2px solid color-mix(in srgb, var(--color-mint) 60%, transparent);
}

dd:last-child {
	margin-block-end: 0;
}

/* ------------------------------------------------------------------------
 * Tables.
 *
 * The website's Card table style: a white box with a faint Mint border,
 * an Ink header row in Space Mono and thin Mist lines between rows.
 * --------------------------------------------------------------------- */

table {
	width: 100%;
	border-collapse: collapse;
	background-color: var(--color-white);
	border: 1px solid color-mix(in srgb, var(--color-mint) 40%, transparent);
	font-size: var(--font-size-small);
}

th,
td {
	padding: var(--space-30) var(--space-40);
	border-bottom: 1px solid var(--color-mist);
	text-align: start;
	vertical-align: top;
}

tbody tr:last-child :is(th, td) {
	border-bottom: 0;
}

thead th {
	background-color: var(--color-ink);
	border-bottom: 0;
	color: var(--color-mist);
	font-family: var(--font-mono);
	font-size: var(--font-size-x-small);
	font-weight: 400;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

tbody th {
	color: var(--color-ink);
	font-weight: 600;
}

/* Wide tables scroll sideways on small screens rather than overflowing. */
@media (max-width: 640px) {
	table {
		display: block;
		overflow-x: auto;
	}
}

/* ------------------------------------------------------------------------
 * Pixel cards.
 *
 * The website's card look: a white box with a thin border and two small
 * square "pixel corners" just outside the top left and bottom right
 * corners. Used for notes and for the signature blocks in addendums.
 * --------------------------------------------------------------------- */

:is(.is-style-note, .is-style-warning, .is-style-alert, .is-style-card, .sig-block) {
	position: relative;
	padding: var(--space-50);
	background-color: var(--color-white);
	color: var(--color-ink);
	border: 1px solid color-mix(in srgb, var(--note-colour, var(--color-mint)) 40%, transparent);
	border-radius: 2px;
}

:is(.is-style-note, .is-style-warning, .is-style-alert, .is-style-card, .sig-block)::before,
:is(.is-style-note, .is-style-warning, .is-style-alert, .is-style-card, .sig-block)::after {
	content: "";
	position: absolute;
	width: 7px;
	height: 7px;
	background-color: var(--note-colour, var(--color-mint));
}

:is(.is-style-note, .is-style-warning, .is-style-alert, .is-style-card, .sig-block)::before {
	top: -3px;
	left: -3px;
}

:is(.is-style-note, .is-style-warning, .is-style-alert, .is-style-card, .sig-block)::after {
	right: -3px;
	bottom: -3px;
}

.is-style-warning {
	--note-colour: var(--color-warning);
}

.is-style-alert {
	--note-colour: var(--color-alert);
}

/* ------------------------------------------------------------------------
 * Signature blocks (client addendums).
 * --------------------------------------------------------------------- */

.entry-content > .sig-block {
	margin-block-start: var(--space-60);
	break-inside: avoid;
}

.sig-block h3 {
	margin: 0 0 var(--space-40);
	font-size: var(--font-size-medium);
	line-height: 1.35;
}

.sig-row {
	display: flex;
	align-items: flex-end;
	gap: var(--space-30);
	margin: 0 0 var(--space-40);
}

.sig-row:last-child {
	margin-block-end: 0;
}

.sig-row .label {
	flex: none;
	width: 90px;
	color: var(--color-ink-muted);
	font-family: var(--font-mono);
	font-size: var(--font-size-x-small);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding-bottom: 5px;
}

.sig-row .value {
	display: flex;
	flex: 1;
	align-items: flex-end;
	min-height: 34px;
	padding-bottom: 4px;
	border-bottom: 1px solid var(--color-mist);
	color: var(--color-ink);
}

.sig-row.sign .value {
	min-height: 90px;
}

.sig-row .value img {
	width: auto;
	height: 52px;
}

/* ------------------------------------------------------------------------
 * Footer.
 *
 * A Midnight band with the white logo, as at the foot of the website.
 * --------------------------------------------------------------------- */

.site-footer {
	padding: var(--space-70) var(--space-50) var(--space-50);
	background-color: var(--color-midnight);
	color: var(--color-mist);
	font-size: var(--font-size-small);
}

.site-footer__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--space-50);
	max-width: var(--wide-size);
	margin: 0 auto;
}

.site-footer__logo {
	display: block;
	width: 150px;
}

.site-footer p {
	margin: 0;
	font-family: var(--font-mono);
	font-size: var(--font-size-x-small);
	line-height: 1.6;
}

.site-footer a {
	color: var(--color-mint);
}

.site-footer a:hover {
	color: var(--color-mint-bright);
}

/* ------------------------------------------------------------------------
 * Print and PDF.
 *
 * White paper, no footer band, and sizes in points. Page breaks avoid
 * splitting headings from their text, and tables or signature blocks
 * across pages.
 * --------------------------------------------------------------------- */

@media print {
	@page {
		size: A4;
		margin: 15mm 15mm 15mm 18mm;
	}

	:root {
		--font-size-xxx-large: 24pt;
		--font-size-x-large: 14pt;
		--font-size-large: 11.5pt;
		--font-size-medium: 10pt;
		--font-size-small: 9pt;
		--font-size-x-small: 7.5pt;
		--space-50: 14pt;
		--space-60: 16pt;
		--space-70: 24pt;
		--space-80: 0;
	}

	body {
		background-color: var(--color-white);
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.skip-link,
	.site-footer,
	.site-header__label {
		display: none;
	}

	.site-header {
		padding: 0 0 12pt;
	}

	.site-header__inner {
		min-height: 0;
	}

	.site-info__logo,
	.site-title__logo {
		width: 120px;
	}

	.entry-content {
		max-width: none;
		padding: 24pt 0 0;
	}

	h1,
	h2,
	h3,
	h4,
	h5,
	h6 {
		break-after: avoid;
		break-inside: avoid;
	}

	table,
	tr,
	dt,
	.sig-block,
	img {
		break-inside: avoid;
	}

	p,
	li,
	dd {
		orphans: 3;
		widows: 3;
	}

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