/* DigiTechGenAI Books: catalogue + single book styles.
   Change the colours in :root to match your brand. */
.dtg-books, .dtg-single-panel {
	--dtg-accent: #4f46e5;
	--dtg-accent-text: #fff;
	--dtg-border: rgba(0, 0, 0, .1);
	--dtg-muted: rgba(0, 0, 0, .6);
	--dtg-radius: 10px;
}

/* Catalogue width: compact cards, centred (3 x 240px + gaps). */
.dtg-books { max-width: 880px; margin: 0 auto; scroll-margin-top: 120px; }

/* Filter bar */
.dtg-books-filter { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.dtg-books-search-form { display: flex; gap: 8px; flex: 1 1 260px; max-width: 380px; margin: 0; }
.dtg-books-search {
	flex: 1; min-width: 0; padding: 9px 14px;
	border: 1px solid var(--dtg-border); border-radius: var(--dtg-radius); font: inherit;
}
.dtg-books-search-form .dtg-btn { padding: 9px 16px; }
.dtg-books-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.dtg-books-cats a, .dtg-books-cats button {
	padding: 7px 14px; border: 1px solid var(--dtg-border); border-radius: 999px;
	background: transparent; color: inherit; font: inherit; font-size: .88em; line-height: 1.2;
	cursor: pointer; text-decoration: none;
}
.dtg-books-cats a:hover, .dtg-books-cats button:hover { border-color: var(--dtg-accent); }
.dtg-books-cats .is-active { background: var(--dtg-accent); border-color: var(--dtg-accent); color: var(--dtg-accent-text); }

/* Grid: 3 compact cards per row */
.dtg-books-grid { display: grid; gap: 28px 24px; justify-content: center;
	grid-template-columns: repeat(var(--dtg-cols, 3), minmax(0, 270px)); }
@media (max-width: 700px) { .dtg-books-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; } }

/* Pagination */
.dtg-books-pagination { display: flex; justify-content: center; margin-top: 36px; }
.dtg-books-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center;
	min-width: 40px; height: 40px; margin: 0 3px; padding: 0 12px; border: 1px solid var(--dtg-border);
	border-radius: var(--dtg-radius); color: inherit; text-decoration: none; font-weight: 600; font-size: .92em; }
.dtg-books-pagination a.page-numbers:hover { border-color: var(--dtg-accent); color: var(--dtg-accent); }
.dtg-books-pagination .page-numbers.current { background: var(--dtg-accent); border-color: var(--dtg-accent); color: var(--dtg-accent-text); }
.dtg-books-pagination .page-numbers.dots { border: 0; min-width: 20px; padding: 0; }

/* Cards: store-style tiles (square image, title, gold call-to-action ribbon). */
.dtg-books { --dtg-ink: #111827; --dtg-gold: #F2B705; }
.dtg-book-card {
	position: relative; display: flex; flex-direction: column; overflow: hidden;
	background: #fff; color: var(--dtg-ink);
	border: 1px solid var(--dtg-ink); border-radius: 6px;
	transition: transform .15s ease, box-shadow .15s ease;
}
.dtg-book-card:hover, .dtg-book-card:focus-within { transform: translate(-4px, -4px); box-shadow: 4px 4px 0 var(--dtg-ink); }
.dtg-book-card[hidden] { display: none; }

.dtg-book-cover { aspect-ratio: 1 / 1; background: #0b1a4a; border-bottom: 1px solid var(--dtg-ink); }
.dtg-book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; }
.dtg-book-placeholder {
	display: flex; align-items: center; justify-content: center; height: 100%; padding: 20px;
	text-align: center; font-weight: 700; font-size: 1.2em; color: #fff;
}

.dtg-book-body { flex: 1; padding: 14px 16px; border-bottom: 1px solid var(--dtg-ink); }
.dtg-book-title { margin: 0; font-size: 1.05em; font-weight: 500; line-height: 1.4; color: var(--dtg-ink);
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dtg-book-title a { color: inherit !important; text-decoration: none !important; }
.dtg-book-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* whole card clickable */
.dtg-book-title a:focus-visible { outline: none; }
.dtg-book-card:focus-within { outline: 3px solid var(--dtg-gold); outline-offset: 2px; }

.dtg-book-foot { padding: 12px 16px; }
.dtg-book-cta {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 6px 26px 6px 12px; background: var(--dtg-gold); color: var(--dtg-ink);
	font-weight: 700; font-size: .9em; line-height: 1.3; letter-spacing: .01em;
	clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
	transition: padding .15s ease;
}
.dtg-book-card:hover .dtg-book-cta { padding-right: 32px; }

@media (prefers-reduced-motion: reduce) { .dtg-book-card, .dtg-book-cta { transition: none; } }

/* Buttons */
.dtg-btn {
	display: inline-block; padding: 10px 16px; border: 1px solid var(--dtg-accent); border-radius: var(--dtg-radius);
	background: var(--dtg-accent); color: var(--dtg-accent-text) !important; text-align: center;
	text-decoration: none !important; font-weight: 600; font-size: .95em; line-height: 1.2;
}
.dtg-btn:hover { filter: brightness(1.1); }
.dtg-btn-secondary { background: transparent; color: var(--dtg-accent) !important; }

.dtg-books-none, .dtg-books-empty { color: var(--dtg-muted); }

/* ---------- Single book ---------- */
.dtg-hero, .dtg-cta, .dtg-sticky-buy {
	--dtg-accent: #4f46e5;
	--dtg-accent-text: #fff;
	--dtg-border: rgba(0, 0, 0, .1);
	--dtg-muted: rgba(0, 0, 0, .6);
	--dtg-radius: 10px;
}
.dtg-btn-lg { padding: 14px 26px; font-size: 1.05em; }
.dtg-btn-disabled { opacity: .55; cursor: not-allowed; }

.dtg-hero {
	display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 48px; align-items: center;
	margin: 8px 0 48px; padding: 32px;
	border: 1px solid var(--dtg-border); border-radius: 18px;
	background: linear-gradient(135deg, rgba(79, 70, 229, .06), rgba(34, 211, 238, .06));
}
.dtg-hero-cover { aspect-ratio: 5 / 8; border-radius: 8px; overflow: hidden; background: rgba(0, 0, 0, .05);
	box-shadow: 0 24px 48px -12px rgba(17, 24, 39, .35), 0 2px 6px rgba(17, 24, 39, .12);
	transform: perspective(1200px) rotateY(-4deg); transition: transform .4s ease; }
.dtg-hero-cover:hover { transform: none; }
.dtg-hero-cover img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; }
.dtg-hero-subtitle { margin: 0 0 16px; font-size: 1.3em; line-height: 1.4; font-weight: 500; }
.dtg-hero-price { margin: 0 0 20px; font-size: 2.2em; font-weight: 800; line-height: 1; color: var(--dtg-accent); }
.dtg-hero-details { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0 0 24px; padding: 16px 0;
	border-top: 1px solid var(--dtg-border); border-bottom: 1px solid var(--dtg-border); }
.dtg-hero-details dt { margin: 0; font-size: .78em; text-transform: uppercase; letter-spacing: .08em; color: var(--dtg-muted); }
.dtg-hero-details dd { margin: 2px 0 0; font-weight: 600; }
.dtg-hero-buy { display: flex; flex-wrap: wrap; gap: 10px; }
.dtg-hero-trust { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 16px 0 0; padding: 0; list-style: none;
	font-size: .88em; color: var(--dtg-muted); }
.dtg-hero-trust li::before { content: "✓ "; color: #16a34a; font-weight: 700; }

.dtg-description { max-width: 760px; }

.dtg-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
	margin: 48px 0 24px; padding: 24px 28px; border-radius: 14px; color: #fff;
	background: linear-gradient(135deg, #111a44, #4f46e5); }
.dtg-cta-title { margin: 0; font-size: 1.3em; font-weight: 700; color: #fff; }
.dtg-cta-sub { margin: 4px 0 0; opacity: .85; color: #fff; }
.dtg-cta .dtg-btn { background: #fff; border-color: #fff; color: #111a44 !important; }

.dtg-sticky-buy { position: fixed; left: 0; right: 0; bottom: 0; z-index: 999; display: flex; align-items: center;
	justify-content: space-between; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
	background: #fff; border-top: 1px solid var(--dtg-border); box-shadow: 0 -6px 20px rgba(0, 0, 0, .08); }
.dtg-sticky-buy[hidden] { display: none; }
.dtg-sticky-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 783px) { .dtg-sticky-buy { display: none !important; } }

@media (max-width: 782px) {
	.dtg-hero { grid-template-columns: 1fr; gap: 24px; padding: 20px; text-align: center; }
	.dtg-hero-cover { max-width: 240px; margin: 0 auto; transform: none; }
	.dtg-hero-details, .dtg-hero-buy, .dtg-hero-trust { justify-content: center; }
	.dtg-hero-buy .dtg-btn-lg { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .dtg-hero-cover, .dtg-book-card { transition: none; } }

/* Content after the catalogue: clear space, and keep table-of-contents boxes
   (Easy TOC and similar) full width and aligned with the text, not floating beside the grid. */
.dtg-books { margin-bottom: 56px; }
.dtg-books ~ * #ez-toc-container, .dtg-books ~ #ez-toc-container,
.dtg-books ~ * .lwptoc, .dtg-books ~ .lwptoc {
	display: block !important; float: none !important; clear: both;
	width: 100% !important; max-width: 820px; box-sizing: border-box;
	margin: 0 auto 40px !important;
}