/*
 * Hanuman PDF Editor — manual.
 * Shared by the front-end lightbox, the wp-admin manual screen and the printable page.
 * Scoped under .hnmpdf-manual, .hnmpdf-dialog, .hnmpdf-manual-btn and body.hnmpdf-print.
 */

@font-face {
	font-family: "HNMPDF Sarabun";
	src: url("../fonts/Sarabun-Regular.ttf") format("truetype");
	font-weight: 400;
	font-display: swap;
}

@font-face {
	font-family: "HNMPDF Sarabun";
	src: url("../fonts/Sarabun-Bold.ttf") format("truetype");
	font-weight: 700;
	font-display: swap;
}

@font-face {
	font-family: "HNMPDF Prompt";
	src: url("../fonts/Prompt-Regular.ttf") format("truetype");
	font-weight: 400;
	font-display: swap;
}

@font-face {
	font-family: "HNMPDF Prompt";
	src: url("../fonts/Prompt-Bold.ttf") format("truetype");
	font-weight: 700;
	font-display: swap;
}

/* The button in a tool's header */

.hnmpdf .hnmpdf-manual-btn {
	position: absolute;
	top: 16px;
	right: 16px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 16px;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 10px;
	background: #012f54;
	color: #fff;
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 15px;
	line-height: 1.3;
	text-decoration: none;
	cursor: pointer;
}

.hnmpdf .hnmpdf-manual-btn:hover,
.hnmpdf .hnmpdf-manual-btn:focus {
	background: #04826d;
	color: #fff;
	text-decoration: none;
}

.hnmpdf .hnmpdf-manual-btn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.hnmpdf .hnmpdf-hero {
	position: relative;
}

.hnmpdf .hnmpdf-hero-slim .hnmpdf-manual-btn {
	position: static;
	margin-left: auto;
}

.hnmpdf .hnmpdf-hero-slim {
	gap: 10px;
}

/* Lightbox */

.hnmpdf .hnmpdf-dialog {
	width: min(940px, 94vw);
	max-width: none;
	height: min(880px, 92vh);
	max-height: none;
	margin: auto;
	padding: 0;
	border: 0;
	border-radius: 22px;
	background: #f3f6f6;
	color: #012f54;
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(1, 47, 84, 0.45);
}

.hnmpdf .hnmpdf-dialog[open] {
	display: flex;
	flex-direction: column;
}

.hnmpdf .hnmpdf-dialog::backdrop {
	background: rgba(1, 47, 84, 0.66);
}

.hnmpdf .hnmpdf-dialog-bar {
	display: flex;
	flex: none;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 12px;
	padding: 14px 16px;
	background: #012f54;
	color: #fff;
}

.hnmpdf .hnmpdf-dialog-bar img {
	width: 44px;
	height: 44px;
	margin: 0;
	border-radius: 12px;
}

.hnmpdf .hnmpdf-dialog-name {
	flex: 1 1 160px;
	min-width: 0;
	line-height: 1.3;
}

.hnmpdf .hnmpdf-dialog-name strong {
	display: block;
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 19px;
}

.hnmpdf .hnmpdf-dialog-name span {
	color: #dce7ec;
	font-size: 14.5px;
}

.hnmpdf .hnmpdf-dialog-act,
.hnmpdf .hnmpdf-dialog-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 10px;
	background: transparent;
	color: #fff;
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 15px;
	line-height: 1.3;
	text-decoration: none;
	cursor: pointer;
	box-shadow: none;
}

.hnmpdf .hnmpdf-dialog-close {
	width: 44px;
	padding: 0;
	border-color: #fff;
	background: #fff;
	color: #012f54;
}

.hnmpdf .hnmpdf-dialog-act:hover,
.hnmpdf .hnmpdf-dialog-act:focus {
	background: #04826d;
	border-color: #04826d;
	color: #fff;
	text-decoration: none;
}

.hnmpdf .hnmpdf-dialog-close:hover,
.hnmpdf .hnmpdf-dialog-close:focus {
	background: #dce7ec;
	color: #012f54;
}

.hnmpdf .hnmpdf-dialog-act:focus-visible,
.hnmpdf .hnmpdf-dialog-close:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.hnmpdf .hnmpdf-dialog-body {
	flex: 1;
	min-height: 0;
	padding: 18px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scroll-behavior: smooth;
}

/* Manual body */

.hnmpdf-manual {
	--man-navy: #012f54;
	--man-green: #04826d;
	--man-red: #a63934;
	--man-muted: #3d5568;
	max-width: 900px;
	margin: 0 auto;
	color: var(--man-navy);
	font-family: "HNMPDF Sarabun", "Sarabun", sans-serif;
	font-size: 17px;
	line-height: 1.65;
	text-align: left;
}

.hnmpdf-manual *,
.hnmpdf-manual *::before,
.hnmpdf-manual *::after {
	box-sizing: border-box;
}

.hnmpdf-manual svg {
	flex: none;
}

.hnmpdf-manual .hnmpdf-man-toc {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 18px;
}

.hnmpdf-manual .hnmpdf-man-toc a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 14px;
	border: 1px solid #c9d5db;
	border-radius: 999px;
	background: #fff;
	color: var(--man-navy);
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 14.5px;
	text-decoration: none;
}

.hnmpdf-manual .hnmpdf-man-toc a:hover,
.hnmpdf-manual .hnmpdf-man-toc a:focus {
	border-color: var(--man-navy);
	background: var(--man-navy);
	color: #fff;
}

.hnmpdf-manual .hnmpdf-man-toc svg {
	width: 18px;
	height: 18px;
}

.hnmpdf-manual .hnmpdf-man-section {
	margin: 0 0 16px;
	padding: 22px;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 6px 20px rgba(1, 47, 84, 0.09);
	scroll-margin-top: 12px;
}

.hnmpdf-manual .hnmpdf-man-head {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	margin: 0 0 16px;
}

.hnmpdf-manual .hnmpdf-man-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	min-width: 56px;
	height: 56px;
	border-radius: 16px;
	background: var(--man-navy);
	color: #fff;
	font-style: normal;
}

.hnmpdf-manual .hnmpdf-man-no {
	display: block;
	color: var(--man-red);
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 13.5px;
	font-weight: 700;
	line-height: 1.4;
}

.hnmpdf-manual .hnmpdf-man-head h3 {
	margin: 0;
	padding: 0;
	color: var(--man-navy);
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 23px;
	font-weight: 700;
	line-height: 1.3;
}

.hnmpdf-manual .hnmpdf-man-head p {
	margin: 2px 0 0;
	color: var(--man-muted);
	font-size: 16.5px;
}

.hnmpdf-manual .hnmpdf-man-figure {
	margin: 0 0 18px;
	padding: 10px;
	border-radius: 14px;
	background: var(--man-red);
}

.hnmpdf-manual .hnmpdf-man-figure img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 460px;
	margin: 0 auto;
	border-radius: 8px;
}

.hnmpdf-manual .hnmpdf-man-steps {
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
	counter-reset: man;
}

.hnmpdf-manual .hnmpdf-man-steps li {
	position: relative;
	min-height: 34px;
	margin: 0 0 10px;
	padding: 3px 0 0 46px;
	list-style: none;
	counter-increment: man;
}

.hnmpdf-manual .hnmpdf-man-steps li::before {
	content: counter(man);
	position: absolute;
	top: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--man-green);
	color: #fff;
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 16px;
	font-weight: 700;
}

.hnmpdf-manual .hnmpdf-man-rows {
	margin: 0 0 14px;
	border: 1px solid #dce5e8;
	border-radius: 14px;
	overflow: hidden;
}

.hnmpdf-manual .hnmpdf-man-rows > div {
	display: grid;
	grid-template-columns: minmax(0, 34%) minmax(0, 1fr);
	gap: 4px 16px;
	padding: 12px 16px;
}

.hnmpdf-manual .hnmpdf-man-rows > div + div {
	border-top: 1px solid #dce5e8;
}

.hnmpdf-manual .hnmpdf-man-rows > div:nth-child(odd) {
	background: #f3f6f6;
}

.hnmpdf-manual .hnmpdf-man-rows dt {
	margin: 0;
	font-weight: 700;
}

.hnmpdf-manual .hnmpdf-man-rows dd {
	margin: 0;
}

.hnmpdf-manual .hnmpdf-man-rows code {
	padding: 2px 6px;
	border-radius: 6px;
	background: #012f54;
	color: #fff;
	font-size: 13px;
	font-weight: 400;
	white-space: nowrap;
}

.hnmpdf-manual .hnmpdf-man-tips {
	display: grid;
	gap: 8px;
	margin: 0 0 14px;
	padding: 14px 16px;
	border-radius: 14px;
	background: #eaf4f1;
	list-style: none;
}

.hnmpdf-manual .hnmpdf-man-tips li {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hnmpdf-manual .hnmpdf-man-tips svg {
	width: 20px;
	height: 20px;
	margin-top: 4px;
	color: var(--man-green);
}

.hnmpdf-manual .hnmpdf-man-warn {
	margin: 0;
	padding: 14px 16px;
	border-radius: 14px;
	background: #fbeceb;
	color: #7a1f1b;
}

.hnmpdf-manual .hnmpdf-man-warn strong {
	margin-right: 6px;
	padding: 2px 10px;
	border-radius: 999px;
	background: var(--man-red);
	color: #fff;
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 14px;
	font-weight: 400;
}

.hnmpdf-manual .hnmpdf-man-section > :last-child {
	margin-bottom: 0;
}

.hnmpdf-manual .hnmpdf-man-credit {
	margin: 20px 0 6px;
	color: var(--man-muted);
	font-size: 14.5px;
	text-align: center;
}

.hnmpdf-manual .hnmpdf-man-credit a {
	color: var(--man-navy);
}

/* wp-admin screen */

.hnmpdf-man-admin .hnmpdf-manual {
	margin: 0;
}

.hnmpdf-man-admin .hnmpdf-man-actions {
	margin: 16px 0;
}

/* Printable page */

body.hnmpdf-print {
	margin: 0;
	background: #f3f6f6;
	color: #012f54;
	font-family: "HNMPDF Sarabun", "Sarabun", sans-serif;
}

body.hnmpdf-print main {
	padding: 24px 16px 40px;
}

.hnmpdf-print-tools {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	justify-content: center;
	padding: 10px;
	background: #012f54;
}

.hnmpdf-print-tools button {
	min-height: 46px;
	padding: 0 24px;
	border: 0;
	border-radius: 10px;
	background: #04826d;
	color: #fff;
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
}

.hnmpdf-print-cover {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 78vh;
	padding: 40px 24px;
	background: #a63934;
	color: #fff;
	text-align: center;
}

.hnmpdf-print-cover img {
	width: min(440px, 80vw);
	height: auto;
}

.hnmpdf-print-cover span {
	padding: 6px 18px;
	border-radius: 999px;
	background: #012f54;
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 17px;
}

.hnmpdf-print-cover h1 {
	margin: 10px 0 0;
	font-family: "HNMPDF Prompt", "Prompt", sans-serif;
	font-size: 44px;
	font-weight: 700;
	line-height: 1.25;
}

.hnmpdf-print-cover p {
	max-width: 520px;
	margin: 0;
	font-size: 19px;
}

.hnmpdf-print-cover small {
	margin-top: 10px;
	font-size: 15px;
}

@media (max-width: 720px) {
	.hnmpdf .hnmpdf-dialog {
		width: 100vw;
		height: 100dvh;
		border-radius: 0;
	}

	.hnmpdf .hnmpdf-dialog-body {
		padding: 12px;
	}

	.hnmpdf-manual .hnmpdf-man-section {
		padding: 16px;
	}

	.hnmpdf-manual .hnmpdf-man-rows > div {
		grid-template-columns: minmax(0, 1fr);
	}

	.hnmpdf .hnmpdf-manual-btn {
		top: 12px;
		right: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hnmpdf .hnmpdf-dialog-body {
		scroll-behavior: auto;
	}
}

@page {
	size: A4;
	margin: 16mm 0 18mm;

	@bottom-center {
		content: "Hanuman PDF Editor · www.hanumanconnect.com · " counter(page);
		color: #3d5568;
		font-family: "HNMPDF Sarabun", sans-serif;
		font-size: 9pt;
	}
}


@media print {
	body.hnmpdf-print {
		background: #fff;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.hnmpdf-print-tools,
	.hnmpdf-print .hnmpdf-man-toc {
		display: none;
	}

	.hnmpdf-print-cover {
		box-sizing: border-box;
		height: 248mm;
		min-height: 0;
		margin: 0 14mm;
		border-radius: 8mm;
		break-after: page;
	}

	body.hnmpdf-print main {
		padding: 0 14mm;
	}

	.hnmpdf-print .hnmpdf-manual {
		max-width: none;
		font-size: 12pt;
	}

	.hnmpdf-print .hnmpdf-man-section {
		margin-bottom: 7mm;
		padding: 6mm;
		border: 1px solid #c9d5db;
		box-shadow: none;
		break-inside: avoid;
	}

	.hnmpdf-print .hnmpdf-man-figure img {
		max-height: 78mm;
		width: auto;
		max-width: 100%;
		margin: 0 auto;
	}

	.hnmpdf-print .hnmpdf-man-credit a {
		text-decoration: none;
	}
}
