Skip to content
← Public packages

@kentcdodds/photo-portfolio

A fast, photo-first portfolio site you update by chatting with your agent: galleries, about, contact, and one-step rollback.

FollowFork

Files

styles.css

801 lines · 12.4 KB · CSS
/* Photo portfolio: photo-first, system fonts (no web-font flash), light/dark via data-theme. */

:root {
	--bg: #faf8f5;
	--surface: #ffffff;
	--text: #1d1b19;
	--muted: #6b655e;
	--line: #e6e1da;
	--placeholder: #ebe6df;
	--accent: #b8763a;
	--accent-text: color-mix(in oklab, var(--accent) 78%, black);
	--on-accent: #ffffff;
	--serif:
		ui-serif, 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua',
		Georgia, serif;
	--sans:
		system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
		sans-serif;
	--radius: 4px;
	--gap: 10px;
	--page: 1120px;
	--page-wide: 1560px;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root[data-theme='auto'] {
		--bg: #121110;
		--surface: #1b1a18;
		--text: #eeeae4;
		--muted: #a29b92;
		--line: #2c2a27;
		--placeholder: #24221f;
		--accent-text: color-mix(in oklab, var(--accent) 70%, white);
		color-scheme: dark;
	}
}

:root[data-theme='dark'] {
	--bg: #121110;
	--surface: #1b1a18;
	--text: #eeeae4;
	--muted: #a29b92;
	--line: #2c2a27;
	--placeholder: #24221f;
	--accent-text: color-mix(in oklab, var(--accent) 70%, white);
	color-scheme: dark;
}

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

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100svh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font: 17px/1.6 var(--sans);
	-webkit-font-smoothing: antialiased;
}

main {
	flex: 1;
}

h1,
h2,
h3,
h4 {
	font-family: var(--serif);
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -0.01em;
	margin: 0 0 0.5em;
	text-wrap: balance;
}

h1 {
	font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem);
}

h2 {
	font-size: clamp(1.4rem, 1.2rem + 0.9vw, 1.9rem);
}

p {
	margin: 0 0 1em;
	text-wrap: pretty;
}

a {
	color: var(--accent-text);
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
}

a:hover {
	text-decoration-thickness: 2px;
}

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

.icon {
	flex: none;
	vertical-align: -0.2em;
}

.skip-link {
	position: absolute;
	left: 1rem;
	top: -4rem;
	z-index: 20;
	padding: 0.5rem 0.9rem;
	background: var(--surface);
	color: var(--text);
}

.skip-link:focus {
	top: 1rem;
}

.wrap {
	width: min(100% - 2.5rem, var(--page));
	margin-inline: auto;
}

.wrap-wide {
	width: min(100% - 2.5rem, var(--page-wide));
	margin-inline: auto;
}

.narrow {
	max-width: 40rem;
}

.section {
	padding-block: clamp(2rem, 1.5rem + 3vw, 4.5rem);
}

/* Header & footer: fixed heights from text only, so nothing shifts on load. */

.preview-bar {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.4rem 1rem;
	padding: 0.55rem 1rem;
	background: var(--accent);
	color: var(--on-accent);
	font-size: 0.9rem;
	text-align: center;
}

.preview-bar a {
	color: inherit;
	font-weight: 600;
}

.site-header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5rem 2rem;
	width: min(100% - 2.5rem, var(--page-wide));
	margin-inline: auto;
	padding-block: 1.4rem;
}

.brand {
	font-family: var(--serif);
	font-size: 1.45rem;
	color: var(--text);
	text-decoration: none;
	letter-spacing: 0.01em;
}

.site-nav {
	display: flex;
	gap: 1.6rem;
}

.site-nav a {
	color: var(--muted);
	text-decoration: none;
	font-size: 0.95rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding-block: 0.25rem;
	border-bottom: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
	color: var(--text);
	border-bottom-color: var(--accent);
}

.site-footer {
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 0.9rem;
}

.footer-inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem 2rem;
	width: min(100% - 2.5rem, var(--page-wide));
	margin-inline: auto;
	padding-block: 1.6rem;
}

.footer-inner p {
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1.2rem;
}

.footer-location {
	display: inline-flex;
	gap: 0.35rem;
	align-items: center;
}

.social-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.2rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.social-links a {
	color: var(--muted);
}

/* Photos: intrinsic aspect ratio + LQIP background = zero layout shift. */

.photo {
	display: block;
	position: relative;
	overflow: hidden;
	background-color: var(--placeholder);
	background-size: cover;
	background-position: center;
}

.photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hero {
	margin: 0;
}

.hero .hero-photo {
	aspect-ratio: auto !important;
	height: min(78svh, 56vw, 860px);
	min-height: 320px;
}

.intro {
	padding-top: clamp(2rem, 1.5rem + 3vw, 4rem);
	max-width: 46rem;
	margin-inline: auto;
	text-align: center;
}

.lede {
	color: var(--muted);
	font-size: 1.12rem;
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: inherit;
	margin-top: 1.6rem;
}

.intro .actions {
	justify-content: center;
}

.button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.72rem 1.3rem;
	border: 1px solid var(--accent);
	border-radius: 999px;
	background: var(--accent);
	color: var(--on-accent);
	font: 500 0.95rem/1.2 var(--sans);
	text-decoration: none;
	cursor: pointer;
}

.button:hover {
	background: color-mix(in oklab, var(--accent) 88%, black);
}

.button.secondary {
	background: transparent;
	color: var(--text);
	border-color: var(--line);
}

.button.secondary:hover {
	border-color: var(--accent);
}

.section-title {
	font-size: 0.85rem;
	font-family: var(--sans);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 1.4rem;
}

.page-head {
	margin-bottom: clamp(1.5rem, 1rem + 2vw, 2.8rem);
	max-width: 46rem;
}

.back-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin-bottom: 1rem;
	color: var(--muted);
	font-size: 0.92rem;
	text-decoration: none;
}

.back-link:hover {
	color: var(--text);
}

.empty {
	color: var(--muted);
}

/* Gallery cards */

.gallery-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
	gap: clamp(1rem, 0.6rem + 1.5vw, 2rem);
	list-style: none;
	margin: 0;
	padding: 0;
}

.gallery-card {
	display: block;
	color: inherit;
	text-decoration: none;
}

.gallery-card .card-photo {
	aspect-ratio: 4 / 3 !important;
	border-radius: var(--radius);
}

.gallery-card img {
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.gallery-card:hover img {
	transform: scale(1.03);
}

.card-text {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	padding-top: 0.8rem;
}

.card-title {
	font-family: var(--serif);
	font-size: 1.3rem;
}

.card-count {
	color: var(--muted);
	font-size: 0.85rem;
	white-space: nowrap;
}

/* Justified photo grid: each tile grows in proportion to its aspect ratio, so rows share a height. */

.photo-grid {
	--row: 300px;
	display: flex;
	flex-wrap: wrap;
	gap: var(--gap);
	list-style: none;
	margin: 0;
	padding: 0;
}

.photo-grid::after {
	content: '';
	flex-grow: 999;
}

.photo-grid li {
	flex: var(--ratio) 1 calc(var(--row) * var(--ratio));
	aspect-ratio: var(--ratio);
}

.photo-grid a {
	display: block;
	height: 100%;
	cursor: zoom-in;
}

.photo-grid .photo {
	height: 100%;
	aspect-ratio: auto !important;
}

@media (max-width: 640px) {
	.photo-grid {
		--gap: 6px;
	}

	.photo-grid li {
		flex-basis: 100%;
	}

	.photo-grid::after {
		display: none;
	}
}

@media (min-width: 641px) and (max-width: 1000px) {
	.photo-grid {
		--row: 220px;
	}
}

/* Single photo page */

.photo-figure {
	margin: 0;
}

.photo-figure .photo {
	max-height: 82svh;
	margin-inline: auto;
	background-size: contain;
	background-repeat: no-repeat;
	background-color: transparent;
}

.photo-figure img {
	object-fit: contain;
}

.photo-figure figcaption,
.lightbox-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1.2rem;
	justify-content: center;
	padding-top: 0.9rem;
	color: var(--muted);
	font-size: 0.92rem;
	text-align: center;
}

.caption {
	color: var(--text);
}

.pager {
	display: flex;
	justify-content: space-between;
	padding-top: 1.4rem;
}

/* About */

.about {
	display: grid;
	grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
	gap: clamp(2rem, 1rem + 4vw, 5rem);
	align-items: start;
}

.about-portrait .photo {
	border-radius: var(--radius);
}

.monogram {
	display: grid;
	place-items: center;
	aspect-ratio: 4 / 5;
	border-radius: var(--radius);
	background: linear-gradient(
		160deg,
		color-mix(in oklab, var(--accent) 30%, var(--placeholder)),
		var(--placeholder)
	);
	color: var(--accent-text);
	font: 500 clamp(4rem, 3rem + 4vw, 7rem) / 1 var(--serif);
	letter-spacing: 0.04em;
}

.eyebrow {
	color: var(--muted);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-size: 0.85rem;
	margin-top: -0.2rem;
}

.prose {
	font-size: 1.08rem;
	max-width: 38rem;
}

.prose h2,
.prose h3,
.prose h4 {
	margin-top: 1.6em;
}

.contact-links {
	display: grid;
	gap: 0.6rem;
	list-style: none;
	margin: 1.8rem 0 0;
	padding: 1.4rem 0 0;
	border-top: 1px solid var(--line);
}

.contact-links a,
.contact-links span {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	color: var(--text);
	text-decoration: none;
	overflow-wrap: anywhere;
}

.contact-links a:hover {
	color: var(--accent-text);
}

.contact-links .icon {
	color: var(--muted);
}

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

	.about-portrait {
		max-width: 280px;
	}
}

/* Contact */

.contact-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
	gap: clamp(2rem, 1rem + 4vw, 5rem);
	align-items: start;
}

.contact-aside h2 {
	font-size: 1.2rem;
}

.contact-aside .contact-links {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.contact-form {
	display: grid;
	gap: 1.1rem;
}

.field label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.92rem;
	font-weight: 500;
}

.optional {
	color: var(--muted);
	font-weight: 400;
}

.field input,
.field textarea {
	width: 100%;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
	font: inherit;
}

.field textarea {
	resize: vertical;
	min-height: 9rem;
}

.field input:focus,
.field textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: 0;
	border-color: transparent;
}

.has-error input,
.has-error textarea {
	border-color: #c0392b;
}

.field-error {
	margin: 0.35rem 0 0;
	color: #c0392b;
	font-size: 0.9rem;
}

.contact-form .button {
	justify-self: start;
}

.hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.notice {
	padding: 1.6rem 1.8rem;
	border: 1px solid var(--line);
	border-left: 3px solid var(--accent);
	border-radius: var(--radius);
	background: var(--surface);
}

.notice p:last-child {
	margin-bottom: 0;
}

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

/* Lightbox (app/assets/entry.ts) */

:root:has(.lightbox[open]) {
	overflow: hidden;
}

.lightbox {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 3.5rem 4.5rem 1.2rem;
	border: 0;
	background: rgb(10 10 10 / 0.96);
	color: #eee;
	overscroll-behavior: contain;
}

.lightbox[open] {
	display: grid;
	/* minmax(0, …) keeps a wide photo from sizing the column past the screen. */
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr) auto;
	place-items: center;
}

.lightbox::backdrop {
	background: rgb(0 0 0 / 0.85);
}

.lightbox-photo {
	display: block;
	max-width: 100%;
	max-height: 100%;
	height: 100%;
	background-size: contain;
	background-position: center;
	background-repeat: no-repeat;
}

.lightbox-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.lightbox-meta {
	color: #bbb;
}

.lightbox-nav,
.lightbox-close {
	position: absolute;
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	border: 0;
	border-radius: 999px;
	background: rgb(255 255 255 / 0.08);
	color: #fff;
	font: 300 2rem/1 var(--sans);
	cursor: pointer;
}

.lightbox-nav:hover,
.lightbox-close:hover {
	background: rgb(255 255 255 / 0.18);
}

.lightbox-nav {
	top: 50%;
	translate: 0 -50%;
}

.lightbox-nav.prev {
	left: 0.8rem;
}

.lightbox-nav.next {
	right: 0.8rem;
}

.lightbox-close {
	top: 0.7rem;
	right: 0.8rem;
}

@media (max-width: 640px) {
	.lightbox {
		padding: 3.5rem 0.4rem 1rem;
	}

	.lightbox-nav {
		top: auto;
		bottom: 0.6rem;
		translate: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
	}
}