/*
	Liminal HQ Labs styles: Afterglow tokens from liminalhq.ca plus the lab-green accent.

	(c) Copyright 2026 Liminal HQ, Scott Morris
	SPDX-License-Identifier: Apache-2.0 OR MIT
*/

/* Tokens ---------------------------------------------------------------------------------------- */

:root {
	color-scheme: dark;

	/* Afterglow, shared with liminalhq.ca. */
	--void: #050507;
	--text: #e0e0e0;
	--text-muted: #b4bfce;
	--orange: #ffaa40;
	--rose: #f43f5e;
	--purple: #a78bfa;
	--cyan: #22d3ee;
	--blue: #60a5fa;

	/* The Labs accent. */
	--lab-green: #a3e635;
	--lab-glow: #4ade80;

	/* Roles. */
	--bg: var(--void);
	--heading: #ffffff;
	--link: var(--text);
	--link-hover: var(--lab-green);
	--accent-ink: var(--lab-green);
	--focus: var(--lab-green);
	--surface: rgba(255, 255, 255, 0.03);
	--surface-strong: rgba(255, 255, 255, 0.05);
	--border: rgba(255, 255, 255, 0.12);
	--border-strong: rgba(255, 255, 255, 0.24);
	--grid-line: rgba(255, 255, 255, 0.035);
	--shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	--title-gradient: linear-gradient(to right, #ffffff 15%, var(--orange) 55%, var(--lab-green));
	--ambient:
		radial-gradient(circle at 8% 12%, rgba(167, 139, 250, 0.13), transparent 42%),
		radial-gradient(circle at 92% 38%, rgba(163, 230, 53, 0.08), transparent 40%),
		radial-gradient(circle at 50% 100%, rgba(34, 211, 238, 0.08), transparent 50%);
	--button-ink: #0b1305;
	--tag-bg: rgba(255, 255, 255, 0.06);
	--tag-status-bg: rgba(163, 230, 53, 0.12);
	--tag-status-border: rgba(163, 230, 53, 0.4);

	/* Scene. */
	--scene-glass: rgba(255, 255, 255, 0.62);
	--scene-shine: rgba(255, 255, 255, 0.22);
	--scene-tick: rgba(255, 255, 255, 0.35);
	--scene-bench: rgba(255, 255, 255, 0.28);
	--scene-glow: var(--lab-glow);
	--scene-liquid-top: var(--lab-green);
	--scene-liquid-bottom: #22a34a;
	--scene-bubble: #ecfccb;
	--scene-vapour: var(--lab-green);
	--scene-lens: rgba(34, 211, 238, 0.14);
	--scene-strap: rgba(167, 139, 250, 0.7);

	/* Type and layout. */
	--font-body: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Adwaita Sans", Cantarell, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
	--font-display: "Space Grotesk", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Adwaita Sans", Cantarell, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
	--gutter: 16px;
	--max-width: 1120px;
	--radius-lg: 24px;
	--radius-md: 18px;
}

@media (prefers-color-scheme: light) {
	:root {
		color-scheme: light;
		--bg: #f6f5f1;
		--text: #1f2328;
		--text-muted: #4a5361;
		--heading: #0b0b10;
		--link: var(--text);
		--link-hover: #3f6212;
		--accent-ink: #3f6212;
		--focus: #3f6212;
		--surface: rgba(255, 255, 255, 0.6);
		--surface-strong: rgba(255, 255, 255, 0.85);
		--border: rgba(15, 23, 42, 0.12);
		--border-strong: rgba(15, 23, 42, 0.28);
		--grid-line: rgba(15, 23, 42, 0.04);
		--shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
		--title-gradient: linear-gradient(to right, #0b0b10 15%, #b4410e 55%, #3f6212);
		--ambient:
			radial-gradient(circle at 8% 12%, rgba(167, 139, 250, 0.16), transparent 42%),
			radial-gradient(circle at 92% 38%, rgba(163, 230, 53, 0.16), transparent 40%),
			radial-gradient(circle at 50% 100%, rgba(34, 211, 238, 0.12), transparent 50%);
		--tag-bg: rgba(15, 23, 42, 0.05);
		--tag-status-bg: rgba(101, 163, 13, 0.12);
		--tag-status-border: rgba(63, 98, 18, 0.45);

		--scene-glass: rgba(31, 35, 40, 0.7);
		--scene-shine: rgba(255, 255, 255, 0.7);
		--scene-tick: rgba(31, 35, 40, 0.4);
		--scene-bench: rgba(31, 35, 40, 0.35);
		--scene-glow: #65a30d;
		--scene-liquid-top: #a3e635;
		--scene-liquid-bottom: #4d9a1d;
		--scene-vapour: #4d7c0f;
		--scene-lens: rgba(14, 116, 144, 0.12);
		--scene-strap: rgba(124, 58, 237, 0.55);
	}
}

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

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

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

body {
	margin: 0;
	min-height: 100vh;
	background-color: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 1rem;
	line-height: 1.65;
	overflow-x: hidden;
	overflow-wrap: break-word;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	background: var(--ambient);
	pointer-events: none;
}

h1,
h2,
h3 {
	margin: 0;
	text-wrap: balance;
	color: var(--heading);
	font-family: var(--font-display);
	letter-spacing: -0.02em;
	line-height: 1.15;
}

p,
ul {
	margin: 0;
}

p {
	text-wrap: pretty;
}

img,
svg {
	display: block;
	max-width: 100%;
}

a {
	color: var(--link);
	text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
	text-underline-offset: 0.2em;
	transition: color 160ms ease, text-decoration-color 160ms ease;
}

a:hover {
	color: var(--link-hover);
	text-decoration-color: currentColor;
}

:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 3px;
	border-radius: 4px;
}

[tabindex="-1"]:focus {
	outline: none;
}

.skip-link {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	z-index: 10;
	padding: 0.6rem 1rem;
	border-radius: 999px;
	background: var(--lab-green);
	color: var(--button-ink);
	font-weight: 600;
	text-decoration: none;
	transform: translateY(-200%);
}

.skip-link:focus,
.skip-link:hover {
	color: var(--button-ink);
	transform: none;
}

.ext {
	display: inline-block;
	font-size: 0.85em;
	line-height: 1;
}

/* Layout ---------------------------------------------------------------------------------------- */

.page {
	max-width: var(--max-width);
	margin: 0 auto;
	padding: 0 var(--gutter);
}

@media (min-width: 768px) {
	:root {
		--gutter: 2rem;
	}
}

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

.site-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 2rem;
	padding: 1.25rem 0;
}

.wordmark {
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	color: var(--heading);
	font-family: var(--font-display);
	font-size: 1.15rem;
	font-variant: small-caps;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1;
	text-decoration: none;
}

.wordmark:hover {
	color: var(--heading);
}

.wordmark img {
	width: 32px;
	height: 32px;
}

.wordmark-labs {
	color: var(--accent-ink);
}

.wordmark-small {
	font-size: 1rem;
}

.wordmark-small img {
	width: 22px;
	height: 22px;
}

.site-nav ul,
.footer-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1.4rem;
	padding: 0;
	list-style: none;
}

.site-nav a {
	display: inline-block;
	padding: 0.35rem 0;
	color: var(--text-muted);
	font-size: 0.95rem;
	font-weight: 500;
	text-decoration: none;
}

.site-nav a:hover {
	color: var(--link-hover);
}

@media (min-width: 768px) {
	.site-header {
		padding: 2rem 0;
	}

	.site-nav ul {
		gap: 0.5rem 2rem;
	}
}

/* Hero ------------------------------------------------------------------------------------------ */

.hero {
	position: relative;
	display: grid;
	gap: 1rem;
	align-items: center;
	overflow: hidden;
	margin-top: 0.5rem;
	padding: 2rem 1.25rem 1.25rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow);
}

.hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(var(--grid-line) 1px, transparent 1px),
		linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
	background-size: 40px 40px;
	-webkit-mask-image: radial-gradient(circle at 72% 55%, #000 0%, transparent 75%);
	mask-image: radial-gradient(circle at 72% 55%, #000 0%, transparent 75%);
	pointer-events: none;
}

.hero > * {
	position: relative;
}

.badge {
	display: inline-block;
	margin-bottom: 1.5rem;
	padding: 0.3rem 0.9rem;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--lab-green), var(--lab-glow));
	box-shadow: 0 4px 20px rgba(163, 230, 53, 0.25);
	color: var(--button-ink);
	font-family: var(--font-display);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.hero-title {
	width: fit-content;
	max-width: 100%;
	margin-bottom: 1.1rem;
	background: var(--title-gradient);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	font-size: clamp(2.2rem, 7vw, 3.8rem);
	font-weight: 700;
	line-height: 1.08;
}

.hero-lede {
	margin-bottom: 0.6rem;
	color: var(--heading);
	font-size: clamp(1.1rem, 2.4vw, 1.3rem);
	font-weight: 500;
}

.hero-pitch {
	max-width: 36rem;
	color: var(--text-muted);
	font-size: 1.05rem;
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1.75rem;
}

.button {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 44px;
	padding: 0.6rem 1.3rem;
	border: 1px solid transparent;
	border-radius: 999px;
	font-weight: 600;
	text-decoration: none;
	transition: box-shadow 200ms ease, border-color 200ms ease, background-color 200ms ease;
}

.button-primary {
	background: var(--lab-green);
	color: var(--button-ink);
}

.button-primary:hover {
	color: var(--button-ink);
	box-shadow: 0 0 0 1px var(--lab-green), 0 0 28px rgba(163, 230, 53, 0.35);
}

.button-quiet {
	border-color: var(--border-strong);
	color: var(--heading);
}

.button-quiet:hover {
	border-color: var(--accent-ink);
	color: var(--heading);
}

.hero-visual {
	justify-self: center;
	width: 100%;
	max-width: 340px;
}

.scene {
	width: 100%;
	height: auto;
	overflow: visible;
}

@media (min-width: 860px) {
	.hero {
		grid-template-columns: 1.5fr 1fr;
		gap: 2rem;
		padding: 3.5rem 3rem 3rem 4rem;
	}

	.hero-visual {
		max-width: 420px;
	}
}

/* Scene ----------------------------------------------------------------------------------------- */

.stop-glow {
	stop-color: var(--scene-glow);
}

.stop-liquid-top {
	stop-color: var(--scene-liquid-top);
}

.stop-liquid-bottom {
	stop-color: var(--scene-liquid-bottom);
}

.stop-bench {
	stop-color: var(--scene-bench);
}

.scene-glass {
	fill: none;
	stroke: var(--scene-glass);
	stroke-width: 4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.scene-shine {
	fill: none;
	stroke: var(--scene-shine);
	stroke-width: 4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.scene-tick {
	fill: none;
	stroke: var(--scene-tick);
	stroke-width: 2;
	stroke-linecap: round;
}

.scene-surface {
	fill: none;
	stroke: var(--scene-bubble);
	stroke-opacity: 0.55;
	stroke-width: 2;
	stroke-linecap: round;
}

.bubble {
	fill: var(--scene-bubble);
	opacity: 0.85;
}

.vapour {
	fill: none;
	stroke: var(--scene-vapour);
	stroke-width: 1.5;
	opacity: 0.55;
}

.goggle-strap {
	fill: none;
	stroke: var(--scene-strap);
	stroke-width: 7;
	stroke-linecap: round;
}

.goggle-lens {
	fill: var(--scene-lens);
}

.goggle-tint {
	fill: none;
	stroke: var(--scene-bubble);
	stroke-opacity: 0.55;
	stroke-width: 2;
	stroke-linecap: round;
}

.goggle-frame,
.goggle-bridge {
	fill: none;
	stroke-width: 5;
	stroke-linecap: round;
}

/* Motion is calm and loops seamlessly: bubbles are invisible at both ends of their path. */
@media (prefers-reduced-motion: no-preference) {
	.scene-glow {
		transform-box: fill-box;
		transform-origin: center;
		animation: glow 6s ease-in-out infinite alternate;
	}

	.scene-liquid {
		animation: liquid 6s ease-in-out infinite alternate;
	}

	.bubble {
		opacity: 0;
		animation: rise var(--duration) linear var(--delay) infinite;
	}

	.vapour {
		opacity: 0;
		animation: drift 9s ease-out var(--delay) infinite;
	}

	/* Each bubble starts near the bottom of the flask and fades out just under the surface (y 200). */
	.b1 { --from: 32px; --to: -50px; --duration: 6.5s; --delay: -1s; }
	.b2 { --from: 22px; --to: -62px; --duration: 5.2s; --delay: -3.4s; }
	.b3 { --from: 40px; --to: -40px; --duration: 7.4s; --delay: -5.1s; }
	.b4 { --from: 16px; --to: -68px; --duration: 5.8s; --delay: -2.2s; }
	.b5 { --from: 24px; --to: -58px; --duration: 6.1s; --delay: -4.3s; }
	.b6 { --from: 50px; --to: -30px; --duration: 4.8s; --delay: -0.6s; }
	.v1 { --delay: 0s; }
	.v2 { --delay: -3s; }
	.v3 { --delay: -6s; }
}

@keyframes glow {
	from {
		opacity: 0.7;
		transform: scale(0.96);
	}

	to {
		opacity: 1;
		transform: scale(1.03);
	}
}

@keyframes liquid {
	from {
		opacity: 0.88;
	}

	to {
		opacity: 1;
	}
}

@keyframes rise {
	0% {
		opacity: 0;
		transform: translate(0, var(--from));
	}

	15% {
		opacity: 0.85;
	}

	50% {
		transform: translate(1.5px, calc((var(--from) + var(--to)) / 2));
	}

	80% {
		opacity: 0.85;
	}

	96% {
		opacity: 0;
	}

	100% {
		opacity: 0;
		transform: translate(0, var(--to));
	}
}

@keyframes drift {
	0% {
		opacity: 0;
		transform: translate(0, 12px);
	}

	30% {
		opacity: 0.6;
	}

	100% {
		opacity: 0;
		transform: translate(4px, -20px);
	}
}

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

	*,
	*::before,
	*::after {
		transition: none !important;
	}
}

/* Sections -------------------------------------------------------------------------------------- */

.section {
	padding: 4rem 0 0;
	scroll-margin-top: 1rem;
}

.section h2 {
	margin-bottom: 0.6rem;
	font-size: clamp(1.6rem, 4vw, 2rem);
	font-weight: 600;
}

.section-intro {
	max-width: 46rem;
	margin-bottom: 2rem;
	color: var(--text-muted);
}

@media (min-width: 768px) {
	.section {
		padding-top: 5.5rem;
	}
}

/* Experiment cards ------------------------------------------------------------------------------ */

.cards {
	display: grid;
	gap: 1.25rem;
	padding: 0;
	list-style: none;
}

.card {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1rem;
	align-items: start;
	overflow: hidden;
	padding: 1.5rem 1.25rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: linear-gradient(160deg, var(--surface-strong), var(--surface));
	transition: border-color 300ms ease, box-shadow 300ms ease;
}

.card-experiment::before {
	content: "";
	position: absolute;
	top: -80px;
	right: -80px;
	width: 320px;
	height: 320px;
	background: radial-gradient(circle, rgba(244, 63, 94, 0.12), transparent 70%);
	pointer-events: none;
}

.card-experiment:hover {
	border-color: color-mix(in srgb, var(--lab-green) 50%, transparent);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.card-placeholder {
	border-style: dashed;
	background: transparent;
}

.card-placeholder .card-icon {
	opacity: 0.6;
	filter: grayscale(0.4);
}

.card-icon {
	width: 48px;
	height: 48px;
}

.card-body p {
	max-width: 42rem;
}

.card-body {
	position: relative;
	display: grid;
	gap: 0.75rem;
}

.card h3 {
	font-size: 1.35rem;
	font-weight: 600;
}

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

.card-meta a {
	color: var(--accent-ink);
	font-weight: 600;
}

.card-meta a:hover {
	color: var(--heading);
}

.tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	padding: 0;
	list-style: none;
}

.tag {
	padding: 0.1rem 0.65rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--tag-bg);
	color: var(--text);
	font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Adwaita Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
	font-size: 0.78rem;
	line-height: 1.6;
}

.tag-status {
	border-color: var(--tag-status-border);
	background: var(--tag-status-bg);
	color: var(--accent-ink);
}

@media (min-width: 600px) {
	.card {
		grid-template-columns: 64px minmax(0, 1fr);
		gap: 1.5rem;
		padding: 2rem;
	}

	.card-icon {
		width: 64px;
		height: 64px;
	}
}

@media (min-width: 960px) {
	.cards {
		grid-template-columns: 2fr 1fr;
	}

	.card-placeholder {
		grid-template-columns: minmax(0, 1fr);
	}

	.card-experiment {
		padding: 2.5rem;
	}
}

/* Principles ------------------------------------------------------------------------------------ */

.principles {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
	gap: 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--border);
}

.principle {
	padding: 1.4rem 0;
	border-bottom: 1px solid var(--border);
}

.principle h3 {
	margin-bottom: 0.4rem;
	font-size: 1.1rem;
	font-weight: 600;
}

.principle h3::before {
	content: "";
	display: inline-block;
	width: 0.5rem;
	height: 0.5rem;
	margin-right: 0.6rem;
	border-radius: 50%;
	background: var(--lab-green);
	box-shadow: 0 0 10px var(--lab-glow);
	vertical-align: 0.15em;
}

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

@media (min-width: 768px) {
	.principles {
		column-gap: 2.5rem;
	}
}

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

.site-footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 2rem;
	margin-top: 5rem;
	padding: 2.5rem 0 3rem;
	border-top: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 0.92rem;
}

.footer-brand {
	display: grid;
	gap: 0.5rem;
	max-width: 32rem;
}

.footer-brand .wordmark {
	margin-bottom: 0.25rem;
}

.footer-brand a,
.footer-nav a {
	color: var(--text-muted);
}

.footer-brand a:hover,
.footer-nav a:hover {
	color: var(--link-hover);
}

.footer-fine {
	font-size: 0.85rem;
}

.footer-nav ul {
	flex-direction: column;
	gap: 0.4rem;
}

/* 404 ------------------------------------------------------------------------------------------- */

.not-found {
	padding: 4rem 0 2rem;
}

.not-found-mark {
	width: 96px;
	height: 96px;
	margin-bottom: 2rem;
}

.not-found h1 {
	margin-bottom: 0.75rem;
	font-size: clamp(2rem, 6vw, 3rem);
}

.not-found p {
	max-width: 36rem;
	color: var(--text-muted);
}
