/* Goodreads Bookshelf: a painted bookcase. Uses the Botanical Library colours when present. */
.jvdl-bookcase {
	--bs-paper: var(--wp--preset--color--paper, #F7F1E6);
	--bs-panel: var(--wp--preset--color--vellum, #EFE6D6);
	--bs-ink: var(--wp--preset--color--ink, #2A2420);
	--bs-soft: var(--wp--preset--color--ink-soft, #4A4039);
	--bs-accent: var(--wp--preset--color--burgundy, #6B1E2E);
	--bs-gilt: #D7B56D;
	--bs-wood: #B89A6A;
	--bs-wood-dark: #8C6E43;
	font-family: inherit;
}
.jvdl-bookcase__heading {
	margin: 0 0 1rem;
	font-variant: small-caps;
	letter-spacing: 0.16em;
	font-size: 0.85rem;
	color: var(--bs-soft);
}
.jvdl-bookcase__case {
	background: var(--bs-panel);
	border-radius: 4px;
	padding: 1.75rem 1.5rem 1.5rem;
}
.jvdl-bookcase__shelf {
	list-style: none;
	margin: 0;
	padding: 0 0.25rem;
	display: flex;
	align-items: flex-end;
	gap: 5px;
	min-height: 260px;
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: thin;
}
.jvdl-bookcase__shelf > li {
	margin: 0;
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
}
.jvdl-bookcase__plank {
	height: 11px;
	background: var(--bs-wood);
	border-bottom: 3px solid var(--bs-wood-dark);
	border-radius: 2px;
	margin-bottom: 1.75rem;
}
.jvdl-bookcase__plank:last-child {
	margin-bottom: 0;
}

/* Spines */
.jvdl-spine {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
	box-sizing: border-box;
	padding: 18px 0;
	border-radius: 3px 3px 1px 1px;
	text-decoration: none !important;
	transition: transform 0.2s ease;
	box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.10), inset -3px 0 0 rgba(0, 0, 0, 0.14);
	overflow: hidden;
}
.jvdl-spine::before,
.jvdl-spine::after {
	content: "";
	position: absolute;
	left: 5px;
	right: 5px;
	height: 0;
	border-top: 1px solid currentColor;
	opacity: 0.45;
}
.jvdl-spine::before { top: 9px; }
.jvdl-spine::after { bottom: 9px; }
.jvdl-spine__title,
.jvdl-spine__author {
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.1;
}
.jvdl-spine__title {
	font-family: Fraunces, Georgia, serif;
	font-size: 14.5px;
	max-height: 68%;
}
.jvdl-spine__author {
	font-size: 11px;
	letter-spacing: 0.06em;
	font-variant: small-caps;
	opacity: 0.9;
	max-height: 30%;
}
a.jvdl-spine:hover,
a.jvdl-spine:focus-visible {
	transform: translateY(-8px);
}
a.jvdl-spine:focus-visible {
	outline: 3px solid var(--bs-accent);
	outline-offset: 2px;
}

/* Bookmark ribbon for "currently reading" */
.jvdl-spine.is-current {
	overflow: visible;
}
.jvdl-spine.is-current::after {
	content: "";
	left: auto;
	right: 7px;
	bottom: auto;
	top: -1px;
	width: 7px;
	height: 26px;
	border: 0;
	opacity: 1;
	background: var(--bs-gilt);
	clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}
.jvdl-bookcase__ribbon {
	display: inline-block;
	width: 7px;
	height: 16px;
	margin-right: 0.35rem;
	vertical-align: -2px;
	background: var(--bs-gilt);
	clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%);
}

/* Colours (text contrast at least 4.5:1) */
.jvdl-spine--burgundy { background: #6B1E2E; color: #F7F1E6; }
.jvdl-spine--pine { background: #1F4A3D; color: #F7F1E6; }
.jvdl-spine--navy { background: #1E2A44; color: #F7F1E6; }
.jvdl-spine--wheat { background: #D9C29A; color: #2A2420; }
.jvdl-spine--rust { background: #8C3B2E; color: #F7F1E6; }
.jvdl-spine--aubergine { background: #4A2D52; color: #F7F1E6; }
.jvdl-spine--moss { background: #4F6B4A; color: #F7F1E6; }
.jvdl-spine--ink { background: #2A2420; color: #EFE6D6; }

.jvdl-bookcase__more {
	margin: 1rem 0 0;
	text-align: right;
	font-style: italic;
}
.jvdl-bookcase__legend {
	margin: 0.25rem 0 0;
	text-align: right;
	font-size: 0.85rem;
	color: var(--bs-soft);
}

/* Phones: shelves scroll sideways so books stay upright and readable */
@media (max-width: 600px) {
	.jvdl-bookcase__case { padding: 1.25rem 0.9rem 1rem; }
	.jvdl-bookcase__shelf { scroll-snap-type: x proximity; }
	.jvdl-bookcase__shelf > li { scroll-snap-align: start; }
}

@media (prefers-reduced-motion: reduce) {
	.jvdl-spine { transition: none; }
	a.jvdl-spine:hover, a.jvdl-spine:focus-visible { transform: none; }
}
@media (forced-colors: active) {
	.jvdl-spine { border: 1px solid CanvasText; }
	.jvdl-bookcase__plank { background: CanvasText; }
}
