/* --- Global Styles & Variables --- */
:root {
	--color-background: #f9fbff;
	--color-text: #1d1d1f;
	--color-grey-light: #ffffff;
	--color-grey-dark: #555555;
	--color-accent: #604b65;
	--color-accent-darker: #4a3a4f;

	--font-heading: 'Space Grotesk', sans-serif;
	--font-body: 'Inter', sans-serif;

	--container-width: 1200px;
	--container-padding: 4rem; /* Increased padding */
}

/* --- Animation Keyframes --- */
@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: var(--font-body);
	background-color: var(--color-background);
	color: var(--color-text);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	padding-left: 1rem; /* Space for vertical text */
}

/* --- Architectural Elements --- */
.vertical-watermark {
	position: fixed;
	top: 0;
	left: 2rem;
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	font-family: var(--font-heading);
	color: #eaeaea;
	font-size: 1rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: -1;
	opacity: 0;
	animation: fadeIn 1s ease 1s forwards;
}

.vertical-watermark .char {
	transition: color 0.2s ease-out;
}

.vertical-watermark .char--highlighted {
	color: #c5c5c5; /* Subtle darker grey */
}

/* --- Typography --- */
h1,
h2,
h3 {
	font-family: var(--font-heading);
	font-weight: 700;
	line-height: 1.1; /* Tighter line height */
	margin-bottom: 1.5rem;
	color: var(--color-text);
}

h1 {
	font-size: clamp(3.5rem, 10vw, 8rem); /* Monumental */
}

h2 {
	font-size: clamp(1.5rem, 3vw, 2rem);
	text-align: left;
	width: 100%;
	margin-bottom: 3rem;
	text-transform: uppercase;
	letter-spacing: 0.3em; /* Wider tracking */
	color: var(--color-grey-dark);
}

h3 {
	font-size: clamp(1.5rem, 4vw, 2rem);
}

p {
	margin-bottom: 1.5rem;
	max-width: 60ch;
	color: var(--color-grey-dark);
	font-size: 1.3rem;
}

a {
	color: var(--color-accent);
	text-decoration: none;
	font-weight: 700;
	transition: color 0.3s ease;
}

a:hover {
	color: var(--color-accent-darker);
}

/* --- Layout & Sections --- */
main > section {
	padding: 8rem var(--container-padding);
	max-width: var(--container-width);
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-start; /* Left align content */
}

section:nth-child(even) {
	background-color: var(--color-grey-light);
}

/* --- Header & Hero (Asymmetric) --- */
.hero {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 2rem var(--container-padding); /* Reduced top padding */
	border-bottom: 1px solid #eaeaea;
}

nav {
	width: 100%;
}

.logo {
	font-family: 'Space Grotesk', sans-serif;
	font-size: 1.8rem;
	font-weight: 700;
	color: var(--color-text);
	opacity: 0;
	animation: fadeIn 1s ease 0.2s forwards;
}

nav ul {
	list-style: none;
	display: none;
	gap: 2rem;
	margin-top: 1rem;
	opacity: 0;
	animation: fadeIn 1s ease 0.4s forwards;
}

nav a {
	color: var(--color-grey-dark);
	font-weight: 700;
}

.hero-content {
	align-self: flex-start;
	max-width: 900px;
}

.hero-content > * {
	opacity: 0;
	animation: fadeInUp 1s ease forwards;
}

.hero-content h1 {
	animation-delay: 0.6s;
}
.hero-content p {
	animation-delay: 0.8s;
}
.hero-content .cta-button {
	animation-delay: 1s;
}

.hero-content p {
	font-size: 1.2rem;
	margin: 2rem 0;
}

.cta-button {
	display: inline-block;
	background-color: transparent;
	color: var(--color-accent);
	padding: 1.2rem 2.5rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	border: 1px solid var(--color-accent);
	position: relative;
	overflow: hidden;
	transition: color 0.4s ease-in-out,
		clip-path 0.4s cubic-bezier(0.25, 1, 0.5, 1);
	z-index: 1;
	clip-path: polygon(
		0 0,
		100% 0,
		100% 0,
		100% 100%,
		0 100%
	); /* Start as rectangle */
}

.cta-button::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: var(--color-accent);
	transform-origin: left;
	transform: scaleX(0);
	transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
	z-index: -1;
}

.cta-button:hover {
	color: var(--color-background);
	clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
}

.cta-button:hover::before {
	transform: scaleX(1);
}

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

#research {
	position: relative;
	overflow: hidden;
}

#research::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-image: radial-gradient(
			circle at 20% 30%,
			var(--color-accent-darker) 5%,
			transparent 40%
		),
		radial-gradient(circle at 80% 70%, var(--color-accent) 5%, transparent 40%);
	background-size: 300% 300%;
	opacity: 0.15; /* Visible by default */
	z-index: 0;
	animation: animate-gradient 25s ease infinite;
	transition: animation-duration 0.4s ease;
}

@keyframes animate-gradient {
	0% {
		background-position: 0% 50%;
	}
	50% {
		background-position: 100% 50%;
	}
	100% {
		background-position: 0% 50%;
	}
}

#research.fast-animation::before {
	animation-duration: 4s;
}

.content-wrapper {
	width: 100%;
}

#research .sectors-grid {
	position: relative;
	z-index: 1;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 3rem;
	width: 100%;
}

.sectors-item {
	background: var(--color-background);
	padding: 2rem;
	transition: background-color 0.3s ease;
}

.sectors-item:hover {
	background-color: var(--color-grey-light);
}

#research .research-content,
#visualization .content-wrapper {
	max-width: 65ch;
}

#threejs-container {
	width: 100%;
	margin-top: 2rem;
	border: 1px solid #eaeaea;
	overflow: hidden;
}

.visualization-mobile {
	display: none;
}

#threejs-container .visualization-desktop {
	width: 100%;
	display: block;
	border: none;
	aspect-ratio: 16 / 9;
}

/* --- Footer --- */
footer {
	padding: 1rem;
	color: var(--color-grey-dark);
	font-size: 0.9rem;
}

.footer-content {
	text-align: center;
}

/* --- Mobile & Responsive --- */
/* --- Hamburger Menu --- */
.hamburger-menu {
	display: none; /* Hidden on desktop */
	background: none;
	border: none;
	cursor: pointer;
	padding: 1rem;
	z-index: 1001;
}

.hamburger-line {
	display: block;
	width: 25px;
	height: 2px;
	background-color: var(--color-text);
	margin: 5px 0;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-menu.is-active .hamburger-line:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.hamburger-menu.is-active .hamburger-line:nth-child(2) {
	opacity: 0;
}

.hamburger-menu.is-active .hamburger-line:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* --- Mobile Nav Overlay --- */
.mobile-nav {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: var(--color-background);
	z-index: 1000;
	display: flex;
	justify-content: center;
	align-items: center;
	transform: translateX(100%);
	transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
}

.mobile-nav.is-active {
	transform: translateX(0);
}

.mobile-nav ul {
	list-style: none;
	text-align: center;
}

.mobile-nav li {
	margin: 2rem 0;
}

.mobile-nav a {
	font-family: var(--font-heading);
	font-size: clamp(1.8rem, 8vw, 2.5rem);
	color: var(--color-text);
	text-transform: uppercase;
	letter-spacing: 0.1em;
}

@media (max-width: 768px) {
	body {
		padding-left: 0;
	}
	.vertical-watermark {
		display: none;
	}

	main > section {
		padding: 6rem 2rem;
	}

	.hero {
		padding: 3rem 2rem 6rem 2rem; /* Reduced top padding */
	}

	h1 {
		font-size: clamp(2.5rem, 12vw, 4rem);
	}
	h2 {
		font-size: clamp(1.5rem, 8vw, 1.8rem);
	}

	.logo {
		margin-top: 0; /* Remove top margin on mobile */
	}

	nav {
		display: flex; /* Enable flexbox for nav */
		justify-content: space-between; /* Push logo and hamburger apart */
		align-items: center; /* Vertically align items */
		width: 100%; /* Ensure nav takes full width */
	}

	nav ul {
		display: none;
	}
	.hamburger-menu {
		display: block;
		margin-left: auto; /* Push hamburger to the right */
	}

	#threejs-container .visualization-desktop {
		display: none;
	}
	.visualization-mobile {
		display: flex;
		justify-content: center;
		width: 100%;
		margin-top: 2rem;
	}
}

@media (max-width: 768px) {
	#research .sectors-grid {
		grid-template-columns: 1fr; /* Stack research items */
	}
}

@media (min-width: 768px) {
	#research .sectors-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* --- Scroll Animations --- */
.fade-in-section {
	opacity: 0;
	transform: translateY(30px);
	transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-section.is-visible {
	opacity: 1;
	transform: translateY(0);
}
