/*
 * Design 2.1: variation on the "mineral auction catalogue" direction —
 * adds a live "online since" clock, a simulated viewer count, per-lot
 * stock counts, and sold-out lots kept visible but marked.
 */

.mk-catalog {
	/* Shop-Palette = Hauptfarben der Seite (tokens.css); "green" heißt nur
	   noch historisch so und ist jetzt das Weinrot. */
	--mk-cat-bg: var(--bg);
	--mk-cat-ink: var(--ink);
	--mk-cat-green: var(--terracotta);
	--mk-cat-bronze: var(--taupe);
	--mk-cat-line: #d9cfbf;

	background: var(--mk-cat-bg);
	color: var(--mk-cat-ink);
	min-height: 100vh;
}

/* NavBar override: this page uses the shared navbar markup but needs the
   catalogue palette instead of the site's default cream/terracotta. */
.mk-catalog .mk-nav {
	background: rgba(246, 241, 231, 0.92);
	border-bottom-color: var(--mk-cat-line);
}
.mk-catalog .mk-nav__brand,
.mk-catalog .mk-nav__links,
.mk-catalog .mk-nav__toggle-bar {
	color: var(--mk-cat-ink);
}
.mk-catalog .mk-nav__toggle-bar {
	background: var(--mk-cat-ink);
}
.mk-catalog .mk-nav__mobile-menu {
	background: var(--mk-cat-bg);
	border-bottom-color: var(--mk-cat-line);
}
.mk-catalog .mk-nav__mobile-menu a {
	color: var(--mk-cat-ink);
}
.mk-catalog .mk-nav__dot {
	color: var(--mk-cat-green);
}

.mk-catalog .mk-footer {
	border-top-color: var(--mk-cat-line);
}
.mk-catalog .mk-footer__brand,
.mk-catalog .mk-footer__copyright {
	color: var(--mk-cat-ink);
}
.mk-catalog .mk-footer__links {
	color: var(--mk-cat-bronze);
}
.mk-catalog .mk-footer__links a:hover {
	color: var(--mk-cat-ink);
}

/* --- Header --- */

.mk-catalog__header {
	padding: 3rem 0 1.5rem;
	border-bottom: 1px solid var(--mk-cat-line);
}
@media (min-width: 768px) {
	.mk-catalog__header {
		padding: 4.5rem 0 2rem;
	}
}

.mk-catalog__header-row {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-bottom: 1rem;
}
@media (min-width: 640px) {
	.mk-catalog__header-row {
		flex-direction: row;
		align-items: baseline;
		justify-content: space-between;
		gap: 1.5rem;
	}
}

.mk-catalog__eyebrow {
	display: block;
	font-family: var(--font-body), sans-serif;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--mk-cat-green);
}

/* Static explanation (no live counter here anymore — the actual live count
   now lives per-product, see .mk-lot-detail__viewers on single-product.php). */
.mk-catalog__viewers-note {
	font-family: var(--font-body), sans-serif;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--mk-cat-bronze);
}

.mk-catalog__title {
	font-family: var(--font-display), serif;
	font-style: italic;
	font-weight: 900;
	font-size: 2.75rem;
	line-height: 0.95;
	letter-spacing: -0.02em;
	color: var(--mk-cat-ink);
	margin: 0 0 1.25rem;
}
@media (min-width: 640px) {
	.mk-catalog__title {
		font-size: 4rem;
	}
}
@media (min-width: 1024px) {
	.mk-catalog__title {
		font-size: 5.5rem;
	}
}

.mk-catalog__promo {
	max-width: 42rem;
	font-size: 0.9375rem;
	line-height: 1.65;
	color: var(--mk-cat-ink);
	opacity: 0.85;
}
@media (min-width: 768px) {
	.mk-catalog__promo {
		font-size: 1rem;
	}
}
.mk-catalog__promo a {
	color: var(--mk-cat-green);
	text-decoration: underline;
	font-weight: 600;
}

/* --- Toolbar (filters) --- */

.mk-catalog__toolbar {
	display: flex;
	flex-direction: row;
	gap: 0.75rem;
	padding: 1rem 0 1.5rem;
}

.mk-catalog__select {
	font-family: var(--font-body), sans-serif;
	font-size: 0.9375rem;
	color: var(--mk-cat-ink);
	background: var(--card);
	border: 1px solid var(--mk-cat-line);
	border-radius: 10px;
	padding: 0.85rem 1.1rem;
	flex: 1 1 0;
	min-width: 0;
}
.mk-catalog__select:focus {
	outline: 2px solid var(--mk-cat-green);
	outline-offset: 1px;
}

/* --- Live-Besucher-Badge: Beispiel-Icon im Header + je Kristall im Grid --- */

.mk-catalog__viewers-note {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}
.mk-catalog__viewers-example {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	/* kein backdrop-filter: mit pulsierendem Punkt wird er pro Frame neu berechnet — im Katalog x7, ließ die fixierte Versand-Leiste beim Scrollen ruckeln */
	background: rgba(28, 27, 25, 0.8);
	border-radius: 999px;
	padding: 0.375rem 0.75rem 0.375rem 0.625rem;
}
.mk-catalog__viewers-example svg {
	width: 0.8125rem;
	height: 0.8125rem;
	fill: #fff;
}
.mk-catalog__viewers-example span:last-child {
	font-size: 0.75rem;
	font-weight: 600;
	color: #fff;
}

.mk-lot__viewers {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	/* kein backdrop-filter: mit pulsierendem Punkt wird er pro Frame neu berechnet — im Katalog x7, ließ die fixierte Versand-Leiste beim Scrollen ruckeln */
	background: rgba(28, 27, 25, 0.8);
	border-radius: 999px;
	padding: 0.375rem 0.75rem 0.375rem 0.625rem;
}
.mk-lot__viewers-icon {
	width: 0.8125rem;
	height: 0.8125rem;
	fill: #fff;
	flex-shrink: 0;
}
.mk-lot__viewers [data-lot-viewers-count] {
	font-family: var(--font-body), sans-serif;
	font-size: 0.75rem;
	font-weight: 600;
	color: #fff;
}

/* --- Grid --- */

.mk-catalog__main {
	padding-block: 0.5rem 5rem;
}

.mk-catalog__grid {
	display: grid;
	/* immer mindestens 2 Spalten, auch auf dem Handy */
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: 1.5rem;
	row-gap: 3rem;
}
@media (min-width: 640px) {
	.mk-catalog__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}
@media (min-width: 1024px) {
	.mk-catalog__grid {
		grid-template-columns: repeat(3, 1fr);
		row-gap: 3.5rem;
	}
}

/* Staggered editorial rhythm: middle column in each row of 3 sits lower,
   avoiding the "identical card grid" default. */
@media (min-width: 1024px) {
	.mk-lot--2 {
		margin-top: 3rem;
	}
}

/* --- Lot (no card shell: hairline rule only, no shadow/border-radius) --- */

.mk-lot {
	position: relative;
	border-top: 1px solid var(--mk-cat-line);
	padding-top: 1.25rem;
}

/* "Kristall des Monats" (WooCommerce "Featured"-Häkchen, siehe
   inc/woo-integration.php) — deutlich erkennbare Umrandung + Label, steht
   im Hauptkatalog immer ganz vorne. */
.mk-lot--special {
	border: 2px solid var(--terracotta);
	border-top: 2px solid var(--terracotta);
	border-radius: 16px;
	padding: 1.25rem 1.25rem 1.5rem;
	background: rgba(122, 31, 43, 0.04);
}
.mk-lot__special-label {
	display: inline-block;
	margin-bottom: 0.75rem;
	padding: 0.375rem 0.875rem;
	border-radius: 999px;
	background: var(--terracotta);
	color: #fff;
	font-family: var(--font-body), sans-serif;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

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

.mk-lot__frame {
	aspect-ratio: 3 / 4; /* Produktfotos sind 3:4 */
	overflow: hidden;
	background: #e2ddd0;
	margin-bottom: 1.25rem;
}

.mk-lot__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: sepia(6%) saturate(92%);
	transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.mk-lot:hover .mk-lot__image {
	transform: scale(1.035);
}

.mk-lot__meta {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-family: var(--font-body), sans-serif;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--mk-cat-bronze);
	margin-bottom: 0.625rem;
}

.mk-lot__name {
	font-family: var(--font-display), serif;
	font-style: italic;
	font-weight: 600;
	font-size: 1.375rem;
	line-height: 1.15;
	color: var(--mk-cat-ink);
	margin: 0 0 1rem;
}

.mk-lot__variant {
	font-weight: 400;
	font-style: italic;
	color: var(--mk-cat-bronze);
}

.mk-lot__stock {
	font-family: var(--font-body), sans-serif;
	font-variant-numeric: tabular-nums;
	font-size: 0.75rem;
	color: var(--mk-cat-bronze);
	margin-bottom: 0.375rem;
}
.mk-lot__stock--low {
	color: var(--mk-cat-ink);
	font-weight: 600;
}
.mk-lot__stock--sold-out {
	color: #ff5656;
	font-weight: 600;
}

.mk-lot__stock-bar {
	height: 3px;
	background: var(--mk-cat-line);
	margin-bottom: 0.875rem;
	overflow: hidden;
}
.mk-lot__stock-bar-fill {
	height: 100%;
	background: var(--mk-cat-green);
	transition: width 0.3s ease;
}
.mk-lot__stock-bar-fill--low {
	background: #ff5656;
}
.mk-lot__stock-bar-fill--sold-out {
	background: #ff5656;
	width: 0 !important;
}

.mk-lot__price-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

/* "3 zur Auswahl": zeigt schon im Katalog, dass es mehrere Kristalle gibt. */
.mk-lot__variants-tag {
	position: absolute;
	bottom: 0.625rem;
	left: 0.625rem;
	z-index: 3;
	padding: 0.25rem 0.625rem;
	font-family: var(--font-body), sans-serif;
	font-size: 0.75rem;
	font-weight: 600;
	color: #fff;
	background: rgba(28, 27, 25, 0.8);
	border-radius: 999px;
}

.mk-lot__price-group {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.125rem 0.375rem;
}

.mk-lot__price {
	font-family: var(--font-body), sans-serif;
	font-variant-numeric: tabular-nums;
	font-size: 1rem;
	font-weight: 600;
	color: var(--mk-cat-ink);
}

.mk-lot__price small {
	font-size: 0.75rem;
	font-weight: 400;
}

.mk-lot__price-normal {
	font-family: var(--font-body), sans-serif;
	font-variant-numeric: tabular-nums;
	font-size: 0.8125rem;
	color: var(--mk-cat-bronze);
}

.mk-lot__add {
	font-family: var(--font-body), sans-serif;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--mk-cat-ink);
	background: none;
	border: none;
	border-bottom: 1px solid var(--mk-cat-ink);
	padding: 0 0 0.125rem;
	cursor: pointer;
	transition: color 0.2s ease, border-color 0.2s ease;
}
.mk-lot__add:hover {
	color: var(--mk-cat-green);
	border-color: var(--mk-cat-green);
}

/* --- Sold-out state: lot stays visible in the catalogue, just marked --- */

.mk-lot--sold-out .mk-lot__image {
	filter: sepia(6%) saturate(60%) brightness(0.82) grayscale(35%);
}
.mk-lot--sold-out .mk-lot__name,
.mk-lot--sold-out .mk-lot__price {
	color: var(--mk-cat-bronze);
}

/* Diagonal "crossed out" stroke over the sold-out image: a real
   corner-to-corner line (inset slightly from the actual corners), drawn
   as an SVG <line> in a viewBox matching the frame's own box, so it
   tracks the exact corners regardless of aspect ratio — a rotated bar
   or a linear-gradient band only lines up with the corners at one
   specific ratio, an SVG line always hits them exactly. */
.mk-lot__frame {
	position: relative;
}
.mk-lot--sold-out .mk-lot__frame::after {
	content: '';
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cline x1='18' y1='82' x2='82' y2='18' stroke='%23ff5656' stroke-width='1.2'/%3E%3C/svg%3E");
	background-size: 100% 100%;
}

/* Status badges: shipped as-is (colorful sticker PNGs), not recolored to
   the catalogue palette — deliberately break the quiet hairline look to
   read as a real shop sticker. Oversized, overhanging the top-right
   corner, each type at a slightly different fixed angle so a grid of
   mixed badges doesn't look mechanically identical. */
.mk-lot__badge {
	position: absolute;
	top: -1.5rem;
	right: -1.5rem;
	width: 8.5rem;
	height: 8.5rem;
	object-fit: contain;
	filter: drop-shadow(0 4px 10px rgba(28, 27, 25, 0.3));
	pointer-events: none;
	z-index: 2;
}
@media (min-width: 640px) {
	.mk-lot__badge {
		width: 10rem;
		height: 10rem;
		top: -1.75rem;
		right: -1.75rem;
	}
}

/* Kristall des Monats: Siegel sitzt auf der Bildecke, nie über dem Label */
.mk-lot--special .mk-lot__link {
	position: relative;
}
.mk-lot--special .mk-lot__badge {
	top: 0.25rem;
	right: -0.5rem;
	width: 7.5rem;
	height: 7.5rem;
}
.mk-lot__badge--sold-out {
	transform: rotate(-7deg);
}
.mk-lot__badge--highlight {
	transform: rotate(11deg);
}

.mk-lot__add--disabled {
	font-family: var(--font-body), sans-serif;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--mk-cat-bronze);
	border-bottom: 1px solid var(--mk-cat-line);
	padding-bottom: 0.125rem;
	cursor: default;
}

/* --- Feedback nach "In den Warenkorb" (assets/js/catalog-add-to-cart.js) --- */

a.mk-lot__add {
	text-decoration: none;
}
.mk-lot__add--added,
.mk-lot__add--added:hover {
	color: var(--mk-cat-green);
	border-color: var(--mk-cat-green);
	animation: mk-add-pop 0.35s ease;
}
.mk-nav__cart--bump {
	animation: mk-add-pop 0.45s ease;
}
@keyframes mk-add-pop {
	40% { transform: scale(1.18); }
}
@media (prefers-reduced-motion: reduce) {
	.mk-lot__add--added,
	.mk-nav__cart--bump {
		animation: none;
	}
}

/* --- Handy: 2 Spalten — Karten kompakter, damit sie in die halbe Breite passen --- */
@media (max-width: 639px) {
	.mk-catalog__grid {
		column-gap: 0.875rem;
		row-gap: 2rem;
	}
	/* "Kristall des Monats" bleibt als Hervorhebung über beide Spalten */
	.mk-lot--special {
		grid-column: 1 / -1;
	}
	.mk-lot:not(.mk-lot--special) .mk-lot__meta {
		font-size: 0.5625rem;
		letter-spacing: 0.04em;
	}
	.mk-lot:not(.mk-lot--special) .mk-lot__name {
		font-size: 1.0625rem;
		margin-bottom: 0.625rem;
	}
	.mk-lot:not(.mk-lot--special) .mk-lot__stock {
		font-size: 0.6875rem;
	}
	.mk-lot:not(.mk-lot--special) .mk-lot__price-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5rem;
	}
	.mk-lot:not(.mk-lot--special) .mk-lot__badge {
		width: 5.5rem;
		height: 5.5rem;
		top: -0.875rem;
		right: -0.875rem;
	}
	.mk-lot:not(.mk-lot--special) .mk-lot__viewers {
		transform: scale(0.85);
		transform-origin: top left;
	}
}
