/* Bookstore Lifecycle — styled on the shop's own palette.
 *
 * Colour logic, kept deliberately narrow so these elements read as part of the
 * site rather than as a plugin:
 *   gold  (palette-5)  → unavailable / heads-up states
 *   green (palette-11) → the current edition — both the pill and the banner
 *                        pointing at it
 *   slate (palette-3)  → all headings and strong text
 * The site's primary blue is deliberately not used: these elements should read
 * as editorial notes, not as page chrome.
 *
 * Override any of these in Appearance → Customize → Additional CSS.
 */

:root {
	--bsl-gold: var(--theme-palette-color-5, #ebb556);
	--bsl-gold-strong: #d99a2b;
	--bsl-heading: var(--theme-palette-color-3, #2d3740);
	--bsl-text-muted: #5c6773;
	--bsl-border: var(--theme-palette-color-6, hsl(214, 25%, 90%));
	--bsl-surface: var(--theme-palette-color-9, #f8f8f8);
	--bsl-surface-alt: var(--theme-palette-color-7, #f4f4f5);
	--bsl-green: var(--theme-palette-color-11, #137d48);
	--bsl-green-dark: #0e6339;
	--bsl-green-soft: #f1f8f4;
	--bsl-green-border: #cfe6da;
	--bsl-radius: 6px;
}

/* ---- Notices ----
   No background, no radius, no box. Just a gold rule down the left edge.
   This sits exactly where the customer is already looking, so it does not
   need to compete for attention. */

.bsl-notice,
.bsl-waitlist-replaced {
	background: none;
	padding: 0px;
}

.bsl-notice__title,
.bsl-waitlist-replaced__title {
	display: block;
	margin: 0 0 0.3em;
	color: var(--bsl-heading);
	font-size: 1em;
	font-weight: 600;
	line-height: 1.4;
}

.bsl-notice__text,
.bsl-waitlist-replaced__text {
	margin: 0;
	color: var(--bsl-text-muted);
	font-size: 0.94em;
	line-height: 1.55;
}

/* ---- Replacement recommendations ---- */

.bsl-replacements {
	clear: both;
	margin: 1.8em 0 0;
}

.bsl-replacements--share,
.bsl-replacements--shortcode {
	margin: 2.5em 0;
}

.bsl-replacements__heading {
	margin: 0 0 0.9em;
	color: var(--bsl-heading);
	font-weight: 700;
}

/* Explicit column count rather than auto-fit, so the row never silently
   reflows to 2x2 in a narrow product summary column. The count comes from PHP
   as --bsl-cols (capped at the number of cards actually rendered).
   minmax(0, 1fr) lets the cards shrink instead of overflowing.
   Neutralises WooCommerce's float-based grid without touching theme styles
   elsewhere. */
.bsl-replacements ul.products {
	display: grid;
	gap: 1.4em 1.2em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bsl-replacements ul.products::before,
.bsl-replacements ul.products::after {
	content: none;
	display: none;
}

.bsl-replacements ul.products > li {
	width: auto !important;
	min-width: 0; /* allow long titles to wrap rather than widen the track */
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
	clear: none !important;
	max-width: 280px !important;
}

.bsl-replacements ul.products > li img {
	width: 100%;
	height: auto;
}

/* Tablet (Blocksy's default 690–999px band): keep the whole row on one line.
   Tighten the gutter and step the card text down slightly so four covers still
   breathe in a half-width summary column. */
@media (min-width: 690px) and (max-width: 999px) {
	.bsl-replacements ul.products {
		gap: 1em 0.7em;
	}

	.bsl-replacements ul.products > li {
		font-size: 0.9em;
	}
}

/* Phones: two per row. */
@media (max-width: 689px) {
	.bsl-replacements ul.products {
		grid-template-columns: repeat(var(--bsl-cols-mobile, 2), minmax(0, 1fr));
		gap: 1.2em 0.9em;
	}
}

/* Out-of-stock picks are kept, but visibly de-emphasised so the in-stock
   ones read first. */
.bsl-replacements ul.products > li.outofstock {
	opacity: 0.72;
}

/* ---- Newer-edition banner ----
   Green, matching the "Najnovije izdanje" pill in the editions table: both
   mean "this is the current one". Kept off the site's primary blue so it does
   not read as ordinary page furniture. */

.bsl-edition-banner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75em 1.5em;
	background: var(--bsl-green-soft);
	border: 1px solid var(--bsl-green-border);
	border-radius: var(--bsl-radius);
	padding: 0.5em 0.75em;
	margin: 0 0 1.5em;
}

.bsl-edition-banner__text {
	margin: 0;
	color: var(--bsl-heading);
}

.bsl-edition-banner__text a {
	color: var(--bsl-green-dark);
	font-weight: 600;
}

.bsl-edition-banner__button {
	white-space: nowrap;
	background: var(--theme-palette-color-11) !important;
}

/* ---- Editions table ---- */

.bsl-editions {
	clear: both;
	margin: 2em 0;
}

.bsl-editions__heading {
	margin: 0 0 0.75em;
	color: var(--bsl-heading);
}

.bsl-editions__table {
	width: 100%;
	margin: 0;
	border: 1px solid var(--bsl-border);
	border-radius: var(--bsl-radius);
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
}

.bsl-editions__table th,
.bsl-editions__table td {
	text-align: left;
	padding: 0.7em 1em;
	border-bottom: 1px solid var(--bsl-border);
	vertical-align: middle;
}

.bsl-editions__table thead th {
	background: var(--bsl-surface-alt);
	color: var(--bsl-text-muted);
	font-size: 0.78em;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.bsl-editions__table tbody tr:last-child td {
	border-bottom: none;
}

.bsl-editions__row--latest {
	background: var(--bsl-surface);
}

.bsl-editions__row--current .bsl-editions__name {
	font-weight: 700;
	color: var(--bsl-heading);
}

/* Edition links inherit the theme's own link colour rather than forcing one. */

.bsl-editions__row--current .bsl-editions__name {
	color: var(--bsl-heading);
}

.bsl-editions__year-col,
.bsl-editions__year {
	white-space: nowrap;
	width: 1%;
	color: var(--bsl-text-muted);
}

.bsl-editions__status-col,
.bsl-editions__status {
	text-align: right;
	white-space: nowrap;
	width: 1%;
}

.bsl-editions__status .bsl-pill + .bsl-pill {
	margin-left: 0.35em;
}

.bsl-editions__you-are-here {
	color: var(--bsl-text-muted);
	font-size: 0.88em;
	font-weight: 400;
}

/* Stack the table into cards on small screens. */
@media (max-width: 600px) {
	.bsl-editions__table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.bsl-editions__table,
	.bsl-editions__table tbody,
	.bsl-editions__table tr,
	.bsl-editions__table td {
		display: block;
		width: auto;
	}

	.bsl-editions__table tr {
		border-bottom: 1px solid var(--bsl-border);
		padding: 0.5em 0;
	}

	.bsl-editions__table tr:last-child {
		border-bottom: none;
	}

	.bsl-editions__table td {
		border-bottom: none;
		padding: 0.25em 1em;
		text-align: left;
	}

	.bsl-editions__year::before {
		content: attr(data-label) ": ";
	}
}

/* ---- Pills & badges ---- */

.bsl-pill {
	display: inline-block;
	font-size: 0.7em;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 0.25em 0.7em;
	border-radius: 999px;
	line-height: 1.6;
	white-space: nowrap;
}

.bsl-pill--latest {
	background: var(--bsl-green);
	color: #fff;
}

.bsl-pill--oop {
	background: var(--bsl-surface-alt);
	color: var(--bsl-text-muted);
	border: 1px solid var(--bsl-border);
}

.bsl-badge {
	display: inline-block;
	font-size: 0.7em;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	background: var(--bsl-heading);
	color: #fff;
	padding: 0.25em 0.7em;
	border-radius: 999px;
	margin-bottom: 0.5em;
	white-space: nowrap;
}
