/* ---------- Colors and fonts ---------- */

:root {
	--text: #f4dce0;
	--text-dim: rgb(244 220 224 / 0.65);
	--background: #040102;
	--secondary: #0e142f;
	--primary: #6fd3c0;
	--accent: #44c5ae;

	--card-background: rgb(14 20 47 / 0.45);
	--border: rgb(244 220 224 / 0.12);
	--border-strong: rgb(244 220 224 / 0.25);

	--mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* Sora is a variable font, so one file covers every weight */
@font-face {
	font-family: Sora;
	src: url('fonts/Sora.ttf');
	font-weight: 100 800;
}

/* ---------- Basic reset ---------- */

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

html {
	line-height: 1.5;
}

h1,
h2,
p,
fieldset {
	margin: 0;
}

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

a {
	color: inherit;
	text-decoration: none;
}

/* Hidden on screen, still read out by screen readers */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------- Page ---------- */

body {
	margin: 0;
	min-height: 100vh;
	font-family: Sora, sans-serif;
	color: var(--text);
	background-color: var(--background);
	background-image: linear-gradient(to top left, var(--secondary), transparent);
	background-attachment: fixed;
}

.page {
	max-width: 64rem;
	margin: 0 auto;
	padding: 0 1rem 4rem;
}

@media (min-width: 640px) {
	.page {
		padding: 0 2rem 4rem;
	}
}

/* ---------- Top bar ---------- */

.navbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.25rem 0;
}

.navbar-logo {
	height: 1.5rem;
	width: auto;
}

.navbar-github {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4rem 0.8rem;
	border: 1px solid var(--border-strong);
	border-radius: 0.5rem;
	font-size: 0.8rem;
	font-weight: 600;
	transition: background-color 150ms;
}

.navbar-github:hover {
	background: rgb(244 220 224 / 0.08);
}

.navbar-github svg {
	width: 1rem;
	height: 1rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---------- Intro ---------- */

.intro {
	padding: 3rem 0 2.5rem;
}

.intro-eyebrow {
	font-family: var(--mono);
	font-size: 0.8rem;
	color: var(--primary);
}

.intro h1 {
	max-width: 14em;
	margin-top: 1rem;
	font-size: clamp(2.25rem, 7vw, 3.5rem);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.04em;
	color: white;
}

.intro-text {
	max-width: 32rem;
	margin-top: 1.25rem;
	color: var(--text-dim);
}

/* ---------- Filter chips ---------- */

.filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding: 0;
	border: 0;
}

/* The radio circles are hidden; the labels are styled as chips instead */
.filters input {
	position: absolute;
	opacity: 0;
}

.filters label {
	padding: 0.4rem 0.9rem;
	border: 1px solid var(--border-strong);
	border-radius: 9999px;
	font-size: 0.8rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 150ms;
}

.filters label:hover {
	background: rgb(244 220 224 / 0.08);
}

.filter-count {
	margin-left: 0.25rem;
	font-family: var(--mono);
	font-size: 0.7rem;
	opacity: 0.6;
}

.filters input:checked + label {
	border-color: var(--primary);
	background: var(--primary);
	color: var(--background);
}

.filters input:focus-visible + label {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}

.showing {
	font-size: 0.8rem;
	color: var(--text-dim);
}

/* ---------- Filtering (no JavaScript, just the checked radio) ---------- */

.projects:has(#filter-games:checked) .card:not(.type-game),
.projects:has(#filter-apps:checked) .card:not(.type-app),
.projects:has(#filter-games:checked) .showing-all,
.projects:has(#filter-apps:checked) .showing-all {
	display: none;
}

.projects:has(#filter-games:checked) .showing-games,
.projects:has(#filter-apps:checked) .showing-apps {
	display: inline;
}

/* ---------- Project cards ---------- */

.project-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
	gap: 1.5rem;
}

.card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: 0.75rem;
	background: var(--card-background);
}

.card img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	object-position: top;
}

.card-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.75rem;
	padding: 1.25rem;
}

.card-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.card-heading h2 {
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: white;
}

.card-type {
	padding: 0.15rem 0.5rem;
	border-radius: 9999px;
	background: rgb(244 220 224 / 0.08);
	font-family: var(--mono);
	font-size: 0.65rem;
	color: var(--text-dim);
}

.card-description {
	font-size: 0.85rem;
	line-height: 1.6;
	color: var(--text-dim);
}

/*
	Buttons on the left, technology on the right, pinned to the bottom of the card.
	It's a <p> and not called "card-footer" so browser reader modes keep it:
	they drop anything named "footer" and any <div> that is mostly links.
*/
.card-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: auto;
	padding-top: 0.5rem;
}

.card-tech {
	margin-left: auto;
	font-family: var(--mono);
	font-size: 0.7rem;
	color: var(--text-dim);
	white-space: nowrap;
}

.button-primary,
.button-secondary {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.45rem 0.9rem;
	border-radius: 0.5rem;
	font-size: 0.8rem;
	font-weight: 600;
	transition:
		background-color 150ms,
		filter 150ms;
}

.button-primary {
	background: var(--primary);
	color: var(--background);
}

.button-primary:hover {
	filter: brightness(1.1);
}

.button-primary svg {
	width: 0.8rem;
	height: 0.8rem;
	fill: currentColor;
}

.button-secondary {
	border: 1px solid var(--border-strong);
}

.button-secondary:hover {
	background: rgb(244 220 224 / 0.08);
}

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