/*
 * TUBT Recommended Books — compact sidebar recommendations.
 *
 * Visual values are controlled from:
 * WordPress Admin → TUBT Recommended Books
 */

.tubt-recommended-books {
	width: 100%;
	box-sizing: border-box;

	/* Safe fallbacks if settings have not yet been saved. */
	--tubt-rb-cover-width: 82px;
	--tubt-rb-cover-text-gap: 12px;
	--tubt-rb-book-gap: 20px;
	--tubt-rb-title-author-gap: 5px;
	--tubt-rb-author-rating-gap: 6px;
	--tubt-rb-heading-size: 24px;
	--tubt-rb-heading-font: "Cinzel", serif;
	--tubt-rb-heading-align: left;
	--tubt-rb-heading-weight: 400;
	--tubt-rb-heading-letter-spacing: 0px;
	--tubt-rb-title-size: 14px;
	--tubt-rb-title-font: "Inter", sans-serif;
	--tubt-rb-title-weight: 600;
	--tubt-rb-title-letter-spacing: 0px;
	--tubt-rb-author-size: 12px;
	--tubt-rb-author-font: "Inter", sans-serif;
	--tubt-rb-author-weight: 400;
	--tubt-rb-author-letter-spacing: 0px;
	--tubt-rb-rating-size: 12px;
	--tubt-rb-rating-font: "Inter", sans-serif;
	--tubt-rb-rating-weight: 400;
	--tubt-rb-rating-letter-spacing: 0px;
	--tubt-rb-heading-color: #e7e2d9;
	--tubt-rb-title-color: #e7e2d9;
	--tubt-rb-author-color: #c0ccda;
	--tubt-rb-rating-color: #febd69;
	--tubt-rb-cover-border-color: #443108;
	--tubt-rb-cover-border-width: 1px;
	--tubt-rb-module-padding: 16px;
	--tubt-rb-module-border-width: 1px;
	--tubt-rb-module-border-color: #443108;
	--tubt-rb-module-background: #11100e;

	padding: var(--tubt-rb-module-padding);
	border: var(--tubt-rb-module-border-width) solid var(--tubt-rb-module-border-color);
	background: var(--tubt-rb-module-background);
}

.tubt-recommended-books__heading {
	margin: 0 0 16px !important;
	color: var(--tubt-rb-heading-color);
	font-family: var(--tubt-rb-heading-font);
	font-size: var(--tubt-rb-heading-size);
	font-weight: var(--tubt-rb-heading-weight);
	letter-spacing: var(--tubt-rb-heading-letter-spacing);
	line-height: 1.05;
	text-align: var(--tubt-rb-heading-align);
}

.tubt-recommended-books__list {
	display: grid;
	gap: var(--tubt-rb-book-gap);
}

.tubt-recommended-book {
	display: grid;
	grid-template-columns: var(--tubt-rb-cover-width) minmax(0, 1fr);
	gap: var(--tubt-rb-cover-text-gap);
	align-items: start;
	width: 100%;
	box-sizing: border-box;
}

.tubt-recommended-book__cover-link {
	display: block;
	width: var(--tubt-rb-cover-width);
	margin: 0;
}

.tubt-recommended-book__cover {
	display: block;
	width: var(--tubt-rb-cover-width);
	height: auto;
	aspect-ratio: 2 / 3;
	object-fit: cover;
	border: var(--tubt-rb-cover-border-width) solid var(--tubt-rb-cover-border-color);
}

.tubt-recommended-book__body {
	min-width: 0;
	padding-top: 1px;
	text-align: left;
}

.tubt-recommended-book__title {
	margin: 0 0 var(--tubt-rb-title-author-gap) !important;
	font-family: var(--tubt-rb-title-font);
	font-size: var(--tubt-rb-title-size);
	font-weight: var(--tubt-rb-title-weight);
	letter-spacing: var(--tubt-rb-title-letter-spacing);
	line-height: 1.28;
}

.tubt-recommended-book__title a,
.tubt-recommended-book__title a:visited {
	color: var(--tubt-rb-title-color) !important;
	text-decoration: none !important;
}

.tubt-recommended-book__title a:hover,
.tubt-recommended-book__title a:focus {
	color: #febd69 !important;
}

.tubt-recommended-book__author {
	margin-bottom: var(--tubt-rb-author-rating-gap);
	color: var(--tubt-rb-author-color);
	font-family: var(--tubt-rb-author-font);
	font-size: var(--tubt-rb-author-size);
	font-weight: var(--tubt-rb-author-weight);
	letter-spacing: var(--tubt-rb-author-letter-spacing);
	line-height: 1.35;
}

.tubt-recommended-book__rating {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	color: var(--tubt-rb-rating-color);
	font-family: var(--tubt-rb-rating-font);
	font-size: var(--tubt-rb-rating-size);
	font-weight: var(--tubt-rb-rating-weight);
	letter-spacing: var(--tubt-rb-rating-letter-spacing);
	line-height: 1.35;
}

.tubt-recommended-book__rating-value {
	color: #e7e2d9;
}

.tubt-recommended-book__rating-stars {
	display: inline-flex;
	align-items: center;
	gap: 1px;
	line-height: 1;
	white-space: nowrap;
	color: #ffa41c;
}

.tubt-recommended-book__rating-count {
	color: #2ea3f2;
}

.tubt-recommended-book__rating-star {
	display: block;
	width: 1em;
	height: 1em;
	flex: 0 0 1em;
}

.tubt-recommended-book__rating-star--full path,
.tubt-recommended-book__rating-star-half-fill {
	fill: currentColor;
	stroke: currentColor;
	stroke-width: 1;
}

.tubt-recommended-book__rating-star--empty path,
.tubt-recommended-book__rating-star-outline {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	opacity: 0.55;
}

.tubt-rb-hide-author .tubt-recommended-book__author {
	display: none;
}

.tubt-rb-hide-rating .tubt-recommended-book__rating {
	display: none;
}


.tubt-recommended-books.tubt-rb-no-outer-border {
	border: none;
}


/* ==============================================================
 * HOME PAGE — [tubt_recommended_books_home]
 * Independent from the existing blog sidebar recommendation layout.
 * Adjust only these home-scoped variables to customize home cards.
 * ============================================================== */
.tubt-rb-home {
	--home-card-background: #1b1916;
	--home-border-color: #a97722;
	--home-title-color: #f0e3c5;
	--home-text-color: #e8e8e8;
	--home-muted-color: #c9bba8;
	--home-stars-color: #ffa41c;
	--home-button-text: #11100e;
	--home-cover-height: 235px;
	--home-gap: 20px;
	display: block;
	width: 100%;
	max-width: 1200px;
	margin-inline: auto;
	box-sizing: border-box;
}

.tubt-rb-home[hidden] {
	display: none !important;
}

.tubt-rb-home .tubt-recommended-books__list {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--home-gap);
	align-items: stretch;
}

.tubt-rb-home .tubt-rb-home__card {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 0;
	width: 100%;
	box-sizing: border-box;
	padding: 24px 18px 22px;
	border: 1px solid var(--home-border-color);
	border-radius: 12px;
	background: var(--home-card-background, #1b1916);
	text-align: center;
}

.tubt-rb-home .tubt-rb-home__cover-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: var(--home-cover-height);
	margin-bottom: 15px;
	text-decoration: none;
}

.tubt-rb-home .tubt-rb-home__cover {
	display: block;
	max-width: 100%;
	width: auto;
	height: 100%;
	object-fit: contain;
	box-shadow: 0 4px 14px rgb(0 0 0 / 28%);
}

.tubt-rb-home .tubt-rb-home__rating {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 5px;
	margin-bottom: 12px;
	color: var(--home-stars-color);
	font-family: "Inter", sans-serif;
	font-size: 14px;
	line-height: 1.3;
}

.tubt-rb-home .tubt-rb-home__rating-number {
	color: var(--home-title-color);
}

.tubt-rb-home .tubt-rb-home__rating-count {
	color: var(--home-muted-color);
}

.tubt-rb-home .tubt-recommended-book__rating-stars {
	color: var(--home-stars-color);
}

.tubt-rb-home .tubt-rb-home__title {
	margin: 0 0 9px !important;
	color: var(--home-title-color) !important;
	font-family: "Cinzel", serif;
	font-size: 19px;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.tubt-rb-home .tubt-rb-home__title a,
.tubt-rb-home .tubt-rb-home__title a:visited {
	color: inherit !important;
	text-decoration: none !important;
}

.tubt-rb-home .tubt-rb-home__title a:hover,
.tubt-rb-home .tubt-rb-home__title a:focus {
	color: #f3d27a !important;
}

.tubt-rb-home .tubt-rb-home__author {
	margin: 0 0 12px !important;
	color: var(--home-muted-color);
	font-family: "Inter", sans-serif;
	font-size: 13px;
	line-height: 1.45;
}

.tubt-rb-home .tubt-rb-home__description {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
	min-height: 4.5em;
	max-height: 4.5em;
	margin: 0 0 20px !important;
	color: var(--home-text-color);
	font-family: "Inter", sans-serif;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.5;
	overflow-wrap: break-word;
}

.tubt-rb-home .tubt-rb-home__button,
.tubt-rb-home .tubt-rb-home__button:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: min(100%, 200px);
	min-height: 42px;
	margin-top: auto;
	padding: 10px 16px;
	border: 1px solid #f0c466;
	border-radius: 7px;
	background: var(--home-button-bg-color, #e9be58);
	color: var(--home-button-text) !important;
	font-family: "Inter", sans-serif;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: .5px;
	text-align: center;
	text-decoration: none !important;
	transition: filter .15s ease;
}

.tubt-rb-home .tubt-rb-home__button:hover,
.tubt-rb-home .tubt-rb-home__button:focus-visible {
	filter: brightness(1.1);
	color: var(--home-button-text) !important;
}

.tubt-rb-home a:focus-visible {
	outline: 2px solid #f3d27a;
	outline-offset: 3px;
}

@media (max-width: 980px) {
	.tubt-rb-home .tubt-recommended-books__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 650px) {
	.tubt-rb-home .tubt-recommended-books__list {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.tubt-rb-home .tubt-rb-home__card {
		padding: 22px 16px;
	}

	.tubt-rb-home .tubt-rb-home__title {
		font-size: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tubt-rb-home .tubt-rb-home__button {
		transition: none;
	}
}


/* ==========================================================
 * HOME PAGE STYLE CONTROLS
 * Independent settings, scoped to .tubt-rb-home only.
 * Blog sidebar selectors and declarations above are untouched.
 * ========================================================== */
.tubt-rb-home { max-width: var(--home-max-width, 1200px); }
.tubt-rb-home .tubt-recommended-books__list {
	grid-template-columns: repeat(var(--home-cols-desktop, 3), minmax(0, 1fr));
	gap: var(--home-gap, 20px);
}
.tubt-rb-home .tubt-rb-home__card {
	padding: var(--home-pad-top, 24px) var(--home-pad-side, 18px) var(--home-pad-bottom, 22px);
	border-width: var(--home-border-width, 1px);
	border-radius: var(--home-radius, 12px);
}
.tubt-rb-home .tubt-rb-home__cover-link {
	height: var(--home-cover-height, 235px);
	margin-bottom: var(--home-cover-gap, 15px);
}
.tubt-rb-home .tubt-rb-home__cover {
	max-width: min(100%, var(--home-cover-width, 300px));
	border-radius: var(--home-cover-radius, 0px);
}
.tubt-rb-home .tubt-rb-home__rating {
	font-family: var(--home-rating-font, "Inter", sans-serif);
	font-size: var(--home-rating-size, 14px);
	gap: var(--home-rating-gap, 5px);
	margin-bottom: var(--home-rating-bottom, 12px);
}
.tubt-rb-home .tubt-rb-home__rating-number { color: var(--home-rating-number-color, #f0e3c5); }
.tubt-rb-home .tubt-rb-home__rating-count { color: var(--home-rating-count-color, #c9bba8); }
.tubt-rb-home .tubt-rb-home__title {
	font-family: var(--home-title-font, "Cinzel", serif);
	font-size: var(--home-title-size, 19px);
	font-weight: var(--home-title-weight, 600);
	line-height: var(--home-title-line, 1.35);
	letter-spacing: var(--home-title-spacing, 0px);
	margin-bottom: var(--home-title-gap, 9px) !important;
}
.tubt-rb-home .tubt-rb-home__author {
	font-family: var(--home-author-font, "Inter", sans-serif);
	font-size: var(--home-author-size, 13px);
	font-weight: var(--home-author-weight, 400);
	line-height: var(--home-author-line, 1.45);
	margin-bottom: var(--home-author-gap, 12px) !important;
}
.tubt-rb-home .tubt-rb-home__description {
	font-family: var(--home-description-font, "Inter", sans-serif);
	font-size: var(--home-description-size, 15px);
	font-weight: var(--home-description-weight, 400);
	line-height: var(--home-description-line, 1.5);
	-webkit-line-clamp: var(--home-description-lines, 3);
	line-clamp: var(--home-description-lines, 3);
	min-height: calc(var(--home-description-lines, 3) * var(--home-description-line, 1.5) * 1em);
	max-height: calc(var(--home-description-lines, 3) * var(--home-description-line, 1.5) * 1em);
	margin-bottom: var(--home-description-gap, 20px) !important;
}
.tubt-rb-home .tubt-rb-home__button,
.tubt-rb-home .tubt-rb-home__button:visited {
	font-family: var(--home-button-font, "Inter", sans-serif);
	font-size: var(--home-button-size, 14px);
	font-weight: var(--home-button-weight, 700);
	letter-spacing: var(--home-button-letter, .5px);
	width: min(100%, var(--home-button-width, 200px));
	min-height: var(--home-button-height, 42px);
	padding: var(--home-button-pad-v, 10px) var(--home-button-pad-h, 16px);
	border-width: var(--home-button-border-width, 1px);
	border-color: var(--home-button-border-color, #f0c466);
	border-radius: var(--home-button-radius, 7px);
	background: var(--home-button-bg-color, #e9be58);
}
.tubt-rb-home .tubt-rb-home__button:hover,
.tubt-rb-home .tubt-rb-home__button:focus-visible {
	filter: brightness(var(--home-button-hover, 1.1));
}
@media (max-width: 980px) {
	.tubt-rb-home .tubt-recommended-books__list {
		grid-template-columns: repeat(var(--home-cols-tablet, 2), minmax(0, 1fr));
	}
	.tubt-rb-home .tubt-rb-home__title { font-size: var(--home-title-tablet, 19px); }
	.tubt-rb-home .tubt-rb-home__cover-link { height: var(--home-cover-tablet, 235px); }
}
@media (max-width: 650px) {
	.tubt-rb-home .tubt-recommended-books__list {
		grid-template-columns: repeat(var(--home-cols-phone, 1), minmax(0, 1fr));
		gap: var(--home-gap-phone, 16px);
	}
	.tubt-rb-home .tubt-rb-home__card {
		padding: var(--home-pad-phone-v, 22px) var(--home-pad-phone-h, 16px);
	}
	.tubt-rb-home .tubt-rb-home__title { font-size: var(--home-title-phone, 18px); }
	.tubt-rb-home .tubt-rb-home__description { font-size: var(--home-description-phone, 15px); }
	.tubt-rb-home .tubt-rb-home__cover-link { height: var(--home-cover-phone, 235px); }
}

/* ============================================================
 * TUBT CARD ELEMENT VISIBILITY CONTROLS
 * Entirely additive: no visual changes when toggles are on.
 * Blog and Home selectors are scoped to their own shortcode.
 * ============================================================ */

/* Cover link; blog's two-column grid collapses only when cover is hidden. */
.tubt-recommended-books.tubt-rb-hide-cover .tubt-recommended-book__cover-link,
.tubt-rb-home.tubt-rb-hide-cover .tubt-rb-home__cover-link { display: none !important; }
.tubt-recommended-books.tubt-rb-hide-cover .tubt-recommended-book {
	grid-template-columns: minmax(0, 1fr);
}

/* Titles and authors. */
.tubt-recommended-books.tubt-rb-hide-title .tubt-recommended-book__title,
.tubt-rb-home.tubt-rb-hide-title .tubt-rb-home__title { display: none !important; }
.tubt-rb-home.tubt-rb-hide-author .tubt-rb-home__author { display: none !important; }

/* Entire rating line; Blog's original show_rating switch still works. */
.tubt-rb-home.tubt-rb-hide-rating .tubt-rb-home__rating { display: none !important; }

/* Independent components inside ratings. */
.tubt-recommended-books.tubt-rb-hide-rating-number .tubt-recommended-book__rating-value,
.tubt-rb-home.tubt-rb-hide-rating-number .tubt-rb-home__rating-number { display: none !important; }
.tubt-recommended-books.tubt-rb-hide-rating-stars .tubt-recommended-book__rating-stars,
.tubt-rb-home.tubt-rb-hide-rating-stars .tubt-recommended-book__rating-stars { display: none !important; }
.tubt-recommended-books.tubt-rb-hide-rating-count .tubt-recommended-book__rating-count,
.tubt-rb-home.tubt-rb-hide-rating-count .tubt-rb-home__rating-count { display: none !important; }

/* Home-only attributes that do not exist on the Blog sidebar card. */
.tubt-rb-home.tubt-rb-hide-description .tubt-rb-home__description,
.tubt-rb-home.tubt-rb-hide-button .tubt-rb-home__button { display: none !important; }


/* ============================================================
 * HOME BOOK CARD WIDTH CONTROLS
 * Width is a percentage of the responsive grid column.
 * At 100% the card keeps its existing dimensions and appearance.
 * Cards stay centered and cannot overflow their grid column.
 * ============================================================ */
.tubt-rb-home .tubt-rb-home__card {
	width: min(100%, var(--home-card-width-desktop, 100%));
	margin-inline: auto;
}
@media (max-width: 980px) {
	.tubt-rb-home .tubt-rb-home__card {
		width: min(100%, var(--home-card-width-tablet, 100%));
	}
}
@media (max-width: 650px) {
	.tubt-rb-home .tubt-rb-home__card {
		width: min(100%, var(--home-card-width-phone, 100%));
	}
}


/* ============================================================
 * OPTIONAL BOOK BROWSING — scoped to the recommendation plugin.
 * Deliberately understated so the gold Learn More CTAs lead.
 * ============================================================ */
.tubt-rb-home .tubt-rb-nav,
.tubt-recommended-books .tubt-rb-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 22px;
	width: 100%;
	color: #e7e2d9;
}
.tubt-recommended-books .tubt-rb-nav {
	margin-top: 14px;
}
.tubt-rb-home .tubt-rb-nav button,
.tubt-recommended-books .tubt-rb-nav button {
	appearance: none !important;
	-webkit-appearance: none !important;
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	text-decoration: none !important;
	text-transform: none !important;
	margin: 0 !important;
	padding: 0 !important;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: "Inter", sans-serif !important;
	font-size: 16px !important;
	line-height: 1.25 !important;
	font-weight: 500 !important;
	cursor: pointer;
	transition: color 140ms ease, transform 140ms ease;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}
.tubt-rb-home .tubt-rb-nav .tubt-rb-nav__previous,
.tubt-rb-home .tubt-rb-nav .tubt-rb-nav__next,
.tubt-recommended-books .tubt-rb-nav .tubt-rb-nav__previous,
.tubt-recommended-books .tubt-rb-nav .tubt-rb-nav__next {
	min-width: 44px;
	color: #f0c466 !important;
	font-size: 18px !important;
	font-weight: 700 !important;
	letter-spacing: -2px;
}
.tubt-rb-home .tubt-rb-nav .tubt-rb-nav__label,
.tubt-recommended-books .tubt-rb-nav .tubt-rb-nav__label {
	color: #e7e2d9 !important;
	white-space: nowrap;
}
.tubt-rb-home .tubt-rb-nav button:hover,
.tubt-rb-home .tubt-rb-nav button:focus-visible,
.tubt-recommended-books .tubt-rb-nav button:hover,
.tubt-recommended-books .tubt-rb-nav button:focus-visible {
	color: #ffe5a0 !important;
}
.tubt-rb-home .tubt-rb-nav .tubt-rb-nav__previous:hover,
.tubt-rb-home .tubt-rb-nav .tubt-rb-nav__previous:focus-visible,
.tubt-recommended-books .tubt-rb-nav .tubt-rb-nav__previous:hover,
.tubt-recommended-books .tubt-rb-nav .tubt-rb-nav__previous:focus-visible {
	transform: translateX(-2px);
}
.tubt-rb-home .tubt-rb-nav .tubt-rb-nav__next:hover,
.tubt-rb-home .tubt-rb-nav .tubt-rb-nav__next:focus-visible,
.tubt-recommended-books .tubt-rb-nav .tubt-rb-nav__next:hover,
.tubt-recommended-books .tubt-rb-nav .tubt-rb-nav__next:focus-visible {
	transform: translateX(2px);
}
.tubt-rb-home .tubt-rb-nav button:focus-visible,
.tubt-recommended-books .tubt-rb-nav button:focus-visible {
	outline: 2px solid #f0c466 !important;
	outline-offset: 3px;
}
.tubt-rb-home .tubt-rb-nav__previous:disabled,
.tubt-recommended-books .tubt-rb-nav__previous:disabled {
	visibility: hidden;
	pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
	.tubt-rb-home .tubt-rb-nav button,
	.tubt-recommended-books .tubt-rb-nav button {
		transition: none;
	}
}
