/* HPN Flipbook — front end. Uses the HPN theme's tokens when available. */

.hpn-fb-page {
	--fb-ink: var(--hpn-ink, #16191d);
	--fb-muted: var(--hpn-muted, #5b6470);
	--fb-line: var(--hpn-line, #e3e6ea);
	--fb-surface: var(--hpn-surface, #f5f7f8);
	--fb-brand: var(--hpn-brand, #3dae2b);
	--fb-brand-dark: var(--hpn-brand-dark, #1f7a1a);
	--fb-radius: var(--hpn-radius, 6px);
}

.hpn-fb-back {
	margin: 0 0 1rem;
	font-size: 0.875rem;
}

.hpn-fb-header {
	max-width: 760px;
	margin-bottom: 1.25rem;
}

.hpn-fb-header__label,
.hpn-fb-latest__eyebrow,
.hpn-fb-gate__eyebrow {
	margin: 0 0 0.4rem;
	color: var(--fb-brand-dark, #1f7a1a);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.hpn-fb-header__title {
	margin-bottom: 0.4rem;
	font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.hpn-fb-header__summary {
	color: var(--fb-muted, #5b6470);
	font-size: 1.0625rem;
}

.hpn-fb-notice {
	padding: 1.25rem;
	border-radius: var(--fb-radius, 6px);
	background: var(--fb-surface, #f5f7f8);
}

/* Viewer */

.hpn-fb {
	position: relative;
	margin: 0 0 2.5rem;
	padding: clamp(12px, 2vw, 24px);
	border-radius: 10px;
	background: radial-gradient(circle at 50% 0%, #3a4048, #22262b 70%);
	color: #e8ebee;
	outline: none;
}

.hpn-fb__stage {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 360px;
}

.hpn-fb__frame {
	max-width: 100%;
	margin: 0 auto;
}

.hpn-fb__book {
	width: 100%;
}

.hpn-fb__page {
	overflow: hidden;
	background: #fff;
}

.hpn-fb__page img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: linear-gradient(110deg, #f1f3f4 30%, #fafbfb 50%, #f1f3f4 70%) 0 0 / 300% 100%;
}

.hpn-fb__page img:not([src]) {
	animation: hpn-fb-shimmer 1.4s linear infinite;
}

@keyframes hpn-fb-shimmer {
	to {
		background-position: -150% 0;
	}
}

.hpn-fb__status {
	margin: 1rem 0;
	color: #c9cfd6;
	text-align: center;
}

.hpn-fb.is-error .hpn-fb__stage {
	min-height: 200px;
}

.hpn-fb__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 1rem;
}

.hpn-fb__btn {
	display: inline-grid;
	place-items: center;
	width: 42px;
	height: 42px;
	border: 1px solid rgb(255 255 255 / 0.18);
	border-radius: 50%;
	background: rgb(255 255 255 / 0.08);
	color: #fff;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

a.hpn-fb__btn {
	text-decoration: none;
}

.hpn-fb__btn--download {
	margin-left: 0.5rem;
}

.hpn-fb__btn:hover:not(:disabled) {
	background: var(--fb-brand-dark, #1f7a1a);
}

.hpn-fb__btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.hpn-fb__btn:focus-visible,
.hpn-fb__pager input:focus-visible {
	outline: 3px solid var(--fb-brand, #3dae2b);
	outline-offset: 2px;
}

.hpn-fb__pager {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin: 0 0.25rem;
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
}

.hpn-fb__pager input {
	width: 4.2em;
	padding: 0.35em 0.4em;
	border: 1px solid rgb(255 255 255 / 0.25);
	border-radius: 6px;
	background: rgb(0 0 0 / 0.25);
	color: #fff;
	font: inherit;
	text-align: center;
}

.hpn-fb.is-fullscreen {
	display: flex;
	flex-direction: column;
	justify-content: center;
	border-radius: 0;
}

/* Zoom dialog */

.hpn-fb-zoom {
	width: 100vw;
	max-width: 100vw;
	height: 100vh;
	max-height: 100vh;
	margin: 0;
	padding: 0;
	border: 0;
	background: #15181b;
}

.hpn-fb-zoom::backdrop {
	background: rgb(0 0 0 / 0.8);
}

.hpn-fb-zoom .hpn-fb__btn--close {
	position: fixed;
	top: 16px;
	right: 16px;
	z-index: 1;
	background: rgb(0 0 0 / 0.6);
}

.hpn-fb-zoom__pages {
	display: flex;
	justify-content: center;
	gap: 8px;
	min-height: 100%;
	padding: 24px;
}

.hpn-fb-zoom__pages img {
	width: min(100%, 1400px);
	height: auto;
	align-self: flex-start;
	background: #fff;
}

/* Sign-in gate */

.hpn-fb-gate {
	display: grid;
	gap: clamp(20px, 4vw, 48px);
	align-items: center;
	margin: 0 0 2.5rem;
	padding: clamp(20px, 4vw, 40px);
	border: 1px solid var(--fb-line, #e3e6ea);
	border-top: 4px solid var(--fb-brand, #3dae2b);
	border-radius: var(--fb-radius, 6px);
	background: var(--fb-surface, #f5f7f8);
}

@media (min-width: 720px) {
	.hpn-fb-gate {
		grid-template-columns: minmax(180px, 280px) 1fr;
	}
}

.hpn-fb-gate__cover .hpn-fb-cover {
	box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
}

.hpn-fb-gate__title {
	font-size: clamp(1.375rem, 3vw, 1.875rem);
}

.hpn-fb-gate__actions,
.hpn-fb-latest__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin: 1.25rem 0 0;
}

/* Covers, archive */

.hpn-fb-cover {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 210 / 297;
	object-fit: cover;
	border-radius: 3px;
	background: #fff;
}

.hpn-fb-cover--empty {
	display: grid;
	place-items: center;
	background: linear-gradient(135deg, var(--fb-brand-dark, #1f7a1a), var(--fb-brand, #3dae2b));
	color: rgb(255 255 255 / 0.9);
	font-size: 2rem;
	font-weight: 800;
	letter-spacing: 0.05em;
}

.hpn-fb-latest {
	display: grid;
	gap: clamp(20px, 4vw, 48px);
	align-items: center;
	margin-bottom: clamp(36px, 5vw, 56px);
	padding: clamp(20px, 4vw, 40px);
	border-radius: 10px;
	background: linear-gradient(135deg, var(--fb-surface, #f5f7f8), #fff);
	box-shadow: inset 0 0 0 1px var(--fb-line, #e3e6ea);
}

@media (min-width: 720px) {
	.hpn-fb-latest {
		grid-template-columns: minmax(200px, 320px) 1fr;
	}
}

.hpn-fb-latest__cover .hpn-fb-cover {
	box-shadow: 0 14px 40px rgb(0 0 0 / 0.2);
	transition: transform 0.2s ease;
}

.hpn-fb-latest__cover:hover .hpn-fb-cover {
	transform: translateY(-3px) rotate(-0.5deg);
}

.hpn-fb-latest__title {
	font-size: clamp(1.5rem, 3.4vw, 2.25rem);
}

.hpn-fb-latest__title a {
	color: inherit;
	text-decoration: none;
}

.hpn-fb-latest__label {
	color: var(--fb-muted, #5b6470);
	font-weight: 600;
}

.hpn-fb-grid {
	display: grid;
	gap: clamp(16px, 2.5vw, 28px);
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 640px) {
	.hpn-fb-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.hpn-fb-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.hpn-fb-tile a {
	display: block;
	color: inherit;
	text-decoration: none;
}

.hpn-fb-tile .hpn-fb-cover {
	margin-bottom: 0.7rem;
	box-shadow: 0 4px 14px rgb(0 0 0 / 0.12);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hpn-fb-tile a:hover .hpn-fb-cover {
	box-shadow: 0 10px 24px rgb(0 0 0 / 0.18);
	transform: translateY(-3px);
}

.hpn-fb-tile__label {
	display: block;
	color: var(--fb-brand-dark, #1f7a1a);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.hpn-fb-tile__title {
	display: block;
	font-weight: 700;
	line-height: 1.3;
}

.hpn-fb-tile a:hover .hpn-fb-tile__title {
	text-decoration: underline;
}

.hpn-fb-more {
	margin-top: 1rem;
}

@media (prefers-reduced-motion: reduce) {
	.hpn-fb__page img:not([src]) {
		animation: none;
	}
}

/* Download */

.hpn-fb-actions {
	display: flex;
	justify-content: center;
	margin: -1.5rem 0 2.5rem;
}

.hpn-fb-download {
	gap: 0.5rem;
}

.hpn-fb-download__size {
	font-weight: 400;
	opacity: 0.75;
}

/* Downloaded magazines (My account) */

.hpn-fb-downloads,
.entry-content .hpn-fb-downloads {
	display: grid;
	gap: 0.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hpn-fb-downloads li,
.entry-content .hpn-fb-downloads li {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.9rem;
	padding: 0.6rem;
	border: 1px solid var(--fb-line, #e3e6ea);
	border-radius: var(--fb-radius, 6px);
}

.hpn-fb-downloads__cover {
	flex: none;
	width: 46px;
	height: 60px;
	border-radius: 3px;
	background: var(--fb-surface, #f5f7f8);
	object-fit: cover;
	box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
}

.hpn-fb-downloads__text {
	display: grid;
	flex: 1;
	min-width: 0;
	font-size: 0.875rem;
	color: var(--fb-muted, #5b6470);
}

.hpn-fb-downloads__text strong {
	color: var(--fb-ink, #16191d);
	font-size: 0.9375rem;
}

.hpn-fb-downloads__text a {
	text-decoration: none;
}

.hpn-fb-downloads__again {
	flex: none;
	font-size: 0.875rem;
	font-weight: 600;
	white-space: nowrap;
}

.hpn-fb-downloads__empty {
	color: var(--fb-muted, #5b6470);
}

@media (max-width: 479px) {
	.hpn-fb-downloads li {
		flex-wrap: wrap;
	}

	.hpn-fb-downloads__again {
		margin-left: calc(46px + 0.9rem);
	}
}
