/* farfield — shared theme.
   Braun × JPL × vintage-NASA: warm paper surface, black ink, sharp ruled
   dividers, function-first type. Semantic HTML, vanilla CSS, no build step.
   See .claude/skills/farfield-style. */

:root {
	--surface: #fafaf7;
	--ink: #0a0a0a;
	--accent: #d93a00;
	--hairline: rgba(10, 10, 10, 0.15);
	--wash: rgba(10, 10, 10, 0.05);
	--font-sans: ui-sans-serif, system-ui, -apple-system, "Helvetica Neue",
		Helvetica, Arial, sans-serif;
	--font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── reset ─────────────────────────────────────────────────────────────── */

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

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

body {
	background: var(--surface);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ── typography ────────────────────────────────────────────────────────── */

h1 { font-weight: 500; font-size: clamp(1.6rem, 3.5vw, 2.4rem);
	line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-weight: 500; font-size: clamp(1.2rem, 2.5vw, 1.55rem); line-height: 1.2; }
h3 { font-weight: 500; font-size: 1.1rem; line-height: 1.25; }

a { color: var(--ink); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.9em; }
code { background: var(--wash); padding: 0.1em 0.3em; }
pre { background: var(--wash); padding: 1rem; overflow-x: auto; }
small { font-size: 0.875rem; }

/* The mono label — JPL/instrument-panel signature. Uppercase, tracked. */
.label {
	display: block;
	font: 500 0.7rem/1 var(--font-mono);
	text-transform: uppercase;
	letter-spacing: 0.09em;
	opacity: 0.55;
}

/* Hierarchy via opacity on the ink — never a gray hex value. */
.muted { opacity: 0.6; }
.hint { opacity: 0.6; font-size: 0.8rem; }
.mono { font-family: var(--font-mono); font-size: 0.8rem; }

hr { border: 0; border-top: 1px solid var(--hairline); margin-block: 1.75rem; }

/* ── layout ────────────────────────────────────────────────────────────── */

.container { max-width: 64rem; margin-inline: auto; padding: 2.5rem 1.5rem; }
.measure { max-width: 60ch; }
.prose { max-width: 38rem; }

.row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.cluster { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.grid {
	display: grid; gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
}

/* prose rhythm — gap depends on what's adjacent */
.prose > * + * { margin-top: 1rem; }
.prose > * + h2 { margin-top: 2.5rem; }
.prose > h2 + * { margin-top: 0.5rem; }

/* ── masthead ──────────────────────────────────────────────────────────── */

.bar {
	display: flex; justify-content: space-between; align-items: baseline;
	gap: 0.6rem 1.5rem; flex-wrap: wrap;
	padding-bottom: 0.85rem; margin-bottom: 1.75rem;
	border-bottom: 2px solid var(--ink);
}
.bar h1 { font-size: 1rem; font-weight: 500; }
.bar h1 a { text-decoration: none; }
.bar nav {
	display: flex; gap: 1.25rem; flex-wrap: wrap;
	font-family: var(--font-mono); font-size: 0.8rem;
}

.section-head {
	display: flex; justify-content: space-between; align-items: baseline;
	gap: 1rem; flex-wrap: wrap;
	margin: 2.25rem 0 0.85rem; padding-bottom: 0.4rem;
	border-bottom: 1px solid var(--hairline);
}
.section-head h2 { font-size: 1rem; font-weight: 500; }

/* filter bar — an instrument-panel control row under a section head */
.filter-bar {
	display: flex; flex-wrap: wrap; align-items: baseline;
	gap: 0.4rem 1rem;
	margin: 0.9rem 0 1.5rem;
	font-family: var(--font-mono); font-size: 0.8rem;
}
.filter-bar .label { display: inline; }
.filter-bar a { opacity: 0.55; text-decoration: none; }
.filter-bar a:hover { opacity: 1; }
.filter-bar a.on { opacity: 1; text-decoration: underline;
	text-underline-offset: 0.2em; }

/* ── controls ──────────────────────────────────────────────────────────── */

button, .btn {
	font: inherit; padding: 0.45rem 1rem;
	background: var(--surface); color: var(--ink);
	border: 1px solid var(--ink); border-radius: 0;
	cursor: pointer;
	transition: background 0.12s ease-out, color 0.12s ease-out;
}
button:hover, .btn:hover { background: var(--ink); color: var(--surface); }
button:disabled { opacity: 0.35; cursor: default; }
button:disabled:hover { background: var(--surface); color: var(--ink); }

.danger { border-color: var(--accent); color: var(--accent); }
.danger:hover { background: var(--accent); color: var(--surface); }

input, textarea, select {
	font: inherit; width: 100%;
	padding: 0.45rem 0.6rem;
	background: var(--surface); color: var(--ink);
	border: 1px solid var(--ink); border-radius: 0;
}
textarea { min-height: 8rem; resize: vertical; line-height: 1.55;
	font-family: var(--font-mono); font-size: 0.85rem; }
input[type="checkbox"], input[type="file"] { width: auto; }

/* form field — a labelled control */
.field { margin: 1.1rem 0; }
.field > label, label.label {
	display: block; margin-bottom: 0.3rem;
	font: 500 0.7rem/1 var(--font-mono);
	text-transform: uppercase; letter-spacing: 0.09em; opacity: 0.6;
}
.field .hint { margin-top: 0.35rem; }
.check { display: flex; align-items: center; gap: 0.5rem; }
.check label { margin: 0; }
.actions {
	display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
	margin-top: 1.5rem;
}

.error {
	border: 1px solid var(--accent); color: var(--accent);
	padding: 0.5rem 0.75rem; font-size: 0.9rem;
}

/* ── table ─────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border: 1px solid var(--ink); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td {
	padding: 0.5rem 0.8rem; text-align: left;
	border-bottom: 1px solid var(--hairline);
}
th {
	font: 500 0.7rem/1 var(--font-mono);
	text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.5;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--wash); }
td.nowrap, th.nowrap { white-space: nowrap; }

/* ── cards — a hairline grid ───────────────────────────────────────────── */

.cards {
	display: grid; gap: 0.75rem;
	grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}
.card { border: 1px solid var(--ink); padding: 1rem 1.1rem; }
.card h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.card p { margin-top: 0.35rem; }

/* ── status badge ──────────────────────────────────────────────────────── */

.badge {
	display: inline-block;
	font: 500 0.65rem/1 var(--font-mono);
	text-transform: uppercase; letter-spacing: 0.07em;
	padding: 0.22rem 0.45rem; border: 1px solid currentColor;
}
.badge.live { color: var(--accent); }
.badge.draft { opacity: 0.45; }

/* ── editor: blob & series embedding ───────────────────────────────────── */

.embed-toolbar { display: flex; gap: 0.5rem; margin-bottom: 0.45rem; }
.embed-toolbar button { font-size: 0.8rem; padding: 0.3rem 0.7rem; }

dialog.embed-modal {
	width: min(56rem, 95vw); height: min(42rem, 88vh);
	margin: auto; /* the * { margin: 0 } reset removes the UA centering */
	padding: 0; border: 1px solid var(--ink); border-radius: 0;
	background: var(--surface); color: var(--ink);
}
dialog.embed-modal[open] { display: flex; flex-direction: column; }
dialog.embed-modal::backdrop { background: rgba(10, 10, 10, 0.45); }

.embed-head {
	display: flex; justify-content: space-between; align-items: center;
	flex: none; padding: 0.85rem 1.1rem; border-bottom: 2px solid var(--ink);
}
.embed-head strong { font-size: 0.85rem; font-weight: 500;
	font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.embed-x {
	border: 0; background: transparent; padding: 0 0.25rem;
	font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.embed-x:hover { background: transparent; color: var(--accent); }

.embed-content, .embed-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.embed-tabs { flex: none; display: flex; gap: 0.25rem; padding: 0.7rem 1.1rem 0; }
.embed-tabs button {
	background: transparent; color: var(--ink); opacity: 0.5;
	border: 0; border-bottom: 2px solid transparent; border-radius: 0;
	padding: 0.4rem 0.6rem;
	font: 500 0.72rem/1 var(--font-mono);
	text-transform: uppercase; letter-spacing: 0.07em;
}
.embed-tabs button:hover { background: transparent; color: var(--ink); opacity: 1; }
.embed-tabs button.active { opacity: 1; border-bottom-color: var(--ink); }

.embed-top { flex: none; padding: 1rem 1.1rem 0.4rem; }

.embed-label {
	margin: 0.85rem 0 0.45rem;
	font: 500 0.7rem/1 var(--font-mono);
	text-transform: uppercase; letter-spacing: 0.09em; opacity: 0.55;
}

.embed-drop {
	display: flex; align-items: center; justify-content: center;
	padding: 1.1rem; border: 1px dashed var(--ink);
	background: var(--wash); cursor: pointer; font-size: 0.85rem;
	transition: background 0.12s ease-out;
}
.embed-top .embed-drop { margin-top: 0.5rem; }
.embed-top > .embed-drop:first-child { margin-top: 0; }
.embed-drop:hover, .embed-drop.over { background: var(--ink); color: var(--surface); }
.embed-drop.busy { opacity: 0.5; pointer-events: none; }
.embed-drop input { display: none; }

.embed-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0.4rem 1.1rem 1.1rem; }
.embed-sentinel { height: 1px; }

.embed-grid {
	display: grid; gap: 0.4rem;
	grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
}
.embed-cell {
	position: relative; padding: 0; border: 1px solid var(--hairline); border-radius: 0;
	background: var(--surface); aspect-ratio: 1; overflow: hidden; cursor: pointer;
}
.embed-cell img { width: 100%; height: 100%; object-fit: cover; }
.embed-cell:hover { background: var(--surface); border-color: var(--ink); }
.embed-cell.sel { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: -4px; }
.embed-badge {
	position: absolute; top: 0; right: 0;
	min-width: 1.35rem; height: 1.35rem;
	display: none; align-items: center; justify-content: center;
	padding: 0 0.3rem; background: var(--ink); color: var(--surface);
	font: 700 0.72rem/1 var(--font-mono);
}
.embed-cell.sel .embed-badge { display: flex; }

.embed-cards {
	display: grid; gap: 0.6rem;
	grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
}
.embed-card { padding: 0; border: 1px solid var(--hairline); border-radius: 0;
	background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.embed-card:hover { background: var(--surface); border-color: var(--ink); }
.embed-cover { aspect-ratio: 4 / 3; background: var(--wash); }
.embed-cover img { width: 100%; height: 100%; object-fit: cover; }
.embed-cover-empty {
	width: 100%; height: 100%; display: flex; align-items: center;
	justify-content: center; font-size: 0.75rem; opacity: 0.4;
}
.embed-card-meta { padding: 0.5rem 0.7rem; border-top: 1px solid var(--hairline); }
.embed-card-meta strong {
	display: block; font-size: 0.85rem; font-weight: 500;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.embed-count { font-size: 0.72rem; opacity: 0.55; font-family: var(--font-mono); }

.embed-tray {
	display: flex; gap: 0.4rem; align-items: stretch; overflow-x: auto;
	min-height: 5.5rem; padding: 0.35rem;
	border: 1px solid var(--ink); background: var(--surface);
}
.embed-tray-empty {
	display: flex; align-items: center; padding: 0 0.4rem;
	font-size: 0.8rem; opacity: 0.55;
}
.embed-tray-item {
	position: relative; flex: none; width: 5rem; height: 4.8rem;
	border: 1px solid var(--hairline);
	background: var(--surface); cursor: grab; overflow: hidden;
}
.embed-tray-item img { width: 100%; height: 100%; object-fit: cover; }
.embed-tray-item.dragging { opacity: 0.35; }
.embed-tray-rm {
	position: absolute; top: 0; right: 0;
	width: 1.4rem; height: 1.4rem; padding: 0; border: 0; border-radius: 0;
	background: var(--ink); color: var(--surface);
	font-size: 0.95rem; line-height: 1;
	display: flex; align-items: center; justify-content: center;
}
.embed-tray-rm:hover { background: var(--accent); color: var(--surface); }

.embed-input { margin-bottom: 0.4rem; }

.embed-foot {
	flex: none; display: flex; justify-content: space-between; align-items: center;
	gap: 1rem; padding: 0.8rem 1.1rem; border-top: 2px solid var(--ink);
}
.embed-foot-count { font-size: 0.8rem; opacity: 0.6; font-family: var(--font-mono); }
.embed-foot-count.err { color: var(--accent); opacity: 1; }
.embed-go { flex: none; background: var(--ink); color: var(--surface); }
.embed-go:hover { background: var(--surface); color: var(--ink); }

.embed-msg { padding: 1.5rem 0.5rem; text-align: center; font-size: 0.85rem; opacity: 0.55; }
