/*
	The blog: layouts/blog, blog/index, blog/show. Its own sheet (no tailwind on these pages).
	Look: research-design.md (Vercel's type in Geist, Linear's restraint). One 620 px column, light only.
*/

.blog {
	--ink: #0C0E13;
	--text: #1F2229;
	--muted: #6B7080;
	--hairline: #EAECF0;
	--fill: #FAFAFB;
	--brand: #0056FF;
	--sans: Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	--mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: #fff;
	color: var(--text);
	font-family: var(--sans);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}
.blog *,
.blog *::before,
.blog *::after {
	box-sizing: border-box;
}
.blog a {
	color: inherit;
	text-decoration: none;
}
.blog a:focus-visible,
.blog button:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 3px;
	border-radius: 4px;
}

/* header and footer: one bar each, the site's 1080 px width */
.blog-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: 1080px;
	margin: 0 auto;
	padding: 0 32px;
}
.blog-header {
	border-bottom: 1px solid var(--hairline);
}
.blog-header .blog-bar {
	height: 64px;
}
.blog-logo {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--ink);
	font-size: 16px;
	font-weight: 500;
	letter-spacing: -0.01em;
}
.blog-crumb {
	color: #C9CCD3;
	font-size: 16px;
}
.blog-crumb-link {
	color: var(--muted);
	font-size: 15px;
}
.blog-crumb-link:hover {
	color: var(--ink);
}
.blog-nav {
	display: flex;
	align-items: center;
	gap: 24px;
	margin-left: auto;
	font-size: 14px;
	color: var(--muted);
}
.blog-nav a:hover {
	color: var(--ink);
}
.blog-nav .blog-signup {
	display: inline-flex;
	align-items: center;
	height: 32px;
	padding: 0 12px;
	border-radius: 6px;
	background: var(--ink);
	color: #fff;
	font-weight: 500;
}
.blog-nav .blog-signup:hover {
	background: #2A2E37;
	color: #fff;
}
.blog-main {
	flex: 1;
	padding: 0 32px;
}
.blog-footer {
	border-top: 1px solid var(--hairline);
	font-size: 14px;
	color: var(--muted);
}
.blog-footer .blog-bar {
	height: 72px;
}

/* the post */
.post {
	max-width: 620px;
	margin: 0 auto;
	padding: 96px 0 128px;
}
.post-date {
	margin: 0;
	font-size: 14px;
	line-height: 20px;
	color: var(--muted);
}
.post-title {
	margin: 12px 0 0;
	color: var(--ink);
	font-size: 48px;
	line-height: 52px;
	font-weight: 500;
	letter-spacing: -0.035em;
	text-wrap: balance;
}
.post-body {
	margin-top: 40px;
	font-size: 17px;
	line-height: 28px;
	overflow-wrap: break-word;
}
.post-body > * {
	margin: 0;
}
.post-body > * + * {
	margin-top: 20px;
}
.post-body h2,
.post-body h3 {
	color: var(--ink);
	font-weight: 600;
	scroll-margin-top: 24px;
	text-wrap: balance;
}
.post-body h2 {
	margin-top: 48px;
	font-size: 24px;
	line-height: 32px;
	letter-spacing: -0.02em;
}
.post-body h3 {
	margin-top: 32px;
	font-size: 19px;
	line-height: 28px;
	letter-spacing: -0.01em;
}
.post-body h2 + *,
.post-body h3 + * {
	margin-top: 12px;
}
.post-anchor {
	margin-left: 8px;
	color: var(--muted);
	font-weight: 400;
	opacity: 0;
}
.post-body h2:hover .post-anchor,
.post-body h3:hover .post-anchor,
.post-anchor:focus-visible {
	opacity: 1;
}
.post-body a:not(.post-anchor) {
	color: var(--ink);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	text-decoration-color: #C9CCD3;
}
.post-body a:not(.post-anchor):hover {
	text-decoration-color: var(--ink);
}
.post-body strong,
.post-body b {
	color: var(--ink);
	font-weight: 600;
}
.post-body ul,
.post-body ol {
	padding-left: 24px;
}
.post-body li + li {
	margin-top: 8px;
}
.post-body li::marker {
	color: var(--muted);
}
.post-body blockquote {
	padding-left: 20px;
	border-left: 2px solid var(--hairline);
	color: var(--muted);
}
.post-body hr {
	margin: 48px 0;
	border: 0;
	border-top: 1px solid var(--hairline);
}
.post-body img {
	display: block;
	max-width: 100%;
	height: auto;
}
.post-body figure {
	margin-left: 0;
	margin-right: 0;
}
.post-body figcaption {
	margin-top: 12px;
	font-size: 14px;
	line-height: 20px;
	color: var(--muted);
	text-align: center;
}
.post-body table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15px;
	line-height: 24px;
}
.post-body th,
.post-body td {
	padding: 8px 12px 8px 0;
	border-bottom: 1px solid var(--hairline);
	text-align: left;
	vertical-align: top;
}
.post-body th {
	color: var(--ink);
	font-weight: 600;
}

/* video: part of the text, plays muted in a loop, no controls */
.post-body .post-video {
	margin-top: 32px;
	margin-bottom: 32px;
}
.post-video video {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--hairline);
	border-radius: 12px;
	background: var(--fill);
}
.post-video {
	position: relative;
}
/* the slot before the file is in (no src, no source): a 16:9 box (the video is 16:9) */
.post-video:not(:has(source)) video:not([src]) {
	aspect-ratio: 16 / 9;
}
.post-video:not(:has(source)):has(video:not([src]))::after {
	content: "Video";
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-size: 14px;
	color: var(--muted);
}

/* code */
.post-body code {
	font-family: var(--mono);
	font-size: 0.86em;
	padding: 2px 5px;
	border: 1px solid var(--hairline);
	border-radius: 4px;
	background: var(--fill);
}
.post-body pre {
	margin: 0;
	padding: 16px 20px;
	overflow-x: auto;
	border: 1px solid var(--hairline);
	border-radius: 8px;
	background: var(--fill);
	color: var(--ink);
	font-family: var(--mono);
	font-size: 14px;
	line-height: 22px;
	white-space: pre;
	overflow-wrap: normal;
	tab-size: 4;
}
.post-body pre code {
	padding: 0;
	border: 0;
	background: none;
	font-size: inherit;
}
/* a prompt the reader pastes to an agent: <pre class="prompt"> */
.post-body pre.prompt {
	padding: 18px 88px 18px 44px;
	background: #fff;
	font-size: 15px;
	line-height: 24px;
	white-space: pre-wrap;
}
/* a link in a prompt does not break at its hyphen: <span class="nowrap"> */
.post-body .nowrap {
	white-space: nowrap;
}
.post-body pre.prompt::before {
	content: "›";
	position: absolute;
	left: 22px;
	color: var(--muted);
}
.post-code {
	position: relative;
}
.post-body .post-code {
	margin-top: 24px;
	margin-bottom: 24px;
}
.post-copy {
	position: absolute;
	top: 11px;
	right: 11px;
	height: 28px;
	padding: 0 10px;
	border: 1px solid var(--hairline);
	border-radius: 6px;
	background: #fff;
	color: var(--muted);
	font: 500 12px/1 var(--sans);
	cursor: pointer;
	opacity: 0;
}
.post-code:hover .post-copy,
.post-copy:focus-visible,
.post-code:has(pre.prompt) .post-copy {
	opacity: 1;
}
.post-copy:hover {
	color: var(--ink);
}
.post-code:has(pre.prompt) .post-copy {
	top: 50%;
	transform: translateY(-50%);
}

/* the index */
/* the index lines up with the header (1080 px bar, 32 px inside) */
.blog-index {
	max-width: 1016px;
	margin: 0 auto;
	padding: 96px 0 128px;
}
.blog-index-title {
	margin: 0;
	color: var(--ink);
	font-size: 48px;
	line-height: 52px;
	font-weight: 500;
	letter-spacing: -0.035em;
}
.blog-list {
	margin: 48px 0 0;
	padding: 0;
	list-style: none;
	border-top: 1px solid var(--hairline);
}
.blog-item {
	position: relative;
	display: grid;
	grid-template-columns: 136px 1fr;
	gap: 24px;
	padding: 24px 0;
	border-bottom: 1px solid var(--hairline);
}
.blog-item-date {
	font-size: 14px;
	line-height: 28px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}
.blog-item-title {
	color: var(--ink);
	font-size: 20px;
	line-height: 28px;
	font-weight: 500;
	letter-spacing: -0.015em;
}
/* the whole row opens the post */
.blog-item-title::after {
	content: "";
	position: absolute;
	inset: 0;
}
.blog-item:hover .blog-item-title {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
	text-decoration-color: #C9CCD3;
}
.blog-item-text {
	margin: 4px 0 0;
	font-size: 15px;
	line-height: 24px;
	color: var(--muted);
}
.blog-empty {
	margin: 48px 0 0;
	padding: 32px;
	border: 2px dashed var(--hairline);
	border-radius: 8px;
	color: var(--muted);
	font-size: 15px;
	text-align: center;
}

/* touch screens have no hover */
@media (hover: none) {
	.post-copy {
		opacity: 1;
	}
}

@media (max-width: 639px) {
	.blog-bar,
	.blog-main {
		padding-left: 20px;
		padding-right: 20px;
	}
	.blog-header .blog-bar {
		height: 56px;
	}
	.blog-nav {
		gap: 16px;
	}
	.blog-footer .blog-bar {
		height: auto;
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
		padding-top: 24px;
		padding-bottom: 24px;
	}
	.blog-footer .blog-nav {
		margin-left: 0;
	}
	.post,
	.blog-index {
		padding: 48px 0 80px;
	}
	.post-title,
	.blog-index-title {
		font-size: 32px;
		line-height: 38px;
		letter-spacing: -0.03em;
	}
	.post-body {
		margin-top: 28px;
		font-size: 16px;
		line-height: 26px;
	}
	.post-body pre {
		padding: 14px 16px;
		font-size: 13px;
		line-height: 20px;
	}
	.post-body pre.prompt {
		padding: 14px 76px 14px 36px;
		font-size: 14px;
		line-height: 22px;
	}
	.post-body pre.prompt::before {
		left: 16px;
	}
	.post-copy {
		top: 9px;
		right: 9px;
	}
	.blog-list {
		margin-top: 32px;
	}
	.blog-item {
		grid-template-columns: 1fr;
		gap: 4px;
		padding: 20px 0;
	}
	.blog-item-date {
		line-height: 20px;
	}
	.blog-item-title {
		font-size: 18px;
		line-height: 26px;
	}
}
