/* Pulptastic "pro" features (pro.js + functions.php markup) */

/* ---------- 1. Reading progress bar (single posts) ---------- */

.pulp-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	z-index: 99999;
	background: transparent;
	pointer-events: none;
}

.pulp-progress-bar {
	display: block;
	width: 0;
	height: 100%;
	background: linear-gradient(90deg, #7b4397, #dc2430);
	transition: width 0.1s linear;
}

/* ---------- 2. AJAX Load More (category archives) ---------- */

.pulp-loadmore-wrap {
	margin: 30px 0 10px;
	text-align: center;
}

.pulp-loadmore {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 13px 34px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, #0f2027, #2c5364);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.pulp-loadmore:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 24px -10px rgba(15, 32, 39, 0.55);
}

.pulp-loadmore:disabled {
	cursor: default;
	opacity: 0.75;
	transform: none;
	box-shadow: none;
}

.pulp-loadmore.is-loading::after {
	content: "";
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: pulp-spin 0.7s linear infinite;
}

@keyframes pulp-spin {
	to { transform: rotate(360deg); }
}

/* Default pagination is replaced by the load-more button on archives. */
body.archive.category nav.ct-pagination {
	display: none;
}

/* ---------- 3. Live search fallback dropdown ---------- */

.pulp-ls-results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 1000;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 18px 44px -12px rgba(15, 23, 42, 0.3);
	overflow: hidden;
	text-align: left;
}

.pulp-ls-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	text-decoration: none;
	border-bottom: 1px solid #f1f3f5;
}

.pulp-ls-item:last-child {
	border-bottom: 0;
}

.pulp-ls-item:hover {
	background: #f6f7f9;
}

.pulp-ls-thumb {
	flex: 0 0 52px;
	width: 52px;
	height: 52px;
	border-radius: 8px;
	overflow: hidden;
	background: #0f172a;
}

.pulp-ls-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pulp-ls-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.pulp-ls-title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: #111827;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pulp-ls-date {
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #6b7280;
}

/* ---------- 4. Back to top ---------- */

.pulp-backtotop {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 999;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #111827;
	color: #fff;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease, background 0.2s ease;
	box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.45);
}

.pulp-backtotop.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.pulp-backtotop:hover {
	background: #2563eb;
}

/* ---------- 5. Mega-menu flyouts ---------- */

.pulp-flyout-item {
	border-top: 1px solid rgba(15, 23, 42, 0.08);
	margin-top: 6px;
	padding-top: 8px;
}

.pulp-flyout-label {
	display: block;
	padding: 4px 15px 8px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: #6b7280;
}

.pulp-flyout-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 15px;
	text-decoration: none;
}

.pulp-flyout-row:hover {
	background: rgba(15, 23, 42, 0.05);
}

.pulp-flyout-thumb {
	flex: 0 0 56px;
	width: 56px;
	height: 40px;
	border-radius: 6px;
	overflow: hidden;
	background: #0f172a;
}

.pulp-flyout-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pulp-flyout-title {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	color: #1f2937;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.pulp-flyout-row:hover .pulp-flyout-title {
	color: #2563eb;
}

/* Injected dropdown for top-level items that had no children. */
@media (min-width: 1000px) {
	#menu-primary-menu li.pulp-flyout-host {
		position: relative;
	}

	#menu-primary-menu li.pulp-flyout-host > ul.pulp-flyout-menu {
		position: absolute;
		top: 100%;
		left: 50%;
		z-index: 60;
		display: block;
		min-width: 300px;
		margin: 0;
		padding: 8px 0;
		list-style: none;
		background: #fff;
		border-radius: 10px;
		box-shadow: 0 18px 44px -12px rgba(15, 23, 42, 0.3);
		opacity: 0;
		visibility: hidden;
		transform: translate(-50%, 8px);
		transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
	}

	#menu-primary-menu li.pulp-flyout-host:hover > ul.pulp-flyout-menu,
	#menu-primary-menu li.pulp-flyout-host:focus-within > ul.pulp-flyout-menu {
		opacity: 1;
		visibility: visible;
		transform: translate(-50%, 0);
	}
}

@media (max-width: 999.98px) {
	.pulp-flyout-item {
		display: none;
	}
}

/* ---------- 6. Most Read section accent (magazine home) ---------- */

.pulp-section--most-read .pulp-section-title::before {
	background: linear-gradient(180deg, #f12711, #f5af19);
}

/* ---------- 7. Custom 404 ---------- */

.pulp-404 {
	padding: 56px 0 72px;
}

.pulp-404-hero {
	max-width: 640px;
	margin: 0 auto 52px;
	text-align: center;
}

.pulp-404-code {
	margin: 0;
	font-size: clamp(4rem, 14vw, 7rem);
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.03em;
	background: linear-gradient(135deg, #7b4397, #dc2430);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: transparent;
}

.pulp-404-title {
	margin: 10px 0 12px;
	font-size: clamp(1.6rem, 4vw, 2.4rem);
	font-weight: 800;
	letter-spacing: -0.02em;
	color: #111827;
}

.pulp-404-text {
	margin: 0;
	font-size: 16px;
	color: #6b7280;
}

.pulp-404-search {
	display: flex;
	max-width: 480px;
	margin: 26px auto 0;
}

.pulp-404-search input[type="search"] {
	flex: 1;
	min-width: 0;
	padding: 13px 18px;
	border: 2px solid #e5e7eb;
	border-right: 0;
	border-radius: 999px 0 0 999px;
	font-size: 15px;
	outline: none;
}

.pulp-404-search input[type="search"]:focus {
	border-color: #2563eb;
}

.pulp-404-search button {
	padding: 13px 26px;
	border: 0;
	border-radius: 0 999px 999px 0;
	background: #111827;
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.2s ease;
}

.pulp-404-search button:hover {
	background: #2563eb;
}

.pulp-404-chips {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin-top: 24px;
}

/* Static chip variant — .pulp-chip is absolutely positioned on cards. */
.pulp-404 .pulp-chip.pulp-chip-static {
	position: static;
	pointer-events: auto;
	display: inline-block;
	padding: 8px 16px;
	font-size: 12px;
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pulp-404 .pulp-chip.pulp-chip-static:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 18px -6px rgba(15, 23, 42, 0.4);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.pulp-progress-bar,
	.pulp-loadmore,
	.pulp-backtotop,
	.pulp-404 .pulp-chip.pulp-chip-static,
	#menu-primary-menu li.pulp-flyout-host > ul.pulp-flyout-menu {
		transition: none;
		animation: none;
	}
}
