/**
 * IEP Digital Library — frontend styles
 *
 * Brand palette:
 *   Background      #000000
 *   Text            #ffffff
 *   Accent (red)    #C8102E
 *   Muted           #999999
 *   Subtle border   #2a2a2a
 *
 * Fonts come from the theme (Cinzel headings, Crimson Pro body) — we
 * inherit rather than enqueue.
 */

.iep-dl-library,
.iep-dl-single-book,
.iep-dl-embed-reader {
	color: #ffffff;
	font-family: inherit;
}

/* -------------------------------------------------------------------------
 * Library grid
 * --------------------------------------------------------------------- */

.iep-dl-grid {
	display: grid;
	gap: 28px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0 0 32px;
}

@media (min-width: 600px) {
	.iep-dl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
	.iep-dl-grid {
		grid-template-columns: repeat(var(--iep-dl-cols, 4), minmax(0, 1fr));
	}
}

@media (min-width: 1400px) {
	.iep-dl-grid {
		grid-template-columns: repeat(min(var(--iep-dl-cols, 4), 6), minmax(0, 1fr));
	}
}

/* -------------------------------------------------------------------------
 * Card
 * --------------------------------------------------------------------- */

.iep-dl-card {
	position: relative;
	background: #000;
	border: 1px solid #2a2a2a;
	border-radius: 4px;
	overflow: hidden;
	transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.iep-dl-card:hover {
	border-color: #C8102E;
	box-shadow: 0 0 0 1px rgba(200, 16, 46, 0.4), 0 8px 24px rgba(200, 16, 46, 0.15);
	transform: translateY(-2px);
}

.iep-dl-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.iep-dl-card__cover {
	position: relative;
	aspect-ratio: 2 / 3;
	background: #111;
	overflow: hidden;
}

.iep-dl-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.iep-dl-card__badges {
	position: absolute;
	top: 8px;
	left: 8px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	z-index: 2;
}

.iep-dl-card__formats {
	position: absolute;
	bottom: 8px;
	right: 8px;
	display: flex;
	gap: 6px;
	z-index: 2;
}

.iep-dl-format {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	background: rgba(0, 0, 0, 0.7);
	border: 1px solid #2a2a2a;
	border-radius: 50%;
	color: #fff;
	font-size: 14px;
}

.iep-dl-format .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	line-height: 16px;
}

.iep-dl-card__meta {
	padding: 14px 14px 18px;
}

.iep-dl-card__title {
	font-family: 'Cinzel', inherit;
	font-size: 1rem;
	line-height: 1.3;
	margin: 0 0 4px;
	color: #fff;
}

.iep-dl-card__author {
	margin: 0;
	font-size: 0.85rem;
	color: #999;
	font-style: italic;
}

/* -------------------------------------------------------------------------
 * Badges
 * --------------------------------------------------------------------- */

.iep-dl-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 8px;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-radius: 2px;
	line-height: 1;
}

.iep-dl-badge--new {
	background: #C8102E;
	color: #fff;
}

.iep-dl-badge--subscribers {
	background: rgba(0, 0, 0, 0.85);
	color: #C8102E;
	border: 1px solid #C8102E;
}

.iep-dl-badge--subscribers .dashicons {
	font-size: 12px;
	width: 12px;
	height: 12px;
	line-height: 12px;
}

.iep-dl-badge--format {
	background: rgba(200, 16, 46, 0.1);
	border: 1px solid rgba(200, 16, 46, 0.5);
	color: #fff;
	padding: 4px 10px;
}

.iep-dl-badge--format .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
	line-height: 14px;
}

/* -------------------------------------------------------------------------
 * Pagination
 * --------------------------------------------------------------------- */

.iep-dl-pagination {
	display: flex;
	justify-content: center;
	gap: 6px;
	flex-wrap: wrap;
	margin: 32px 0;
}

.iep-dl-pagination .page-numbers {
	padding: 8px 14px;
	border: 1px solid #2a2a2a;
	color: #fff;
	text-decoration: none;
	border-radius: 2px;
	transition: all 200ms ease;
}

.iep-dl-pagination .page-numbers:hover,
.iep-dl-pagination .page-numbers.current {
	background: #C8102E;
	border-color: #C8102E;
	color: #fff;
}

/* -------------------------------------------------------------------------
 * Empty state
 * --------------------------------------------------------------------- */

.iep-dl-empty {
	text-align: center;
	padding: 48px 24px;
	color: #999;
	border: 1px dashed #2a2a2a;
	border-radius: 4px;
}

.iep-dl-empty__hint {
	font-style: italic;
	font-size: 0.9rem;
	margin: 8px 0 0;
}

/* -------------------------------------------------------------------------
 * Single book — header
 * --------------------------------------------------------------------- */

.iep-dl-single-book {
	max-width: 1100px;
	margin: 0 auto;
	padding: 24px 16px 48px;
}

.iep-dl-book-header {
	display: grid;
	gap: 32px;
	grid-template-columns: 1fr;
	align-items: start;
	margin-bottom: 40px;
}

@media (min-width: 768px) {
	.iep-dl-book-header {
		grid-template-columns: 300px 1fr;
	}
}

.iep-dl-book-header__cover .iep-dl-book-cover,
.iep-dl-book-header__cover img {
	width: 100%;
	height: auto;
	border: 1px solid #2a2a2a;
	border-radius: 4px;
	display: block;
}

.iep-dl-book-title {
	font-family: 'Cinzel', inherit;
	font-size: 2rem;
	line-height: 1.2;
	margin: 0 0 8px;
	color: #fff;
}

.iep-dl-book-author {
	font-size: 1.1rem;
	color: #C8102E;
	margin: 0 0 16px;
	font-style: italic;
}

.iep-dl-book-bib {
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
	color: #999;
	font-size: 0.95rem;
	line-height: 1.6;
}

.iep-dl-book-bib li {
	margin: 0;
}

.iep-dl-book-bib strong {
	color: #fff;
	font-weight: 600;
}

.iep-dl-book-badges {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.iep-dl-book-jumplinks {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.iep-dl-jump {
	display: inline-block;
	padding: 10px 20px;
	background: #C8102E;
	color: #fff;
	text-decoration: none;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-radius: 2px;
	font-size: 0.85rem;
	transition: background 200ms ease;
}

.iep-dl-jump:hover { background: #a30d26; }

/* -------------------------------------------------------------------------
 * Reader + audio sections
 * --------------------------------------------------------------------- */

.iep-dl-section-heading {
	font-family: 'Cinzel', inherit;
	font-size: 1.5rem;
	margin: 0 0 16px;
	color: #fff;
	border-bottom: 1px solid #2a2a2a;
	padding-bottom: 8px;
}

.iep-dl-reader-section,
.iep-dl-audio-section,
.iep-dl-description {
	margin-bottom: 40px;
	scroll-margin-top: 80px;
}

.iep-dl-flipbook-wrap {
	width: 100%;
	background: #0a0a0a;
	border: 1px solid #2a2a2a;
	border-radius: 4px;
	overflow: hidden;
}

.iep-dl-flipbook-wrap iframe {
	width: 100% !important;
	max-width: 100%;
	display: block;
}

.iep-dl-audio-wrap {
	background: #0a0a0a;
	border: 1px solid #2a2a2a;
	border-radius: 4px;
	padding: 20px;
}

.iep-dl-audio-player {
	width: 100%;
	display: block;
	border-radius: 2px;
}

.iep-dl-audio-meta {
	margin: 12px 0 0;
	color: #999;
	font-size: 0.9rem;
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
}

.iep-dl-audio-meta strong {
	color: #fff;
}

.iep-dl-audio-duration {
	font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
 * Notices (in-template warnings)
 * --------------------------------------------------------------------- */

.iep-dl-notice {
	padding: 16px;
	border-radius: 4px;
	border: 1px solid #2a2a2a;
	background: #0a0a0a;
	color: #ccc;
}

.iep-dl-notice--warn {
	border-color: #C8102E;
	color: #fff;
}

/* -------------------------------------------------------------------------
 * Description body — inherit theme typography
 * --------------------------------------------------------------------- */

.iep-dl-description__body {
	font-family: inherit;
	line-height: 1.7;
}

.iep-dl-description__body p {
	margin: 0 0 1em;
}

/* -------------------------------------------------------------------------
 * Embed reader (single-book shortcode use)
 * --------------------------------------------------------------------- */

.iep-dl-embed-reader .iep-dl-flipbook-wrap { margin-bottom: 16px; }

/* -------------------------------------------------------------------------
 * Paywall — note: inline styles ship in templates/paywall.php so they
 * survive aggressive theme CSS. Rules here are progressive enhancement.
 * --------------------------------------------------------------------- */

.iep-dl-paywall { font-family: inherit; }
.iep-dl-paywall a:focus-visible { outline: 2px solid #C8102E; outline-offset: 2px; }
