/* ═══════════════════════════════════════════════════════════════════
 * WP E-Newspaper Pro — Viewer  v1.2.3
 * Clean white background, full-height scrollable paper, title label band
 * ═══════════════════════════════════════════════════════════════════ */

/* ── Design tokens ────────────────────────────────────────────────── */
:root {
	--wenp-dark-bg: #1a1a2e;
	--wenp-dark-card: #16213e;
	--wenp-dark-nav: #0f3460;
	--wenp-accent: #e94560;
	--wenp-text: #eaeaea;
	--wenp-transition: .25s ease;
	--wenp-thumb-w: 150px;
	/* thumbnail sidebar */
	--flip-ms: 480ms;
	/* flip animation    */
}

/* ── Full-width wrapper ───────────────────────────────────────────── */
.wenp-fullwidth-wrap {
	width: 100%;
	box-sizing: border-box;
}

/* ── Outer viewer ────────────────────────────────────────────────── */
.wenp-viewer-wrapper {
	display: flex;
	flex-direction: column;
	width: 100%;
	font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
	box-shadow: 0 4px 24px rgba(0, 0, 0, .15);
	background: #fff;
	color: #222;
	overflow: visible;
}

/* Both themes now use white / light background */
.wenp-theme-dark,
.wenp-theme-light {
	background: #fff;
	color: #222;
}

/* ── Navigation bar ──────────────────────────────────────────────── */
.wenp-nav {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	padding: 8px 16px;
	background: #0f3460;
}

.wenp-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 14px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: .85rem;
	font-weight: 600;
	text-decoration: none;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	transition: background var(--wenp-transition), transform var(--wenp-transition);
}

.wenp-btn:hover:not(:disabled) {
	background: var(--wenp-accent);
	transform: translateY(-1px);
}

.wenp-btn:disabled {
	opacity: .4;
	cursor: not-allowed;
}

.wenp-page-indicator {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: .88rem;
	color: #fff;
}

.wenp-page-input {
	width: 52px;
	text-align: center;
	background: rgba(255, 255, 255, .15);
	border: 1px solid rgba(255, 255, 255, .3);
	border-radius: 4px;
	color: #fff;
	padding: 4px;
	font-size: .88rem;
}

.wenp-zoom-controls {
	display: flex;
	gap: 4px;
}

.wenp-fullscreen {
	margin-left: 6px;
}

.wenp-download {
	color: #fff !important;
}

/* ── Newspaper title inside nav bar (right side) ────────────────── */
.wenp-nav-title {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 340px;
	font-size: .82rem;
	font-weight: 600;
	color: #f0c040;
	letter-spacing: .01em;
}

.wenp-nav-title-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wenp-nav-title-page {
	white-space: nowrap;
	font-weight: 700;
	color: #fff;
	background: rgba(255, 255, 255, .15);
	padding: 2px 7px;
	border-radius: 10px;
	font-size: .78rem;
}

/* ── Page title label band ───────────────────────────────────────── */
/*  Sits between the nav bar and the newspaper body.
    Shows "Newspaper Title — Page N" and optional date + DL link.     */
.wenp-page-label {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	padding: 7px 18px;
	background: #ffd700;
	/* golden yellow — distinct label   */
	border-bottom: 2px solid #e6c000;
	font-size: .88rem;
	font-weight: 700;
	color: #111;
	line-height: 1.3;
}

.wenp-page-label-text {
	flex: 1;
	min-width: 0;
}

.wenp-page-label-date {
	font-weight: 600;
	font-size: .8rem;
	color: #555;
	white-space: nowrap;
}

.wenp-label-dl-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 12px;
	background: #0f3460;
	color: #fff !important;
	border-radius: 4px;
	text-decoration: none;
	font-size: .78rem;
	font-weight: 700;
	white-space: nowrap;
	transition: background var(--wenp-transition);
}

.wenp-label-dl-btn:hover {
	background: var(--wenp-accent);
}

/* ═══════════════════════════════════════════════════════════════════
 * Main body — 2-column grid
 *   col 1: thumbnails (--wenp-thumb-w)
 *   col 2: newspaper page (fills remaining space)
 * ═══════════════════════════════════════════════════════════════════ */
.wenp-viewer-body {
	display: grid;
	grid-template-columns: var(--wenp-thumb-w) 1fr;
	align-items: start;
	/* columns start at top, not stretched */
}

/* ── Thumbnail sidebar — stretches to full paper height ─────────── */
.wenp-sidebar {
	overflow-y: auto;
	overflow-x: hidden;
	background: #f5f5f5;
	border-right: 1px solid #e0e0e0;
	/* align-self: stretch so the sidebar grows to the full height of
	   the content column (newspaper image), not just the viewport.   */
	align-self: stretch;
}

.wenp-sidebar-heading {
	padding: 10px 12px 6px;
	font-size: .73rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: #888;
}

/* ── Thumbnail strip ─────────────────────────────────────────────── */
.wenp-thumbnails {
	padding: 6px;
}

.wenp-thumb {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 5px 3px;
	cursor: pointer;
	border-radius: 4px;
	transition: background var(--wenp-transition);
	margin-bottom: 3px;
}

.wenp-thumb:hover,
.wenp-thumb-active {
	background: rgba(15, 52, 96, .12);
}

.wenp-thumb img {
	width: 100%;
	max-width: 126px;
	border-radius: 2px;
	display: block;
	border: 1px solid #ddd;
}

.wenp-thumb-num {
	font-size: .68rem;
	color: #888;
	margin-top: 3px;
}

/* ═══════════════════════════════════════════════════════════════════
 * Flipbook stage (centre column)
 *
 * White background. No height constraint — the newspaper image
 * displays at its full natural height and the browser page scrolls.
 * ═══════════════════════════════════════════════════════════════════ */
.wenp-flipbook-stage {
	display: block;
	/* block so content flows naturally  */
	position: relative;
	background: #fff;
	padding: 16px 20px 24px;
	box-sizing: border-box;
	width: 100%;
}

/* Container wraps the img; no perspective needed for simple scroll mode */
.wenp-single-page {
	width: 100%;
}

/* The newspaper page image — full width, natural (tall) height */
.wenp-page-img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	/* Paper-like drop shadow */
	box-shadow: 0 2px 20px rgba(0, 0, 0, .18), 0 1px 4px rgba(0, 0, 0, .08);
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	user-select: none;
	-webkit-user-drag: none;
	transform-origin: center top;
	transition: box-shadow .2s ease;
}

/* Overlay layer */
.wenp-flip-overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════
 * Page-turn animations (kept for JS flip effect)
 * ═══════════════════════════════════════════════════════════════════ */
@keyframes wenp-flip-fwd {
	0% {
		transform: rotateY(0deg) skewY(0deg);
		transform-origin: left center;
		opacity: 1;
	}

	20% {
		transform: rotateY(-25deg) skewY(-1.5deg);
		transform-origin: left center;
	}

	50% {
		transform: rotateY(-90deg) skewY(0deg);
		transform-origin: left center;
		opacity: .85;
	}

	80% {
		transform: rotateY(-155deg) skewY(1.5deg);
		transform-origin: left center;
	}

	100% {
		transform: rotateY(-180deg) skewY(0deg);
		transform-origin: left center;
		opacity: 1;
	}
}

@keyframes wenp-flip-bwd {
	0% {
		transform: rotateY(0deg) skewY(0deg);
		transform-origin: right center;
		opacity: 1;
	}

	20% {
		transform: rotateY(25deg) skewY(1.5deg);
		transform-origin: right center;
	}

	50% {
		transform: rotateY(90deg) skewY(0deg);
		transform-origin: right center;
		opacity: .85;
	}

	80% {
		transform: rotateY(155deg) skewY(-1.5deg);
		transform-origin: right center;
	}

	100% {
		transform: rotateY(180deg) skewY(0deg);
		transform-origin: right center;
		opacity: 1;
	}
}

.wenp-flip-fwd {
	animation: wenp-flip-fwd var(--flip-ms) cubic-bezier(.45, 0, .55, 1) forwards;
}

.wenp-flip-bwd {
	animation: wenp-flip-bwd var(--flip-ms) cubic-bezier(.45, 0, .55, 1) forwards;
}

/* ── Zoom levels ─────────────────────────────────────────────────── */
.wenp-viewer-wrapper.wenp-zoomed .wenp-page-img {
	cursor: move;
}

.wenp-zoom-1 .wenp-page-img {
	transform: scale(1);
}

.wenp-zoom-2 .wenp-page-img {
	transform: scale(1.5);
}

.wenp-zoom-3 .wenp-page-img {
	transform: scale(2);
}

.wenp-zoom-4 .wenp-page-img {
	transform: scale(2.5);
}

/* ── Fullscreen — scrollable so user can read the full paper ───── */
.wenp-viewer-wrapper:-webkit-full-screen {
	width: 100vw;
	height: 100vh;
	overflow-y: auto;
	background: #fff;
}

.wenp-viewer-wrapper:-moz-full-screen {
	width: 100vw;
	height: 100vh;
	overflow-y: auto;
	background: #fff;
}

.wenp-viewer-wrapper:fullscreen {
	width: 100vw;
	height: 100vh;
	overflow-y: auto;
	background: #fff;
}

/* In fullscreen the viewer body and stage should NOT restrict height */
.wenp-viewer-wrapper:-webkit-full-screen .wenp-viewer-body,
.wenp-viewer-wrapper:-moz-full-screen .wenp-viewer-body,
.wenp-viewer-wrapper:fullscreen .wenp-viewer-body {
	align-items: start;
}

.wenp-viewer-wrapper:-webkit-full-screen .wenp-flipbook-stage,
.wenp-viewer-wrapper:-moz-full-screen .wenp-flipbook-stage,
.wenp-viewer-wrapper:fullscreen .wenp-flipbook-stage {
	min-height: auto;
	height: auto;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.wenp-no-pages {
	padding: 40px;
	text-align: center;
	opacity: .6;
	font-size: 1.1rem;
}

/* ═══════════════════════════════════════════════════════════════════
 * Theme container overrides — force full width in any WP theme
 * ═══════════════════════════════════════════════════════════════════ */
body.wenp-issue-page .entry-content,
body.wenp-issue-page .post-content,
body.wenp-issue-page .post-body,
body.wenp-issue-page .site-content,
body.wenp-issue-page .site-main,
body.wenp-issue-page .content-area,
body.wenp-issue-page #content,
body.wenp-issue-page #main,
body.wenp-issue-page #primary,
body.wenp-issue-page article,
body.wenp-issue-page article.hentry,
body.wenp-issue-page article.post,
body.wenp-issue-page .container,
body.wenp-issue-page .td-pb-span8,
body.wenp-issue-page .td-ss-main-content,
body.wenp-issue-page .td-container,
body.wenp-issue-page .wp-block-post-content {
	max-width: none !important;
	width: 100% !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	float: none !important;
	box-sizing: border-box !important;
}

/* ═══════════════════════════════════════════════════════════════════
 * Responsive — collapse on narrow screens
 * ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
	.wenp-viewer-body {
		grid-template-columns: 1fr;
	}

	.wenp-sidebar {
		display: none;
	}

	.wenp-nav {
		justify-content: center;
	}

	.wenp-nav-title {
		display: none;
		/* hide on mobile — too narrow */
	}

	.wenp-flipbook-stage {
		padding: 10px 12px 16px;
	}
}