/* R&M Simulation site styles. Colours are tokens from assets/rm-palettes.css; the palette (spectral or
   darklab) is picked from the light/dark setting by assets/theme.js. */

/* Fira Sans, self-hosted (assets/fonts, SIL Open Font License in OFL.txt): Latin subset, the three weights used.
   Text shows in the fallback font until it loads; the regular weight is preloaded by every page. */
@font-face {
	font-family: "Fira Sans";
	font-style: normal;
	font-weight: 300;
	font-display: swap;
	src: url("assets/fonts/fira-sans-latin-300.woff2") format("woff2");
}

@font-face {
	font-family: "Fira Sans";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("assets/fonts/fira-sans-latin-400.woff2") format("woff2");
}

@font-face {
	font-family: "Fira Sans";
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url("assets/fonts/fira-sans-latin-500.woff2") format("woff2");
}

/* -----------------------
Page
------------------------*/

* {
	box-sizing: border-box;
}

/* Ensure images don't overflow containers */
img {
	max-width: 100%;
	height: auto;
}

/* Mobile-first: base styles for all screens, then enhance for larger screens */
body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	margin: 0;
	color: var(--color-text);
	background-color: var(--color-bg);
	font: 1em "Fira Sans", sans-serif;
	text-align: justify;
	line-height: 1.5;
}

.container {
	margin: 0 5%;
}

/* -----------------------
Text elements
------------------------*/

h1,
h2,
h3,
h4,
h5,
h6 {
	font-weight: 500;
	line-height: 1.1;
}

h1 {
	font-size: 1.8em;
	margin-bottom: .5em;
}

h2 {
	font-size: 1.5em;
	margin-bottom: .5em;
}

h3 {
	font-size: 1.3em;
}

h4 {
	font-size: 1.25em;
}

h5 {
	font-size: 1.125em;
}

h6 {
	font-size: 1em;
}

/* Heading teals: deep for the main levels, text teal for the minor ones */
h1,
h2,
h3 {
	color: var(--color-primary-deep);
}

h4,
h5,
h6 {
	color: var(--color-primary-text);
}

/* Deep teal is unreadable on darklab's dark surfaces (2:1): all heading levels use its light teal instead */
:root[data-palette="darklab"] :is(h1, h2, h3) {
	color: var(--color-primary-text);
}

/* ...except the header tagline, which is the home page h1 but keeps its muted colour */
:root[data-palette="darklab"] h1.header-tagline {
	color: var(--color-text-muted);
}

p {
	line-height: 1.5;
	margin-bottom: 1em;
}

/* Text alignment, overriding the block's own */
.text-center {
	text-align: center;
}

.text-left {
	text-align: left;
}

.text-right {
	text-align: right;
}

.text-justify {
	text-align: justify;
}

/* Link colours inside :where(), at zero specificity: component styles such as .btn override them
   without !important */
:where(a:link, a:visited) {
	color: var(--color-link);
}

:where(a:focus) {
	color: var(--color-text);
}

:where(a:hover) {
	color: var(--color-primary-deep);
}

:where(a:active) {
	color: var(--color-accent-text);
}

/* Same contrast issue for the hover colour on darklab: light text colour instead */
:where(:root[data-palette="darklab"] a:hover) {
	color: var(--color-text);
}

blockquote {
	margin: 0 0 2em;
	padding: 1em 2em;
	border-left: 5px solid var(--color-border);
}

hr {
	height: 0;
	margin: 1em 0 2em;
	border: 0;
	border-top: 1px solid var(--color-border);
}

table {
	border-spacing: 0;
	border-collapse: collapse;
	border-top: 1px solid var(--color-border);
	width: 100%;
}

th,
td {
	padding: .5em 1em;
	vertical-align: top;
	text-align: left;
	border-bottom: 1px solid var(--color-border);
}

/* -----------------------
Header: logo on the left, hamburger menu on the right for mobile
------------------------*/

.header {
	padding: .75em 1em;
	color: var(--color-text);
	background: var(--color-surface-alt);
	position: relative;
	z-index: 1000;
}

.header-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
}

/* Phone: tagline stacked under the logo; from 40em it sits beside the logo */
.header-heading {
	margin: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: .5em;
}

.header-heading img {
	display: block;
	height: 3.25rem;
	width: auto;
	max-width: 100%;
}

/* Tagline: thin, widely tracked caps behind a red divider */
.header-tagline {
	display: block;
	font-size: .5rem;
	font-weight: 400;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--color-text-muted);
	margin: 0;
	padding: 0;
	line-height: 1.8;
}

@media (min-width: 40em) {
	.header-heading {
		flex-direction: row;
		align-items: center;
		gap: 1.25em;
	}

	.header-tagline {
		font-size: .7rem;
		letter-spacing: .25em;
		border-left: 2px solid var(--color-accent);
		padding: .5em 0 .5em 1.5em;
	}
}

/* Logo variant per palette: colour lockup on light headers, reversed lockup on dark ones */
.header-heading img.logo-on-dark {
	display: none;
}

:root[data-palette="darklab"] .header-heading img.logo-on-light {
	display: none;
}

:root[data-palette="darklab"] .header-heading img.logo-on-dark {
	display: block;
}

/* Hamburger menu button */
.menu-toggle {
	background: none;
	border: none;
	padding: .5em;
	cursor: pointer;
	z-index: 1000;
}

.hamburger {
	display: block;
	width: 24px;
	height: 2px;
	background-color: var(--color-text);
	position: relative;
	transition: all .3s ease;
}

.hamburger::before,
.hamburger::after {
	content: '';
	position: absolute;
	width: 24px;
	height: 2px;
	background-color: var(--color-text);
	transition: all .3s ease;
}

.hamburger::before {
	top: -8px;
}

.hamburger::after {
	top: 8px;
}

.menu-toggle[aria-expanded="true"] .hamburger {
	background-color: transparent;
}

.menu-toggle[aria-expanded="true"] .hamburger::before {
	transform: rotate(45deg);
	top: 0;
}

.menu-toggle[aria-expanded="true"] .hamburger::after {
	transform: rotate(-45deg);
	top: 0;
}

/* Mobile navigation - dropdown menu */
.main-nav {
	position: absolute;
	top: 100%;
	right: 0;
	min-width: 200px;
	max-width: 300px;
	background: var(--color-surface-alt);
	flex-direction: column;
	gap: 0;
	padding: 1.5em;
	box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
	clip-path: circle(0px at 100% 0);
	transition: all .5s ease-out;
	pointer-events: none;
	opacity: 0;
	display: flex;
	z-index: 2000;
}

.main-nav.active {
	clip-path: circle(1000px at 100% 0);
	pointer-events: all;
	opacity: 1;
}

.main-nav a {
	padding: .75em 1em;
	font-size: 1em;
	text-align: center;
	border-bottom: 1px solid var(--color-border);
	text-decoration: none;
	color: var(--color-text);
}

.main-nav a:last-child {
	border-bottom: none;
}

.main-nav a:hover {
	color: var(--color-primary-text);
}

.main-nav a[aria-current="page"] {
	color: var(--color-primary-text);
	border-bottom: 2px solid var(--color-primary);
}

/* The current page can also be the last item (Contact): override the last-child border reset */
.main-nav a[aria-current="page"]:last-child {
	border-bottom: 2px solid var(--color-primary);
}

/* Menu items without a link (pages not published yet): muted, no hover */
.main-nav a:not([href]) {
	color: var(--color-text-muted);
	cursor: default;
}

/* Desktop navigation - horizontal (logo + tagline + nav need the full 1440px on one line) */
@media (min-width: 90em) {
	.header {
		padding: 1em 3em;
	}

	.header-heading img {
		height: 4.75rem;
	}

	.menu-toggle {
		display: none;
	}

	.main-nav {
		position: static;
		background: transparent;
		box-shadow: none;
		clip-path: none;
		pointer-events: auto;
		opacity: 1;
		flex-direction: row;
		flex-wrap: nowrap;
		gap: .25em 1.5em;
		padding: 0;
		justify-content: flex-end;
		white-space: nowrap;
	}

	.main-nav a {
		padding: .5em 0;
		text-align: left;
		border-bottom: 2px solid transparent;
	}

	.main-nav a:last-child {
		border-bottom: 2px solid transparent;
	}

	.header-bar {
		gap: 1em 2em;
	}

	.header-heading {
		flex: none;
	}
}

/* -----------------------
Content
------------------------*/

.content {
	flex: 1 0 auto;
	padding: 1.5em 1em;
	background-color: var(--color-surface);
}

/* Content centred vertically in the space left between the header and the footer (or the render) */
.fill {
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 2em 0;
}

/* Plain text pages (legal notice, contact): [placeholders] are highlighted until the real details are filled in */
.text-page h2 {
	margin-top: 1.5em;
}

.text-page .placeholder {
	padding: 0 .2em;
	color: var(--color-accent-text);
	background-color: var(--color-surface-alt);
}

/* Banner render under the home page header: full window width, cropped to a thin strip */
.hero {
	display: block;
	width: 100%;
	height: clamp(8rem, 10vw, 20rem);
	object-fit: cover;
	object-position: center 60%;
}

/* Same render shown uncropped (team page): full window width, height follows the image's 4:1 ratio */
.banner {
	display: block;
	width: 100%;
	height: auto;
}

/* Tighter gap between the banner and the first heading: half the usual top padding and heading margin */
picture + .fill {
	padding-top: 1em;
}

picture + .fill h2:first-child {
	margin-top: .4em;
}

/* Desktop content enhancements */
@media (min-width: 60em) {
	.container {
		margin: 0 10%;
	}

	.content {
		padding: 2em 3em;
	}

	.fill {
		padding: 3em 3em 4em;
	}

	picture + .fill {
		padding-top: 1.5em;
	}

	/* Larger font sizes on desktop */
	body {
		font-size: 1.2em;
	}

	h1 {
		font-size: 2.5em;
	}

	h2 {
		font-size: 2em;
	}

	h3 {
		font-size: 1.75em;
	}
}

/* -----------------------
Team panels: stacked on mobile, two columns on desktop
------------------------*/

.team {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5em;
	margin-top: 2em;
}

.team-member {
	position: relative;
	padding: 1em;
	display: flex;
	flex-direction: column;
}

/* Each partner framed in a brand colour (red for Jeremy, teal for David). */
.team-member::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	border: 2px solid var(--color-border);
	-webkit-mask-image: radial-gradient(100% 100% at 0 0, #000, transparent);
	mask-image: radial-gradient(100% 100% at 0 0, #000, transparent);
}

.team-member-red::before {
	border-color: var(--color-accent);
}

.team-member-teal::before {
	border-color: var(--color-primary);
	-webkit-mask-image: radial-gradient(100% 100% at 100% 0, #000, transparent);
	mask-image: radial-gradient(100% 100% at 100% 0, #000, transparent);
}

/* Photo above the name on mobile, beside on desktop */
.team-member-header {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1em;
	margin-bottom: 1em;
	text-align: center;
}

.team-member-header img {
	flex: none;
	width: 80px;
	height: 80px;
	object-fit: cover;
	border-radius: 4px;
}

.team-member-title {
	flex: 1;
}

.team-member-title h3 {
	margin: 0;
	font-size: 1.3em;
}

.team-member-title .team-role {
	margin: .25em 0 0;
	font-size: 1em;
	color: var(--color-primary-text);
}

/* CV link pushed to the bottom of the panel, so both CV links line up when the panels are side by side */
.team-member p.text-center {
	margin-top: auto;
}

/* Desktop: side-by-side layout - at higher resolution to prevent overlap */
@media (min-width: 60em) {
	.team {
		grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
		gap: 2em;
		align-items: stretch;
	}

	.team-member-header {
		flex-direction: row;
		gap: 1.5em;
		text-align: left;
	}

	.team-member-header img {
		width: 144px;
		height: 144px;
	}

	.team-member {
		padding: 2em 2.5em;
	}

	.team-member-title h3 {
		font-size: 1.75em;
	}

	.team-member-title .team-role {
		font-size: 1.125em;
	}

	/* Mirror the second team member */
	.team-member+.team-member .team-member-header {
		flex-direction: row-reverse;
	}
}

/* Tools line under the team panels */
.team-tools {
	color: var(--color-text-muted);
}

/* "Who we are" on the home page: a short narrow text block after the engagement modes */
.about {
	max-width: 46em;
	margin: 3em auto 1em;
}

.about p {
	text-align: justify;
}

/* -----------------------
"What we offer": three engagement modes (Assess, Build, Embed), stacked on mobile, three columns on desktop
------------------------*/

.modes {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5em;
	margin-top: 1.5em;
	text-align: left;
}

/* Same faded corner frame as the team panels: teal, red, teal */
.mode {
	position: relative;
	padding: 1.5em;
	display: flex;
	flex-direction: column;
}

.mode::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	border: 2px solid var(--color-primary);
	-webkit-mask-image: radial-gradient(100% 100% at 0 0, #000, transparent);
	mask-image: radial-gradient(100% 100% at 0 0, #000, transparent);
}

/* Central item in red */
.mode:nth-child(2)::before {
	border-color: var(--color-accent);
}

/* Heading: number and keyword at the same size, the number thin and muted */
.mode h3 {
	margin: 0 0 .6em;
	font-size: 1.6em;
}

.mode-num {
	margin-right: .4em;
	font-weight: 300;
	color: var(--color-text-muted);
}

.mode .lead {
	font-weight: 500;
	color: var(--color-text);
	margin-bottom: .5em;
}

.mode p {
	margin-top: 0;
}

/* The offer list of each mode */
.mode ul {
	margin: .25em 0 1em;
	padding: 0;
	list-style: none;
}

.mode li {
	padding: .4em 0 .4em 1em;
	border-left: 2px solid var(--color-border);
	margin-bottom: .4em;
}

.mode li strong {
	color: var(--color-primary-text);
	font-weight: 500;
}

@media (min-width: 60em) {
	.modes {
		gap: 2em;
	}

	.mode {
		padding: 2em;
	}
}

/* Three columns only on typical desktop monitors (1440 CSS px and up, which includes a 1920px screen at 125%
   scaling); below that, laptops, tablets and phones, the modes stay stacked in rows */
@media (min-width: 90em) {
	.modes {
		grid-template-columns: repeat(3, 1fr);
	}

	/* Central column: solid at both top corners (the two mask layers add up) */
	.mode:nth-child(2)::before {
		-webkit-mask-image: radial-gradient(100% 100% at 0 0, #000, transparent), radial-gradient(100% 100% at 100% 0, #000, transparent);
		mask-image: radial-gradient(100% 100% at 0 0, #000, transparent), radial-gradient(100% 100% at 100% 0, #000, transparent);
	}

	/* Mirror the frame on the last column, like the second team panel */
	.mode:last-child::before {
		-webkit-mask-image: radial-gradient(100% 100% at 100% 0, #000, transparent);
		mask-image: radial-gradient(100% 100% at 100% 0, #000, transparent);
	}
}

/* -----------------------
Footer: stacked on mobile, horizontal on desktop
------------------------*/

.footer {
	color: var(--color-text-muted);
	background: var(--color-surface-alt);
	border-top: 1px solid var(--color-border);
	padding: 1.5em;
}

.footer-content {
	display: flex;
	flex-direction: column;
	gap: 1em;
	align-items: center;
	text-align: center;
}

.footer-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: .5em 1em;
}

.footer-icon {
	display: inline-flex;
	align-items: center;
}

.footer-icon svg {
	width: 1.5em;
	height: 1.5em;
}

.footer-icons {
	display: inline-flex;
	gap: .4em;
}

@media (min-width: 60em) {
	.footer {
		padding: 2em 3em;
	}

	.footer-content {
		flex-direction: row;
		justify-content: space-between;
		text-align: left;
	}

	.footer-links {
		justify-content: flex-start;
	}
}

/* -----------------------
Buttons
------------------------*/

.btn {
	display: inline-block;
	padding: .5em 1em;
	color: var(--color-on-primary);
	background-color: var(--color-primary);
	border: 1px solid transparent;
	border-radius: .2em;
	font-weight: 400;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	vertical-align: middle;
	cursor: pointer;
}

.btn:hover,
.btn:focus {
	background-color: var(--color-primary-deep);
}

.btn:focus {
	outline: 2px solid var(--color-primary-light);
}

.btn:active {
	color: var(--color-on-accent);
	background-color: var(--color-accent);
}

.btn-lg {
	padding: .8em 1.8em;
	font-size: 1.25em;
	border-radius: .25em;
}

.btn-accent {
	color: var(--color-on-accent);
	background-color: var(--color-accent);
}

.btn-accent:hover,
.btn-accent:focus {
	filter: brightness(.9);
}

.contact-cta {
	margin-top: 2em;
}
