@import 'base/reset.css';
@import 'base/utility.css';
@import 'components/markers.css';
@import 'layout/block.css';
@import 'layout/caption.css';
@import 'layout/block-type.css';

:root {
	--font-size-m: 12.5px;
	--line-height-m: 13.5px;
	--font-size-l: calc(25px + 0.25vw);
	--line-height-l: 1.1;
	/* --font-size-l: calc(28px + 0.5vw); */
	/* --line-height-l: calc(30px + 0.5vw); */

	--s: 0.25rem;
	--s-1: calc(var(--s) * 1);
	--s-2: calc(var(--s) * 2);
	--s-3: calc(var(--s) * 3);
	--s-4: calc(var(--s) * 4);
	--s-5: calc(var(--s) * 5);
	--s-8: calc(var(--s-4) * 2);
	--s-10: calc(var(--s-5) * 2);
	--s-12: calc(var(--s-4) * 3);
	--s-16: calc(var(--s-4) * 4);
	--s-18: calc(var(--s-16) + var(--s-2));
	--s-20: calc(var(--s-4) * 5);
	--s-24: calc(var(--s-4) * 6);

	--spacing-sm: var(--s-2);
	--spacing-base: var(--s-4);
	--spacing-md: var(--s-12);
	--spacing-lg: var(--s-20);

	--spacing: 9px;
	--spacing-s: calc(var(--spacing) / 2);
	--spacing-m: calc(var(--spacing) * 1);
	--spacing-l: calc(var(--spacing) * 2);
	--spacing-xl: calc(var(--spacing) * 6);
	--spacing-xxl: calc(var(--spacing) * 10);
	--spacing-top: 37.5vh;
	--spacing-footer: calc(var(--spacing) * 4);

	--color-blue: 89, 189, 248;
	--color-white: rgb(244, 244, 244);
	--color-black: rgb(44, 44, 44);
	--color-grey: rgb(183, 184, 186);
	--color-error: rgb(255, 0, 0); /* form errors (portfolio login), same in both themes */

	--color-accent: rgb(var(--color-blue)); /* navigation markers */
	--transition: 500ms ease-in-out;
	--duration-fast: 200ms; /* also read by footer.js (theme switch) */
	--transition-fast: var(--duration-fast) ease-in-out;
	--duration-out: 300ms; /* page exit — also read by header.js */
	--duration-in: 500ms; /* page entry */
	--slide-distance: var(--spacing-m);
	--animate-in: slide-in var(--duration-in) ease-out forwards;
	--animate-out: slide-out var(--duration-out) ease-in forwards;
	--easeOutExpo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reduced motion: no slide, short fade only */
@media (prefers-reduced-motion: reduce) {
	:root {
		--slide-distance: 0;
		--duration-out: 150ms;
		--duration-in: 150ms;
	}
}

html[data-theme='light'] {
	--bg: var(--color-white);
	--bg-inverted: var(--color-black);
	--bg-translucent: rgba(244, 244, 244, 0.9); /* header backdrop, footer */
	--bg-inverted-translucent: rgba(44, 44, 44, 0.9); /* mobile menu */
	--color-text: var(--color-black);
	--color-text-inverted: var(--color-white);
	--color-text-muted: var(--color-grey);
	--color-border: var(--color-black);
	--color-text-solid: #000; /* pure black: typeface styles list, default tester colour */
}

html[data-theme='dark'] {
	--bg: var(--color-black);
	--bg-inverted: var(--color-white);
	--bg-translucent: rgba(44, 44, 44, 0.9);
	--bg-inverted-translucent: rgba(255, 255, 255, 0.9);
	--color-text: var(--color-white);
	--color-text-inverted: var(--color-black);
	--color-text-muted: var(--color-grey);
	--color-border: var(--color-white);
	--color-text-solid: #fff; /* pure white */
}

/* Theme switch: fade colours while .is-theme-switching is on <html> (added/removed by footer.js).
   transform is included so the switch knob still slides while this rule overrides it. */
@media (prefers-reduced-motion: no-preference) {
	html.is-theme-switching,
	html.is-theme-switching *,
	html.is-theme-switching *::before,
	html.is-theme-switching *::after {
		transition:
			background-color var(--transition-fast),
			color var(--transition-fast),
			border-color var(--transition-fast),
			transform var(--transition-fast) !important;
	}
}

/* ====================================== */
/* animations */

/* see var(--animate-in) */
@keyframes slide-in {
	from {
		transform: translateY(var(--slide-distance));
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

/* see var(--animate-out) */
@keyframes slide-out {
	from {
		transform: translateY(0);
		opacity: 1;
	}
	to {
		transform: translateY(var(--slide-distance));
		opacity: 0;
	}
}

/* Fade only — for elements with their own transform (slide keyframes would override it) */
@keyframes fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes fade-out {
	from {
		opacity: 1;
	}
	to {
		opacity: 0;
	}
}

.slide-in {
	animation: var(--animate-in);
}

.slide-out {
	animation: var(--animate-out);
}

/* ====================================== */
/* fonts */

html {
	font-size: 12px;
}

body {
	background-color: var(--bg);
	color: var(--color-text);
	font-weight: bold;
	font-size: var(--font-size-m);
	line-height: var(--line-height-m);
	font-family: 'Univers-Bold', Arial, Helvetica, sans-serif;
	text-size-adjust: none;
}

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

/* Media are not interactive: no drag, no right-click save; clicks reach the slider underneath */
img,
video {
	pointer-events: none;
}

/* Copy-email button (scripts/components/copy-email.js): looks and behaves like a link.
   Before the hover block, so .inverted below can override its colour */
.copy-email {
	color: var(--color-text);
	font-weight: inherit;
	text-align: left;
	/* same underline as text links (.wysiwyg a): signals the click */
	/* text-decoration: underline;
	text-underline-offset: 0.2em;
	text-decoration-thickness: max(1px, 0.08em);
	text-decoration-color: currentcolor; */
}

/* Global link hover — opt-outs: .order (typeface.css), .card-title (card-typeface.css) */
@media (hover: hover) {
	a,
	.copy-email {
		transition: color var(--transition-fast);
	}

	a:hover,
	.copy-email:hover {
		color: var(--color-text-muted);
	}

	.inverted {
		color: var(--color-text-muted);
	}

	html[data-theme='light'] .inverted:hover {
		color: var(--color-black);
	}

	html[data-theme='dark'] .inverted:hover {
		color: var(--color-white);
	}
}

/* ====================================== */
/* utility classes */

.hidden {
	display: none;
}

.no-scroll {
	overflow-y: hidden;
}

.text-large {
	font-size: var(--font-size-l);
	line-height: var(--line-height-l);
}

.text-large p + p {
	margin-top: var(--spacing-base);
}

/* Links inside editor (wysiwyg) text — hover comes from the global a:hover */
.wysiwyg a {
	text-decoration: underline;
	text-decoration-color: currentcolor;
	text-decoration-thickness: max(1px, 0.125em);
	text-underline-offset: 0.15em;
}

/* ====================================== */
/* Main Layout */

html,
body {
	height: 100%;
	margin: 0;
}

html {
	overflow: hidden;
}

body {
	min-height: 100%;
	/* transition: all var(--transition); */
	margin: 0;
	overflow-x: hidden;
	overflow-y: scroll;
}

#main {
	width: 100%;
}

/* Unused — replaced by html.is-navigating below */
/* #main.no-pointers > #content {
	pointer-events: none;
} */

/* Block clicks on the fading content during a page transition */
html.is-navigating #main {
	pointer-events: none;
}

/* ====================================== */
/* Main Animation */

/* Disabled: stacked with the #content fade (double fade). #content now handles slide + fade alone */
/* #main {
	opacity: 1;
	transition: opacity var(--transition);
}

#main.is-hidden {
	opacity: 0;
} */

/* ====================================== */
/* Content Animation */

/* #content is the ajax target and must NOT animate: a transform on it would trap
   position:fixed children (e.g. .order) and their z-index. The page wrapper animates instead. */
#content {
	position: relative;
}

#content > .content__inner {
	animation: var(--animate-in);
}

#content.is-hidden > .content__inner {
	animation: var(--animate-out);
}

#animation {
	display: flex;
	z-index: 110; /* above .header (101) and .nav-container (105) */
	position: fixed;
	top: 0;
	left: 0;
	flex-direction: column;
	justify-content: flex-end;
	width: 100%;
	height: 100vh; /* fallback for older browsers */
	height: 100dvh;
	padding: var(--spacing-m);
	padding-bottom: calc(var(--spacing-m) * 3);
	background: var(--bg);
}

#animation > .wrapper {
	width: 0%;
	overflow: hidden;
	opacity: 0;
}

/* ====================================== */
/* Homepage Animation */

/* animate wrapper in */
#animation.animation-in > .wrapper {
	width: 100%;
	opacity: 1;
	transition:
		width 1250ms var(--easeOutExpo),
		opacity 500ms linear;
}

/* animate wrapper out */
#animation.animation-out > .wrapper {
	width: 0%;
	opacity: 0;
	transition:
		width 1250ms var(--easeOutExpo),
		opacity 500ms linear;
}

#animation > .wrapper > svg {
	width: calc(100vw - (var(--spacing-m) * 2));
	height: auto;
}

/* Intro: hold header and main hidden while the logo plays (see animation.js) */
/* ID selectors so this wins over .header's slide-in and #main */
#header.intro-hidden,
#main.intro-hidden {
	animation: none;
	opacity: 0;
}
