/* ---------- Design tokens ---------- */

:root {
	--bg-canvas: #05070a;
	--panel-bg: rgba(13, 19, 17, 0.82);
	--panel-border: rgba(79, 227, 161, 0.14);
	--rain-bg: #05070a;
	--rain-dim: #0d3321;
	--rain-mid: #177a48;
	--rain-bright: #4fe3a1;
	--text: #e8ece9;
	--text-dim: #9fb0a7;
	--accent: #4fe3a1;
	--accent-soft: rgba(79, 227, 161, 0.12);
	--field-bg: rgba(255, 255, 255, 0.03);
	--field-border: rgba(232, 236, 233, 0.18);
	--shadow: 0 20px 60px rgba(0, 0, 0, 0.45);

	--font-body: "Space Grotesk", system-ui, sans-serif;
	--font-mono: "JetBrains Mono", ui-monospace, monospace;

	--gutter: 32px;
	--radius: 18px;
}

html[data-theme="light"] {
	--bg-canvas: #f2efe4;
	--panel-bg: rgba(250, 248, 241, 0.86);
	--panel-border: rgba(31, 122, 79, 0.16);
	--rain-bg: #f2efe4;
	--rain-dim: #dcd6c2;
	--rain-mid: #a9c4a9;
	--rain-bright: #4a9a6c;
	--text: #1c211d;
	--text-dim: #5c665e;
	--accent: #1f7a4f;
	--accent-soft: rgba(31, 122, 79, 0.1);
	--field-bg: rgba(0, 0, 0, 0.025);
	--field-border: rgba(28, 33, 29, 0.16);
	--shadow: 0 20px 50px rgba(60, 55, 40, 0.15);
}

* { box-sizing: border-box; }

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

body {
	font-family: var(--font-body);
	color: var(--text);
	background: var(--bg-canvas);
	-webkit-font-smoothing: antialiased;
	overflow: hidden;
}

a { color: inherit; }

h1, h2, h3 {
	font-weight: 600;
	line-height: 1.15;
	margin: 0 0 0.5em;
}

h2 {
	font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
	padding-bottom: 0.5em;
	border-bottom: 1px solid var(--panel-border);
	margin-bottom: 1em;
}

h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

.body-text {
	color: var(--text-dim);
	line-height: 1.7;
	max-width: 62ch;
}

.body-text.muted { font-size: 0.95rem; }

/* ---------- Background rain canvas ---------- */

#rain {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	background: var(--rain-bg);
	transition: background 0.4s ease;
}

/* ---------- Panel ---------- */

.panel {
	position: fixed;
	top: var(--gutter);
	left: var(--gutter);
	right: var(--gutter);
	bottom: var(--gutter);
	background: var(--panel-bg);
	border: 1px solid var(--panel-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	backdrop-filter: blur(14px) saturate(120%);
	-webkit-backdrop-filter: blur(14px) saturate(120%);
	overflow-y: auto;
	overflow-x: hidden;
	scroll-behavior: smooth;
	transition: background 0.4s ease, border-color 0.4s ease;
}

/* Firefox */
.panel {
	scrollbar-width: thin;
	scrollbar-color: var(--accent) transparent;
}

/* Chrome, Edge, Safari */
.panel::-webkit-scrollbar {
	width: 10px;
}

.panel::-webkit-scrollbar-track {
	background: transparent;
}

.panel::-webkit-scrollbar-thumb {
	background: var(--accent);
	border-radius: 8px;
	border: 2px solid transparent;
	background-clip: padding-box;
}

.panel::-webkit-scrollbar-thumb:hover {
	background: var(--rain-bright);
}

.panel-header {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.75rem;
	background: var(--panel-bg);
	border-bottom: 1px solid var(--panel-border);
	backdrop-filter: blur(10px);
}

.brand {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	text-decoration: none;
	font-weight: 600;
}

.avatar {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--panel-border);
	position: relative;
	z-index: 1;
	isolation: isolate;
	transform: translateZ(0);
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
}

.brand-name { font-size: 0.95rem; }

.site-nav {
	display: flex;
	gap: 1.75rem;
	font-size: 0.92rem;
}

.site-nav a {
	text-decoration: none;
	color: var(--text-dim);
	transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible { color: var(--accent); }

.header-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

#theme-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid var(--panel-border);
	background: transparent;
	color: var(--text);
	cursor: pointer;
}

#theme-toggle svg { width: 18px; height: 18px; }
#theme-toggle .icon-sun { display: none; }
html[data-theme="light"] #theme-toggle .icon-moon { display: none; }
html[data-theme="light"] #theme-toggle .icon-sun { display: block; }

.nav-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	border: 1px solid var(--panel-border);
	background: transparent;
	cursor: pointer;
}

.nav-toggle span {
	display: block;
	width: 16px;
	height: 1.5px;
	background: var(--text);
	margin: 0 auto;
}

.mobile-nav {
	display: none;
	flex-direction: column;
	padding: 0 1.75rem;
	border-bottom: 1px solid var(--panel-border);
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.25s ease;
}

.mobile-nav a {
	text-decoration: none;
	color: var(--text-dim);
	padding: 0.85rem 0;
	border-top: 1px solid var(--panel-border);
	font-size: 0.95rem;
}

.mobile-nav a:first-child { border-top: none; }

.mobile-nav.open {
	max-height: 80vh;
	overflow-y: auto;
}

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

main {
	padding: 0 1.75rem;
}

.section {
	padding: 3rem 0;
	border-bottom: 1px solid var(--panel-border);
}

.section:last-of-type { border-bottom: none; }

.hero { padding-top: 3.5rem; }

.terminal-line {
	font-family: var(--font-mono);
	font-size: 0.85rem;
	color: var(--text-dim);
	margin: 0 0 0.9em;
}

.terminal-line .prompt { color: var(--accent); }
.terminal-line .colon,
.terminal-line .path { color: var(--text-dim); }
.terminal-line .dollar { color: var(--text-dim); margin-right: 0.35em; }
.terminal-line .cmd { color: var(--text); }

.hero-title {
	font-family: var(--font-mono);
	font-size: clamp(1.75rem, 1.3rem + 2vw, 2.6rem);
	font-weight: 500;
	color: var(--text);
	margin-bottom: 0.6em;
	min-height: 1.2em;
}

.cursor {
	display: inline-block;
	color: var(--accent);
	animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.lede {
	font-size: 1.1rem;
	max-width: 60ch;
	color: var(--text);
	line-height: 1.6;
}

.social-icons {
	display: flex;
	gap: 0.9rem;
	list-style: none;
	margin: 1.5rem 0 0;
	padding: 0;
}

.social-icons a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 1px solid var(--panel-border);
	color: var(--text-dim);
	transition: color 0.2s ease, border-color 0.2s ease;
}

.social-icons a:hover,
.social-icons a:focus-visible {
	color: var(--accent);
	border-color: var(--accent);
}

.social-icons svg { width: 16px; height: 16px; }

/* ---------- Skills ---------- */

.skill-grid {
	list-style: none;
	margin: 1.5rem 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.75rem;
}

.skill-grid li {
	padding: 0.85rem 1rem;
	border: 1px solid var(--panel-border);
	border-radius: 10px;
	background: var(--accent-soft);
	font-size: 0.92rem;
}

/* ---------- Work ---------- */

.work-list {
	display: flex;
	flex-direction: column;
	gap: 1.75rem;
	margin-top: 1.5rem;
}

.work-item {
	display: grid;
	grid-template-columns: 320px 1fr;
	gap: 1.5rem;
	align-items: center;
}

.work-thumb {
	display: block;
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid var(--panel-border);
	aspect-ratio: 7 / 4;
}

.work-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}

.work-thumb:hover img { transform: scale(1.04); }

.work-body h3 { margin-bottom: 0.35em; }

.work-body h3 a { text-decoration: none; }
.work-body h3 a:hover { color: var(--accent); }

.work-body p {
	color: var(--text-dim);
	font-size: 0.95rem;
	line-height: 1.6;
	margin: 0;
	max-width: 55ch;
}

.work-body .work-links {
	margin-top: 0.6rem;
	font-size: 0.9rem;
	color: var(--text-dim);
}

.work-links a {
	color: var(--accent);
	text-decoration: none;
	font-weight: 500;
}

.work-links a:hover { text-decoration: underline; }

/* ---------- Contact ---------- */

.contact-form {
	margin-top: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	max-width: 46rem;
}

.hidden-field { display: none; }

.form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

.form-field {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.form-field label {
	font-size: 0.85rem;
	color: var(--text-dim);
}

.form-field input,
.form-field textarea {
	font-family: var(--font-body);
	font-size: 0.95rem;
	color: var(--text);
	background: var(--field-bg);
	border: 1px solid var(--field-border);
	border-radius: 8px;
	padding: 0.7rem 0.85rem;
	resize: vertical;
	min-width: 0;
}

.form-field input:focus,
.form-field textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

.submit-btn {
	align-self: flex-start;
	font-family: var(--font-body);
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--bg-canvas);
	background: var(--accent);
	border: none;
	border-radius: 8px;
	padding: 0.75rem 1.5rem;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.submit-btn:hover { opacity: 0.88; }

/* ---------- Resume / Projects views ---------- */

.site-nav a.active,
.mobile-link.active { color: var(--accent); }

.page-view {
	padding: 0 1.75rem;
}

.view-heading {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-top: 2.5rem;
	padding-bottom: 0.5em;
	border-bottom: 1px solid var(--panel-border);
	margin-bottom: 1em;
}

.view-heading h2 {
	padding-bottom: 0;
	border-bottom: none;
	margin-bottom: 0;
}

.download-btn {
	display: inline-block;
	font-family: var(--font-body);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--bg-canvas);
	background: var(--accent);
	text-decoration: none;
	border-radius: 8px;
	padding: 0.6rem 1.2rem;
	white-space: nowrap;
}

.resume-frame {
	max-width: 640px;
	margin: 1rem auto 3rem;
	border: 1px solid var(--panel-border);
	border-radius: 10px;
	overflow: hidden;
	box-shadow: var(--shadow);
}

.resume-frame img {
	display: block;
	width: 100%;
	height: auto;
}

.projects-list,
.work-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 2rem;
	margin-top: 1.5rem;
	margin-bottom: 3rem;
}

.projects-list .work-item,
.work-grid .work-item {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.projects-list .work-thumb,
.work-grid .work-thumb {
	margin-bottom: 1rem;
}

.work-grid {
	grid-template-columns: repeat(2, 1fr);
	gap: 2rem;
	margin-top: 1.25rem;
	margin-bottom: 0;
}

/* main page cards: 75% the width of the projects page ones, centered in each column */
.work-grid .work-item {
	width: 75%;
	justify-self: center;
}

.work-grid .work-thumb {
	margin-bottom: 0.85rem;
}

.work-grid .work-body h3 {
	font-size: 1.05rem;
}

.work-grid .work-body p {
	font-size: 0.9rem;
	line-height: 1.55;
}

@media (max-width: 700px) {
	.work-grid { grid-template-columns: 1fr; }
	.work-grid .work-item {
		width: 100%;
		display: grid;
		grid-template-columns: 170px 1fr;
		gap: 1rem;
		align-items: center;
	}
	.work-grid .work-thumb { margin-bottom: 0; }
}

@media (max-width: 480px) {
	.work-grid .work-item {
		grid-template-columns: 112px 1fr;
		gap: 0.75rem;
		align-items: start;
	}
	.work-grid .work-body p {
		font-size: 0.8rem;
	}
}

@media (max-width: 700px) {
	.projects-list,
	.work-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.page-view {
		padding: 0 1.25rem;
	}
}

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

.panel-footer {
	padding: 1.5rem 1.75rem 2rem;
	font-size: 0.85rem;
	color: var(--text-dim);
}

.panel-footer p { margin: 0; }

/* ---------- Focus visibility ---------- */

a:focus-visible,
button:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.cursor { animation: none; opacity: 1; }
	.work-thumb img { transition: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
	.work-item {
		grid-template-columns: 1fr;
	}
	.skill-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 760px) {
	:root { --gutter: 14px; }

	.site-nav { display: none; }
	.nav-toggle { display: flex; }
	.mobile-nav { display: flex; }

	.panel { border-radius: 14px; }
}

@media (max-width: 480px) {
	:root { --gutter: 0px; }
	
	.avatar {
		width: 56px;
		height: 56px;
	}

	.form-row {
		grid-template-columns: 1fr;
	}

	.panel {
		border-radius: 0;
		border-left: none;
		border-right: none;
	}
	.skill-grid { grid-template-columns: 1fr 1fr; }
	.panel-header { padding: 0.9rem 1.25rem; }
	main { padding: 0 1.25rem; }
}
