/* Variables */
:root {
	/* --bg:          #f8f8f6; */
	--bg:          #ffffff;
	--bg-alt:      #f0f0ed;
	--border:      #e4e4e0;
	/* --text:        #1a1a18; */
	--text:        black;
	--text-muted:  #6b6b68;
	--link:        #2563eb;
	--accent:      #2563eb;
	--accent-h:    #1d4ed8;

	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	--s1: 4px;
	--s2: 8px;
	--s3: 12px;
	--s4: 16px;
	--s5: 20px;
	--s6: 24px;
	--s8: 32px;

	--sidebar: 240px;
	--radius:  6px;

	/* Logo palette — Ocean (default, overridden by inline script) */
	--logo-dk:  #001a33;
	--logo-bd:  #b0d4e8;
	--logo-fl:  #5a9ab5;
	--logo-e1d: #006699;
	--logo-e1h: #00ccff;
	--logo-e2m: #004d99;
	--logo-e2h: #0099ff;
	--logo-e2s: #002266;
	--logo-mm:  #006644;
	--logo-ma:  #00cc88;
}

/* Icon sprite */
.icon {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	flex-shrink: 0;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg:         #18181a;
		--bg-alt:     #222224;
		--border:     #2c2c2e;
		--text:       #e2e2df;
		--text-muted: #88888a;
		--link:       #60a5fa;
		--accent:     #3b82f6;
		--accent-h:   #2563eb;
	}
}

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

/* Base */
html { font-size: 16px; }

body {
	font-family: var(--font);
	background:  var(--bg);
	color:       var(--text);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* App shell */
.app {
	/* max-width: 1200px; */
	margin: 0 auto;
	min-height: 100vh;
	display: flex;
	flex-direction: row;
}

/* Header */
.site-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--s3) var(--s4);
	/* border-bottom: 1px solid var(--border); */
	/* height: 52px; */
	height: 66px;
}

.site-name {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 1.9375rem;
	font-weight: 600;
	color: var(--text);
	letter-spacing: -0.01em;
}
.site-name:hover { text-decoration: none; color: var(--text); }
.site-name svg { flex-shrink: 0; }

.menu-toggle {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--text);
	padding: var(--s1);
	line-height: 0;
}

/* Left column (header + sidebar) */
.app-sidebar {
	width: var(--sidebar);
	flex-shrink: 0;
	border-right: 1px solid var(--border);
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

/* Sidebar nav */
.sidebar {
	flex: 1;
	padding: 0 0 var(--s5) 0;
	display: flex;
	flex-direction: column;
}

.nav-item {
	display: flex;
	align-items: center;
	gap: var(--s3);
	padding: var(--s2) var(--s5);
	color: var(--text);
	font-size: 0.9375rem;
	border-radius: 0;
}
.nav-item:hover { background: var(--bg-alt); text-decoration: none; color: var(--text); }
.nav-item.active { font-weight: 600; }
.nav-item svg { flex-shrink: 0; color: var(--text-muted); }

.nav-divider {
	height: 1px;
	background: var(--border);
	margin: var(--s3) var(--s5);
}

.nav-muted { color: var(--text-muted); font-size: 0.875rem; }
.nav-muted:hover { color: var(--text-muted); }

/* Right column */
.app-right {
	width: var(--sidebar);
	flex-shrink: 0;
	/* border-left: 1px solid var(--border); */
}

/* Main */
.main-content {
	flex: 1;
	min-width: 0;
	padding: var(--s8);
    padding-top: var(--s4);
}

/* Artifact detail */
.artifact-detail {
	width: 100%; max-width: 620px;
}

/* Artifact detail */
.artifact-detail {
	max-width: 620px;
}

.bd-header {
	display: flex;
	align-items: flex-start;
	gap: var(--s3);
	margin-bottom: var(--s2);
}

.bd-title {
	flex: 1;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.4;
	margin: 0;
}

.bd-title-link {
	color: var(--text);
}

.bd-title-link:hover {
	color: var(--link);
	text-decoration: none;
}

.artifact-detail .artifact-year {
	vertical-align: middle;
	margin-left: var(--s2);
}

.bd-toolbar {
	display: flex;
	align-items: center;
	gap: var(--s1);
	flex-shrink: 0;
	padding-top: 2px;
}

.bd-icon-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text-muted);
	cursor: pointer;
	padding: 0;
}

.bd-icon-btn:hover {
	color: var(--text);
	border-color: var(--text-muted);
}

.bd-icon-btn--danger:hover {
	color: #dc2626;
	border-color: #dc2626;
}

.bd-desc {
	font-size: 0.9375rem;
	color: var(--text-muted);
	line-height: 1.6;
	margin-bottom: var(--s3);
}

.bd-byline {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0 var(--s2);
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-bottom: var(--s5);
}

.bd-dot {
	opacity: 0.4;
}

.bd-notes {
	font-size: 0.9375rem;
	line-height: 1.6;
	color: var(--text);
	padding: var(--s3) var(--s4);
	background: var(--bg-alt);
	border-radius: var(--radius);
	margin-bottom: var(--s4);
	min-height: 48px;
	white-space: pre-wrap;
	outline: none;
}

.bd-tags-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--s2);
	margin-bottom: var(--s4);
	min-height: 26px;
}

.bd-tag {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px;
	background: var(--bg-alt);
	border: 1px solid var(--border);
	border-radius: 99px;
	font-size: 0.75rem;
	color: var(--text-muted);
}

.bd-tag-remove {
	display: inline-flex;
	align-items: center;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	font-size: 0.875rem;
	line-height: 1;
	color: var(--text-muted);
}

.bd-tag-remove:hover {
	color: #dc2626;
}

input[type="text"].bd-tag-input {
	flex: none;
	width: 90px;
	border: 1px solid var(--accent);
	border-radius: 99px;
	outline: none;
	font-size: 0.75rem;
	font-family: var(--font);
	background: transparent;
	color: var(--text);
	padding: 2px 8px;
}

input[type="text"].bd-tag-input::placeholder {
	color: var(--text-muted);
	opacity: 0.6;
}

.bd-add-tag-btn {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	background: none;
	border: 1px dashed var(--border);
	border-radius: 99px;
	font-size: 0.75rem;
	color: var(--text-muted);
	cursor: pointer;
	font-family: var(--font);
	line-height: 1.6;
}

.bd-add-tag-btn:hover {
	color: var(--text);
	border-color: var(--text-muted);
	border-style: solid;
}

.bd-attribution {
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-top: var(--s4);
}

.bd-attribution a {
	color: var(--text-muted);
}

.bd-attribution a:hover {
	color: var(--text);
}

/* Meta toggles (visibility, status) */
.bd-meta-row {
	display: flex;
	align-items: center;
	gap: var(--s2);
	margin-bottom: var(--s3);
}

.bd-meta-toggle {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 10px 3px 8px;
	background: var(--bg-alt);
	border: 1px solid var(--border);
	border-radius: 99px;
	font-size: 0.75rem;
	color: var(--text-muted);
	cursor: pointer;
	font-family: var(--font);
	line-height: 1;
}

.bd-meta-toggle:hover {
	color: var(--text);
	border-color: var(--text-muted);
}

/* Action bar (Delete/Edit ↔ Cancel/Save) */
.bd-action-bar {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--s4);
	margin-bottom: var(--s2);
}

.bd-default-actions:not([hidden]),
.bd-edit-actions:not([hidden]) {
	display: flex;
	gap: var(--s2);
	align-items: center;
}

.bd-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 4px 12px;
	font-size: 0.8125rem;
	font-family: var(--font);
	cursor: pointer;
	color: var(--text-muted);
	line-height: 1.4;
}

.bd-action-btn:hover {
	color: var(--text);
	border-color: var(--text-muted);
}

.bd-action-btn--danger:hover {
	color: #dc2626;
	border-color: #dc2626;
}

.bd-action-btn--primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}

.bd-action-btn--primary:hover {
	opacity: 0.88;
	color: #fff;
}

.btn-sm {
	padding: var(--s1) var(--s4);
	font-size: 0.875rem;
}

[data-field][contenteditable="true"] {
	outline: none;
	cursor: text;
}

[data-field][contenteditable="true"]:focus,
.bd-notes[contenteditable="true"]:focus {
	outline: 2px solid var(--accent);
	outline-offset: 4px;
	border-radius: 4px;
}

[data-field].is-empty[contenteditable="true"]::before {
	content: attr(data-empty);
	color: var(--text-muted);
	opacity: 0.5;
	pointer-events: none;
}

.artifact-detail.is-editing .bd-notes:empty {
	display: block;
	min-height: 48px;
}


.artifact-image {
	line-height: 0.8125rem;
}

.layout-grid .artifact-image,
.layout-masonry .artifact-image {
	aspect-ratio: 3/2;
}


/* Shared artifact info block (.art-*) */
.art-meta-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: var(--s1) var(--s4);
	margin-top: var(--s1);
}

.art-updated-at,
.art-credit,
.art-meta {
	font-size: 0.8125rem;
	color: var(--text-muted);
}
.art-credit a { color: var(--text-muted); }
.art-credit a:hover { color: var(--text); }

.art-updated-at {
	margin-top: var(--s1);
}

.art-description {
	font-size: 0.9375rem;
    margin-top: var(--s2);
    white-space: nowrap;
    color: black;
}

.art-title {
	font-size: 0.9375rem;
	font-weight: 400;
	line-height: 1.4;
	margin-top: var(--s3);
	text-wrap: balance;
}

.art-title a { 
	color: var(--text);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
}

.art-title a:hover { color: var(--link); text-decoration: none; }

.art-source {
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-top: var(--s1);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	display: block;
}
.art-source a { color: var(--text-muted); }
.art-source a:hover { color: var(--link); }

.artifact-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: var(--s3);
	min-height: 30px;
}

.artifact-divider {
	border: none;
	border-top: 1px solid var(--border);
	margin: var(--s4) 0;
}

.artifact-actions {
	display: flex;
	align-items: center;
	gap: var(--s1);
	flex-shrink: 0;
	padding-top: 2px;
}

.artifact-action-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text-muted);
	cursor: pointer;
	padding: 0;
}
.artifact-action-btn:hover { color: var(--text); border-color: var(--text-muted); }
.artifact-action-btn.active { color: var(--accent); border-color: var(--accent); }
.artifact-action-btn--danger:hover { color: #dc2626; border-color: #dc2626; }

.form-row {
	display: flex;
	gap: var(--s3);
	align-items: center;
}

.btn-secondary {
	display: inline-flex;
	align-items: center;
	padding: var(--s2) var(--s5);
	background: none;
	color: var(--text-muted);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-size: 0.9375rem;
	font-family: var(--font);
	cursor: pointer;
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); text-decoration: none; }

.btn-danger {
	display: inline-flex;
	align-items: center;
	padding: var(--s2) var(--s5);
	background: none;
	color: #dc2626;
	border: 1px solid #dc2626;
	border-radius: var(--radius);
	font-size: 0.9375rem;
	font-family: var(--font);
	cursor: pointer;
}
.btn-danger:hover {
	background: color-mix(in srgb, #dc2626 8%, transparent);
	text-decoration: none;
}

/* Edit page layout */
.artifact-edit-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--s8);
	align-items: start;
}

.artifact-image--thumb img {
	max-height: 260px;
	max-width: 100%;
	width: auto;
	display: block;
	border-radius: var(--radius);
	margin-bottom: var(--s4);
}

.edit-back-link { margin-top: var(--s5); }

/* Layout controls */
.layout-controls {
	display: flex;
	gap: var(--s1);
	justify-content: flex-end;
	margin-bottom: var(--s4);
}

.layout-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	background: none;
	border: 1px solid var(--border);
	border-radius: 4px;
	color: var(--text-muted);
	cursor: pointer;
	padding: 0;
}
.layout-btn:hover { color: var(--text); border-color: var(--text-muted); }
.layout-btn.active { color: var(--accent); border-color: var(--accent); }

/* Artifact list */
.list { list-style: none; }

.artifact-list {
	list-style: none;
	margin-top: 3.4em;
}

.artifact-item {
	max-width: 620px;
	padding: var(--s5) 0;
	border-bottom: 1px solid var(--border);
}

.artifact-item:first-child {
	padding-top: 0;
}

.artifact-title-row {
	margin-bottom: var(--s1);
	line-height: 1.4;
}

.artifact-meta {
	display: flex;
	align-items: center;
	gap: var(--s3);
	margin-bottom: var(--s1);
	font-size: 0.8125rem;
}

.artifact-handle {
	color: var(--text-muted);
	font-weight: 500;
}

.artifact-handle:hover {
	color: var(--text);
	text-decoration: none;
}

.artifact-domain {
	color: var(--text-muted);
}

.artifact-title {
	display: block;
	font-size: 0.9375rem;
	font-weight: 500;
	color: var(--text);
	line-height: 1.4;
}

.artifact-title:hover {
	color: var(--link);
	text-decoration: none;
}

.artifact-year {
	font-size: 0.75rem;
	color: var(--text-muted);
	/* background: var(--bg-alt); */
	border: 1px solid var(--border);
	border-radius: 99px;
	padding: 1px 7px;
	margin-left: var(--s2);
	vertical-align: middle;
}

.artifact-unlisted {
	font-size: 0.75rem;
	padding: 1px 6px;
	border: 1px solid var(--border);
	border-radius: 99px;
	color: var(--text-muted);
}

.artifact-desc {
	font-size: 0.875rem;
	color: var(--text);
	line-height: 1.5;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
}

.artifact-footer {
	display: flex;
	align-items: center;
	margin-top: var(--s2);
	gap: var(--s3);
}

.artifact-attribution {
	font-size: 0.8125rem;
	color: var(--text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.artifact-ago {
	font-size: 0.8125rem;
	color: var(--text-muted);
	white-space: nowrap;
	flex-shrink: 0;
}

.artifact-ago:hover {
	color: var(--text);
	text-decoration: none;
}

.artifact-tags {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s2);
	margin-top: var(--s2);
}

.tag {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.artifact-loading {
	color: var(--text-muted);
	font-size: 0.9375rem;
	padding: var(--s8) 0;
}

.artifact-more {
	padding: var(--s6) 0;
}

.btn-load-more {
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: var(--s2) var(--s5);
	font-size: 0.875rem;
	font-family: var(--font);
	color: var(--text-muted);
	cursor: pointer;
}

.btn-load-more:hover {
	border-color: var(--text-muted);
	color: var(--text);
}

.btn-load-more:disabled {
	opacity: 0.5;
	cursor: default;
}

/* Artifact card grid */
.artifact-grid {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 272px));
	gap: var(--s4);
	margin-top: var(--s8);
}

.artifact-card {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background: var(--bg);
}

.artifact-card-media {
	position: relative;
	display: block;
	aspect-ratio: 5 / 6;
	flex-shrink: 0;
	overflow: hidden;
	text-decoration: none;
}

.artifact-card-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.2s ease;
}

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

.artifact-card-bg {
	width: 100%;
	height: 100%;
}

.artifact-card-type {
	position: absolute;
	top: 8px;
	right: 8px;
	background: rgba(0,0,0,0.58);
	color: #fff;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 2px 7px;
	border-radius: 99px;
	line-height: 1.6;
}

.artifact-card-body {
	flex: 1;
	padding: var(--s3) var(--s4);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 0;
}

.artifact-card-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	margin-bottom: var(--s2);
	overflow: hidden;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.45;
	color: var(--text);
	flex: 1;
	text-decoration: none;
}

.artifact-card-title:hover {
	color: var(--link);
}

.artifact-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--s2);
	/* margin-top: var(--s2); */
	flex-shrink: 0;
}

.artifact-card-credit {
	font-size: 0.75rem;
	color: var(--text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.artifact-card-ago {
	font-size: 0.75rem;
	color: var(--text-muted);
	white-space: nowrap;
	flex-shrink: 0;
	text-decoration: none;
}

.artifact-card-ago:hover {
	color: var(--text);
}

/* Image-type card: media fills the full card, footer sits below */
.artifact-card--image .artifact-card-media {
	flex: 1;
	/* aspect-ratio: unset; */
}

.artifact-card--image .artifact-card-body {
	flex: 0 0 auto;
}

.artifact-card--image .artifact-card-type {
	display: none;
}

.item {
	width: 100%;
	max-width: 620px;
	padding: var(--s5) 0;
	border-bottom: 1px solid var(--border);
}
.item:first-child { padding-top: 0; }


.meta {
	margin-top: var(--s1);
	font-size: 0.8125rem;
	color: var(--text-muted);
	display: flex;
	align-items: center;
	gap: var(--s3);
	flex-wrap: wrap;
}
.meta a { color: var(--text-muted); }
.meta a:hover { color: var(--link); text-decoration: none; }

.color-swatches { display: inline-flex; gap: 0; align-items: center; }
.color-swatch { display: inline-block; width: 22px; height: 22px; border-radius: 1px; }

.desc {
	margin-top: var(--s2);
	font-size: 0.875rem;
	color: var(--text-muted);
	line-height: 1.5;
}

.tags {
	margin-top: var(--s2);
	display: flex;
	flex-wrap: wrap;
	gap: var(--s2);
}
.tags a {
	font-size: 0.75rem;
	color: var(--text-muted);
}
.tags a:hover { color: var(--link); text-decoration: none; }

.actions { margin-top: var(--s3); }

.btn-save {
	font-size: 0.8125rem;
	padding: 3px var(--s3);
	background: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text-muted);
	cursor: pointer;
	font-family: var(--font);
	transition: border-color 0.1s, color 0.1s;
}
.btn-save:hover { border-color: var(--accent); color: var(--accent); }

.btn-delete {
	font-size: 0.8125rem;
	color: var(--text-muted);
}
.btn-delete:hover { color: #dc2626; text-decoration: none; }

/* Empty / pagination */
.empty { color: var(--text-muted); padding: var(--s8) 0; font-size: 0.9375rem; }
.pagination { padding: var(--s6) 0; font-size: 0.875rem; color: var(--text-muted); }

/* Forms */
.form-stack { display: flex; flex-direction: column; gap: var(--s5); max-width: 480px; }

.form-group { display: flex; flex-direction: column; gap: var(--s2); }

label { font-size: 0.875rem; font-weight: 500; color: var(--text); }

input[type="text"],
input[type="url"],
input[type="password"],
textarea {
	width: 100%;
	padding: var(--s2) var(--s3);
	font-size: 0.9375rem;
	font-family: var(--font);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	line-height: 1.5;
}
input:focus, textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: -1px;
	border-color: transparent;
}

textarea { resize: vertical; min-height: 80px; }

.form-hint { font-size: 0.8125rem; color: var(--text-muted); }

.error { color: #dc2626; font-size: 0.875rem; }

.btn-primary {
	display: inline-flex;
	align-items: center;
	gap: var(--s2);
	padding: var(--s2) var(--s5);
	background: var(--accent);
	color: #fff;
	border: none;
	border-radius: var(--radius);
	font-size: 0.9375rem;
	font-family: var(--font);
	font-weight: 500;
	cursor: pointer;
	align-self: flex-start;
}
.btn-primary:hover { background: var(--accent-h); color: #fff; text-decoration: none; }

.form-footer { font-size: 0.875rem; color: var(--text-muted); }

/* Bookmarklet install */
.bm-install { margin-top: var(--s8); }
.bm-heading  { font-size: 0.9375rem; margin-bottom: var(--s3); }
.bm-drag-link {
	display: inline-block;
	margin-top: var(--s1);
	padding: 5px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-size: 0.8125rem;
	cursor: grab;
	user-select: none;
}
.bm-steps { padding-left: 1.25rem; margin: var(--s2) 0 var(--s4); line-height: 1.8; }
.bm-copy-block { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s3); }
.bm-code {
	width: 100%;
	font: 0.75rem/1.5 monospace;
	padding: var(--s2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-alt);
	color: var(--text);
	resize: none;
	box-sizing: border-box;
	word-break: break-all;
}
.bm-copy-btn {
	align-self: flex-start;
	padding: 6px 14px;
	font-size: 0.8125rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--text);
	cursor: pointer;
}
.bm-copy-btn:hover { background: var(--bg-alt); }

/* Desktop: hide mobile steps; mobile: hide drag link */
@media (hover: hover) and (pointer: fine) {
	.bm-mobile,
	.bm-copy-block { display: none; }
}
@media (hover: none), (pointer: coarse) {
	.bm-desktop { display: none; }
}

/* Auth page */
.auth-wrap {
	max-width: 360px;
	margin: var(--s8) auto;
	padding: 0 var(--s4);
}

/* Responsive */
@media (max-width: 720px) {
	.menu-toggle { display: flex; }

	.app { flex-direction: column; }

	.app-sidebar {
		width: 100%;
		height: auto;
		position: sticky;
		top: 0;
		z-index: 100;
		background: var(--bg);
		border-right: none;
		overflow-y: visible;
	}


	.sidebar {
		display: none;
		position: fixed;
		inset: 0 auto 0 0;
		width: 280px;
		background: var(--bg);
		border-right: 1px solid var(--border);
		padding-top: var(--s8);
		z-index: 200;
		box-shadow: 4px 0 16px rgba(0,0,0,.08);
	}
	.sidebar.is-open { display: flex; }

	.main-content { padding: var(--s5) var(--s4); }

	.app-right { display: none; }

	.artifact-edit-layout { grid-template-columns: 1fr; }
}

/* Grid layout */
.layout-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--s4);
	max-width: none;
}
.layout-grid .item {
	max-width: none;
	padding: 0;
	border-bottom: none;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}
.layout-grid .item:first-child { padding-top: 0; }
.layout-grid .artifact-image {
	aspect-ratio: 4/3;
	overflow: hidden;
	background: var(--bg-alt);
}


.layout-grid .artifact-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.layout-grid .artifact-image a { display: block; height: 100%; }
.layout-grid .title { padding: var(--s2) var(--s3) 0; font-size: 0.8125rem; }
.layout-grid .meta  { padding: var(--s1) var(--s3) var(--s3); }
.layout-grid .desc,
.layout-grid .tags  { display: none; }

@media (max-width: 1024px) { .layout-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .layout-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1400px) { .layout-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1800px) { .layout-grid { grid-template-columns: repeat(6, 1fr); } }

.layout-grid .art-title,
.layout-grid .art-meta-row {
	padding: 0 var(--s2) 0 var(--s2);
}

.layout-grid .art-title {
	margin-top: var(--s1);
	padding-bottom: var(--s2);
	font-size: 0.8125rem;
}

.layout-grid .art-meta span,
.layout-grid .art-credit,
.layout-grid .art-description,
.layout-grid .art-updated-at,
/* .layout-grid .art-title, */
.layout-grid .art-source {
    display: none;
}

/* Masonry layout */

.layout-masonry {
	columns: 4;
	column-gap: var(--s4);
	max-width: none;
}
.layout-masonry .item {
	max-width: none;
	break-inside: avoid;
	padding: 0;
	border-bottom: none;
	margin-bottom: var(--s4);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}
.layout-masonry .artifact-image img {
	width: 100%;
	height: auto;
	max-height: none;
	object-fit: unset;
	display: block;
}
.layout-masonry .title { padding: var(--s2) var(--s3) 0; font-size: 0.8125rem; }
.layout-masonry .meta  { padding: var(--s1) var(--s3) var(--s3); }
.layout-masonry .desc,
.layout-masonry .tags  { display: none; }

@media (max-width: 1024px) { .layout-masonry { columns: 3; } }
@media (max-width: 600px)  { .layout-masonry { columns: 2; } }
@media (min-width: 1400px) { .layout-masonry { columns: 5; } }
@media (min-width: 1800px) { .layout-masonry { columns: 6; } }

.layout-masonry .art-meta-row {
	padding: 0 var(--s2) var(--s1) var(--s2);
}

.layout-masonry .art-meta span,
.layout-masonry .art-description,
.layout-masonry .art-credit,
.layout-masonry .art-title,
.layout-masonry .art-updated-at,
.layout-masonry .art-source {
	display: none;
}

/* *** */

.artifact-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: calc(100vh - var(--s4));
    object-fit: contain;
    object-position: left top;
}

/* Collections rail */
.collections-rail-wrap {
	position: relative;
	margin-bottom: var(--s1);
}
.collections-rail-wrap.is-compact {
	position: fixed;
	top: 0;
	left: var(--sidebar);
	right: 0;
	z-index: 10;
	background: var(--bg);
	padding: var(--s2) var(--s8);
	box-shadow: 0 1px 0 var(--border);
	animation: rail-slide-in 0.18s ease forwards;
}

@media (max-width: 720px) {
	.collections-rail-wrap.is-compact {
		left: 0;
		z-index: 99;
		padding-left: var(--s4);
		padding-right: var(--s4);
	}
}

@keyframes rail-slide-in {
	from { transform: translateY(-100%); }
	to   { transform: translateY(0); }
}

.collections-rail-wrap::after {
	content: '';
	position: absolute;
	top: 0; right: 0; bottom: 0;
	width: 40px;
	background: linear-gradient(to right, transparent, var(--bg));
	pointer-events: none;
}

.collections-rail {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s3);
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	/* padding-bottom: var(--s2); */
}
.collections-rail::-webkit-scrollbar { display: none; }

.collection-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--s2);
	text-decoration: none;
	flex-shrink: 0;
	width: 100px;
}
.collection-card:hover { text-decoration: none; }

.collection-card-cover {
	width: 100px;
	height: 100px;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--bg-alt);
	border: 2px solid var(--bg);
	transition: border-color 0.15s, box-shadow 0.15s;
}
.collection-card:hover .collection-card-cover {
	border-color: var(--text-muted);
	box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.collection-card--active .collection-card-cover {
	border-color: var(--accent);
	/* box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); */
}

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

.collection-card-cover--new {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--text-muted);
	border-style: dashed;
	border-color: var(--border);
}

.collection-card-title {
	font-size: 0.75rem;
	color: var(--text-muted);
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100px;
	line-height: 1.3;
}
.collection-card--active .collection-card-title { color: var(--accent); }

/* Compact rail (fixed scroll state) */
.is-compact .collections-rail      { flex-wrap: nowrap; gap: var(--s2); padding-bottom: 0; }
.is-compact .collection-card       { width: 60px; gap: var(--s1); }
.is-compact .collection-card-cover { width: 60px; height: 60px; }
.is-compact .collection-card-title { display: none; }

/* Collection management list */
.edit-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: var(--s5);
}

.form-inline-create {
	margin-bottom: var(--s6);
}

.form-inline-create .form-row input[type="text"] {
	flex: 1;
	padding: var(--s2) var(--s3);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-size: 0.9375rem;
	font-family: var(--font);
	background: var(--bg);
	color: var(--text);
}

.collection-manage-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.collection-manage-item {
	display: flex;
	align-items: center;
	gap: var(--s3);
	padding: var(--s3) 0;
	border-bottom: 1px solid var(--border);
}

.collection-manage-name {
	font-weight: 500;
	color: var(--text);
	flex: 1;
}
.collection-manage-name:hover { text-decoration: underline; }

.collection-manage-slug {
	font-size: 0.8125rem;
	color: var(--text-muted);
	font-family: monospace;
}

.badge {
	font-size: 0.6875rem;
	padding: 2px 6px;
	border-radius: 99px;
	border: 1px solid var(--border);
	color: var(--text-muted);
	white-space: nowrap;
}

.btn-sm {
	padding: var(--s1) var(--s3);
	font-size: 0.8125rem;
}

.form-hint {
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-top: var(--s1);
}

/* Drag and drop */
.item.is-dragging { opacity: 0.5; }

.collection-card.drag-over .collection-card-cover {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

.collection-card.drop-success .collection-card-cover {
	border-color: #16a34a;
	box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 25%, transparent);
	transition: border-color 0.2s, box-shadow 0.2s;
}

/* Artifact detail — collection membership */
.artifact-collections {
	margin-top: var(--s5);
	padding-top: var(--s4);
	border-top: 1px solid var(--border);
}

.artifact-collections-label {
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-bottom: var(--s3);
}

.artifact-collections-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s2);
}

.collection-membership-form { display: contents; }

.collection-membership-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--s2);
	padding: var(--s1) var(--s3);
	border: 1px solid var(--border);
	border-radius: 99px;
	background: none;
	font-size: 0.8125rem;
	font-family: var(--font);
	color: var(--text-muted);
	cursor: pointer;
	transition: border-color 0.15s, color 0.15s;
}
.collection-membership-btn:hover { border-color: var(--text-muted); color: var(--text); }
.collection-membership-btn.is-member { border-color: var(--accent); color: var(--accent); }
.collection-membership-btn.is-member:hover { border-color: #dc2626; color: #dc2626; }

.collection-membership-indicator { font-size: 0.75rem; }

/* Collection checkboxes on artifact edit */
.collection-checkboxes {
	display: flex;
	flex-direction: column;
	gap: var(--s2);
}

.collection-checkbox-item {
	display: flex;
	align-items: center;
	gap: var(--s2);
	font-size: 0.9375rem;
	cursor: pointer;
}

/* Remove from collection button */
.btn-remove {
	font-size: 0.8125rem;
	color: var(--text-muted);
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	font-family: var(--font);
}
.btn-remove:hover { color: #dc2626; text-decoration: underline; }

/* Collection page header */
.collection-header {
	margin-bottom: var(--s6);
}

.collection-cover {
	margin-bottom: var(--s4);
}

.collection-cover img {
	max-height: 240px;
	max-width: 100%;
	border-radius: var(--radius);
	display: block;
}

.collection-header-row {
	display: flex;
	align-items: baseline;
	gap: var(--s3);
	margin-bottom: var(--s2);
}

.collection-name {
	font-size: 1.375rem;
	font-weight: 600;
}

.collection-desc {
	color: var(--text-muted);
	margin-bottom: var(--s2);
}

/* Development */

.artifact-detail pre {
    font-size: 10px;
    line-height: 14px;
    width: 100%;
    /* max-width: 600px; */
    overflow: scroll;
    border: 1px solid #ccc;
    padding: 4px;
    margin: 1em 0;
}

/* Landing page */

/* When no sidebar, strip main-content padding so landing sections control their own */
.app:not(:has(.app-sidebar)) .main-content {
	padding: 0;
}

.landing-hero {
	padding: var(--s8) var(--s4);
	padding-top: calc(var(--s8) * 2);
	text-align: center;
	border-bottom: 1px solid var(--border);
	margin-bottom: var(--s8);
}

.hero-logo-link {
	display: inline-block;
	margin-bottom: var(--s5);
}

.hero-logo {
	width: 88px;
	height: 100px;
	display: block;
	image-rendering: pixelated;
}

.hero-name {
	font-size: 2rem;
	font-weight: 700;
	letter-spacing: -1px;
	margin-bottom: var(--s3);
}

.hero-tagline {
	font-size: 0.9375rem;
	color: var(--text-muted);
	line-height: 1.6;
	margin-bottom: var(--s6);
}

.hero-tagline span {
	text-transform: uppercase;
	font-size: 0.78rem;
	font-weight: bold;
}

.hero-cta {
	display: inline-block;
	font-size: 0.9375rem;
}

.landing-feed {
	max-width: 1300px;
	margin: 0 auto;
	padding: 0 var(--s8);
}

.sign-in-form {
	max-width: 380px;
	margin: 0 auto;
	padding: var(--s1) var(--s4) calc(var(--s8) * 2);
}

#landing-signin-form { display: none; }

body.is-signing-in .landing-hero {
    border-bottom: 0;
    margin-bottom: 0;
}

body.is-signing-in #landing-signin-form { display: block; }

body.is-signing-in #hero-signin-btn { display: none; }

.landing-feed .list.layout-masonry {
	padding-top: 0;
}

.landing-image-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
	gap: 3px;
	list-style: none;
	padding: 0;
	margin: 0;
}

.landing-image-item {
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
}

.landing-image-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity 0.15s;
}

.landing-image-item:hover img { opacity: 0.85; }

.landing-image-item--portrait {
	aspect-ratio: auto;
}

.landing-image-item--portrait img {
	height: auto;
	object-fit: fill;
}


/* Collection grid */

.coll-page-header {
	display: flex;
	align-items: baseline;
	margin-bottom: var(--s5);
}

.coll-create-form {
	display: flex;
	gap: var(--s2);
	margin-bottom: var(--s7);
}

.coll-create-form input[type="text"] {
	flex: 1;
	max-width: 300px;
	padding: var(--s2) var(--s3);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-size: 0.9375rem;
	font-family: var(--font);
	background: var(--bg);
	color: var(--text);
}

.coll-create-form input[type="text"]:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
	border-color: transparent;
}

.coll-section + .coll-section {
	margin-top: var(--s7);
}

.coll-section-head {
	font-size: 0.6875rem;
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: .06em;
	margin-bottom: var(--s4);
}

.coll-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: var(--s4);
}

.coll-item {
	position: relative;
}

.coll-cover-link {
	display: block;
	text-decoration: none;
	border-radius: var(--radius);
	overflow: hidden;
}

.coll-cover {
	position: relative;
	aspect-ratio: 2 / 3;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--bg-alt);
}

.coll-cover img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.coll-cover-link:hover .coll-cover {
	opacity: 0.88;
}

.coll-cover-foot {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: var(--s6) var(--s3) var(--s3);
	background: linear-gradient(transparent, rgba(0,0,0,.6));
}

.coll-badge {
	display: inline-block;
	font-size: 0.625rem;
	font-weight: 600;
	padding: 1px 6px;
	border-radius: 99px;
	background: rgba(255,255,255,.2);
	color: #fff;
	text-transform: uppercase;
	letter-spacing: .04em;
	margin-bottom: var(--s1);
}

.coll-name {
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.25;
	margin: 0 0 2px;
	color: #fff;
	word-break: break-word;
}

.coll-count {
	font-size: 0.75rem;
	color: rgba(255,255,255,.75);
}

.coll-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--s2) 2px 0;
}

.coll-fav-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
	color: var(--text-muted);
	border-radius: 4px;
	transition: color .15s;
}

.coll-fav-btn:hover {
	color: var(--text);
}

.coll-fav-btn.is-active {
	color: #f59e0b;
}

.coll-fav-btn.is-active .icon {
	fill: currentColor;
}

.coll-edit-link {
	font-size: 0.8125rem;
	color: var(--text-muted);
	text-decoration: none;
}

.coll-edit-link:hover {
	color: var(--link);
}

.coll-empty {
	color: var(--text-muted);
	font-size: 0.9375rem;
	padding: var(--s8) 0;
}

/* Collection detail */

.coll-detail-heading-row {
	display: flex;
	align-items: baseline;
	gap: var(--s4);
}

.coll-detail-meta {
	display: flex;
	align-items: center;
	gap: var(--s3);
	margin-top: var(--s1);
	margin-bottom: var(--s2);
	font-size: 0.8125rem;
	color: var(--text-muted);
}

.coll-badge-inline {
	display: inline-block;
	font-size: 0.6875rem;
	font-weight: 600;
	padding: 1px 7px;
	border-radius: 99px;
	border: 1px solid var(--border);
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: .04em;
}

.btn-link-sm {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.8125rem;
	color: var(--text-muted);
	text-decoration: none;
	white-space: nowrap;
}

.btn-link-sm:hover {
	color: var(--link);
}

.sort-control {
	font-size: 0.8125rem;
	color: var(--text-muted);
	margin-bottom: var(--s4);
}

.sort-control strong {
	font-weight: 600;
	color: var(--text);
}

.sort-control a {
	color: var(--text-muted);
}

.sort-control a:hover {
	color: var(--link);
}

/* Sidebar sub-nav */

.nav-sub {
	padding: 2px 0 var(--s2) var(--s6);
	display: flex;
	flex-direction: column;
	gap: 1px;
	margin-top: -2px;
}

.nav-sub-item {
	font-size: 0.8125rem;
	color: var(--text-muted);
	text-decoration: none;
	padding: 3px var(--s2);
	border-radius: var(--radius);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	display: block;
}

.nav-sub-item:hover {
	color: var(--text);
	background: var(--bg-hover);
}

.nav-sub-item.active {
	color: var(--text);
	font-weight: 500;
}

/* Collection edit page */

.edit-section {
	margin-top: var(--s7);
	padding-top: var(--s6);
	border-top: 1px solid var(--border);
}

.edit-section--danger .edit-section-label {
	color: var(--danger, #dc2626);
}

.edit-section-label {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: var(--text-muted);
	margin-bottom: var(--s3);
}

.coll-fav-btn--labeled {
	display: inline-flex;
	align-items: center;
	gap: var(--s2);
	padding: var(--s2) var(--s3);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
	cursor: pointer;
	font-size: 0.875rem;
	color: var(--text-muted);
	width: auto;
	height: auto;
	transition: color .15s, border-color .15s;
}

.coll-fav-btn--labeled:hover {
	color: var(--text);
	border-color: var(--text-muted);
}

.coll-fav-btn--labeled.is-active {
	color: #f59e0b;
	border-color: #f59e0b;
}

.coll-fav-btn--labeled.is-active .icon {
	fill: currentColor;
}

.coll-edit-cover {
	width: 80px;
	aspect-ratio: 2 / 3;
	border-radius: var(--radius);
	overflow: hidden;
	margin-bottom: var(--s2);
}

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

.coll-edit-items {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.coll-edit-item {
	display: flex;
	align-items: center;
	gap: var(--s3);
	padding: var(--s2) 0;
	border-bottom: 1px solid var(--border);
}

.coll-edit-item-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.coll-edit-item-title {
	font-size: 0.875rem;
	color: var(--text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.coll-edit-item-domain {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.coll-edit-remove-btn {
	flex-shrink: 0;
	font-size: 0.75rem;
	color: var(--text-muted);
	background: none;
	border: none;
	cursor: pointer;
	padding: 2px var(--s2);
	border-radius: var(--radius);
}

.coll-edit-remove-btn:hover {
	color: var(--danger, #dc2626);
	background: var(--bg-alt);
}
