/* Lobster Archive Cards - front end.
 * Logical properties are used everywhere so the layout works in RTL and LTR.
 * Variables (columns, gap, aspect, colors) are printed inline from the settings page.
 */

/* ---------------------------------------------------------------- Grid */
.lac-grid {
	display: grid;
	grid-template-columns: repeat(var(--lac-cols-d, 4), minmax(0, 1fr));
	grid-auto-flow: row dense; /* lets single cards fill the gaps next to a double card */
	gap: 28px var(--lac-gap, 16px);
	margin: 0 0 24px;
	padding: 0;
	width: 100%;
	max-width: none;
	list-style: none;
}

@media (max-width: 849px) {
	.lac-grid { grid-template-columns: repeat(var(--lac-cols-t, 3), minmax(0, 1fr)); }
}

@media (max-width: 549px) {
	.lac-grid { grid-template-columns: repeat(var(--lac-cols-m, 2), minmax(0, 1fr)); }
}

.lac-grid .lac-card {
	position: relative;
	float: none !important;
	width: auto !important;
	margin: 0 !important;
	padding: 0 !important;
	min-width: 0;
	clear: none !important;
}

/* A double card always takes two columns: 2 doubles, 1 double + 2 singles or 4 singles per row. */
.lac-grid .lac-card--double { grid-column: span 2; }

/* Sub category tiles printed inside the loop by WooCommerce/Flatsome */
.lac-grid > .product-category,
.lac-grid > .col {
	float: none;
	width: auto;
	max-width: none;
	flex: none;
	margin: 0;
	padding: 0;
}

/* ---------------------------------------------------------------- Media */
.lac-inner { position: relative; }

.lac-media {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--lac-gap, 16px);
	overflow: hidden;
}

.lac-media--double { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.lac-pane {
	position: relative;
	overflow: hidden;
	aspect-ratio: var(--lac-aspect, 1 / 1);
	background: #f3f3f3;
}

.lac-imglink {
	position: absolute;
	inset: 0;
	display: block;
}

.lac-pane img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	max-width: none;
	object-fit: var(--lac-fit, cover);
	transition: opacity 0.35s ease;
}

.lac-img--hover { opacity: 0; }

@media (hover: hover) and (pointer: fine) {
	.lac-card:hover .lac-img--hover { opacity: 1; }
}

/* After a color was picked the hover image would show the wrong color. */
.lac-card.is-swapped .lac-img--hover { opacity: 0 !important; }

.lac-oos .lac-pane img { opacity: 0.6; }
.lac-oos .lac-pane img.lac-img--hover { opacity: 0; }

/* ---------------------------------------------------------------- Badges */
.lac-badges {
	position: absolute;
	inset-block-start: 8px;
	inset-inline-start: 8px;
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	pointer-events: none;
}

.lac-badge {
	display: inline-block;
	padding: 2px 8px;
	font-size: 12px;
	line-height: 1.6;
	color: #fff;
	background: #111;
}

.lac-badge--sale { background: var(--lac-c-sale, #d63638); }
.lac-badge--new { background: var(--lac-c-new, #111); }
.lac-badge--best { background: var(--lac-c-best, #b8860b); }
.lac-badge--oos { background: var(--lac-c-oos, #777); }

/* ---------------------------------------------------------------- Theme tools (quick view, wishlist) */
.lac-tools {
	position: absolute;
	inset-block-start: 8px;
	inset-inline-end: 8px;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
}

.lac-tools:empty { display: none; }

@media (hover: hover) and (pointer: fine) {
	.lac-tools {
		opacity: 0;
		transition: opacity 0.2s ease;
	}
	.lac-card:hover .lac-tools,
	.lac-card:has(.lac-tools :focus-visible) .lac-tools { opacity: 1; }
}

/* ---------------------------------------------------------------- Options panel */
.lac-panel {
	position: absolute;
	inset-inline: 0;
	inset-block-end: 0;
	z-index: 4;
	box-sizing: border-box;
	max-height: 85%;
	overflow: auto;
	padding: 10px 12px 12px;
	background: rgba(255, 255, 255, 0.97);
	transform: translateY(101%);
	visibility: hidden;
	transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

.lac-card.is-open .lac-panel {
	transform: none;
	visibility: visible;
	transition-delay: 0s;
}

@media (hover: hover) and (pointer: fine) {
	.lac-card:hover .lac-panel,
	.lac-card:has(.lac-panel :focus-visible) .lac-panel {
		transform: none;
		visibility: visible;
		transition-delay: 0s;
	}
}

.lac-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 8px;
}

.lac-opt {
	position: relative;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	font: inherit;
	font-size: 13px;
	line-height: 1;
	color: #111;
	background: #fff;
	border: 1px solid #d5d5d5;
	border-radius: 2px;
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.lac-opt:hover { border-color: #111; }

.lac-opt--color {
	width: 36px;
	height: 36px;
	overflow: hidden;
}

.lac-opt--color img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.lac-opt--color .lac-txt {
	display: block;
	padding: 0 8px;
	white-space: nowrap;
}

.lac-opt--color:has(.lac-txt) {
	width: auto;
	min-width: 36px;
}

.lac-opt--size {
	min-width: 38px;
	height: 34px;
	padding: 0 8px;
}

.lac-opt.is-selected {
	border-color: #111;
	box-shadow: 0 0 0 1px #111;
}

.lac-opt--size.is-selected {
	color: #fff;
	background: #111;
}

.lac-opt.is-hidden { display: none; }

/* Out of stock options stay visible but crossed out and faded. */
.lac-opt.is-oos {
	opacity: 0.4;
	text-decoration: line-through;
}

.lac-opt--size.is-oos { cursor: not-allowed; }

.lac-opt.is-oos::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(to top right, transparent calc(50% - 1px), #111 calc(50% - 1px), #111 calc(50% + 1px), transparent calc(50% + 1px));
}

.lac-add {
	display: block;
	width: 100%;
	margin: 0;
	text-align: center;
}

.lac-add[disabled],
.lac-add.is-oos { opacity: 0.55; cursor: not-allowed; }

.lac-add.is-loading { opacity: 0.7; cursor: progress; }

.lac-panel .added_to_cart {
	display: block;
	margin-block-start: 6px;
	font-size: 12px;
	text-align: center;
	text-decoration: underline;
}

.lac-msg {
	min-height: 0;
	margin-block-start: 6px;
	font-size: 12px;
	line-height: 1.4;
}

.lac-msg:empty { display: none; }
.lac-msg.is-error { color: #b32d2e; }

.lac-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Touch: the + button opens the panel, the x closes it. */
.lac-toggle,
.lac-close { display: none; }

@media (hover: none), (pointer: coarse) {
	.lac-toggle {
		position: absolute;
		inset-block-end: 8px;
		inset-inline-end: 8px;
		z-index: 6;
		display: flex;
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
		width: 34px;
		height: 34px;
		margin: 0;
		padding: 0;
		font-size: 22px;
		line-height: 1;
		color: #111;
		background: rgba(255, 255, 255, 0.95);
		border: 1px solid #d5d5d5;
		border-radius: 50%;
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
		cursor: pointer;
	}

	.lac-card.is-open .lac-toggle { display: none; }

	.lac-close {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 28px;
		height: 28px;
		margin: 0 0 4px;
		margin-inline-start: auto;
		padding: 0;
		font-size: 22px;
		line-height: 1;
		color: #111;
		background: transparent;
		border: 0;
		cursor: pointer;
	}

	.lac-tools { opacity: 1; }
	.lac-opt--color { width: 40px; height: 40px; }
	.lac-opt--size { min-width: 42px; height: 38px; }
}

/* ---------------------------------------------------------------- Title and price */
.lac-info { padding-block-start: 10px; }

.lac-title {
	margin: 0 0 4px;
	font-size: 14px;
	line-height: 1.4;
	font-weight: 600;
}

.lac-title a {
	color: inherit;
	text-decoration: none;
}

.lac-price {
	font-size: 14px;
	line-height: 1.4;
}

.lac-price del { opacity: 0.55; margin-inline-end: 6px; }
.lac-price ins { text-decoration: none; }

/* ---------------------------------------------------------------- Pagination */
.lac-pagination {
	margin: 30px 0;
	text-align: center;
}

.lac-pagination .lac-more { margin: 0 auto; }
.lac-pagination .lac-more[disabled] { opacity: 0.6; cursor: progress; }
.lac-sentinel { height: 1px; }
.lac-spinner { display: inline-block; font-size: 14px; opacity: 0.7; }

/* The theme/WooCommerce numbers are replaced by the button when JavaScript runs. */
body.lac-pager-js .woocommerce-pagination { display: none; }
body.lac-pager-js .lac-pagination .woocommerce-pagination { display: block; }

@media (prefers-reduced-motion: reduce) {
	.lac-panel,
	.lac-pane img,
	.lac-tools { transition: none; }
}
