/* rosenbohm.dev
 *
 * Design direction: a workshop index.
 *
 * The platform is a single origin that routes to self-contained machines, so
 * the page is built around one vertical rail representing that origin, with
 * each applet branching off it. The rail is the only ornament; everything else
 * stays quiet so it reads as structure rather than decoration.
 *
 * Palette is cool zinc with an oxidised brass accent, chosen to sit away from
 * both the warm-paper and the near-black-with-neon looks that a developer
 * portfolio falls into by default.
 */

/* ---------------------------------------------------------------- tokens - */

:root {
	color-scheme: light dark;

	/* Type. Archivo carries display and labels; the body face is the system
	 * stack so text renders natively at any size without a second download. */
	--font-display: "Archivo", ui-sans-serif, system-ui, sans-serif;
	--font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, monospace;

	/* A deliberately short scale: three sizes carry the whole page. */
	--step-display: clamp(3.25rem, 13vw, 8.5rem);
	--step-title: clamp(1.5rem, 3.5vw, 2rem);
	--step-body: 1.0625rem;
	--step-small: 0.8125rem;
	--step-label: 0.6875rem;

	--tracking-display: -0.045em;
	--tracking-label: 0.16em;

	/* Space, on a 4px base. */
	--space-1: 0.25rem;
	--space-2: 0.5rem;
	--space-3: 0.75rem;
	--space-4: 1rem;
	--space-6: 1.5rem;
	--space-8: 2rem;
	--space-12: 3rem;
	--space-16: 4rem;
	--space-24: 6rem;

	--measure: 38rem;
	--frame: min(72rem, 100% - 2.5rem);

	--rail-width: 1px;
	--node: 11px;

	--radius: 2px;
	--transition: 140ms cubic-bezier(0.2, 0, 0.2, 1);
}

/* Light is the default. */
:root {
	--bg: #e7e9ec;
	--surface: #f2f4f6;
	--ink: #14171c;
	--ink-2: #4f575f;
	--ink-3: #7d858e;
	--rule: #c6cbd1;
	--accent: #7a5c1f;
	--accent-bright: #93701f;
	--focus: #1d4ed8;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #121418;
		--surface: #181b20;
		--ink: #e7e9ec;
		--ink-2: #99a0a9;
		--ink-3: #6b727b;
		--rule: #272c33;
		--accent: #cfa25c;
		--accent-bright: #e2b972;
		--focus: #7ea6ff;
	}
}

/* ------------------------------------------------------------- typeface - */

@font-face {
	font-family: "Archivo";
	src: url("/static/fonts/archivo-latin.woff2") format("woff2-variations");
	font-weight: 400 800;
	font-display: swap;
	font-style: normal;
}

/* ------------------------------------------------------------------ base - */

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

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: var(--step-body);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

a {
	color: inherit;
}

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

/* Reachable by keyboard, out of the way otherwise. */
.skip {
	position: absolute;
	left: var(--space-4);
	top: var(--space-4);
	z-index: 10;
	padding: var(--space-2) var(--space-4);
	background: var(--ink);
	color: var(--bg);
	font-size: var(--step-small);
	text-decoration: none;
	transform: translateY(-200%);
	transition: transform var(--transition);
}

.skip:focus {
	transform: translateY(0);
}

.frame {
	width: var(--frame);
	margin-inline: auto;
}

/* An eyebrow states what a section is. Wide tracking and small size make it
 * read as a label rather than as a heading competing with the content. */
.eyebrow {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--step-label);
	font-weight: 600;
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
	color: var(--ink-3);
}

/* ---------------------------------------------------------------- header - */

.masthead {
	padding-block: var(--space-6);
	border-bottom: 1px solid var(--rule);
}

.masthead__inner {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-4);
}

.wordmark {
	font-family: var(--font-mono);
	font-size: var(--step-small);
	color: var(--ink-2);
	text-decoration: none;
}

.wordmark b {
	color: var(--ink);
	font-weight: 600;
}

.wordmark__tld {
	color: var(--accent);
}

.masthead__nav {
	display: flex;
	align-items: baseline;
	gap: var(--space-4);
	font-size: var(--step-small);
}

.masthead__nav a,
.masthead__nav button {
	color: var(--ink-2);
	font: inherit;
	text-decoration: none;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	transition: color var(--transition);
}

.masthead__nav a:hover,
.masthead__nav button:hover {
	color: var(--accent);
}

.masthead__who {
	font-family: var(--font-mono);
	color: var(--ink-3);
}

/* ------------------------------------------------------------------ hero - */

.hero {
	padding-block: clamp(var(--space-16), 14vh, var(--space-24)) var(--space-12);
}

/* The name is the page's opening statement, set as large as the frame allows
 * and tracked tight so the two lines lock into a single block. */
.hero__name {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--step-display);
	font-weight: 800;
	letter-spacing: var(--tracking-display);
	line-height: 0.85;
	text-transform: uppercase;
}

.hero__name span {
	display: block;
}

/* The second line steps back in weight so the block reads as one name rather
 * than two shouted words. */
.hero__name span + span {
	font-weight: 400;
	color: var(--ink-2);
}

.hero__rule {
	height: 1px;
	margin-block: var(--space-8) var(--space-6);
	border: 0;
	background: var(--rule);
}

.hero__thesis {
	max-width: var(--measure);
	margin: 0;
	font-size: var(--step-title);
	line-height: 1.35;
	letter-spacing: -0.015em;
	text-wrap: balance;
}

.hero__meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2) var(--space-4);
	margin-top: var(--space-6);
	font-family: var(--font-mono);
	font-size: var(--step-small);
	color: var(--ink-3);
}

.hero__meta a {
	color: var(--ink-2);
	text-decoration-color: var(--rule);
	text-underline-offset: 3px;
	transition: color var(--transition);
}

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

/* ----------------------------------------------------------------- index - */

.index {
	padding-block: var(--space-6) var(--space-24);
}

.index__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-4);
	padding-bottom: var(--space-3);
	margin-bottom: var(--space-6);
	border-bottom: 1px solid var(--rule);
}

/* The rail. One line stands for the origin every applet hangs off, which is
 * literally how the platform routes: one host, one path each. Reading the
 * origin at the head and a path on each branch spells out the real URL. */
.rail {
	position: relative;
}

/* The spine runs from the centre of the origin marker to the last branch, so
 * the origin and its branches read as one connected structure. */
.rail::before {
	content: "";
	position: absolute;
	left: 0;
	top: calc(var(--step-small) * 0.8);
	bottom: 0;
	width: var(--rail-width);
	background: var(--rule);
}

.rail__origin {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--space-4);
	margin: 0;
	font-family: var(--font-mono);
	font-size: var(--step-small);
	color: var(--ink-2);
}

/* The origin marker: the one place the accent sits at rest, on the thing
 * every branch descends from. */
.rail__cap {
	flex: none;
	width: var(--node);
	height: var(--node);
	margin-left: calc(var(--node) / -2);
	background: var(--accent);
}

.rail__list {
	list-style: none;
	margin: 0;
	padding: 0 0 0 var(--space-8);
	position: relative;
}

/* The rail fades below the last branch instead of stopping flat, so it reads
 * as a spine with room for more rather than a closed box. */
.rail::after {
	content: "";
	position: absolute;
	left: 0;
	top: 100%;
	width: var(--rail-width);
	height: var(--space-12);
	background: linear-gradient(var(--rule), transparent);
}

.branch {
	position: relative;
	padding-block: var(--space-6);
	border-bottom: 1px solid var(--rule);
}

.branch:first-child {
	padding-top: var(--space-4);
}

.branch:last-child {
	border-bottom: 0;
}

/* The connector from rail to entry. */
.branch::before {
	content: "";
	position: absolute;
	left: calc(var(--space-8) * -1);
	top: calc(var(--space-6) + 0.7em);
	width: var(--space-6);
	height: 1px;
	background: var(--rule);
	transition: background var(--transition);
}

/* The node where the branch meets the rail. Filled means deployed, hollow
 * means declared but not yet routed, so the shape carries the status. */
.branch::after {
	content: "";
	position: absolute;
	left: calc(var(--space-8) * -1 - var(--node) / 2);
	top: calc(var(--space-6) + 0.7em - var(--node) / 2 + 0.5px);
	width: var(--node);
	height: var(--node);
	background: var(--bg);
	border: 1px solid var(--rule);
	transition:
		background var(--transition),
		border-color var(--transition);
}

.branch--live::after {
	background: var(--accent);
	border-color: var(--accent);
}

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

.branch__top {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: var(--space-3);
}

.branch__name {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--step-title);
	font-weight: 700;
	letter-spacing: -0.02em;
	transition: color var(--transition);
}

.branch__path {
	font-family: var(--font-mono);
	font-size: var(--step-small);
	color: var(--ink-3);
}

.branch__summary {
	max-width: var(--measure);
	margin: var(--space-2) 0 0;
	color: var(--ink-2);
}

/* Tags state facts about an entry: who may open it, whether it is deployed. */
.tag {
	font-family: var(--font-display);
	font-size: var(--step-label);
	font-weight: 600;
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
	color: var(--ink-3);
	white-space: nowrap;
}

.tag--operator {
	color: var(--accent);
}

/* Hovering an entry lights its branch back to the rail. */
.branch__link:hover ~ .branch__marker,
.branch:hover::before {
	background: var(--accent);
}

.branch:hover::after {
	border-color: var(--accent);
}

.branch:hover .branch__name {
	color: var(--accent);
}

.branch:has(.branch__link:focus-visible)::before {
	background: var(--accent);
}

/* An entry with nowhere to go yet must not look clickable. */
.branch--planned .branch__name {
	color: var(--ink-2);
}

/* ------------------------------------------------------------ empty state - */

.empty {
	padding-block: var(--space-8);
	max-width: var(--measure);
	color: var(--ink-2);
}

/* ----------------------------------------------------------------- login - */

.login {
	display: flex;
	align-items: center;
	min-height: 68vh;
	padding-block: var(--space-16);
}

/* Left-aligned, like everything else on the site: a centred panel would be the
 * one element that does not sit on the same axis as the rail. */
.login__panel {
	position: relative;
	width: 100%;
	max-width: 24rem;
	padding-left: var(--space-8);
}

/* The spine continues past the form, so the sign-in page belongs to the same
 * structure as the index. */
.login__panel::before {
	content: "";
	position: absolute;
	left: 0;
	top: calc(var(--step-small) * 0.8);
	bottom: 0;
	width: var(--rail-width);
	background: var(--rule);
}

.login__panel .rail__origin {
	margin-left: calc(var(--space-8) * -1);
}

.login__title {
	margin: var(--space-6) 0 var(--space-6);
	font-family: var(--font-display);
	font-size: var(--step-title);
	font-weight: 700;
	letter-spacing: -0.02em;
}

.field {
	display: block;
	margin-bottom: var(--space-4);
}

.field__label {
	display: block;
	margin-bottom: var(--space-2);
	font-family: var(--font-display);
	font-size: var(--step-label);
	font-weight: 600;
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
	color: var(--ink-3);
}

.field__input {
	width: 100%;
	padding: var(--space-3);
	background: var(--surface);
	color: var(--ink);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	font: inherit;
	font-size: var(--step-body);
	transition: border-color var(--transition);
}

.field__input:hover {
	border-color: var(--ink-3);
}

.field__input:focus {
	border-color: var(--accent);
}

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: var(--space-3) var(--space-6);
	background: var(--ink);
	color: var(--bg);
	border: 1px solid var(--ink);
	border-radius: var(--radius);
	font-family: var(--font-display);
	font-size: var(--step-small);
	font-weight: 600;
	letter-spacing: var(--tracking-label);
	text-transform: uppercase;
	cursor: pointer;
	transition:
		background var(--transition),
		border-color var(--transition);
}

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

.button[aria-busy="true"] {
	opacity: 0.7;
	pointer-events: none;
}

/* Errors say what happened and what to do, in the interface's voice. */
.notice {
	margin-bottom: var(--space-4);
	padding: var(--space-3);
	border-left: 2px solid var(--accent);
	background: var(--surface);
	font-size: var(--step-small);
	color: var(--ink-2);
}

.notice:empty {
	display: none;
}

/* ---------------------------------------------------------------- footer - */

.colophon {
	padding-block: var(--space-6);
	border-top: 1px solid var(--rule);
	font-family: var(--font-mono);
	font-size: var(--step-small);
	color: var(--ink-3);
}

.colophon__inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: var(--space-2) var(--space-4);
}

.colophon a {
	color: var(--ink-2);
	text-decoration-color: var(--rule);
	text-underline-offset: 3px;
}

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

/* ------------------------------------------------------------ small screens - */

@media (max-width: 34rem) {
	:root {
		--frame: min(72rem, 100% - 1.75rem);
		--space-24: 4rem;
	}

	.hero {
		padding-block: var(--space-12) var(--space-8);
	}

	.masthead__inner {
		flex-wrap: wrap;
	}
}

/* --------------------------------------------------------- reduced motion - */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* An applet that is deployed but not answering. Stated rather than styled away:
 * a launcher that hides a broken applet is lying about the system. */
.tag--down {
	color: var(--accent);
}

.branch--down .branch__name {
	color: var(--ink-2);
}

.branch--down::after {
	background: var(--bg);
}
