/**
 * [bs_product_cards] — product overview cards.
 * Scoped under .bs-cards-wrap to avoid Breakdance conflicts.
 * Supports layout="card" (grid tiles) and layout="list" (horizontal rows).
 */

@font-face {
	font-family: 'Monomakh';
	src: url('../fonts/monomakh-regular.woff2') format('woff2');
	font-display: swap;
}

.bs-cards-wrap {
	font-family: 'Source Sans 3', system-ui, sans-serif;
}

/* ── Shared status colours ─────────────────────────────────── */

.bs-card__bar-fill.bs-bar-green  { background: #28a745; }
.bs-card__bar-fill.bs-bar-yellow { background: #ffc107; }
.bs-card__bar-fill.bs-bar-red    { background: #dc3545; }

.bs-card__remaining,
.bs-list-item__remaining {
	background: transparent !important;
}

.bs-card__remaining.bs-bar-green,
.bs-list-item__remaining.bs-bar-green  { color: #28a745; }

.bs-card__remaining.bs-bar-yellow,
.bs-list-item__remaining.bs-bar-yellow { color: #ffc107; }

.bs-card__remaining.bs-bar-red,
.bs-list-item__remaining.bs-bar-red    { color: #dc3545; }

/* ══ CARD LAYOUT ════════════════════════════════════════════ */

.bs-cards-grid {
	display: grid;
	gap: 12px;
}

/* Scoped to beat Breakdance post-stylesheet specificity */
.bs-cards-wrap .bs-cards-grid {
	grid-template-columns: 1fr 1fr;
}

@media (min-width: 560px) {
	.bs-cards-wrap .bs-cards-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

@media (min-width: 900px) {
	.bs-cards-wrap .bs-cards-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Card shell — flex-column so body grows and button stays at bottom */
.bs-card {
	background: #fff;
	border-radius: 12px;
	border: 1.5px solid #e8ddd0;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	overflow: hidden;
	transition: transform 0.15s, box-shadow 0.15s;
}

.bs-card[data-bs-product] { cursor: pointer; }

.bs-card[data-bs-product]:hover,
.bs-card[data-bs-product]:focus {
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(107,66,38,0.12);
	outline-offset: 3px;
}

/* Top image — square */
.bs-card__img-wrap {
	aspect-ratio: 1/1;
	overflow: hidden;
	background: #EDE0CC;
	position: relative;
}

.bs-card__img-wrap img,
.bs-card__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	object-position: center center;
	display: block;
}

.bs-card__img-placeholder {
	width: 100%;
	height: 100%;
	background: #EDE0CC;
}

/* Card body — grows to fill card, stacks content so button pins to bottom */
.bs-card__body {
	padding: 10px 12px 12px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

@media (min-width: 560px) {
	.bs-card__body { padding: 12px 14px 14px; }
}

.bs-card__name {
	font-family: 'Monomakh', serif;
	font-size: 17px;
	color: #2C1810;
	line-height: 1.2;
	margin: 0 0 3px;
}

@media (min-width: 560px) {
	.bs-card__name { font-size: 20px; }
}

.bs-card__price,
.bs-card__price span,
.bs-card__price bdi,
.bs-card__price .woocommerce-Price-amount,
.bs-card__price .woocommerce-Price-amount bdi,
.bs-card__price .woocommerce-Price-currencySymbol {
	font-size: 13px;
	font-weight: 700;
	color: #6B4226 !important;
}

.bs-card__price { margin-bottom: 8px; }

.bs-card__variant {
	font-size: 11px;
	font-style: italic;
	color: #856404;
	margin: 0 0 6px;
}

.bs-card__desc {
	font-size: 12px;
	color: #2C1810;
	opacity: 0.65;
	line-height: 1.35;
	margin-bottom: 8px;
}

.bs-card__desc p { margin: 0; }

/* Availability bar — pinned to bottom of card body */
.bs-card__bar-wrap {
	background: #e9ecef;
	border-radius: 3px;
	height: 4px;
	overflow: hidden;
	margin-top: auto;
	margin-bottom: 5px;
}

.bs-card__bar-fill {
	height: 100%;
	border-radius: 3px;
	transition: width 0.3s ease;
}

.bs-card__remaining {
	font-size: 11px;
	font-weight: 600;
	display: block;
	margin-bottom: 10px;
	background: transparent !important;
}

/* Full-width CTA button */
.bs-card__cta-btn {
	display: block;
	width: 100%;
	padding: 8px 0;
	background: #6B4226;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	text-align: center;
	border-radius: 7px;
	letter-spacing: 0.02em;
	transition: background 0.15s;
	text-decoration: none;
}

/* Override Breakdance's .breakdance a { color: var(--bde-links-color) } (0,1,1) */
.bs-cards-wrap .bs-card__cta-btn,
.bs-cards-wrap .bs-card__cta-btn:link,
.bs-cards-wrap .bs-card__cta-btn:visited { color: #fff !important; }

.bs-card[data-bs-product]:hover .bs-card__cta-btn,
.bs-card[data-bs-product]:focus .bs-card__cta-btn { background: #4F2E16; }

/* ══ LIST LAYOUT ════════════════════════════════════════════ */

.bs-list {
	display: flex;
	flex-direction: column;
}

.bs-list-item {
	display: flex;
	gap: 14px;
	align-items: center;
	padding: 14px 0;
	border-bottom: 1px solid #e8ddd0;
	text-decoration: none;
	color: inherit;
}

.bs-list-item:first-child { border-top: 1px solid #e8ddd0; }

.bs-list-item[data-bs-product] { cursor: pointer; }

.bs-list-item[data-bs-product]:hover .bs-list-item__name,
.bs-list-item[data-bs-product]:focus .bs-list-item__name { color: #6B4226; }

/* Side image */
.bs-list-item__img-wrap {
	flex-shrink: 0;
	width: 90px;
	height: 90px;
	border-radius: 10px;
	overflow: hidden;
	background: #EDE0CC;
	position: relative;
}

.bs-list-item__img-wrap img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	object-position: center center;
	display: block;
}

.bs-list-item__img-placeholder {
	width: 100%;
	height: 100%;
	background: #EDE0CC;
}

/* Info column */
.bs-list-item__info {
	flex: 1;
	min-width: 0;
}

.bs-list-item__name {
	font-family: 'Monomakh', serif;
	font-size: 16px;
	color: #2C1810;
	line-height: 1.2;
	margin: 0 0 3px;
	transition: color 0.15s;
}

.bs-list-item__desc {
	font-size: 12px;
	color: #2C1810;
	opacity: 0.6;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0 0 3px;
}

.bs-list-item__variant {
	font-size: 11px;
	font-style: italic;
	color: #856404;
	margin: 0 0 3px;
}

.bs-list-item__meta {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 4px;
}

.bs-list-item__price,
.bs-list-item__price span,
.bs-list-item__price bdi,
.bs-list-item__price .woocommerce-Price-amount,
.bs-list-item__price .woocommerce-Price-amount bdi,
.bs-list-item__price .woocommerce-Price-currencySymbol {
	font-size: 14px;
	font-weight: 700;
	color: #6B4226 !important;
}

.bs-list-item__remaining {
	font-size: 11px;
	font-weight: 600;
	background: transparent !important;
}

/* Circle CTA button */
.bs-list-item__cta {
	flex-shrink: 0;
	display: flex;
	align-items: center;
}

.bs-list-item__cta-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: #6B4226;
	color: #fff;
	border-radius: 50%;
	font-size: 22px;
	font-weight: 300;
	line-height: 1;
	transition: background 0.15s, transform 0.12s;
	text-decoration: none;
}

/* Override Breakdance's .breakdance a { color: var(--bde-links-color) } (0,1,1) */
.bs-cards-wrap .bs-list-item__cta-btn,
.bs-cards-wrap .bs-list-item__cta-btn:link,
.bs-cards-wrap .bs-list-item__cta-btn:visited { color: #fff !important; }

.bs-list-item[data-bs-product]:hover .bs-list-item__cta-btn,
.bs-list-item[data-bs-product]:focus .bs-list-item__cta-btn {
	background: #4F2E16;
	transform: scale(1.1);
}

/* ══ ADDON SECTION — always list rows ══════════════════════ */

.bs-addon-section {
	margin-top: 32px;
}

.bs-addon-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #6B4226;
	opacity: 0.55;
	margin: 0 0 4px;
}

.bs-list--addons .bs-list-item__img-wrap {
	width: 72px;
	height: 72px;
}

/* ══ PRODUCT DETAIL MODAL ══════════════════════════════════ */

body.bs-modal-open { overflow: hidden; }

.bs-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.bs-modal-overlay[hidden] { display: none; }

.bs-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(44, 24, 16, 0.6);
}

.bs-modal-sheet {
	position: relative;
	background: #fff;
	border-radius: 20px 20px 0 0;
	width: 100%;
	max-height: 92dvh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.bs-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(255,255,255,0.92);
	border: none;
	cursor: pointer;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #2C1810;
	transition: background 0.15s;
	box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.bs-modal-close:hover,
.bs-modal-close:focus { background: #fff; outline-offset: 3px; }

.bs-modal-img-wrap {
	position: relative;
	width: 100%;
	height: 300px;
	overflow: hidden;
	background: #EDE0CC;
	flex-shrink: 0;
	cursor: default;
}

.bs-modal-img-wrap.bs-has-drag { cursor: grab; }
.bs-modal-img-wrap.bs-dragging { cursor: grabbing; }

/* Side arrow buttons — desktop only */
.bs-modal-arrow {
	display: none;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.88);
	border: none;
	cursor: pointer;
	font-size: 26px;
	line-height: 1;
	align-items: center;
	justify-content: center;
	color: #2C1810;
	box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
	transition: background 0.15s;
	padding: 0;
	user-select: none;
}

.bs-modal-arrow--prev { left: 10px; }
.bs-modal-arrow--next { right: 10px; }

.bs-modal-arrow:hover,
.bs-modal-arrow:focus { background: #fff; outline-offset: 3px; }

@media (min-width: 600px) {
	.bs-modal-arrow:not([hidden]) { display: flex; }
}

/* Slider strip */
.bs-modal-slider {
	display: flex;
	height: 100%;
	transition: transform 0.3s ease;
	will-change: transform;
}

.bs-modal-slide {
	flex: 0 0 100%;
	position: relative;
}

.bs-modal-slide img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	object-position: center center;
	display: block;
}

/* Dot indicators */
.bs-modal-dots {
	position: absolute;
	bottom: 10px;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	gap: 6px;
	pointer-events: none;
}

.bs-modal-dots[hidden] { display: none; }

.bs-modal-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: rgba(255,255,255,0.55);
	border: none;
	cursor: pointer;
	padding: 0;
	transition: background 0.15s, transform 0.15s;
	pointer-events: all;
}

.bs-modal-dot.is-active {
	background: #fff;
	transform: scale(1.25);
}

.bs-modal-body {
	padding: 20px 24px 40px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bs-modal-name {
	font-family: 'Monomakh', serif;
	font-size: 24px;
	color: #2C1810;
	line-height: 1.2;
	margin: 0;
}

.bs-modal-price,
.bs-modal-price span,
.bs-modal-price bdi,
.bs-modal-price .woocommerce-Price-amount,
.bs-modal-price .woocommerce-Price-amount bdi,
.bs-modal-price .woocommerce-Price-currencySymbol {
	font-size: 18px;
	font-weight: 700;
	color: #6B4226 !important;
}

.bs-modal-variant {
	font-size: 13px;
	font-style: italic;
	color: #856404;
	margin: 0;
}

.bs-modal-desc {
	font-size: 14px;
	color: #2C1810;
	opacity: 0.7;
	line-height: 1.5;
	margin: 0;
}

.bs-modal-status {
	font-size: 13px;
	font-weight: 600;
	background: transparent !important;
	margin: 0;
}

.bs-modal-status.bs-bar-green  { color: #28a745; }
.bs-modal-status.bs-bar-yellow { color: #ffc107; }
.bs-modal-status.bs-bar-red    { color: #dc3545; }

.bs-modal-cta {
	display: block;
	padding: 14px 20px;
	background: #6B4226;
	font-size: 15px;
	font-weight: 700;
	text-align: center;
	border-radius: 10px;
	letter-spacing: 0.02em;
	transition: background 0.15s;
	margin-top: 10px;
	text-decoration: none !important;
}

/* High-specificity rule to beat Breakdance/theme link colour overrides */
.bs-modal-overlay .bs-modal-cta,
.bs-modal-overlay .bs-modal-cta:link,
.bs-modal-overlay .bs-modal-cta:visited,
.bs-modal-overlay .bs-modal-cta:hover,
.bs-modal-overlay .bs-modal-cta:focus,
.bs-modal-overlay .bs-modal-cta:active {
	color: #fff !important;
}

.bs-modal-cta:hover,
.bs-modal-cta:focus { background: #4F2E16; outline-offset: 3px; }

.bs-modal-cta.bs-modal-cta--disabled {
	background: #ccc;
	pointer-events: none;
}

/* Mobile: full-screen modal, fixed close button */
@media (max-width: 599px) {
	.bs-modal-sheet {
		border-radius: 0;
		height: 100dvh;
		max-height: 100dvh;
	}

	.bs-modal-close {
		position: fixed;
		top: 12px;
		right: 12px;
		z-index: 10000;
	}

	.bs-modal-name {
		font-size: 20px;
	}
}

@media (min-width: 600px) {
	.bs-modal-overlay { align-items: center; }
	.bs-modal-sheet {
		border-radius: 16px;
		max-width: 480px;
		max-height: 85dvh;
	}
	.bs-modal-img-wrap { height: 260px; }
}

@media (prefers-reduced-motion: no-preference) {
	.bs-modal-overlay { animation: bs-fade-in 0.18s ease; }
	.bs-modal-sheet   { animation: bs-slide-up 0.22s ease; }

	@keyframes bs-fade-in {
		from { opacity: 0; }
		to   { opacity: 1; }
	}

	@keyframes bs-slide-up {
		from { transform: translateY(24px); opacity: 0; }
		to   { transform: translateY(0);    opacity: 1; }
	}
}
