/* ==========================================================================
   Devin Udy — Portfolio
   Minimal editorial theme. Hand-written, no framework.
   ========================================================================== */

/* ---- Tokens ------------------------------------------------------------- */
:root {
	--bg: #fafaf8;
	--surface: #ffffff;
	--fg: #141413;
	--muted: #5f5e5a;
	--border: #e4e3de;
	--accent: #0f766e;
	--accent-contrast: #ffffff;
	--shadow: 0 1px 2px rgba(20, 20, 19, .04), 0 8px 24px rgba(20, 20, 19, .06);

	--font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-serif: "Fraunces", Georgia, "Times New Roman", serif;

	--radius: 14px;
	--gutter: clamp(1rem, 4vw, 2rem);
	--section: clamp(4rem, 10vw, 8rem);

	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #111110;
		--surface: #1a1a18;
		--fg: #ecebe6;
		--muted: #a3a29c;
		--border: #2c2c29;
		--accent: #5eead4;
		--accent-contrast: #0b1f1d;
		--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--bg: #111110;
	--surface: #1a1a18;
	--fg: #ecebe6;
	--muted: #a3a29c;
	--border: #2c2c29;
	--accent: #5eead4;
	--accent-contrast: #0b1f1d;
	--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
	color-scheme: dark;
}

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

html {
	scroll-behavior: smooth;
	scroll-padding-top: 5rem;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font-sans);
	font-size: 1.0625rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	transition: background-color .25s ease, color .25s ease;
}

img { display: block; max-width: 100%; height: auto; }

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

h1, h2 {
	font-family: var(--font-serif);
	font-weight: 400;
	letter-spacing: -0.02em;
}

h2 { font-size: clamp(2rem, 4.5vw, 3rem); margin-bottom: 1rem; }
h3 { font-size: 1.125rem; letter-spacing: -0.01em; }

p { margin: 0 0 1rem; max-width: 65ch; }

a {
	color: inherit;
	text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
	text-underline-offset: .2em;
	transition: color .2s ease, text-decoration-color .2s ease;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

ul, ol { margin: 0; padding: 0; list-style: none; }

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

.container {
	width: 100%;
	max-width: 72rem;
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.skip-link {
	position: absolute;
	left: var(--gutter);
	top: -3rem;
	padding: .5rem 1rem;
	background: var(--fg);
	color: var(--bg);
	border-radius: 8px;
	z-index: 100;
}
.skip-link:focus { top: 1rem; }

/* ---- Header ------------------------------------------------------------- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--bg) 85%, transparent);
	-webkit-backdrop-filter: saturate(1.4) blur(12px);
	backdrop-filter: saturate(1.4) blur(12px);
	border-bottom: 1px solid transparent;
	transition: border-color .25s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.nav {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	height: 4rem;
}

.wordmark {
	font-family: var(--font-serif);
	font-size: 1.25rem;
	text-decoration: none;
	margin-right: auto;
}

.nav-links { display: flex; gap: 1.75rem; font-size: .9375rem; }
.nav-links a { text-decoration: none; color: var(--muted); }
.nav-links a:hover { color: var(--fg); }

.theme-toggle {
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: transparent;
	color: var(--fg);
	cursor: pointer;
	transition: border-color .2s ease;
}
.theme-toggle:hover { border-color: var(--muted); }
.theme-toggle svg {
	width: 1.05rem;
	height: 1.05rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .icon-sun { display: none; }
	:root:not([data-theme="light"]) .icon-moon { display: block; }
}

@media (max-width: 640px) {
	.nav-links { display: none; }
}

/* ---- Buttons ------------------------------------------------------------ */
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.btn {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .8rem 1.35rem;
	border-radius: 999px;
	font-weight: 500;
	font-size: .9375rem;
	text-decoration: none;
	border: 1px solid transparent;
	transition: transform .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--accent-contrast); }

.btn-ghost { border-color: var(--border); }
.btn-ghost:hover { border-color: var(--fg); color: var(--fg); }

/* ---- Hero --------------------------------------------------------------- */
.hero {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: clamp(2rem, 6vw, 5rem);
	padding-top: clamp(4rem, 12vw, 9rem);
	padding-bottom: clamp(3rem, 8vw, 6rem);
}

.eyebrow {
	font-size: .8125rem;
	font-weight: 500;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 1.25rem;
}

.hero h1 {
	font-size: clamp(2.5rem, 7vw, 4.75rem);
	line-height: 1.04;
	max-width: 14ch;
}

.lede {
	margin-top: 1.5rem;
	font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
	color: var(--muted);
	max-width: 52ch;
}

.headshot {
	width: clamp(10rem, 22vw, 17rem);
	aspect-ratio: 4 / 5;
	object-fit: cover;
	object-position: 50% 20%;
	border-radius: calc(var(--radius) * 1.5);
	box-shadow: var(--shadow);
}

@media (max-width: 760px) {
	.hero { grid-template-columns: 1fr; }
	.headshot { order: -1; width: 7rem; aspect-ratio: 1; border-radius: 999px; }
}

/* ---- Sections ----------------------------------------------------------- */
.section {
	padding-block: var(--section);
	border-top: 1px solid var(--border);
}

.section-head { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.section-head p { color: var(--muted); }

.subhead {
	font-family: var(--font-sans);
	font-size: .8125rem;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--muted);
	margin: 2rem 0 .85rem;
}

/* ---- Project cards ------------------------------------------------------ */
.project-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(1.25rem, 3vw, 2rem);
}

.card {
	display: flex;
	flex-direction: column;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}
.card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow);
	border-color: color-mix(in srgb, var(--fg) 18%, var(--border));
}

.card-media {
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--border);
}
.card-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
	transition: transform .6s ease;
}
.card:hover .card-media img { transform: scale(1.03); }

.card-body {
	display: flex;
	flex-direction: column;
	gap: .75rem;
	flex: 1;
	padding: clamp(1.25rem, 3vw, 1.75rem);
}
.card-body h3 { font-size: 1.25rem; }
.card-body p { margin: 0; color: var(--muted); font-size: 1rem; }

.card-links {
	display: flex;
	gap: 1.25rem;
	margin-top: auto;
	padding-top: .5rem;
	font-size: .9375rem;
	font-weight: 500;
}
.card-links a { text-decoration: none; }

.card-featured {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: 1.4fr 1fr;
}
.card-featured .card-media { aspect-ratio: auto; min-height: 100%; }
.card-featured .card-media img { object-position: left top; }
.card-featured .card-body { justify-content: center; padding: clamp(1.5rem, 4vw, 3rem); }
.card-featured h3 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(1.75rem, 3vw, 2.25rem); }
.card-featured .card-links { margin-top: .5rem; }

@media (max-width: 960px) {
	.project-grid { grid-template-columns: 1fr; }
	.card-featured { grid-template-columns: 1.2fr 1fr; }
}

@media (max-width: 760px) {
	.card-featured { grid-template-columns: 1fr; }
	.card-featured .card-media { aspect-ratio: 16 / 10; }
}

/* ---- Tags --------------------------------------------------------------- */
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li {
	font-size: .8125rem;
	padding: .2rem .65rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--muted);
}
.tags-lg li {
	font-size: .9375rem;
	padding: .35rem .9rem;
	color: var(--fg);
	background: var(--surface);
}

/* ---- Experience --------------------------------------------------------- */
.timeline li {
	display: grid;
	grid-template-columns: 12rem 1fr;
	gap: 1rem 2rem;
	padding-block: 1.75rem;
	border-top: 1px solid var(--border);
}
.timeline li:last-child { border-bottom: 1px solid var(--border); }
.timeline h3 { font-size: 1.25rem; margin-bottom: .5rem; }
.timeline h3 a { text-decoration: none; }
.timeline p { margin: 0; color: var(--muted); }
.timeline-meta {
	font-size: .875rem;
	color: var(--muted);
	padding-top: .2rem;
}

@media (max-width: 640px) {
	.timeline li { grid-template-columns: 1fr; gap: .35rem; }
}

/* ---- About -------------------------------------------------------------- */
.about {
	display: grid;
	grid-template-columns: 1.2fr 1fr;
	gap: clamp(2.5rem, 6vw, 5rem);
}
.about > div > p { font-size: 1.125rem; }

.creds li {
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: .25rem 1rem;
	padding-block: .8rem;
	border-top: 1px solid var(--border);
	font-size: .9875rem;
}
.creds li span:last-child { color: var(--muted); }

@media (max-width: 760px) {
	.about { grid-template-columns: 1fr; }
}

/* ---- Contact ------------------------------------------------------------ */
.contact { text-align: center; }
.contact h2 { font-size: clamp(2.5rem, 7vw, 4.5rem); }
.contact p { margin-inline: auto; color: var(--muted); margin-bottom: 2rem; }
.contact .btn { font-size: 1rem; padding: 1rem 1.75rem; overflow-wrap: anywhere; }

.socials {
	display: flex;
	justify-content: center;
	gap: .75rem;
	margin-top: 2.5rem;
}
.socials a {
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--muted);
	transition: color .2s ease, border-color .2s ease;
}
.socials a:hover { color: var(--fg); border-color: var(--fg); }
.socials svg { width: 1.15rem; height: 1.15rem; fill: currentColor; }
.socials svg[fill="none"] { fill: none; }

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
	border-top: 1px solid var(--border);
	font-size: .875rem;
	color: var(--muted);
}
.footer-inner {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding-block: 2rem;
}
.footer-inner a { text-decoration: none; }

/* ---- Reveal animation --------------------------------------------------- */
.js .reveal {
	opacity: 0;
	transform: translateY(16px);
	transition: opacity .7s ease, transform .7s ease;
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
	}
	.js .reveal { opacity: 1; transform: none; }
}
