/* A calm terminal from the future: editorial reading with a phosphor accent. */

:root {
	color-scheme: dark;
	--bg: #0b0f0c;
	--surface: #121a14;
	--surface-raised: #18221a;
	--fg: #d7e3d5;
	--muted: #829383;
	--accent: #9cff75;
	--accent-soft: #b4ff94;
	--warning: #e6b85c;
	--rule: #29392c;
	--code-bg: #101711;
	--focus: #d0ffb8;
	--display: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
	--sans: "Avenir Next", "Segoe UI", sans-serif;
	--mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	background: var(--bg);
	scroll-behavior: smooth;
}

body {
	position: relative;
	margin: 0;
	padding: 2rem 1.25rem 5rem;
	background: var(--bg);
	color: var(--fg);
	font: 1.0625rem/1.75 var(--display);
}

body::before {
	position: fixed;
	inset: 0;
	z-index: -1;
	background-image: linear-gradient(to bottom, transparent 0, transparent 95%, rgba(156, 255, 117, 0.025) 100%);
	background-size: 100% 5px;
	content: "";
	pointer-events: none;
}

body,
button,
input,
textarea,
select { font-kerning: normal; }

a {
	color: var(--accent-soft);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

a:hover { color: var(--accent); }

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

header.site,
main,
footer.site {
	width: min(100%, 68rem);
	margin-inline: auto;
}

header.site {
	margin-bottom: clamp(3.5rem, 8vw, 6.5rem);
	border: 1px solid var(--rule);
	background: var(--surface);
	box-shadow: 0 0 0 1px rgba(156, 255, 117, 0.025);
}

.terminal-chrome {
	display: flex;
	align-items: center;
	gap: 1rem;
	min-height: 2.25rem;
	padding: 0.45rem 0.8rem;
	border-bottom: 1px solid var(--rule);
	background: var(--surface-raised);
	color: var(--muted);
	font-family: var(--mono);
	font-size: 0.67rem;
	letter-spacing: 0.06em;
	line-height: 1;
	text-transform: lowercase;
}

.terminal-lights {
	display: flex;
	gap: 0.35rem;
}

.terminal-lights i {
	display: block;
	width: 0.48rem;
	height: 0.48rem;
	border: 1px solid var(--muted);
	border-radius: 50%;
	opacity: 0.7;
}

.terminal-lights i:first-child { border-color: var(--accent); background: var(--accent); }
.terminal-path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.terminal-state { color: var(--accent); }
.terminal-state::before { content: "● "; }

.site-bar {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 2rem;
	padding: clamp(2rem, 5vw, 4rem) clamp(1.25rem, 5vw, 4rem) 0;
}

.site-title {
	position: relative;
	display: inline-block;
	color: var(--fg);
	font-family: var(--mono);
	font-size: clamp(1.35rem, 3vw, 2.2rem);
	font-weight: 700;
	letter-spacing: -0.08em;
	line-height: 1;
	text-decoration: none;
	text-shadow: 0 0 18px rgba(156, 255, 117, 0.08);
}

.site-title::before {
	margin-right: 0.65em;
	color: var(--accent);
	content: ">";
}

.site-title::after {
	position: absolute;
	inset: 0;
	color: var(--accent);
	content: "> " attr(data-text);
	opacity: 0;
	pointer-events: none;
}

.site-title:hover::after,
.site-title:focus-visible::after {
	opacity: 0.65;
	animation: title-glitch 420ms steps(2, end);
}

@keyframes title-glitch {
	0% { clip-path: inset(15% 0 70% 0); transform: translate(0.08em, -0.04em); }
	45% { clip-path: inset(58% 0 22% 0); transform: translate(-0.05em, 0.04em); }
	100% { clip-path: inset(0); transform: translate(0); }
}

.site-nav {
	display: flex;
	align-items: center;
	gap: 1.25rem;
	font-family: var(--mono);
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.site-nav a {
	color: var(--muted);
	text-decoration: none;
}

.site-nav a::before { color: var(--rule); content: "["; }
.site-nav a::after { color: var(--rule); content: "]"; }
.site-nav a:hover { color: var(--accent); }

.site-description {
	max-width: 38rem;
	margin: 1.2rem 0 0;
	padding: 0 clamp(1.25rem, 5vw, 4rem) clamp(2rem, 5vw, 4rem);
	color: var(--muted);
	font-size: clamp(1rem, 1.8vw, 1.2rem);
	line-height: 1.5;
}

main { min-height: 18rem; }

h1,
h2,
h3,
h4 {
	color: var(--fg);
	font-family: var(--display);
	font-weight: 700;
}

h1 {
	max-width: 18ch;
	margin: 0 0 1.25rem;
	font-size: clamp(2.35rem, 6vw, 4.8rem);
	letter-spacing: -0.055em;
	line-height: 0.98;
}

h2 {
	margin: 3rem 0 0.85rem;
	font-size: clamp(1.45rem, 2.3vw, 2rem);
	letter-spacing: -0.035em;
	line-height: 1.1;
}

h3 {
	margin: 2.25rem 0 0.65rem;
	font-size: 1.3rem;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

p { margin: 0 0 1.1rem; }

.section-kicker,
.post-meta,
.back,
.sources h2,
footer.site {
	font-family: var(--mono);
}

.section-kicker {
	margin: 0 0 0.9rem;
	color: var(--accent);
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	line-height: 1.2;
	text-transform: uppercase;
}

.section-kicker::before { color: var(--muted); content: "// "; }

.post-list {
	max-width: 54rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.post-list > li {
	padding: 1.75rem 0 1.9rem;
	border-top: 1px solid var(--rule);
}

.post-list > li:last-child { border-bottom: 1px solid var(--rule); }

.post-link {
	display: inline;
	color: var(--fg);
	font-family: var(--display);
	font-size: clamp(1.45rem, 2.4vw, 2rem);
	font-weight: 700;
	letter-spacing: -0.035em;
	line-height: 1.1;
	text-decoration: none;
}

.post-link:hover { color: var(--accent); }

.post-description {
	max-width: 42rem;
	margin: 0.65rem 0 0.85rem;
	color: var(--muted);
	font-size: 1.03rem;
	line-height: 1.55;
}

.post-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.35rem 0.65rem;
	margin: 0;
	color: var(--muted);
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.5;
	text-transform: uppercase;
}

.post-meta time { color: var(--fg); }

.tag-list {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.tag {
	display: inline-block;
	padding: 0.22rem 0.55rem;
	border: 1px solid var(--rule);
	border-radius: 2px;
	background: rgba(156, 255, 117, 0.025);
	color: var(--muted);
	font-family: var(--mono);
	font-size: 0.66rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	line-height: 1.2;
	text-decoration: none;
	text-transform: none;
}

a.tag:hover {
	border-color: var(--accent);
	background: rgba(156, 255, 117, 0.08);
	color: var(--accent);
}

article { max-width: 54rem; }
article > h1 { max-width: 15ch; }

.article-dek {
	max-width: 42rem;
	margin: -0.25rem 0 1.25rem;
	color: var(--muted);
	font-size: clamp(1.12rem, 2vw, 1.35rem);
	line-height: 1.45;
}

.prose {
	max-width: 44rem;
	margin-top: 3.5rem;
}

.prose > * + * { margin-top: 1.25rem; }
.prose p { margin-bottom: 0; }
.prose a { color: var(--accent-soft); }

.prose ul,
.prose ol {
	margin: 0;
	padding-left: 1.4rem;
}

.prose li + li { margin-top: 0.4rem; }

.prose blockquote {
	margin-right: 0;
	margin-left: 0;
	padding: 0.2rem 0 0.2rem 1.25rem;
	border-left: 2px solid var(--accent);
	color: var(--muted);
	font-size: 1.15em;
	font-style: italic;
}

.prose code {
	padding: 0.12em 0.35em;
	border: 1px solid var(--rule);
	border-radius: 2px;
	background: var(--code-bg);
	font-family: var(--mono);
	font-size: 0.82em;
}

.prose pre {
	margin-inline: -1rem;
	padding: 1.2rem 1rem;
	border: 1px solid var(--rule);
	border-left: 2px solid var(--accent);
	border-radius: 2px;
	background: var(--code-bg);
	overflow-x: auto;
}

.prose pre code {
	padding: 0;
	border: 0;
	background: none;
	font-size: 0.8rem;
	line-height: 1.65;
}

.prose table {
	width: 100%;
	border-collapse: collapse;
	font-family: var(--sans);
	font-size: 0.9rem;
}

.prose th,
.prose td {
	padding: 0.7rem 0.8rem;
	border-bottom: 1px solid var(--rule);
	text-align: left;
}

.prose th {
	color: var(--fg);
	font-family: var(--mono);
	font-size: 0.7rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.prose img { max-width: 100%; height: auto; }

.prose hr {
	margin: 2.5rem 0;
	border: 0;
	border-top: 1px solid var(--rule);
}

.sources {
	max-width: 44rem;
	margin-top: 4rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--rule);
}

.sources h2 {
	margin: 0 0 0.9rem;
	color: var(--muted);
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.15em;
	line-height: 1.2;
	text-transform: uppercase;
}

.sources h2::before { color: var(--accent); content: "["; }
.sources h2::after { color: var(--accent); content: "]"; }
.sources ul { margin: 0; padding: 0; list-style: none; }
.sources li + li { margin-top: 0.55rem; }

.sources a {
	display: inline-block;
	max-width: 100%;
	font-family: var(--mono);
	font-size: 0.78rem;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.empty {
	max-width: 34rem;
	padding: 1.5rem 0;
	color: var(--muted);
	font-style: italic;
}

.back {
	margin-top: 3rem;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.error-page { padding-bottom: 2rem; }
.error-page p:not(.section-kicker) { max-width: 32rem; }

.terminal-invite {
	margin-top: 0.65rem;
	color: var(--muted);
}

.terminal-invite code {
	padding: 0.2rem 0.45rem;
	border: 1px solid var(--rule);
	border-radius: 2px;
	background: var(--code-bg);
	color: var(--accent);
	font-family: var(--mono);
	font-size: 0.9em;
}

body.terminal-page {
	min-height: 100vh;
	padding: clamp(1rem, 4vw, 3rem) 1rem;
}

body.terminal-page main.terminal-app {
	width: min(100%, 76rem);
	min-height: 0;
}

.terminal-window {
	position: relative;
	border: 1px solid var(--rule);
	background: var(--surface);
	box-shadow: 0 0 0 1px rgba(156, 255, 117, 0.025);
}

.terminal-window::after {
	position: absolute;
	right: 1.1rem;
	bottom: -0.35rem;
	width: 0.35rem;
	height: 0.35rem;
	background: var(--accent);
	box-shadow: 0.55rem 0 var(--rule), 1.1rem 0 var(--accent);
	content: "";
}

.terminal-screen {
	min-height: min(68vh, 42rem);
	padding: clamp(1rem, 3vw, 2.5rem);
	background: var(--code-bg);
	font-family: var(--mono);
	font-size: 0.83rem;
	line-height: 1.65;
}

.terminal-output {
	max-height: 15rem;
	overflow-y: auto;
	scrollbar-color: var(--rule) transparent;
}

.terminal-output p { margin: 0 0 0.45rem; }
.terminal-prompt { color: var(--accent); }
.terminal-success { color: var(--accent); }
.terminal-muted { color: var(--muted); }
.terminal-error { color: var(--warning); }
.terminal-command { color: var(--fg); }

.terminal-screen code {
	padding: 0.1rem 0.3rem;
	border: 1px solid var(--rule);
	border-radius: 2px;
	background: var(--surface);
	color: var(--accent-soft);
	font-family: inherit;
	font-size: 0.92em;
}

.terminal-directory {
	margin-top: 2rem;
	border-top: 1px solid var(--rule);
	border-bottom: 1px solid var(--rule);
}

.terminal-directory-heading {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.7rem 0;
	color: var(--muted);
	font-size: 0.7rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.terminal-post-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.terminal-post {
	display: grid;
	grid-template-columns: 2.5rem minmax(0, 1fr) auto;
	align-items: baseline;
	gap: 0.5rem;
	padding: 0.75rem 0;
	border-top: 1px solid var(--rule);
}

.terminal-post-number,
.terminal-post-meta { color: var(--muted); }
.terminal-post-number { color: var(--accent); }

.terminal-post a {
	color: var(--fg);
	font-family: var(--display);
	font-size: 1.05rem;
	font-weight: 700;
	text-decoration: none;
}

.terminal-post a:hover { color: var(--accent); }
.terminal-post-meta { font-size: 0.68rem; }
.terminal-empty { padding: 1rem 0; color: var(--muted); }

.terminal-form {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px solid var(--rule);
}

.terminal-form input {
	min-width: 0;
	flex: 1;
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--fg);
	font: inherit;
}

.terminal-form:focus-within { border-top-color: var(--accent); }
.terminal-help { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.68rem; }

.terminal-noscript {
	margin-top: 1rem;
	padding: 0.75rem;
	border: 1px solid var(--warning);
	color: var(--warning);
}

.terminal-exit {
	margin: 1rem 0 0;
	font-family: var(--mono);
	font-size: 0.75rem;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

footer.site {
	margin-top: clamp(5rem, 12vw, 9rem);
	padding: 1.25rem 0 0;
	border-top: 1px solid var(--rule);
	color: var(--muted);
	font-size: 0.72rem;
	letter-spacing: 0.02em;
}

footer.site p { margin: 0; }
footer.site .terminal-invite { margin-top: 0.65rem; }
footer.site a { color: var(--fg); }

@media (max-width: 600px) {
	body { padding: 1rem 0.9rem 4rem; }

	.site-bar {
		align-items: flex-start;
		flex-direction: column;
		gap: 1.25rem;
	}

	.site-nav { gap: 1rem; }
	.post-list > li { padding-block: 1.45rem; }
	.prose { margin-top: 2.75rem; }
	.prose pre { margin-inline: 0; }
	.terminal-screen { min-height: 70vh; padding: 1rem; }
	.terminal-directory-heading { align-items: flex-start; flex-direction: column; gap: 0.15rem; }
	.terminal-post { grid-template-columns: 2rem minmax(0, 1fr); }
	.terminal-post-meta { grid-column: 2; }
	.terminal-form { align-items: flex-start; }
	.terminal-form .terminal-prompt { max-width: 8rem; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	a { transition: none; }
	.site-title:hover::after,
	.site-title:focus-visible::after { animation: none; }
}

/* Draft preview chrome. Drafts are private and must never be mistaken for a
   published post, so the banner is deliberate and loud. */
.draft-banner {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin-bottom: 0.75rem;
	font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	font-size: 0.75rem;
}
.draft-badge {
	display: inline-block;
	padding: 0.1rem 0.5rem;
	border: 1px solid currentColor;
	border-radius: 999px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.75;
}
.draft-badge--draft {
	border-style: dashed;
	opacity: 1;
}
.draft-badge--approved {
	border-style: solid;
	opacity: 1;
}
.draft-hash { opacity: 0.5; }
.draft-quote {
	margin: 0 0 1.5rem;
	padding-left: 0.75rem;
	border-left: 2px solid currentColor;
	opacity: 0.7;
	font-style: italic;
}
.draft-note { opacity: 0.7; font-size: 0.9rem; }
