:root {
	/* Fonts */
	--font-title: "Rethink Sans", sans-serif;
	--font-body: "Geist", sans-serif;
	--font-mono: "Geist Mono", monospace;

	/* Colors */
	--color-bg: #010101;
	--color-text: #FFEED6;
	--color-stroke: var(--color-text);
	--color-card: #ffffff;
	--color-card-image: #7A0000;
	--color-muted: rgba(18, 18, 18, 0.7);

	/* Base size: 1rem = html font-size (12px); tokens scale with root */
	--size-base: 1rem;
	--size-text-xs: 0.8rem;
	--size-text-sm: 0.9rem;
	--size-text-md: 1rem;
	--size-text-lg: 1.1rem;
	--size-text-xl: 1.3rem;
	--size-text-2xl: 1.5rem;

	/* Spacing (relative to --size-base) */
	--space-unit: var(--size-base);
	--space-2xs: calc(var(--space-unit) * 0.25);
	--space-xs: calc(var(--space-unit) * 0.5);
	--space-sm: calc(var(--space-unit) * 0.75);
	--space-md: var(--space-unit);
	--space-lg: calc(var(--space-unit) * 1.5);
	--space-xl: calc(var(--space-unit) * 2);
	--space-2xl: calc(var(--space-unit) * 2);
	--space-3xl: calc(var(--space-unit) * 5);
	--space-gap-icon: 0.4em;

	/* Radii (relative) */
	--radius-sm: 0px;
	--radius-md: 0px;
	--radius-lg: 0px;
	--radius-card: 0px;

	/* Layout (relative / viewport) */
	--height-hero-vh: 70vh;
	--height-image-vh: 50vh;
	--height-footer-mobile-vh: 40vh;
	--height-footer-desktop-vh: 80vh;
	--width-ham: 2.5rem;

	/* Breakpoint: single source for media queries (use in JS or @custom-media if supported) */
	--breakpoint-md: 48rem; /* 768px */

	/* Motion */
	--duration-fast: 150ms;
	--duration-normal: 400ms;
	--ease-out: ease-out;
	--ease-default: ease;
}

html {
	font-size: 12px;
	scroll-padding-top: 5rem;
}

/* Gradient fade behind fixed logo/nav so content disappears smoothly when scrolling */
body::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 7rem;
	background: linear-gradient(to bottom, color-mix(in srgb, var(--color-bg) 60%, transparent) 0%, transparent 100%);
	pointer-events: none;
	z-index: 50;
}

body {
	scroll-behavior: smooth;
	
	background-color: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: 1rem;
}

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

html,
body {
	overflow-x: clip;
}

/* ── Hamburger button ── */
.nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-xs);
	padding: var(--space-xs) var(--space-md);
	background: transparent;
	color: var(--color-stroke);
	border-radius: 30px;
	cursor: pointer;
	z-index: 200;
	position: fixed;
	top: var(--space-sm);
	right: var(--space-md);
	align-self: flex-start;
	transition: transform 350ms var(--ease-default);
}

.nav-toggle.is-open {
	background: transparent;
	color: var(--color-stroke);
	position: fixed;
	top: var(--space-sm);
	right: var(--space-md);
	align-self: flex-start;
}

.nav-toggle.is-open .line {
	stroke: var(--color-stroke);
}

/* Ensure the close ("X") icon shows whenever the toggle is open.
   This mirrors the `.ham7.active ...` dasharray/dashoffset rules. */
.nav-toggle.is-open .hamRotate {
	transform: rotate(45deg);
}

.nav-toggle.is-open .ham7 .top {
	stroke-dasharray: 17 82 !important;
	stroke-dashoffset: -62px !important;
}

.nav-toggle.is-open .ham7 .middle {
	stroke-dasharray: 40 111 !important;
	stroke-dashoffset: 23px !important;
}

.nav-toggle.is-open .ham7 .bottom {
	stroke-dasharray: 40 161 !important;
	stroke-dashoffset: -83px !important;
}


.nav-toggle svg {
	width: var(--width-ham);
	height: var(--width-ham);
}

.nav-toggle .line {
	stroke: currentColor;
}

/* ham7 animation styles */
.ham {
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: transform var(--duration-normal);
	user-select: none;
}
.hamRotate.active  { transform: rotate(45deg); }
.line {
	fill: none;
	transition: stroke-dasharray var(--duration-normal), stroke-dashoffset var(--duration-normal);
	stroke: var(--color-stroke);
	stroke-width: 5.5;
	stroke-linecap: round;
}
.ham7 .top    { stroke-dasharray: 40 82; }
.ham7 .middle { stroke-dasharray: 40 111; }
.ham7 .bottom { stroke-dasharray: 40 161; }
.ham7.active .top    { stroke-dasharray: 17 82;  stroke-dashoffset: -62px; }
.ham7.active .middle { stroke-dashoffset: 23px; }
.ham7.active .bottom { stroke-dashoffset: -83px; }

/* ── Full-screen nav overlay ── */
#main-nav {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100dvh;
	z-index: 90;
	background-color: var(--color-bg);
	color: var(--color-text);
	overflow: auto;
	/* Hidden state */
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition:
		opacity 400ms var(--ease-default),
		visibility 0s 400ms;
}

#main-nav.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition:
		opacity 400ms var(--ease-default),
		visibility 0s 0ms;
}

.main-nav__inner {
	display: grid;
	min-height: 100dvh;
	padding:
		clamp(5rem, 14vh, 8rem)
		clamp(2rem, 6vw, 5rem)
		clamp(2.5rem, 6vh, 4rem);
	grid-template-rows: 1fr auto;
	gap: var(--space-3xl);
}

@media (width > 1024px) {
	.main-nav__inner {
		grid-template-columns: 1fr auto;
		grid-template-rows: 1fr;
		align-items: center;
	}
}

/* ── Primary links ── */
.main-nav__links {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.main-nav__links a {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	text-decoration: none;
	color: var(--color-text);
	font-family: var(--font-title);
	font-size: clamp(3rem, 10vw, 6.5rem);
	font-weight: 800;
	line-height: 1.05;
	opacity: 0;
	transform: translateY(1.5rem);
	transition:
		transform 0ms,
		opacity 0ms;
}

/* Slide-in with stagger on open */
#main-nav.is-open .main-nav__links a {
	transform: translateY(0);
	opacity: 0.2;
	transition:
		transform 500ms var(--ease-out) calc(var(--i, 0) * 70ms),
		opacity 400ms var(--ease-out) calc(var(--i, 0) * 70ms);
}

#main-nav.is-open .main-nav__links a:hover,
#main-nav.is-open .main-nav__links a[aria-current="page"],
#main-nav.is-open .main-nav__links a.is-active {
	opacity: 1;
}


/* ── Aside: contact, socials, resume ── */
.main-nav__aside {
	display: flex;
	flex-direction: column;
	gap: var(--space-xl);
	align-self: end;
	/* hidden until open */
	opacity: 0;
	transform: translateY(0.75rem);
	transition: opacity 0ms, transform 0ms;
}

#main-nav.is-open .main-nav__aside {
	opacity: 1;
	transform: translateY(0);
	transition:
		opacity 400ms var(--ease-out) calc(4 * 70ms + 60ms),
		transform 400ms var(--ease-out) calc(4 * 70ms + 60ms);
}

.nav-group__label {
	font-family: var(--font-mono);
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	opacity: 0.4;
	margin: 0 0 0.45em;
}

.nav-group__socials {
	display: flex;
	flex-direction: column;
	gap: 0.2em;
}

.nav-group__link {
	display: inline-block;
	font-family: var(--font-body);
	font-size: clamp(0.85rem, 2vw, 1rem);
	color: var(--color-text);
	text-decoration: none;
	opacity: 0.5;
	transition: opacity 180ms var(--ease-out);
}

.nav-group__link:hover {
	opacity: 1;
}


.icon-arrow {
	width: 1em;
	height: 1em;
	flex-shrink: 0;
	transform-origin: center;
	transition: transform var(--duration-fast) var(--ease-out);
}

.footer-link:hover .icon-arrow,
.footer-contact-link:hover .icon-arrow,
.main-nav__links a:hover .icon-arrow,
.nav-group__link:hover .icon-arrow {
	transform: rotate(45deg);
}

.main-nav__links .icon-arrow {
	width: 0.7em;
	height: 0.7em;
	flex-shrink: 0;
}


header {
	/* 1. Make it stick to the top */
	position: sticky;
	top: 0;
	
	/* 2. Ensure it stays above everything else */
	z-index: 100; 
	
	/* 3. Keep toggle contrast stable while scrolling */
	background-color: var(--color-bg);
	
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-sm) var(--space-md);
}

.site-header {
	position: relative;
	z-index: 100;
	background-color: var(--color-bg);
}

.logo {
	position: fixed;
	top: var(--space-sm);
	left: var(--space-md);
	z-index: 200;
	transition: transform 350ms var(--ease-default);
}

body.header-hidden .logo,
body.header-hidden .nav-toggle {
	transform: translateY(calc(-100% - var(--space-sm) * 2 - 2rem));
}

.logo a {
	display: block;
	color: inherit;
	text-decoration: none;
}

.logo-svg {
	display: block;
	height: calc(var(--width-ham) + var(--space-xs) * 2); /* matches nav-toggle height */
	width: auto;
}

@keyframes spin-in {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

.logo-svg .animate-on-load {
	transform-box: fill-box;
	transform-origin: center;
	animation: spin-in 1s var(--ease-out) forwards;
}

.site-footer__mark.do-spin path {
	transform-box: fill-box;
	transform-origin: center;
	animation: spin-in 1s var(--ease-out) forwards;
}

main {
	position: relative;
	/* 4. Lower than header (100) and footer (3) */
	z-index: 2;
	background-color: var(--color-bg);
	min-height: 100vh;
	box-shadow: none;
	padding-bottom: 5rem;
}


/* ── Hero ── */
.hero {
	position: relative;
	min-height: 90vh;
	padding: var(--space-3xl) var(--space-md) var(--space-xl);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--space-xs);
	overflow: hidden;
}

.hero .hi {
	font-family: var(--font-mono);
	font-size: clamp(0.85rem, 2vw, 1rem);
	text-transform: uppercase;
	opacity: 0.5;
	margin: 0;
}

.hero .name {
	font-family: var(--font-title);
	font-size: clamp(5.5rem, 23vw, 15rem);
	font-weight: 800;
	line-height: 0.88;
	margin: 0;
}

@keyframes hero-fade-up {
	from {
		opacity: 0;
		transform: translateY(1.5rem);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.hero .brand-stmnt {
	font-family: var(--font-title);
	font-size: clamp(3rem, 8vw, 6rem);
	font-weight: 800;
	line-height: 0.95;
	text-align: center;
	margin: 0;
	max-width: 14ch;
}

.hero-line {
	display: block;
	opacity: 0;
	animation: hero-fade-up 800ms var(--ease-out) forwards;
}

.hero-line:nth-child(1) { animation-delay: 100ms; }
.hero-line:nth-child(2) { animation-delay: 450ms; }

/* ── Projects ── */
.projects ul {
	display: grid;
	grid-template-columns: auto;
	list-style: none;
	padding: 0 var(--space-md);
	margin: 0;
}

.micro-text {
	font-family: var(--font-mono);
	font-size: clamp(0.95rem, 2.6vw, 1.1rem);
	text-transform: uppercase;
	font-weight: 500;
	font-kerning: auto;
	text-align: center;
	line-height: 1;
	background: transparent;
	padding: 0;
	border-radius: 30px;
	color: var(--color-text);
	margin: 0 0 var(--space-xs);
}

h2 {
	font-family: var(--font-title);
	font-size: clamp(2rem, 6vw, 2.75rem);
	text-align: center;
	font-weight: 800;
	margin: 0 0 var(--space-xl);
}

/* ── Footer ── */
.site-footer {
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100%;
	z-index: 3;
	transform: translateY(100%);
	transition: transform var(--duration-normal) var(--ease-out);
	background: var(--color-text);
	color: var(--color-bg);
	border-radius: 30px 30px 0 0;
	overflow: hidden;
	padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 5vw, 3rem);
	min-height: 60vh;
	display: grid;
	grid-template-rows: 1fr auto;
}

.site-footer.is-revealed {
	transform: translateY(0);
}

.site-footer__top {
	display: flex;
	justify-content: flex-end;
	align-items: flex-start;
}

.site-footer__contact {
	display: flex;
	flex-direction: column;
	gap: 0.35em;
	text-align: right;
}

.footer-contact-link {
	font-family: var(--font-body);
	font-size: clamp(1rem, 3vw, 1.5rem);
	font-weight: 400;
	color: inherit;
	text-decoration: none;
	line-height: 1.3;
	display: inline-block;
	transform: rotate(0deg);
	transform-origin: left center;
	transition: transform 220ms var(--ease-out), color 180ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
	.site-footer__contact a:nth-child(odd):hover {
		transform: rotate(-3deg);
	}
	.site-footer__contact a:nth-child(even):hover {
		transform: rotate(3deg);
	}
}

.site-footer .micro-text {
	background: transparent;
	padding: 0;
	color: var(--color-bg);
	line-height: 1.4;
	margin: 0;
	font-family: var(--font-mono);
	font-size: clamp(0.75rem, 2vw, 0.85rem);
	text-transform: none;
	font-weight: 400;
	opacity: 0.5;
}

.site-footer__bottom {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
}

.site-footer__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.2em;
	text-align: right;
}

.site-footer__mark {
	width: clamp(10rem, 28vw, 18rem);
	height: auto;
	color: var(--color-bg);
	margin-left: -2%;
	align-self: center;
	flex-shrink: 0;
}

/* ── Project card styling (matches reference) ── */
.projects ul {
	/* More breathing room between project cards */
	gap: calc(var(--space-xl) * 1.5);
}

.project-card {
	height: auto;
	width: 100%;
	background: transparent;
	border-radius: 30px;
	overflow: visible;
	box-shadow: none;
}

.project-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.project-card__media {
	background-color: var(--color-card-image); /* default: #7A0000 */
	aspect-ratio: 4 / 3;
	border-radius: 30px;
	overflow: hidden;
	box-shadow: 0 0.75rem 1.875rem rgba(0, 0, 0, 0.25);
	outline: 1px solid transparent; /* enables smooth hover outline, no layout shift */
	transform: rotate(0deg);
	transform-origin: center;
	transition: transform 220ms var(--ease-out), outline-color 180ms var(--ease-out), box-shadow 220ms var(--ease-out);
	will-change: transform;
}

.project-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* Project-specific media tweaks */
.project-google-tasks .project-card__media img {
	object-fit: contain;
	object-position: center;
}

/* Desktop hover: playful tilt + 1px border */
@media (width > 768px) and (hover: hover) and (pointer: fine) {
	.project-card:nth-child(odd) .project-card__link:hover .project-card__media {
		outline-color: var(--color-bg);
		transform: rotate(-3deg);
		box-shadow: 0 1.125rem 2.375rem rgba(0, 0, 0, 0.35);
	}

	.project-card:nth-child(even) .project-card__link:hover .project-card__media {
		outline-color: var(--color-bg);
		transform: rotate(3deg);
		box-shadow: 0 1.125rem 2.375rem rgba(0, 0, 0, 0.35);
	}
}

/* Scroll-activated state (IntersectionObserver) mirrors hover behaviour */
.project-card.project-card--active:nth-child(odd) .project-card__media {
	outline-color:var(--color-bg);
	transform: rotate(-3deg);
	box-shadow: 0 1.125rem 2.375rem rgba(0, 0, 0, 0.35);
}

.project-card.project-card--active:nth-child(even) .project-card__media {
	outline-color:var(--color-bg)7;
	transform: rotate(3deg);
	box-shadow: 0 1.125rem 2.375rem rgba(0, 0, 0, 0.35);
}

.project-card__content {
	padding-top: var(--space-md);
}

.project-card__content h3 {
	font-family: var(--font-title);
	font-size: clamp(2rem, 6vw, 2.75rem);
	font-weight: 800;
	margin: 0 0 var(--space-xs);
}

.project-card__content .tag-layout {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	margin: 0 0 var(--space-sm);
	font-family: var(--font-mono);
	font-size: clamp(0.95rem, 2.6vw, 1.1rem);
	text-transform: uppercase;
	color: inherit;
}

.project-card__content .tag {
	padding: 0.45em 0;
	border-radius: 30px;
	background: var(--color-bg);
	color: var(--color-text);
	line-height: 1;
}

.project-card__content .icon-star {
	color: var(--color-text);
	flex-shrink: 0;
}

.project-card__content .icon-star path {
	fill: currentColor;
}

.project-card__content .about {
	margin: 0;
	font-family: var(--font-body);
	font-size: clamp(1.05rem, 3vw, 1.25rem);
	line-height: 1.45;
	/* Match the main body text color so the description stays readable on dark bg */
	color: var(--color-text);
}

/* ── Playground section ── */
.playground {
	padding: var(--space-3xl) var(--space-md) var(--space-3xl);
	display: grid;
	gap: var(--space-xl);

	.playground__header {
		display: grid;
		gap: var(--space-2xs);
		text-align: center;
	}

	.playground__top {
		display: grid;
		gap: var(--space-md);
	}

	.playground__title {
		margin: 0;
		font-family: var(--font-title);
		font-size: clamp(2rem, 6vw, 2.75rem);
		font-weight: 800;
		text-align: center;
	}

	.playground__filters {
		list-style: none;
		margin: 0;
		padding: 0;
		display: flex;
		flex-wrap: wrap;
		gap: 0.5rem;
		justify-content: flex-end;
	}

	.playground__chip {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 0.45em 0.9em;
		border-radius: 30px;
		background: var(--color-bg);
		color: var(--color-text);
		font-family: var(--font-body);
		font-size: clamp(0.65rem, 2vw, 0.8rem);
		line-height: 1;
		white-space: nowrap;
	}

	.playground__grid {
		list-style: none;
		margin: 0;
		padding: 0;
		display: grid;
		grid-template-columns: 1fr;
		gap: var(--space-md);
	}

	.play-card {
		a {
			display: block;
			position: relative;
			width: 100%;
			aspect-ratio: 1 / 1.25;
			border-radius: 30px;
			background: #c4c4c4;
			overflow: hidden;

			img {
				position: absolute;
				inset: 0;
				width: 100%;
				height: 100%;
				object-fit: cover;
				object-position: center;
				display: block;
				transform: scale(1.15);
			}
		}
	}

	@media (width > 640px) {
		.playground__grid {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}
	}

	@media (width > 1024px) {
		.playground__grid {
			grid-template-columns: repeat(3, minmax(0, 1fr));
		}
	}
}
