/* AK Urdu Publisher – Books library, reader and About the Author */
.akup-lib, .akup-author {
	--akl-green: #2E3D35;
	--akl-green-dark: #243029;
	--akl-clay: #8A4A2C;
	--akl-ink: #1F2A24;
	--akl-muted: #5E6660;
	--akl-line: #E4E0D6;
	--akl-paper: #F6F3EC;
	--akl-card: #FFFFFF;
	color: var(--akl-ink);
	box-sizing: border-box;
}
.akup-lib *, .akup-lib *::before, .akup-lib *::after,
.akup-author *, .akup-author *::before, .akup-author *::after { box-sizing: border-box; }
.akup-lib { display: flex; flex-direction: column; gap: 22px; width: 100%; scroll-margin-top: 90px; }
.akup-lib__sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.akup-lib svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Header + search */
.akup-lib__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 32px; }
.akup-lib__intro { flex: 1 1 380px; max-width: 640px; }
.akup-lib__title { margin: 0 0 6px; font-size: clamp(28px, 4vw, 40px); line-height: 1.2; color: var(--akl-ink); }
.akup-lib__intro p { margin: 0; font-size: 16px; line-height: 1.7; color: var(--akl-muted); }
.akup-lib__search {
	position: relative; display: flex; align-items: center; gap: 6px; flex: 1 1 320px; max-width: 420px; margin: 0;
}
.akup-lib__search svg { position: absolute; left: 14px; font-size: 18px; color: var(--akl-muted); pointer-events: none; }
.akup-lib__search input {
	flex: 1 1 auto; min-width: 0; height: 48px; margin: 0; padding: 0 14px 0 42px; border: 1px solid var(--akl-line); border-radius: 12px;
	background: var(--akl-card); font-size: 16px; color: var(--akl-ink); box-shadow: none;
}
.akup-lib__search input:focus { outline: none; border-color: var(--akl-green); box-shadow: 0 0 0 3px rgba(46,61,53,.15); }
.akup-lib__search button {
	height: 48px; padding: 0 18px; margin: 0; border: none; border-radius: 12px; background: var(--akl-green); color: #FFFFFF;
	font-weight: 600; font-size: 15px; cursor: pointer; line-height: 1;
}
.akup-lib__search button:hover { background: var(--akl-green-dark); }
.akup-lib__count { margin: -6px 0 0; font-size: 14px; color: var(--akl-muted); }
.akup-lib__count a { color: var(--akl-clay); font-weight: 600; }
.akup-lib__empty { margin: 0; padding: 40px 0; text-align: center; color: var(--akl-muted); font-size: 16px; }
.akup-lib__empty[hidden] { display: none; }
.akup-lib__notice { margin: 0; padding: 12px 16px; border-radius: 10px; background: #FBF1EA; color: var(--akl-clay); font-weight: 600; }

/* Grid of books */
.akup-lib__grid {
	list-style: none; margin: 0; padding: 0;
	display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 36px 28px;
}
.akup-book { display: flex; flex-direction: column; margin: 0; padding: 0; }
.akup-book[hidden] { display: none; }
.akup-book__cover {
	position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 4px 10px 10px 4px; overflow: hidden;
	background: var(--akl-paper);
	box-shadow: 0 1px 2px rgba(31,42,36,.12), 0 10px 24px rgba(31,42,36,.16);
	transition: transform .25s ease, box-shadow .25s ease;
}
.akup-book__cover::after { /* soft spine shading, so the cover reads as a book */
	content: ""; position: absolute; inset: 0;
	background: linear-gradient(90deg, rgba(0,0,0,.18) 0, rgba(255,255,255,.18) 2.5%, rgba(0,0,0,.06) 5%, rgba(0,0,0,0) 9%);
	pointer-events: none;
}
.akup-book__cover:hover, .akup-book__cover:focus-visible { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(31,42,36,.12), 0 18px 34px rgba(31,42,36,.2); }
.akup-book__cover img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; }
.akup-book__blank {
	display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 22px; text-align: center;
	background: linear-gradient(160deg, var(--akl-green), #3F5347); color: #F3EFE4;
	font-family: var(--akup-font, "Jameel Noori Nastaleeq", "Noto Nastaliq Urdu", serif); font-size: 24px; line-height: 2;
}
.akup-book__body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding-top: 16px; flex: 1 1 auto; }
.akup-book__title {
	margin: 0; font-family: var(--akup-font, "Jameel Noori Nastaleeq", "Noto Nastaliq Urdu", serif);
	font-size: 23px; line-height: 1.95; font-weight: 400; unicode-bidi: plaintext;
}
.akup-book__title a { color: var(--akl-ink); text-decoration: none; }
.akup-book__title a:hover { color: var(--akl-clay); }
.akup-book__en { margin: 0; font-size: 14px; line-height: 1.5; color: var(--akl-muted); font-weight: 500; }
.akup-book__meta { margin: 0; font-size: 13px; color: var(--akl-muted); }
.akup-book__actions { display: flex; gap: 8px; justify-content: center; margin-top: auto; padding-top: 10px; }
.akup-book__read, .akup-book__dl {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 18px; border-radius: 10px;
	font-size: 14px; font-weight: 600; text-decoration: none; line-height: 1; transition: background .15s, border-color .15s;
}
.akup-book__read { background: var(--akl-green); color: #FFFFFF !important; }
.akup-book__read:hover { background: var(--akl-green-dark); }
.akup-book__dl { border: 1px solid var(--akl-line); background: var(--akl-card); color: var(--akl-ink) !important; padding: 0 14px; }
.akup-book__dl:hover { border-color: var(--akl-green); }
.akup-book__dl svg { font-size: 16px; }

/* Reader */
.akup-lib__back { align-self: flex-start; color: var(--akl-green); font-weight: 600; text-decoration: none; font-size: 15px; }
.akup-lib__back:hover { color: var(--akl-clay); }
.akup-reader {
	display: flex; flex-direction: column; background: #3A4540; border-radius: 16px; overflow: hidden;
	scroll-margin-top: 20px; color: #FFFFFF;
}
.akup-reader__top, .akup-reader__bar {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px;
	background: var(--akl-green);
}
.akup-reader__heading { display: flex; flex-direction: column; min-width: 0; }
.akup-reader__title {
	margin: 0; color: #FFFFFF; font-family: var(--akup-font, "Jameel Noori Nastaleeq", "Noto Nastaliq Urdu", serif);
	font-size: 24px; line-height: 1.8; font-weight: 400; unicode-bidi: plaintext;
}
.akup-reader__en { font-size: 13px; opacity: .75; }
.akup-reader__tools, .akup-reader__zoom { display: flex; gap: 8px; }
.akup-rbtn {
	display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; min-width: 40px; padding: 0 14px; margin: 0;
	border: 1px solid rgba(255,255,255,.25); border-radius: 10px; background: rgba(255,255,255,.08); color: #FFFFFF !important;
	font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1; text-decoration: none; cursor: pointer; transition: background .15s;
}
.akup-rbtn:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.akup-rbtn:focus-visible { outline: 2px solid #F3D9A4; outline-offset: 2px; }
.akup-rbtn:disabled { opacity: .4; cursor: default; }
.akup-rbtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.akup-rbtn--main { background: #FFFFFF; color: var(--akl-green) !important; border-color: #FFFFFF; min-width: 116px; font-size: 15px; }
.akup-rbtn--main:hover:not(:disabled) { background: #EDE7DA; }
.akup-reader__nav { display: flex; align-items: center; gap: 12px; }
.akup-reader--rtl .akup-reader__nav { flex-direction: row-reverse; }
.akup-reader__pos { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; white-space: nowrap; margin: 0; color: #FFFFFF; }
.akup-reader__pos input {
	width: 64px; height: 40px; margin: 0; padding: 0 6px; border: 1px solid rgba(255,255,255,.3); border-radius: 8px;
	background: rgba(0,0,0,.18); color: #FFFFFF; font-size: 15px; text-align: center; -moz-appearance: textfield;
}
.akup-reader__pos input::-webkit-inner-spin-button, .akup-reader__pos input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.akup-reader__stage {
	position: relative; overflow: auto; padding: 18px; min-height: 420px;
	display: flex; -webkit-user-select: none; user-select: none;
}
.akup-reader__page { margin: auto; line-height: 0; }
.akup-reader__page canvas { display: block; background: #FFFFFF; box-shadow: 0 6px 28px rgba(0,0,0,.35); border-radius: 2px; }
.akup-reader__zone {
	position: absolute; top: 0; bottom: 0; width: 18%; max-width: 160px; margin: 0; padding: 0; border: 0; background: transparent;
	cursor: pointer; opacity: 0; z-index: 1;
}
.akup-reader__zone--left { left: 0; cursor: w-resize; }
.akup-reader__zone--right { right: 0; cursor: e-resize; }
.akup-reader.is-zoomed .akup-reader__zone { display: none; }
.akup-reader__status {
	position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
	background: #3A4540; font-size: 16px; text-align: center; padding: 20px;
}
.akup-reader__status[hidden] { display: none; }
.akup-reader__status.is-error .akup-reader__spinner { display: none; }
.akup-reader__spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #FFFFFF; animation: akup-spin .9s linear infinite; }
@keyframes akup-spin { to { transform: rotate(360deg); } }
.akup-reader__resume {
	position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 12px;
	padding: 8px 8px 8px 16px; border-radius: 12px; background: rgba(20,26,23,.92); font-size: 14px; white-space: nowrap;
}
.akup-reader__resume[hidden] { display: none; }
.akup-reader__resume button { margin: 0; min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: #FFFFFF; color: var(--akl-green); font-weight: 600; font-size: 13px; cursor: pointer; }
.akup-reader__nojs { margin: 0; padding: 20px; text-align: center; }

/* Full screen */
.akup-reader.is-full { position: fixed; inset: 0; z-index: 999999; border-radius: 0; }
.akup-reader.is-full .akup-reader__stage { flex: 1 1 auto; min-height: 0; }
.akup-reader:fullscreen { border-radius: 0; }
html.akup-reading-full, html.akup-reading-full body { overflow: hidden !important; }

.akup-reader__about { font-size: 17px; line-height: 1.9; color: var(--akl-ink); max-width: 820px; unicode-bidi: plaintext; }
.akup-reader__about p { margin: 0 0 12px; }
.akup-lib--reading .akup-share { margin: 0; }
.akup-lib__more { margin-top: 18px; padding-top: 28px; border-top: 1px solid var(--akl-line); }
.akup-lib__subhead { margin: 0 0 20px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--akl-clay); }
.akup-lib__grid--small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 22px; }
.akup-lib__grid--small .akup-book__title { font-size: 20px; }

/* Reading only, no download: nothing to print */
@media print {
	.akup-reader--nodl .akup-reader__stage { display: none !important; }
}

/* About the Author: adapts to the width it is given (Elementor column or narrow theme) */
.akup-author-wrap { container-type: inline-size; width: 100%; margin: 64px 0 0; }
.akup-author {
	display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 48px; align-items: start;
	margin: 0; padding: 48px; border-radius: 20px; background: var(--akl-paper);
	scroll-margin-top: 90px;
}
.akup-author__photo { margin: 0; position: sticky; top: 100px; }
.akup-author__photo img {
	display: block; width: 100%; height: auto; aspect-ratio: 617 / 662; object-fit: cover; border-radius: 14px;
	box-shadow: 0 16px 40px rgba(31,42,36,.18);
}
.akup-author__eyebrow { margin: 0 0 10px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--akl-clay); }
.akup-author__name { margin: 0; font-size: clamp(28px, 3.6vw, 40px); line-height: 1.2; color: var(--akl-ink); }
.akup-author__role { margin: 8px 0 0; font-size: 15px; font-weight: 600; color: var(--akl-green); }
.akup-author__bio { margin-top: 22px; font-size: 17px; line-height: 1.85; color: #34403A; }
.akup-author__bio p { margin: 0 0 16px; }
.akup-author__bio h3 { margin: 30px 0 14px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; color: var(--akl-clay); }
.akup-author__bio ul, .akup-author__bio ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.akup-author__bio li { margin: 0; padding: 14px 18px; background: var(--akl-card); border: 1px solid var(--akl-line); border-radius: 12px; font-size: 15px; line-height: 1.7; color: var(--akl-muted); }
.akup-author__bio li strong { color: var(--akl-ink); font-size: 17px; }
.akup-author__bio [lang="ur"] {
	display: inline-block; font-family: var(--akup-font, "Jameel Noori Nastaleeq", "Noto Nastaliq Urdu", serif);
	font-size: 21px; line-height: 2; color: var(--akl-ink); font-weight: 400;
}

@container (max-width: 780px) {
	.akup-author { grid-template-columns: 1fr; gap: 28px; padding: 28px 22px; }
	.akup-author__photo { position: static; max-width: 300px; }
}
@supports not (container-type: inline-size) {
	@media (max-width: 900px) {
		.akup-author { grid-template-columns: 1fr; gap: 28px; padding: 28px 22px; }
		.akup-author__photo { position: static; max-width: 300px; }
	}
}
@media (max-width: 700px) { .akup-author-wrap { margin-top: 44px; } }
@media (max-width: 700px) {
	.akup-lib__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
	.akup-book__title { font-size: 19px; }
	.akup-book__read, .akup-book__dl { padding: 0 12px; }
	.akup-lib__search { max-width: none; }
	.akup-reader { border-radius: 12px; margin: 0 -4px; }
	.akup-reader__top, .akup-reader__bar { padding: 10px; }
	.akup-reader__title { font-size: 20px; }
	.akup-reader .akup-rbtn span { display: none; }
	.akup-reader__stage { padding: 10px; min-height: 300px; }
	.akup-reader__bar { justify-content: center; }
	.akup-reader__nav { width: 100%; justify-content: space-between; gap: 8px; }
	.akup-rbtn--main { min-width: 0; flex: 1 1 0; padding: 0 10px; }
	.akup-reader__pos input { width: 52px; }
	.akup-reader__zone { width: 22%; }
	.akup-author__bio { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
	.akup-book__cover, .akup-reader__spinner { transition: none; animation: none; }
}

/* Keep reader and library buttons the same in every theme (themes often style all buttons). */
.akup-lib .akup-reader .akup-rbtn, .akup-lib .akup-reader .akup-rbtn:hover, .akup-lib .akup-reader .akup-rbtn:focus {
	background: rgba(255,255,255,.08) !important; color: #FFFFFF !important; border: 1px solid rgba(255,255,255,.25) !important;
	box-shadow: none !important; text-shadow: none !important; text-transform: none !important; letter-spacing: normal !important;
	min-height: 40px !important; padding: 0 14px !important; border-radius: 10px !important; font-size: 14px !important; font-weight: 600 !important; line-height: 1 !important; width: auto !important;
}
.akup-lib .akup-reader .akup-rbtn:hover:not(:disabled) { background: rgba(255,255,255,.2) !important; }
.akup-lib .akup-reader .akup-rbtn--main, .akup-lib .akup-reader .akup-rbtn--main:focus {
	background: #FFFFFF !important; color: #2E3D35 !important; border-color: #FFFFFF !important; min-width: 116px; font-size: 15px !important;
}
.akup-lib .akup-reader .akup-rbtn--main:hover:not(:disabled) { background: #EDE7DA !important; }
.akup-lib .akup-reader .akup-rbtn:disabled { opacity: .4 !important; }
.akup-lib .akup-reader .akup-reader__zone, .akup-lib .akup-reader .akup-reader__zone:hover, .akup-lib .akup-reader .akup-reader__zone:focus {
	background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; opacity: 0 !important;
}
.akup-lib .akup-reader .akup-reader__resume button { background: #FFFFFF !important; color: #2E3D35 !important; border: 0 !important; padding: 0 12px !important; min-height: 34px !important; font-size: 13px !important; }
.akup-lib .akup-lib__search button, .akup-lib .akup-lib__search button:hover, .akup-lib .akup-lib__search button:focus {
	background: #2E3D35 !important; color: #FFFFFF !important; border: 0 !important; border-radius: 12px !important; height: 48px !important; padding: 0 18px !important; font-size: 15px !important; text-transform: none !important; min-height: 0 !important; width: auto !important;
}
.akup-lib .akup-reader__top, .akup-lib .akup-reader__bar { background: #2E3D35 !important; }
.akup-lib .akup-reader__stage { background: #3A4540; }
@media (max-width: 700px) {
	.akup-lib .akup-reader .akup-rbtn--main { min-width: 0; flex: 1 1 0; padding: 0 10px !important; }
}
.akup-lib .akup-reader .akup-rbtn { white-space: nowrap; }
@media (max-width: 700px) {
	.akup-reader__pw { display: none; }
	.akup-lib .akup-reader .akup-rbtn--main { font-size: 14px !important; }
}

/* 1.1.1: zoom with the mouse wheel / pinch, drag to move when zoomed */
.akup-reader__stage { touch-action: pan-x pan-y; overscroll-behavior-x: contain; }
.akup-reader.is-zoomed .akup-reader__stage { cursor: grab; overscroll-behavior: contain; }
.akup-reader.is-full .akup-reader__stage { overscroll-behavior: contain; }
.akup-reader.is-dragging .akup-reader__stage { cursor: grabbing; }
