@import url(fontawesome-all.min.css);
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap");

/* CSS Variables for Dark/Light Mode */
:root {
	/* Dark Mode (Default) */
	--bg-primary: #000000;
	--bg-secondary: #0a0a0a;
	--bg-tertiary: #1a1a1a;
	--text-primary: #ffffff;
	--text-secondary: #cccccc;
	--text-muted: #999999;
	--border-color: #333333;
	--accent-color: #ffffff;
	--hover-color: #f5f5f5;
}

/* Light Mode */
body.light-mode {
	--bg-primary: #f8f8f8;
	--bg-secondary: #ffffff;
	--bg-tertiary: #f0f0f0;
	--text-primary: #000000;
	--text-secondary: #333333;
	--text-muted: #666666;
	--border-color: #e0e0e0;
	--accent-color: #000000;
	--hover-color: #1a1a1a;
}

/* Reset and Base Styles */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	font-size: 16px;
	line-height: 1.6;
}

body {
	font-family: 'Crimson Text', serif;
	font-weight: 400;
	color: var(--text-primary);
	background-color: var(--bg-primary);
	transition: background-color 0.3s ease, color 0.3s ease;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
	font-family: 'Inter', sans-serif;
	font-weight: 600;
	line-height: 1.2;
	margin-bottom: 1rem;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

p {
	margin-bottom: 1.5rem;
	max-width: 65ch;
}

a {
	color: var(--text-primary);
	text-decoration: none;
	transition: color 0.2s ease;
}

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

a:focus {
	outline: 2px solid var(--accent-color);
	outline-offset: 2px;
	border-radius: 2px;
}

button:focus {
	outline: 2px solid var(--accent-color);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Enhanced focus indicators for interactive elements */
.theme-toggle:focus,
.hamburger-menu:focus,
.project-card-link:focus {
	outline: 2px solid var(--accent-color);
	outline-offset: 2px;
}

.project-card-link:focus {
	outline-offset: 4px;
}

/* Focus within project cards */
.project-card:focus-within {
	box-shadow: 0 0 0 2px var(--accent-color);
}

/* Skip Links for Accessibility */
.skip-link {
	position: absolute;
	top: -50px;
	left: 6px;
	background: var(--accent-color);
	color: var(--bg-primary);
	padding: 8px 12px;
	text-decoration: none;
	font-family: 'Inter', sans-serif;
	font-weight: 600;
	border-radius: 4px;
	z-index: 10000;
	transition: top 0.3s ease;
	opacity: 0;
	pointer-events: none;
}

.skip-link:focus {
	top: 6px;
	opacity: 1;
	pointer-events: auto;
}

/* Layout */
#wrapper {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.container {
	max-width: 900px;
	margin: 0 auto;
	padding: 0 2rem;
}

@media (max-width: 768px) {
	.container {
		padding: 0 1rem;
	}
}

/* Header */
#header {
	background-color: var(--bg-primary);
	position: relative;
	z-index: 100;
}

#header .container {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1.5rem 2rem;
	gap: 2rem;
}

#header .logo {
	order: 1;
}

#header .desktop-nav {
	order: 2;
	flex: 1;
	justify-content: flex-end;
	display: flex;
	gap: 2rem;
}

#header .header-controls {
	order: 3;
}

.logo {
	font-family: 'Inter', sans-serif;
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--text-primary);
}

.logo:hover {
	color: var(--text-secondary);
}

nav {
	display: flex;
	gap: 2rem;
}

nav a {
	font-family: 'Inter', sans-serif;
	font-size: 0.9rem;
	font-weight: 400;
	color: var(--text-secondary);
	transition: color 0.2s ease;
}

nav a:hover {
	color: var(--text-primary);
}

/* Header Controls */
.header-controls {
	display: flex;
	align-items: center;
	gap: 1rem;
}

/* Back Button Section */
.back-button-section {
	background-color: var(--bg-primary);
	padding: 0.5rem 0 1rem 0;
	border-top: 1px solid var(--border-color);
	position: relative;
	z-index: 5;
}

.back-button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: none;
	border: none;
	color: var(--text-secondary);
	font-family: 'Inter', sans-serif;
	font-size: 0.9rem;
	font-weight: 400;
	cursor: pointer !important;
	padding: 0.5rem 1rem;
	border-radius: 4px;
	transition: all 0.2s ease;
	text-decoration: none;
	pointer-events: auto;
	z-index: 10;
}

.back-button:hover {
	color: var(--text-primary);
	background-color: var(--bg-tertiary);
}

.back-button:focus {
	outline: 2px solid var(--accent-color);
	outline-offset: 2px;
}

.back-button i {
	font-size: 0.8rem;
}

/* Desktop Navigation */
.desktop-nav {
	display: flex;
	gap: 2rem;
}

/* Hide desktop navigation on mobile */
@media (max-width: 768px) {
	.desktop-nav {
		display: none !important;
	}
}

/* Hide desktop navigation when mobile menu is active */
body.mobile-menu-open .desktop-nav {
	opacity: 0;
	pointer-events: none;
}

/* Hamburger Menu */
.hamburger-menu {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 44px;
	height: 44px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.5rem;
	transition: transform 0.2s ease;
}

.hamburger-menu:hover {
	transform: scale(1.1);
}

@media (max-width: 768px) {
	.hamburger-menu {
		display: flex;
	}
}

.hamburger-line {
	width: 20px;
	height: 2px;
	background-color: var(--text-secondary);
	transition: all 0.3s ease;
	margin: 2px 0;
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
	transform: rotate(45deg) translate(5px, 5px);
}

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

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

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: var(--bg-primary);
	z-index: 1000;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
	transform: translateY(-100%);
	pointer-events: none;
}

.mobile-nav-overlay.active {
	pointer-events: auto;
}

.mobile-nav-overlay.active {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.mobile-nav {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	gap: 2rem;
	padding: 2rem;
	position: relative;
	pointer-events: auto;
}

.mobile-menu-close {
	position: absolute;
	top: 2.75rem;
	right: 3.25rem;
	background-color: var(--bg-tertiary);
	border: 1px solid var(--border-color);
	font-size: 1.3rem;
	color: var(--text-primary);
	cursor: pointer;
	padding: 0;
	border-radius: 50%;
	transition: all 0.2s ease;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1002;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	opacity: 1;
	pointer-events: auto;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.mobile-menu-close:hover {
	background-color: var(--text-primary);
	color: var(--bg-primary);
	border-color: var(--text-primary);
	transform: scale(1.05);
}

.mobile-menu-close:focus {
	outline: 2px solid var(--accent-color);
	outline-offset: 2px;
	border-radius: 50%;
}

.mobile-nav a {
	font-family: 'Inter', sans-serif;
	font-size: 1.2rem;
	font-weight: 500;
	color: var(--text-primary);
	text-decoration: none;
	padding: 1rem 2rem;
	border-radius: 4px;
	transition: all 0.2s ease;
	width: 200px;
	text-align: center;
}

.mobile-nav a:hover {
	background-color: var(--bg-tertiary);
	color: var(--text-primary);
}


/* Theme Toggle */
.theme-toggle {
	background: none;
	border: none;
	width: auto;
	height: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--text-secondary);
	font-size: 0.9rem;
	padding: 0;
	margin-left: 1rem;
}

.theme-toggle:hover {
	color: var(--text-primary);
}

/* Banner/Hero */
#banner {
	background-color: var(--bg-primary);
	padding: 2rem 0;
	text-align: center;
	border-bottom: 1px solid var(--border-color);
}

#banner h1 {
	margin-bottom: 1rem;
	font-size: clamp(2.5rem, 6vw, 4rem);
}

#banner p {
	font-size: 1.1rem;
	color: var(--text-secondary);
	max-width: 60ch;
	margin: 0 auto;
}

/* Main Content */
#main {
	flex: 1;
	padding: 2rem 0;
}

/* Projects page specific styles */
.projects-main {
	margin-bottom: 1rem !important;
}

.projects-intro {
	margin-bottom: 3rem !important;
	color: var(--text-secondary) !important;
}

/* Projects page footer alignment fix */
body.projects-page #footer .container {
	text-align: left !important;
}

/* Spacer for visual separation between table and footer */
.section-spacer {
	height: 4rem;
	margin: 2rem 0;
	border-top: 1px solid var(--border-color);
	opacity: 0.3;
}

section {
	margin-bottom: 2rem;
}

/* Project Grid - Norma Inspired Masonry Layout */
.project-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 2rem;
	margin-top: 3rem;
}

.project-card {
	background-color: var(--bg-secondary);
	padding: 2rem;
	transition: all 0.3s ease;
	position: relative;
	overflow: hidden;
}

.project-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.project-card-link {
	display: block;
	text-decoration: none;
	color: inherit;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card-link:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.project-card:nth-child(3n) {
	grid-column: span 2;
}

.project-card:nth-child(4n) {
	grid-column: span 1;
	grid-row: span 2;
}

.project-card:nth-child(5n) {
	grid-column: span 2;
	grid-row: span 1;
}

@media (max-width: 768px) {
	.project-card:nth-child(n) {
		grid-column: span 1;
		grid-row: span 1;
	}
}

.project-image {
	width: 100%;
	height: 200px;
	background-color: var(--bg-tertiary);
	margin-bottom: 1.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	font-family: 'Inter', sans-serif;
	font-size: 0.9rem;
	overflow: hidden;
	border-radius: 4px;
}

.project-image img {
	width: calc(100% - 2rem);
	height: calc(100% - 2rem);
	object-fit: contain;
	transition: transform 0.3s ease;
	margin: 1rem;
}

/* Specific larger images for select projects - using nth-child for better browser support */
.project-card:nth-child(1) .project-image, /* REACT3D */
.project-card:nth-child(2) .project-image, /* Advanced CAD */
.project-card:nth-child(5) .project-image, /* Assistive Shaker */
.project-card:nth-child(7) .project-image, /* EGT Sensor Routing */
.project-card:nth-child(11) .project-image { /* Sustainability Engineering VR */
	height: 280px;
}

.project-card:nth-child(1) .project-image img, /* REACT3D */
.project-card:nth-child(2) .project-image img, /* Advanced CAD */
.project-card:nth-child(5) .project-image img, /* Assistive Shaker */
.project-card:nth-child(7) .project-image img, /* EGT Sensor Routing */
.project-card:nth-child(11) .project-image img { /* Sustainability Engineering VR */
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
}

/* Smaller images for remaining projects to prevent cramping */
.project-card:nth-child(4) .project-image, /* Mobile Robot */
.project-card:nth-child(6) .project-image, /* SinuComfort */
.project-card:nth-child(10) .project-image { /* Volumetric Equine Scanner */
	height: 120px;
}

.project-card:nth-child(4) .project-image img, /* Mobile Robot */
.project-card:nth-child(6) .project-image img, /* SinuComfort */
.project-card:nth-child(10) .project-image img { /* Volumetric Equine Scanner */
	max-width: calc(100% - 2rem);
	max-height: calc(100% - 2rem);
	width: auto;
	height: auto;
	margin: 1rem;
	object-fit: contain;
}

/* Override for specific card heights */
.project-card:nth-child(3n) .project-image img {
	height: 250px;
	object-fit: cover;
}

.project-card:hover .project-image img {
	transform: scale(1.05);
}

.project-card:nth-child(3n) .project-image {
	height: 250px;
}

.project-card:nth-child(4n) .project-image {
	height: 400px;
}

.project-content h3 {
	margin-bottom: 1rem;
}

.project-content h3 a {
	color: var(--text-primary);
	text-decoration: none;
}

.project-content h3 a:hover {
	color: var(--text-secondary);
}

.project-description {
	color: var(--text-secondary);
	line-height: 1.6;
}

/* About Section */
#about {
	background-color: var(--bg-primary);
	padding: 2rem 0;
	margin: 2rem 0;
}

.about-layout {
	padding: 2rem 0;
}

.about-content {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 4rem;
	align-items: start;
	max-width: 1200px;
	margin: 0 auto;
	position: relative;
}

.about-text {
	text-align: left;
	max-width: 700px;
	line-height: 1.8;
	padding-top: 0;
	margin-top: 0;
}

.company-logos {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	position: absolute;
	right: 0;
	top: 0;
	height: 100%;
	padding: 0.5rem 0;
	width: 100px;
	/* Align with text paragraphs */
	padding-top: 2.5rem; /* Align with start of first paragraph */
	padding-bottom: 1.5rem; /* Align with end of last paragraph */
}

.logo-item {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 70px;
	height: 50px;
	background-color: var(--bg-tertiary);
	border-radius: 6px;
	overflow: hidden;
	transition: transform 0.2s ease, filter 0.3s ease;
	flex-shrink: 0;
}

.logo-item:hover {
	transform: scale(1.05);
}

.logo-item img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: filter 0.3s ease;
}

/* Dark mode - white logos */
body:not(.light-mode) .logo-item img {
	filter: brightness(0) contrast(1.2) invert(1);
}

/* Light mode - gray logos */
body.light-mode .logo-item img {
	filter: grayscale(100%) brightness(0.6);
}

.about-text h1 {
	font-size: 1.5rem;
	margin-bottom: 2.5rem;
}

.about-text p {
	margin-bottom: 1.5rem;
	font-size: 1rem;
	line-height: 1.6;
}


@media (max-width: 768px) {
	.about-content {
		grid-template-columns: 1fr;
		gap: 2rem;
		position: static;
	}


	.company-logos {
		position: static;
		flex-direction: row;
		justify-content: center;
		gap: 1rem;
		min-height: auto;
		padding: 1rem 0;
		width: auto;
		flex-wrap: wrap;
	}

	.logo-item {
		width: 55px;
		height: 40px;
		flex-shrink: 0;
	}
}

/* iPhone mini specific fix - prevent logo wrapping */
@media (max-width: 480px) {
	.company-logos {
		flex-wrap: nowrap;
		justify-content: space-around;
		gap: 0.5rem;
		padding: 1rem;
	}

	.logo-item {
		width: 50px;
		height: 35px;
		flex-shrink: 0;
	}
}

/* Footer */
#footer {
	background-color: var(--bg-primary);
	padding: 2rem 0;
	margin-top: auto;
}

#footer .container {
	text-align: left;
	display: flex;
	justify-content: flex-start;
	align-items: center;
}

#footer p {
	color: var(--text-muted);
	font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
	.project-grid {
		grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
		gap: 1.5rem;
	}
}

@media (max-width: 768px) {
	#banner,
	#main,
	#about {
		padding: 1rem 0;
	}

	section {
		margin-bottom: 1rem;
	}

	.project-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
		margin-top: 1rem;
	}
}

@media (max-width: 480px) {
	#header .container {
		padding: 1rem;
	}

	#banner,
	#main,
	#about {
		padding: 0.75rem 0;
	}
}

/* Project Page Styles */
.project-hero {
	padding: 3rem 0 2rem 0;
	border-bottom: 1px solid var(--border-color);
	margin-bottom: 3rem;
}

/* REACT3D Project Overview Layout - Two Column Layout */
.project-overview-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: auto;
	gap: 3rem;
	align-items: start;
	max-width: 1200px;
	margin: 0 auto;
	padding-bottom: 2rem;
}

.project-overview-text {
	grid-column: 1;
	grid-row: 1;
}

.project-overview-visuals {
	grid-column: 2;
	grid-row: 1;
	display: flex;
	flex-direction: column;
	max-width: 500px;
	min-height: 200px;
}

/* REACT3D Design Innovation Layout - Two Column Layout */
.project-innovation-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: auto;
	gap: 3rem;
	align-items: start;
	max-width: 1200px;
	margin: 0 auto;
	padding-bottom: 2rem;
}

.project-innovation-text {
	grid-column: 1;
	grid-row: 1;
}

.project-innovation-visuals {
	grid-column: 2;
	grid-row: 1;
	display: flex;
	flex-direction: column;
	max-width: 500px;
	min-height: 200px;
}

.project-remaining-content {
	max-width: 1200px;
	margin: 0 auto;
	padding-top: 2rem;
	/* Left justify to align with previous paragraphs */
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.project-remaining-content .content-block {
	max-width: 394px;  /* Match Design Innovation LEFT column width exactly */
}

.project-remaining-content .content-block p {
	max-width: 100%;  /* Ensure paragraphs stay within the content block */
}

.project-remaining-content .project-actions {
	margin-top: 1.5rem;
	align-self: flex-start;
	width: 100%;
}

.project-overview-visuals .main-setup,
.project-innovation-visuals .main-poster {
	width: 100%;
	min-height: 200px;
	border-radius: 8px;
	overflow: hidden;
	background-color: var(--bg-tertiary);
	display: flex;
	align-items: center;
	justify-content: center;
}

.project-overview-visuals .main-setup img,
.project-innovation-visuals .main-poster img {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 300px;
	object-fit: contain;
	display: block;
}

/* Ensure setup.jpg doesn't get cut off */
.project-visuals-main .main-setup {
	min-height: 200px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.project-visuals-main .main-setup img {
	max-width: 100%;
	max-height: 280px;
	width: auto;
}

.project-visuals-remaining {
	display: flex;
	flex-direction: column;
	gap: 2rem;
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 1px solid var(--border-color);
}

.project-hero-content {
	max-width: 800px;
}

.project-hero-text h1 {
	font-size: clamp(2rem, 5vw, 3.5rem);
	margin-bottom: 1rem;
	font-family: 'Inter', sans-serif;
	font-weight: 600;
}

.project-tagline {
	font-size: 1.2rem;
	color: var(--text-secondary);
	line-height: 1.6;
	max-width: 60ch;
}

.project-content {
	padding-bottom: 2rem;
}

.project-layout {
	max-width: 1200px;
	margin: 0 auto;
	/* Use CSS Grid for main layout but allow flexibility */
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: auto auto;
	gap: 3rem;
	align-items: start;
}

/* Special layout for CAD project */
.project-layout.cad-layout {
	grid-template-columns: 3fr 2fr;
	grid-template-rows: auto;
	gap: 3rem;
	align-items: start;
}

/* Special layout for SinuComfort 2x2 project */
/* SinuComfort specific 2x2 visual grid */
.visual-grid.cad-components.horizontal {
	grid-template-columns: 1fr 1fr !important;
	grid-template-rows: 1fr 1fr !important;
	gap: 1rem !important;
	max-width: 600px !important;
	margin: 0 !important;
}

.visual-grid.cad-components.horizontal .visual-item {
	height: 200px !important;
	width: 100% !important;
}

/* Mobile responsiveness for SinuComfort */
@media (max-width: 768px) {
	body.sinucomfort-layout .project-layout {
		grid-template-columns: 1fr !important;
		gap: 2rem !important;
	}

	body.sinucomfort-layout .project-layout .project-text {
		grid-column: 1 !important;
		grid-row: 1 !important;
	}

	body.sinucomfort-layout .project-layout .project-visuals {
		grid-column: 1 !important;
		grid-row: 2 !important;
	}
}

/* SinuComfort specific 2x2 visual grid */
.visual-grid.cad-components.horizontal {
	grid-template-columns: 1fr 1fr !important;
	grid-template-rows: 1fr 1fr !important;
	gap: 1rem !important;
	max-width: 600px !important;
	margin: 0 !important;
}

.visual-grid.cad-components.horizontal .visual-item {
	height: 200px !important;
	width: 100% !important;
}

/* DML specific layout */
body.dml-layout .project-layout {
	grid-template-columns: 1fr 1fr !important;
	gap: 3rem !important;
	align-items: start !important;
}

body.dml-layout .project-layout .project-text {
	grid-column: 1 !important;
	grid-row: 1 !important;
}

body.dml-layout .project-layout .project-visuals {
	grid-column: 2 !important;
	grid-row: 1 !important;
	display: flex !important;
	flex-direction: column !important;
	gap: 2rem !important;
}

/* DML main images - single image layout */
body.dml-layout .visual-grid.dml-main-images {
	grid-template-columns: 1fr !important;
	grid-template-rows: 1fr !important;
	gap: 1rem !important;
	max-width: 100% !important;
	margin: 0 !important;
}

body.dml-layout .visual-grid.dml-main-images .dml-single-image {
	height: 400px !important;
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
	background-color: transparent !important;
}

body.dml-layout .visual-grid.dml-main-images .dml-single-image img {
	max-height: 380px !important;
	max-width: 100% !important;
	width: auto !important;
	height: auto !important;
	object-fit: contain !important;
	display: block !important;
}

/* DML process images grid */
body.dml-layout .visual-grid.dml-process-images {
	grid-template-columns: repeat(4, 1fr) !important;
	grid-template-rows: repeat(2, 1fr) !important;
	gap: 1rem !important;
	max-width: 100% !important;
	margin: 0 !important;
}

body.dml-layout .visual-grid.dml-process-images .visual-item {
	height: 150px !important;
}

/* DML Process Grid - 3x3 layout below everything */
body.dml-layout .dml-process-section {
	margin-top: 0.04rem !important;
	padding-top: 0.03rem !important;
}

body.dml-layout .visual-grid.dml-process-grid {
	grid-template-columns: repeat(3, 1fr) !important;
	grid-template-rows: repeat(3, 1fr) !important;
	gap: 1.5rem !important;
	max-width: 100% !important;
	margin: 2rem auto 0 !important;
}

body.dml-layout .visual-grid.dml-process-grid .visual-item {
	height: 180px !important;
	width: 100% !important;
	display: flex !important;
	justify-content: center !important;
	align-items: center !important;
}

body.dml-layout .visual-grid.dml-process-grid .visual-item img {
	height: 100% !important;
	width: 100% !important;
	object-fit: contain !important;
}

/* DML mobile responsiveness */
@media (max-width: 768px) {
	body.dml-layout .project-layout {
		grid-template-columns: 1fr !important;
		gap: 2rem !important;
	}

	body.dml-layout .project-layout .project-text {
		grid-column: 1 !important;
		grid-row: 1 !important;
	}

	body.dml-layout .project-layout .project-visuals {
		grid-column: 1 !important;
		grid-row: 2 !important;
		display: flex !important;
		flex-direction: column !important;
		gap: 2rem !important;
	}

	body.dml-layout .visual-grid.dml-main-images,
	body.dml-layout .visual-grid.dml-process-images {
		grid-template-columns: 1fr !important;
		grid-template-rows: auto !important;
		max-width: 100% !important;
		margin: 0 !important;
	}

	body.dml-layout .visual-grid.dml-main-images .dml-single-image {
		height: 380px !important;
		display: flex !important;
		justify-content: center !important;
		align-items: center !important;
		background-color: transparent !important;
	}

	body.dml-layout .visual-grid.dml-main-images .dml-single-image img {
		max-height: 360px !important;
		max-width: 100% !important;
		width: auto !important;
		height: auto !important;
		object-fit: contain !important;
		display: block !important;
	}

	body.dml-layout .visual-grid.dml-process-images .visual-item {
		height: 180px !important;
	}

	/* DML mobile layout updates */
	body.dml-layout .dml-process-section {
		margin-top: 2rem !important;
		padding-top: 1rem !important;
	}

	body.dml-layout .visual-grid.dml-process-grid {
		grid-template-columns: 1fr 1fr 1fr !important;
		grid-template-rows: auto auto auto !important;
		gap: 0.75rem !important;
		max-width: 900px !important;
		margin: 0 auto !important;
	}

	body.dml-layout .visual-grid.dml-process-grid .visual-item {
		height: 150px !important;
		width: 100% !important;
		justify-self: stretch !important;
	}
}

/* CAD project main image in right column */
.project-visuals .main-image {
	height: auto;
	min-height: 210px;
	margin-bottom: 1rem;
}

.project-visuals .main-image img {
	height: 100%;
	min-height: 210px;
	object-fit: contain;
	background-color: var(--bg-tertiary);
}

/* Horizontal layout for components - 3 images in one row */
.visual-grid.cad-components {
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: auto;
	gap: 1.5rem;
	max-width: 100%;
	margin: 0 auto;
}

.visual-grid.cad-components .visual-item {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 120px;
	overflow: hidden;
}

.visual-grid.cad-components .visual-item img {
	max-height: 110px;
	max-width: 85%;
	object-fit: contain;
}

/* Special vertical layout for CAD components */
.visual-grid.cad-components.vertical {
	grid-template-columns: 1fr;
	grid-template-rows: repeat(4, auto);
	gap: 1.5rem;
	max-width: 80%;
	margin: 0 auto;
}

.visual-grid.cad-components.vertical .visual-item {
	height: 200px;
}

.visual-grid.cad-components.vertical .visual-item img {
	max-height: 180px;
	max-width: 90%;
}

/* SinuComfort specific 2x2 layout - target horizontal class specifically */
.visual-grid.cad-components.horizontal {
	grid-template-columns: 1fr 1fr !important;
	grid-template-rows: 1fr 1fr !important;
	gap: 1rem !important;
	max-width: 600px !important;
	margin: 0 !important;
}

.visual-grid.cad-components.horizontal .visual-item {
	height: 150px !important;
	width: 100% !important;
	min-width: 0 !important;
}

.project-text {
	max-width: 500px;
}

.content-block {
	margin-bottom: 2.5rem;
}

.content-block h3 {
	font-family: 'Inter', sans-serif;
	font-size: 1.3rem;
	font-weight: 600;
	margin-bottom: 1rem;
	color: var(--text-primary);
}

.content-block p {
	color: var(--text-secondary);
	line-height: 1.7;
	margin-bottom: 1rem;
}

.project-actions {
	margin-top: 2rem;
}

.project-actions .button {
	background-color: var(--bg-tertiary);
	color: var(--text-primary);
	padding: 0.8rem 2rem;
	border-radius: 4px;
	font-family: 'Inter', sans-serif;
	font-weight: 500;
	text-decoration: none;
	display: inline-block;
	transition: all 0.2s ease;
	border: 1px solid var(--border-color);
	width: auto;
	min-width: 150px;
}

.project-actions .button:hover {
	background-color: var(--text-primary);
	color: var(--bg-primary);
	transform: translateY(-1px);
}

.project-visuals {
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

/* Flexible image containers that can wrap */
.visual-block {
	width: 100%;
	border-radius: 8px;
	overflow: hidden;
	/* Allow images to be full width if they're wider */
	justify-self: stretch;
}

.visual-block img {
	width: 100%;
	height: auto;
	object-fit: cover;
	transition: transform 0.3s ease;
	display: block;
}

.visual-block:hover img {
	transform: scale(1.02);
}

/* Full-width image variant */
.visual-block.full-width {
	grid-column: 1 / -1;
	max-height: 400px;
}

.visual-block.full-width img {
	max-height: 400px;
	object-fit: contain;
	background-color: var(--bg-tertiary);
}

/* Ensure images are always visible */
.visual-block img,
.visual-item img {
	opacity: 1 !important;
	display: block !important;
}

/* Grid for multiple images */
.visual-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 1rem;
	width: 100%;
}

/* Earcup project specific 4x2 grid layout */
.visual-grid.earcup-grid {
	grid-template-columns: repeat(2, 1fr);
	grid-template-rows: repeat(4, 1fr);
	gap: 1.5rem;
	max-width: 800px;
	margin: 0 auto;
}

.visual-grid.earcup-grid .visual-item {
	height: 250px;
}

.visual-grid.earcup-grid .visual-item img {
	height: 100%;
	max-height: 250px;
	object-fit: cover;
}

/* Compact grid for smaller images - 2x2 layout */
.visual-grid-compact {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: auto auto;
	gap: 1.5rem;
	width: 100%;
	max-width: 600px;
	justify-items: center;
	align-items: center;
}

/* CAD project specific grid with larger height */
.visual-grid.cad-grid {
	max-width: 700px;
	gap: 2rem;
}

.visual-item {
	border-radius: 6px;
	overflow: hidden;
	background-color: var(--bg-tertiary);
}

.visual-item img {
	width: 100%;
	height: 280px;
	object-fit: contain;
	transition: transform 0.3s ease;
}

/* Smaller images for CAD project grid */
.visual-item.small img {
	height: 150px;
}

/* Compact images - smaller but show complete content */
.visual-item.compact {
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: var(--bg-tertiary);
	border-radius: 4px;
}

.visual-item.compact img {
	max-height: 160px;
	max-width: 160px;
	width: auto;
	height: auto;
	object-fit: contain;
}

/* Taller images for specific projects */
.visual-item.tall img {
	height: 280px;
}

.visual-item.taller img {
	height: 350px;
}

/* Vertical images (portrait orientation) */
.visual-item.vertical {
	grid-column: span 1;
}

.visual-item.vertical img {
	height: 320px;
	object-fit: cover;
}

/* Horizontal images (landscape orientation) */
.visual-item.horizontal {
	grid-column: span 2;
}

.visual-item.horizontal img {
	height: 200px;
	object-fit: cover;
}

/* Special layout containers */
.project-images-below {
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 1px solid var(--border-color);
}

.images-below-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 2rem;
	margin-top: 2rem;
}

.visual-item:hover img {
	transform: scale(1.05);
}

/* Single image that spans full width */
.visual-single {
	grid-column: 1 / -1;
	border-radius: 8px;
	overflow: hidden;
	background-color: var(--bg-tertiary);
	max-height: 300px;
}

.visual-single img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Enhanced Mobile Responsiveness for Project Pages */
@media (max-width: 768px) {
	/* CAD project mobile layout - stack images below text */
	.project-layout.cad-layout {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto;
		gap: 2rem;
	}

	.project-layout.cad-layout .project-text {
		grid-column: 1;
		grid-row: 1;
	}

	.project-layout.cad-layout .project-visuals {
		grid-column: 1;
		grid-row: 2;
	}

	.project-overview-layout,
	.project-innovation-layout {
		grid-template-columns: 1fr;
		gap: 2rem;
	}

	.project-overview-text,
	.project-innovation-text {
		grid-column: 1;
		grid-row: 1;
	}

	.project-overview-visuals,
	.project-innovation-visuals {
		grid-column: 1;
		grid-row: 2;
		max-width: none;
	}

	.project-overview-visuals .main-setup,
	.project-innovation-visuals .main-poster {
		min-height: auto;
		max-height: 300px;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.project-overview-visuals .main-setup img,
	.project-innovation-visuals .main-poster img {
		max-height: 280px;
		max-width: 100%;
		width: auto;
		height: auto;
		object-fit: contain;
	}

	.project-remaining-content {
		padding-top: 1rem;
		align-items: flex-start;
	}

	.project-remaining-content .content-block {
		max-width: none;
	}

	.project-remaining-content .project-actions {
		margin-top: 1.5rem;
		width: 100%;
		text-align: left;
	}

	.project-text {
		max-width: none;
	}

	.project-hero {
		padding: 2rem 0 1rem 0;
		margin-bottom: 2rem;
	}

	.project-hero-text h1 {
		font-size: 2rem;
		line-height: 1.1;
	}

	.project-tagline {
		font-size: 1rem;
		line-height: 1.5;
	}

	.visual-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
	}

	/* Earcup grid mobile responsiveness */
	.visual-grid.earcup-grid {
		grid-template-columns: repeat(2, 1fr);
		grid-template-rows: repeat(4, 1fr);
		gap: 1rem;
		max-width: 600px;
	}

	.visual-grid.earcup-grid .visual-item {
		height: 200px;
	}

	.visual-grid.earcup-grid .visual-item img {
		max-height: 200px;
	}

	.visual-item img {
		height: auto;
		min-height: 200px;
		max-height: 300px;
	}

	/* CAD components on mobile - maintain vertical stack and narrower width */
	.visual-grid.cad-components,
	.visual-grid.cad-components.vertical {
		grid-template-columns: 1fr;
		gap: 2rem;
		max-width: 100%;
		margin: 0 auto;
	}

	.visual-grid.cad-components .visual-item {
		height: 180px;
	}

	.visual-grid.cad-components .visual-item img,
	.visual-grid.cad-components.vertical .visual-item img {
		max-height: 160px;
		max-width: 85%;
	}

	/* SinuComfort horizontal grid on mobile */
	.visual-grid.cad-components.horizontal {
		grid-template-columns: 1fr 1fr !important;
		grid-template-rows: 1fr 1fr !important;
		gap: 1rem !important;
		max-width: 100% !important;
		margin: 0 auto !important;
	}

	.visual-grid.cad-components.horizontal .visual-item {
		height: 180px !important;
		width: 100% !important;
		min-width: 0 !important;
	}

	.visual-grid.cad-components.horizontal .visual-item img {
		max-height: 160px !important;
		max-width: 90% !important;
	}

	/* Main image on mobile */
	.project-visuals .main-image {
		height: auto;
		min-height: 130px;
		margin-bottom: 1.5rem;
	}

	/* Taller images on mobile should be adjusted */
	.visual-item.tall img {
		height: auto;
		min-height: 250px;
		max-height: 350px;
	}

	.visual-item.taller img {
		height: auto;
		min-height: 300px;
		max-height: 400px;
	}

	/* Horizontal images on mobile should be single column */
	.visual-item.horizontal {
		grid-column: span 1;
	}

	/* Compact grid on mobile */
	.visual-grid-compact {
		grid-template-columns: 1fr 1fr;
		gap: 0.75rem;
		max-width: 100%;
	}

	.visual-item.compact img {
		max-height: 140px;
		max-width: 140px;
		width: auto;
		height: auto;
	}

	/* Images below text section on mobile */
	.project-images-below {
		margin-top: 2rem;
		padding-top: 1rem;
	}

	.images-below-grid {
		grid-template-columns: 1fr;
		gap: 1rem;
		margin-top: 1rem;
	}

	/* Full-width images on mobile should be contained */
	.visual-block.full-width {
		max-height: 300px;
	}

	.visual-block.full-width img {
		max-height: 300px;
		object-fit: contain;
	}

	/* Mobile navigation styles */
	.header-controls {
		gap: 0.5rem;
	}

	.theme-toggle {
		padding: 0.3rem;
	}

	/* Mobile close button positioning */
	.mobile-menu-close {
		top: 2.25rem;
		right: 2.25rem;
		width: 32px;
		height: 32px;
		font-size: 1.1rem;
	}

	/* Better image responsiveness */
	.visual-block img {
		width: 100%;
		height: auto;
	}

	/* Ensure images maintain aspect ratio */
	.visual-item img {
		object-fit: contain;
	}
}

@media (max-width: 480px) {
	.project-hero-text h1 {
		font-size: 1.75rem;
	}

	.content-block h3 {
		font-size: 1.2rem;
	}

	.project-actions .button {
		padding: 0.7rem 1.5rem;
		font-size: 0.9rem;
		width: 100%;
		text-align: center;
	}

	/* Improve touch targets */
	nav a, .theme-toggle, .logo {
		min-height: 44px;
		display: flex;
		align-items: center;
	}

	/* Better spacing on small screens */
	.content-block {
		margin-bottom: 2rem;
	}

	.project-visuals {
		gap: 1.5rem;
	}

	.visual-item img {
		height: 200px;
	}

	/* Very small screens - single column for earcup */
	@media (max-width: 480px) {
		.visual-grid.earcup-grid {
			grid-template-columns: 1fr;
			grid-template-rows: repeat(8, 1fr);
			gap: 0.75rem;
			max-width: 400px;
		}

		.visual-grid.earcup-grid .visual-item {
			height: 240px;
		}

		.visual-grid.earcup-grid .visual-item img {
			max-height: 240px;
		}
	}
}

/* iPhone-specific optimizations */
@supports (-webkit-touch-callout: none) {
	/* iOS-specific styles */
	.project-hero-text h1 {
		-webkit-text-size-adjust: 100%;
	}

	/* Prevent zoom on input focus */
	nav a, .theme-toggle, .button, .back-button {
		touch-action: manipulation;
	}

	/* Better scrolling */
	body {
		-webkit-overflow-scrolling: touch;
	}

	/* Ensure proper viewport width on iOS */
	html {
		width: 100vw;
		overflow-x: hidden;
	}

	/* Fix for iOS not zooming out properly */
	body {
		width: 100%;
		max-width: 100%;
		overflow-x: hidden;
	}
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
	.project-hero {
		padding: 1rem 0 0.5rem 0;
		margin-bottom: 1rem;
	}

	.project-content {
		padding-bottom: 1rem;
	}
}

/* Performance Optimizations */
img {
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
}

@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* Optimize font loading - using Google Fonts via @import */

/* GPU acceleration for animations */
.project-card, .visual-block img, .theme-toggle {
	will-change: transform;
	transform: translateZ(0);
}

/* Optimize scrolling */
body {
	scroll-behavior: smooth;
}

/* Lazy loading support */
img[loading="lazy"] {
	opacity: 0;
	transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
	opacity: 1;
}

/* Theme transition - Instant switch */
* {
 	transition: none;
}