:root {
	--bg: #f3f0e8;
	--panel: #fffaf0;
	--ink: #172114;
	--ink-soft: #3e4a3a;
	--accent: #0f766e;
	--accent-warm: #c86f3f;
	--line: #d8d2c3;
	--ok: #3f8f4f;
	--radius: 16px;
	--shadow: 0 10px 30px rgba(16, 29, 18, 0.12);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: "Space Grotesk", "Segoe UI", sans-serif;
	color: var(--ink);
	background:
		radial-gradient(circle at 12% 12%, rgba(200, 111, 63, 0.18), transparent 34%),
		radial-gradient(circle at 88% 0%, rgba(15, 118, 110, 0.16), transparent 30%),
		linear-gradient(180deg, #f8f4eb, #f3f0e8 60%);
	min-height: 100vh;
}

.page {
	width: min(1120px, 92vw);
	margin: 0 auto;
	padding: 2.2rem 0 3.2rem;
}

.hero {
	display: grid;
	grid-template-columns: 1.2fr .8fr;
	gap: 1.2rem;
	align-items: stretch;
	margin-bottom: 1.6rem;
}

.hero-main,
.hero-panel,
.controls,
.catalog,
.add-form {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: linear-gradient(155deg, rgba(255, 250, 240, 0.95), rgba(255, 255, 255, 0.92));
	box-shadow: var(--shadow);
}

.hero-main {
	padding: 1.6rem;
	position: relative;
	overflow: hidden;
}

.hero-main::after {
	content: "";
	position: absolute;
	right: -48px;
	top: -32px;
	width: 168px;
	height: 168px;
	border-radius: 40% 60% 65% 35%;
	background: linear-gradient(160deg, rgba(15, 118, 110, 0.22), rgba(200, 111, 63, 0.26));
	transform: rotate(-8deg);
}

h1 {
	font-family: "Fraunces", Georgia, serif;
	font-size: clamp(2rem, 5vw, 3.3rem);
	line-height: 1.04;
	margin: 0 0 .6rem;
	max-width: 18ch;
}

.tagline {
	margin: 0 0 1.2rem;
	max-width: 46ch;
	color: var(--ink-soft);
	line-height: 1.5;
}

.pill-row {
	display: flex;
	flex-wrap: wrap;
	gap: .55rem;
}

.pill {
	border: 1px solid rgba(23, 33, 20, 0.16);
	border-radius: 999px;
	padding: .3rem .72rem;
	font-size: .85rem;
	background: rgba(255, 255, 255, 0.76);
}

.hero-panel {
	padding: 1.4rem;
	display: grid;
	gap: .8rem;
	align-content: center;
	position: relative;
}

.stat {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	border-bottom: 1px dashed rgba(23, 33, 20, 0.2);
	padding-bottom: .6rem;
}

.stat:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.stat-label {
	color: var(--ink-soft);
	font-size: .93rem;
}

.stat-value {
	font-family: "Fraunces", Georgia, serif;
	font-size: 1.9rem;
	line-height: 1;
}

.controls {
	display: flex;
	flex-wrap: wrap;
	gap: .9rem;
	margin: 1.2rem 0;
	padding: .95rem;
	align-items: center;
}

.controls label {
	font-size: .82rem;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--ink-soft);
	display: grid;
	gap: .32rem;
}

.controls input,
.controls select,
.add-form input,
.add-form select,
.add-form textarea {
	width: 100%;
	border: 1px solid #b9b4a9;
	border-radius: 10px;
	background: #fffdfa;
	color: var(--ink);
	font: inherit;
	padding: .58rem .72rem;
}

.controls .group {
	flex: 1 1 170px;
}

.catalog {
	padding: 1rem;
}

.catalog-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: .8rem;
}

.catalog-head h2 {
	margin: 0;
	font-size: 1.15rem;
	letter-spacing: .02em;
}

.catalog-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: .8rem;
}

.card {
	position: relative;
	border: 1px solid #d2cbba;
	border-radius: 12px;
	padding: .9rem;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 247, 237, 0.92));
	transform: translateY(12px);
	opacity: 0;
	animation: rise-in .5s ease forwards;
}

.public-page .card {
	cursor: pointer;
}

.card.editing {
	border: 2px solid var(--accent);
	background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(15, 118, 110, 0.05));
	box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.card:nth-child(2) { animation-delay: .06s; }
.card:nth-child(3) { animation-delay: .12s; }
.card:nth-child(4) { animation-delay: .18s; }
.card:nth-child(5) { animation-delay: .24s; }
.card:nth-child(6) { animation-delay: .3s; }

.card-top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: .55rem;
}

.category {
	font-size: .74rem;
	text-transform: uppercase;
	letter-spacing: .08em;
	padding: .24rem .52rem;
	border-radius: 999px;
	border: 1px solid rgba(23, 33, 20, 0.15);
	background: rgba(255, 255, 255, 0.76);
}

.condition {
	font-size: .78rem;
	color: var(--ok);
	font-weight: 700;
}

.title {
	margin: 0;
	font-size: 1.03rem;
	font-weight: 700;
}

.card-photo {
	width: 100%;
	height: 138px;
	object-fit: cover;
	border-radius: 9px;
	margin-bottom: .65rem;
	border: 1px solid #d7cfbe;
	background: #efe8d9;
}

.meta {
	margin: .5rem 0 0;
	color: var(--ink-soft);
	font-size: .88rem;
	display: grid;
	gap: .2rem;
}

.note {
	margin-top: .55rem;
	padding-top: .5rem;
	border-top: 1px dashed rgba(23, 33, 20, 0.2);
	font-size: .86rem;
	color: #243220;
	line-height: 1.4;
	white-space: pre-wrap;
	word-break: break-word;
	display: -webkit-box;
	-webkit-line-clamp: 5;
	line-clamp: 5;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tags {
	margin-top: .5rem;
	font-size: .82rem;
	color: var(--ink-soft);
}

.collection {
	margin-top: .35rem;
	font-size: .82rem;
	color: var(--accent);
	font-weight: 600;
}

.layout {
	display: grid;
	grid-template-columns: 1.1fr .9fr;
	gap: 1rem;
	margin-top: 1rem;
}

.public-page .layout {
	grid-template-columns: 1fr;
}

.add-form {
	padding: 1rem;
	position: relative;
	transition: opacity .2s ease;
}

.add-form.form-busy {
	opacity: .5;
	pointer-events: none;
	user-select: none;
}

.add-form.form-busy::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: var(--radius);
	cursor: wait;
}

.add-form h2 {
	margin: 0 0 .7rem;
	font-size: 1.1rem;
}

.form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: .72rem;
}

.form-grid .full {
	grid-column: span 2;
}

.photo-upload-block {
	display: grid;
	gap: .5rem;
}

.upload-label {
	font-size: .95rem;
	font-weight: 700;
}

.photo-dropzone {
	border: 2px dashed #0f766e;
	border-radius: 12px;
	padding: .95rem;
	min-height: 118px;
	background: rgba(18, 158, 145, 0.08);
	text-align: center;
	display: grid;
	gap: .45rem;
	justify-items: center;
	transition: border-color .2s ease, background-color .2s ease;
}

.photo-dropzone p {
	margin: 0;
	font-size: .88rem;
	color: var(--ink-soft);
}

.photo-dropzone.drag-active {
	border-color: #0a5e57;
	background: rgba(18, 158, 145, 0.18);
}

.upload-button {
	border: 1px solid rgba(23, 33, 20, 0.22);
	background: #fff;
	color: var(--ink);
	box-shadow: none;
	padding: .45rem .9rem;
	font-size: .86rem;
}

.upload-button:hover {
	box-shadow: none;
	transform: none;
	background: #f7f4eb;
}

.photo-queue {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
	gap: .5rem;
}

.all-photos {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
	gap: .5rem;
	margin-bottom: 1rem;
}

.photo-thumb {
	position: relative;
	border-radius: 10px;
	overflow: hidden;
	border: 1px solid #c9c2b2;
	background: #f4eee0;
	aspect-ratio: 1 / 1;
}

.photo-thumb.existing {
	border: 2px solid var(--ok);
	opacity: 1;
}

.photo-thumb.pending {
	opacity: 0.75;
	border: 2px dashed var(--accent);
}

.photo-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.photo-remove {
	position: absolute;
	right: 5px;
	top: 5px;
	width: 22px;
	height: 22px;
	padding: 0;
	line-height: 1;
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, 0.2);
	font-size: .85rem;
	background: rgba(255, 255, 255, 0.92);
	color: #1a1a1a;
	box-shadow: none;
}

.photo-remove:hover {
	background: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	transform: scale(1.1);
}

.photo-delete-btn {
	position: absolute;
	right: 5px;
	top: 5px;
	width: 22px;
	height: 22px;
	padding: 0;
	line-height: 1;
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, 0.2);
	font-size: .85rem;
	background: rgba(255, 255, 255, 0.92);
	color: #c84545;
	box-shadow: none;
}

.photo-delete-btn:hover {
	background: #fff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	transform: scale(1.1);
}

button {
	border: none;
	border-radius: 999px;
	font: inherit;
	font-weight: 700;
	padding: .66rem 1rem;
	background: linear-gradient(135deg, var(--accent), #129e91);
	color: #f7fffd;
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease;
	box-shadow: 0 7px 18px rgba(11, 95, 88, 0.28);
}

button:hover {
	transform: translateY(-1px);
	box-shadow: 0 9px 20px rgba(11, 95, 88, 0.34);
}

button.primary {
	background: linear-gradient(135deg, var(--accent), #129e91);
}

button.secondary {
	background: #ccc;
	color: var(--ink);
	box-shadow: none;
}

button.secondary:hover {
	background: #bbb;
	box-shadow: none;
}

button.danger {
	background: #c84545;
	box-shadow: 0 7px 18px rgba(200, 69, 69, 0.28);
}

button.danger:hover {
	box-shadow: 0 9px 20px rgba(200, 69, 69, 0.34);
}

.card-edit-btn {
	position: absolute;
	top: .5rem;
	right: .5rem;
	width: 30px;
	height: 30px;
	padding: 0;
	line-height: 1;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--ink);
	font-size: 1.3rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	z-index: 10;
	opacity: 0;
	transition: opacity .2s ease, transform .2s ease;
}

.card:hover .card-edit-btn {
	opacity: 1;
}

.card-edit-btn:hover {
	background: #fff;
	transform: scale(1.1);
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
	}

.card-dupe-btn {
	position: absolute;
	top: .5rem;
	right: 2.4rem;
	width: 30px;
	height: 30px;
	padding: 0;
	line-height: 1;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--ink-soft);
	font-size: 1rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	z-index: 10;
	opacity: 0;
	transition: opacity .2s ease, transform .2s ease;
}

.card:hover .card-dupe-btn {
	opacity: 1;
}

.card-dupe-btn:hover {
	background: #fff;
	transform: scale(1.1);
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.card {
	position: relative;
}

.form-buttons {
	display: flex;
	gap: .5rem;
	flex-wrap: wrap;
}

.form-buttons button {
	flex: 1;
	min-width: 120px;
}


.form-message {
	margin: .8rem 0 0;
	min-height: 1.2rem;
	color: #2d6f3a;
	font-size: .88rem;
	font-weight: 600;
}

.catalog-pagination {
	margin-top: .9rem;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: .7rem;
	flex-wrap: wrap;
}

.catalog-pagination button {
	min-width: 110px;
}

#pageIndicator {
	font-size: .86rem;
	color: var(--ink-soft);
}

.empty {
	padding: 1.3rem;
	text-align: center;
	color: var(--ink-soft);
	border: 1px dashed #c8c2b3;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.5);
}

.image-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(17, 48, 92, 0.72);
	backdrop-filter: blur(2px);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	z-index: 9999;
}

.image-lightbox.open {
	display: flex;
}

.image-lightbox-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.2rem;
	max-width: min(94vw, 800px);
}

.image-lightbox-image-wrap {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
}

.image-lightbox-image {
	max-width: 100%;
	max-height: 70vh;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
	background: #fff;
}

.image-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 2.4rem;
	height: 2.4rem;
	border: 0;
	border-radius: 999px;
	background: rgba(7, 18, 43, 0.72);
	color: #fff;
	font-size: 1.7rem;
	line-height: 1;
	display: none;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background .2s ease;
	z-index: 1;
}

.image-lightbox-nav:hover {
	transform: translateY(-50%);
	background: rgba(7, 18, 43, 0.9);
	box-shadow: none;
}

.image-lightbox-nav-prev {
	left: .7rem;
}

.image-lightbox-nav-next {
	right: .7rem;
}

.image-lightbox-counter {
	position: absolute;
	left: 50%;
	bottom: .7rem;
	transform: translateX(-50%);
	padding: .2rem .55rem;
	border-radius: 999px;
	font-size: .78rem;
	color: #fff;
	background: rgba(7, 18, 43, 0.7);
	letter-spacing: .02em;
}

.image-lightbox-content {
	background: rgba(255, 255, 255, 0.95);
	border-radius: 12px;
	padding: 1.4rem;
	max-width: 100%;
	text-align: center;
}

.image-lightbox-title {
	margin: 0 0 0.8rem;
	font-size: 1.3rem;
	color: var(--ink);
	font-family: "Fraunces", Georgia, serif;
}

.image-lightbox-notes {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.6;
	color: var(--ink-soft);
	white-space: pre-wrap;
	word-break: break-word;
}

@keyframes rise-in {
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

@media (max-width: 940px) {
	.hero,
	.layout {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.page {
		width: min(1120px, 94vw);
		padding-top: 1.1rem;
	}

	.form-grid,
	.form-grid .full {
		grid-template-columns: 1fr;
		grid-column: span 1;
	}
}
