/*
 * The Grand Athenaeum Scribe's Edition v2.0.18 — Stylesheet
 * Colors injected as CSS vars via PHP settings.
 */

:root {
	--bsp-accent:      var(--wp--preset--color--accent, var(--wp--preset--color--primary, var(--wp--preset--color--secondary, var(--wp--custom--color--accent, currentColor))));
	--bsp-accent-soft: color-mix(in srgb, var(--bsp-accent) 12%, transparent);
	--bsp-bg:          #f3f4f6;
	--bsp-card-bg:     #ffffff;
	--bsp-text:        #1a1a1a;
	--bsp-muted:       #6b7280;
	--bsp-border:      color-mix(in srgb, var(--bsp-accent) 28%, transparent);
	--bsp-border-h:    color-mix(in srgb, var(--bsp-accent) 60%, transparent);
	--bsp-divider:     rgba(0,0,0,.08);
	--bsp-ff:          inherit, system-ui, sans-serif;
	--bsp-r:           8px;
}

/* ── Grid ──────────────────────────────────────────────────── */

.bsp-grid {
	display: grid;
	gap: 1.25rem;
	padding: 1.5rem 0;
	align-items: start;       /* cards are their own natural height */
	min-width: 0;
}

.bsp-grid,
.bsp-grid * {
	box-sizing: border-box;
}

.bsp-cols-1 { grid-template-columns: minmax(0, 1fr); }
.bsp-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bsp-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bsp-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.bsp-single-book-grid {
	grid-template-columns: minmax(0, 1fr);
	max-width: 560px;
	width: min(100%, 560px);
	margin-left: auto;
	margin-right: auto;
	padding-bottom: 0;
	margin-bottom: 0;
}


/* Single book pages: keep the auto-rendered card clean and remove theme/plugin separator lines. */
body.single-book .bsp-single-book-grid {
	max-width: 560px;
	width: min(100%, 560px);
	padding-bottom: 0;
	margin-bottom: 0;
}

body.single-book main hr.wp-block-separator,
body.single-book .bsp-single-book-grid + hr,
body.single-book .bsp-single-book-grid ~ hr,
body.single-book footer.entry-footer,
body.single-book .entry-footer {
	display: none !important;
	border: 0 !important;
}

/* ── Card ──────────────────────────────────────────────────── */

.bsp-card {
	display: flex;
	flex-direction: column;
	background: var(--bsp-card-bg);
	border: 1.5px solid var(--bsp-border);
	border-radius: var(--bsp-r);
	overflow: hidden;
	transition: box-shadow .2s, border-color .2s;
}

.bsp-card:hover {
	border-color: var(--bsp-border-h);
	box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

/* ── Cover ─────────────────────────────────────────────────── */

.bsp-cover-wrap {
	position: relative;
	cursor: pointer;
	overflow: hidden;
	flex-shrink: 0;
	background: var(--bsp-bg);
	display: flex;
	align-items: center;
	justify-content: center;
}

.bsp-cover {
	display: block;
	width: 100%;
	height: auto;
	max-height: none;
	object-fit: contain;
	transition: none;
}

.bsp-cover-wrap:hover .bsp-cover { transform: none; }

.bsp-cover-placeholder {
	width: 100%;
	padding-bottom: 150%;
	background: var(--bsp-bg);
}

.bsp-cover-hint {
	position: absolute;
	bottom: 0; left: 0; right: 0;
	padding: .8rem .5rem .5rem;
	background: linear-gradient(transparent, rgba(0,0,0,.7));
	color: #fff;
	font-family: var(--bsp-ff);
	font-size: .65rem;
	font-weight: 700;
	letter-spacing: .1em;
	text-align: center;
	text-transform: uppercase;
	opacity: 0;
	transition: opacity .2s;
	pointer-events: none;
}

.bsp-cover-wrap:hover .bsp-cover-hint { opacity: 1; }

/* ── Card body ─────────────────────────────────────────────── */

.bsp-card-body {
	padding: .9rem .9rem .75rem;
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.bsp-series {
	font-family: var(--bsp-ff);
	font-size: .62rem;
	font-weight: 800;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--bsp-accent);
	margin: 0 0 .25rem;
}

.bsp-title {
	font-family: var(--bsp-ff);
	font-size: 1rem;
	font-weight: 800;
	color: var(--bsp-text);
	line-height: 1.25;
	margin: 0 0 .2rem;
}

.bsp-subtitle {
	font-family: var(--bsp-ff);
	font-size: .78rem;
	font-style: italic;
	font-weight: 400;
	color: var(--bsp-muted);
	margin: 0 0 .3rem;
}

.bsp-price {
	font-family: var(--bsp-ff);
	font-size: .85rem;
	font-weight: 700;
	color: var(--bsp-text);
	margin: 0 0 .5rem;
}

.bsp-featured-badge {
	display: inline-flex;
	width: fit-content;
	align-items: center;
	border-radius: 999px;
	background: var(--bsp-accent-soft);
	color: var(--bsp-accent);
	border: 1px solid var(--bsp-border);
	font-family: var(--bsp-ff);
	font-size: .62rem;
	font-weight: 800;
	letter-spacing: .08em;
	line-height: 1;
	padding: .28rem .48rem;
	text-transform: uppercase;
	margin: 0 0 .45rem;
}


/* ── Preorder / release status ─────────────────────────────── */

.bsp-release-status {
	display: grid;
	gap: .18rem;
	margin: .45rem 0 .5rem;
	padding: .52rem .6rem;
	border: 1px solid var(--bsp-border);
	border-radius: 6px;
	background: var(--bsp-accent-soft);
	font-family: var(--bsp-ff);
	line-height: 1.25;
}

.bsp-release-badge {
	display: inline-flex;
	width: fit-content;
	align-items: center;
	border-radius: 999px;
	background: var(--bsp-accent);
	color: #fff;
	font-size: .62rem;
	font-weight: 800;
	letter-spacing: .08em;
	line-height: 1;
	padding: .28rem .48rem;
	text-transform: uppercase;
}

.bsp-release-date {
	font-size: .74rem;
	font-weight: 700;
	color: var(--bsp-text);
}

.bsp-release-countdown {
	font-size: .72rem;
	font-style: italic;
	color: var(--bsp-muted);
}

/* ── Platform / Retailer Buttons ───────────────────────────── */

.bsp-links {
	display: flex;
	flex-direction: column;
	gap: .4rem;
	margin: .55rem 0 .45rem;
	max-width: 100%;
	min-width: 0;
}

.bsp-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 34px;
	padding: .52rem .75rem;
	border-radius: 4px;
	background: var(--bsp-accent);
	color: #fff;
	font-family: var(--bsp-ff);
	font-size: .75rem;
	font-weight: 800;
	letter-spacing: .05em;
	line-height: 1.2;
	text-transform: uppercase;
	text-align: center;
	text-decoration: none !important;
	transition: filter .15s, transform .1s, opacity .15s;
	box-sizing: border-box;
	overflow-wrap: anywhere;
}

.bsp-link:hover {
	filter: brightness(.96);
	transform: translateY(-1px);
}

.bsp-link:active { transform: translateY(0); }

.bsp-link-icon,
.bsp-link svg,
.bsp-link-img {
	display: none !important;
}

.bsp-popup-links-row { margin-top: 1.25rem; }
.bsp-popup-links-row .bsp-link { max-width: 320px; }

/* ── Perks list ────────────────────────────────────────────── */

.bsp-perks {
	list-style: none;
	margin: .55rem 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: .35rem;
}

.bsp-perks li {
	display: flex;
	align-items: center;
	gap: .45rem;
	border: none !important;
	font-family: var(--bsp-ff);
	font-size: .75rem;
	font-weight: 400;
	color: var(--bsp-text);
	line-height: 1.3;
}

.bsp-perk-icon { width: 15px; height: 15px; flex-shrink: 0; color: var(--bsp-accent); }
.bsp-perk-icon svg { width: 15px; height: 15px; }

.bsp-perk-sample {
	display: flex;
	align-items: center;
	gap: .45rem;
	justify-content: flex-start;
	background: none;
	border: none;
	padding: 0;
	font-family: var(--bsp-ff);
	font-size: .75rem;
	font-weight: 400;
	color: var(--bsp-text);
	cursor: pointer;
	text-align: left;
	transition: color .15s;
}

.bsp-perk-sample:hover { color: var(--bsp-accent); }

.bsp-perk-sample.bsp-look-inside {
	justify-content: flex-start;
	padding: 0;
	margin: 0;
	border-top: 0;
	font-size: .75rem;
	font-weight: 400;
	line-height: 1.3;
}


/* ── Accordion ─────────────────────────────────────────────── */

.bsp-acc-label      { display: flex; align-items: center; gap: .4rem; }
.bsp-acc-icon-left  { display: flex; align-items: center; width: 14px; height: 14px; flex-shrink: 0; color: var(--bsp-accent); }
.bsp-acc-icon-left svg { width: 14px; height: 14px; }

.bsp-accordion { border-top: 1px solid var(--bsp-divider); margin-top: .25rem; }

.bsp-acc-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: .55rem 0;
	background: none;
	border: none;
	font-family: var(--bsp-ff);
	font-size: .8rem;
	font-weight: 700;
	color: var(--bsp-text);
	cursor: pointer;
	text-align: left;
	gap: .5rem;
	transition: color .15s;
}

.bsp-acc-trigger:hover { color: var(--bsp-accent); }

.bsp-acc-chevron {
	flex-shrink: 0;
	width: 14px; height: 14px;
	display: flex; align-items: center; justify-content: center;
	transition: transform .22s ease;
	color: var(--bsp-muted);
}

.bsp-acc-chevron::before {
	content: '';
	display: block;
	width: 8px; height: 8px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translate(-1px,-1px);
}

.bsp-acc-trigger[aria-expanded="true"] .bsp-acc-chevron { transform: rotate(180deg); }
.bsp-acc-panel { overflow: hidden; max-height: 0; transition: max-height .25s ease; }

.bsp-acc-inner {
	padding: 0 0 .65rem;
	font-family: var(--bsp-ff);
	font-size: .8rem;
	font-weight: 300;
	color: var(--bsp-text);
	line-height: 1.7;
}

.bsp-acc-inner p            { margin: 0 0 .5rem; }
.bsp-acc-inner p:last-child { margin-bottom: 0; }

/* ── Look Inside ───────────────────────────────────────────── */

.bsp-look-inside {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: .55rem 0;
	background: none;
	border: none;
	border-top: 1px solid var(--bsp-divider);
	margin-top: .25rem;
	font-family: var(--bsp-ff);
	font-size: .8rem;
	font-weight: 700;
	color: var(--bsp-text);
	cursor: pointer;
	text-align: left;
	gap: .5rem;
	transition: color .15s;
}

.bsp-look-inside:hover { color: var(--bsp-accent); }
.bsp-li-arrow,
.bsp-li-chevron {
	flex-shrink: 0;
	width: 14px;
	height: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--bsp-muted);
}

.bsp-li-chevron::before {
	content: '';
	display: block;
	width: 8px;
	height: 8px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
}

.bsp-excerpt  { display: none; }

/* ── Popup ─────────────────────────────────────────────────── */

#bsp-popup {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	background: rgba(0,0,0,.65);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .25s ease;
	box-sizing: border-box;
}

#bsp-popup.bsp-open { opacity: 1; pointer-events: all; }

.bsp-popup-box {
	position: relative;
	width: 100%;
	max-width: 1100px;
	max-height: calc(100dvh - 2.5rem);
	background: #fff;
	border: 1.5px solid var(--bsp-border);
	border-radius: 10px;
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	transform: translateY(14px) scale(.975);
	transition: transform .25s ease;
	box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

#bsp-popup.bsp-open .bsp-popup-box { transform: translateY(0) scale(1); }

.bsp-popup-box::-webkit-scrollbar       { width: 3px; }
.bsp-popup-box::-webkit-scrollbar-track { background: transparent; }
.bsp-popup-box::-webkit-scrollbar-thumb { background: var(--bsp-border); border-radius: 2px; }

.bsp-close {
	position: sticky;
	top: .85rem;
	float: right;
	margin: .85rem .85rem 0 0;
	z-index: 5;
	width: 34px; height: 34px;
	display: flex; align-items: center; justify-content: center;
	background: var(--bsp-accent-soft);
	border: 1.5px solid var(--bsp-border);
	border-radius: 50%;
	color: var(--bsp-accent);
	font-size: 1.1rem;
	cursor: pointer;
	transition: background .15s, color .15s;
	padding: 0;
	font-family: var(--bsp-ff);
	flex-shrink: 0;
}

.bsp-close:hover            { background: var(--bsp-accent); color: #fff; border-color: var(--bsp-accent); }
.bsp-close:focus-visible     { outline: 2px solid var(--bsp-accent); outline-offset: 2px; }

.bsp-popup-inner   { display: flex; flex-direction: column; align-items: center; clear: both; }

.bsp-popup-cover-col {
	width: 100%;
	background: var(--bsp-bg);
	display: flex;
	justify-content: center;
	padding: 1.5rem 2rem 1.75rem;
	box-sizing: border-box;
}

.bsp-popup-img {
	width: auto;
	max-width: 100%;
	max-height: calc(100dvh - 5rem);
	object-fit: contain;
	border-radius: 5px;
	box-shadow: 0 6px 28px rgba(0,0,0,.18);
	display: block;
}

.bsp-popup-text-col {
	width: 100%;
	max-width: 820px;
	margin: 0 auto;
	padding: 1.75rem 2rem 2rem;
	box-sizing: border-box;
}

#bsp-popup-series {
	font-family: var(--bsp-ff);
	font-size: .68rem;
	font-weight: 800;
	letter-spacing: .13em;
	text-transform: uppercase;
	color: var(--bsp-accent);
	margin: 0 0 .4rem;
}

#bsp-popup-title {
	font-family: var(--bsp-ff);
	font-size: 1.75rem;
	font-weight: 800;
	color: var(--bsp-text);
	margin: 0 0 .15rem;
	line-height: 1.2;
}

#bsp-popup-subtitle {
	font-family: var(--bsp-ff);
	font-size: .95rem;
	font-style: italic;
	font-weight: 400;
	color: var(--bsp-muted);
	margin: 0 0 1.25rem;
}

.bsp-popup-divider {
	width: 36px; height: 2px;
	background: var(--bsp-accent);
	opacity: .45;
	margin: 0 0 1.25rem;
	border-radius: 1px;
}

#bsp-popup-excerpt {
	font-family: var(--bsp-ff);
	font-size: .95rem;
	font-weight: 300;
	color: #3a3a3a;
	line-height: 1.75;
	max-width: 72ch;
	white-space: normal;
}

#bsp-popup-excerpt h3 {
	font-family: var(--bsp-ff);
	font-size: 1rem;
	font-weight: 700;
	color: var(--bsp-text);
	margin: 0 0 .85rem;
}

#bsp-popup-excerpt p            { display: block; margin: 0 0 1.15em; }
#bsp-popup-excerpt p:last-child { margin-bottom: 0; }

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.bsp-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
	.bsp-cols-4,
	.bsp-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
	.bsp-cols-4,
	.bsp-cols-3,
	.bsp-cols-2,
	.bsp-cols-1 { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
	.bsp-popup-cover-col { padding: 1.25rem; }
	.bsp-popup-text-col  { padding: 1.25rem; }
	#bsp-popup-title     { font-size: 1.35rem; }
}

/* ── Featured carousel ─────────────────────────────────────── */

.bsp-featured-carousel {
	position: relative;
	max-width: 1120px;
	margin: 1.5rem auto;
	min-width: 0;
}

.bsp-featured-carousel-title {
	font-family: inherit;
	font-size: clamp(1.35rem, 2vw, 2rem);
	font-weight: 800;
	color: inherit;
	margin: 0 0 1rem;
}

.bsp-featured-carousel-shell {
	position: relative;
	display: block;
	padding: 0 3.25rem;
	min-width: 0;
}

.bsp-featured-carousel-track {
	display: flex;
	align-items: stretch;
	grid-template-columns: none !important;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	gap: 1.25rem;
	padding: .25rem 0 1rem;
	-webkit-overflow-scrolling: touch;
	box-sizing: border-box;
	scrollbar-width: thin;
}

.bsp-featured-carousel-track,
.bsp-featured-carousel-track * {
	box-sizing: border-box;
}

.bsp-featured-carousel-track .bsp-featured-card {
	flex: 0 0 calc((100% - 2.5rem) / 3);
	min-width: 0;
	height: auto;
	align-self: stretch;
	scroll-snap-align: center;
}

.bsp-featured-card .bsp-cover-wrap {
	cursor: default;
}

.bsp-featured-card .bsp-cover-hint {
	display: none !important;
}

.bsp-featured-card .bsp-card-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 230px;
}

.bsp-featured-card .bsp-price {
	margin-bottom: .8rem;
}

.bsp-featured-more {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100% !important;
	max-width: 100% !important;
	inline-size: 100% !important;
	min-width: 0 !important;
	min-height: 34px;
	margin: auto 0 0 !important;
	padding: .52rem .75rem !important;
	box-sizing: border-box !important;
	border: 0 !important;
	border-radius: 4px;
	background: var(--bsp-accent) !important;
	color: #fff !important;
	font-family: var(--bsp-ff);
	font-size: .75rem;
	font-weight: 800;
	letter-spacing: .05em;
	line-height: 1.2;
	text-transform: uppercase;
	text-align: center;
	text-decoration: none !important;
	white-space: normal;
	overflow-wrap: anywhere;
	transition: filter .15s, transform .1s, opacity .15s;
}

.bsp-featured-more:hover {
	filter: brightness(.96);
	transform: translateY(-1px);
}

.bsp-carousel-btn {
	position: absolute;
	top: 50%;
	z-index: 5;
	transform: translateY(-50%);
	width: 38px;
	height: 38px;
	border-radius: 999px;
	border: 1px solid var(--bsp-border);
	background: var(--bsp-card-bg);
	color: var(--bsp-accent);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.bsp-carousel-prev { left: .25rem; }
.bsp-carousel-next { right: .25rem; }

.bsp-carousel-btn:hover,
.bsp-carousel-btn:focus {
	border-color: var(--bsp-border-h);
	background: var(--bsp-accent-soft);
}

.bsp-carousel-btn span {
	display: block;
	width: 10px;
	height: 10px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
}

.bsp-carousel-prev span { transform: rotate(-135deg); margin-left: 4px; }
.bsp-carousel-next span { transform: rotate(45deg); margin-right: 4px; }

@media (max-width: 900px) {
	.bsp-featured-carousel-track .bsp-featured-card {
		flex-basis: calc((100% - 1.25rem) / 2);
	}
}

@media (max-width: 640px) {
	.bsp-featured-carousel-shell {
		padding: 0;
	}
	.bsp-carousel-btn {
		display: none;
	}
	.bsp-featured-carousel-track .bsp-featured-card {
		flex-basis: min(86vw, 320px);
	}
}

.bsp-featured-card .bsp-cover-wrap {
	cursor: default;
}

.bsp-featured-card .bsp-cover-wrap:hover .bsp-cover {
	transform: none;
}

.bsp-featured-card .bsp-cover-hint {
	display: none;
}


/* Settings accent hardening: keep The Grand Athenaeum Scribe's Edition buttons/icons on the saved accent unless a link explicitly uses an inline brand/custom color. */
.bsp-card .bsp-link:not([style]),
.bsp-featured-card .bsp-link:not([style]),
.bsp-popup-box .bsp-link:not([style]) {
	background-color: var(--bsp-accent) !important;
}
.bsp-perk-icon,
.bsp-acc-icon-left,
.bsp-featured-badge,
.bsp-series,
.bsp-carousel-arrow {
	color: var(--bsp-accent) !important;
}
.bsp-card,
.bsp-featured-card,
.bsp-popup-box {
	border-color: var(--bsp-border) !important;
}

/* ── Single book spotlight ─────────────────────────────────── */
.bsp-spotlight {
	max-width: 1120px;
	margin: 1.5rem auto;
	padding: 0 1rem;
	box-sizing: border-box;
}

.bsp-spotlight-title {
	font-family: inherit;
	font-size: clamp(1.35rem, 2vw, 2rem);
	font-weight: 800;
	color: inherit;
	margin: 0 0 1rem;
}

.bsp-spotlight-inner {
	display: flex;
	justify-content: center;
	align-items: flex-start;
}

.bsp-spotlight-card {
	width: min(100%, 340px);
	max-width: 340px;
}

.bsp-spotlight-card .bsp-card-body {
	min-height: 230px;
}


/* Spotlight button hardening: keep the CTA inside the card even when themes apply global button/link widths. */
.bsp-spotlight-card .bsp-featured-more,
.bsp-featured-card .bsp-featured-more {
	position: static !important;
	left: auto !important;
	right: auto !important;
	float: none !important;
	clear: both;
}
.bsp-spotlight-card .bsp-card-body,
.bsp-featured-card .bsp-card-body {
	overflow: hidden;
}

/* Card alignment hardening: keep book-card text from zig-zagging when themes apply global heading/list alignment. */
.bsp-card .bsp-card-body {
	text-align: left;
}

.bsp-card .bsp-series,
.bsp-card .bsp-title,
.bsp-card .bsp-subtitle,
.bsp-card .bsp-price {
	align-self: stretch;
	text-align: left !important;
}

.bsp-card .bsp-links {
	align-items: stretch;
}

.bsp-card .bsp-link {
	text-align: center !important;
}

.bsp-card .bsp-perks,
.bsp-card .bsp-perks li {
	text-align: left !important;
}

.bsp-card .bsp-perks,
.bsp-card .bsp-perks ul,
.bsp-card ul.bsp-perks {
	list-style: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

.bsp-card .bsp-perks li {
	justify-content: flex-start;
	list-style: none !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

.bsp-card .bsp-perks li::before,
.bsp-card .bsp-perks li::after,
.bsp-card .bsp-perks li::marker {
	content: none !important;
	display: none !important;
}
