@font-face {
	font-family: "Araboto";
	src: url("assets/fonts/Araboto Thin.ttf") format("truetype");
	font-weight: 100;
	font-style: normal;
}
@font-face {
	font-family: "Araboto";
	src: url("assets/fonts/Araboto Light.ttf") format("truetype");
	font-weight: 300;
	font-style: normal;
}
@font-face {
	font-family: "Araboto";
	src: url("assets/fonts/Araboto Normal.ttf") format("truetype");
	font-weight: 400;
	font-style: normal;
}
@font-face {
	font-family: "Araboto";
	src: url("assets/fonts/Araboto Medium.ttf") format("truetype");
	font-weight: 500;
	font-style: normal;
}
@font-face {
	font-family: "Araboto";
	src: url("assets/fonts/Araboto Bold.ttf") format("truetype");
	font-weight: 700;
	font-style: normal;
}
@font-face {
	font-family: "Araboto";
	src: url("assets/fonts/Araboto Black.ttf") format("truetype");
	font-weight: 900;
	font-style: normal;
}

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

:root {
	--primary-color: #f7c900;
	--secondary-color: #000000;
	--mobile-scale: 1;
}

html,
body {
	width: 100%;
	height: 100%;
	height: 100dvh;
	overflow: hidden;
	background: var(--ambient);
	-webkit-tap-highlight-color: transparent;
	font-family: "Araboto", "Lora", Georgia, serif;
	overscroll-behavior: none;
	touch-action: manipulation;
	/* Prevent iOS rubber-banding */
	position: fixed;
	inset: 0;
}

.bg-primary {
	background-color: var(--primary-color);
}

.bg-secondary {
	background-color: var(--secondary-color);
}

.text-primary {
	color: var(--primary-color);
}

.text-secondary {
	color: var(--secondary-color);
}

.fvp {
	width: 100%;
	height: 100%;
	position: relative;
}

.display-1
{
	font-size: 80px;
}

.qi-logo {
	position: absolute;
	width: 7%;
	left: 5%;
	top: 5%;
}

/* ── Book ────────────────────────────────────────
   Shifted left by 100vw so only the RIGHT half
   (the right page of StPageFlip's spread) is
   visible inside the viewport.
   Left pages bleed off-screen to the left.
─────────────────────────────────────────────── */
#book {
	position: fixed;
	top: 0;
	left: -100vw;
	width: 200vw;
	height: 100vh;
	height: 100dvh;
}

/* ── Pages ───────────────────────────────────── */
.page {
	background-color: var(--primary-color);
	overflow: hidden;
}

.page-back {
	background-color: var(--primary-color);
}

/* ── Page content ────────────────────────────── */
.page-content {
	/* Offset right by 100vw so padding is relative to viewport, not spread */
	width: 100%;
	height: 100%;
	padding: 52px 56px 40px;
	display: flex;
	flex-direction: column;
}

/* ── Nav buttons (fixed to viewport) ─────────── */
.nav-btn {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	z-index: 9999;
	width: 54px;
	height: 54px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.6);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ink-mid);
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
	transition:
		background 0.18s,
		transform 0.15s;
}
.nav-btn--prev {
	left: 16px;
}
.nav-btn--next {
	right: 16px;
}
.nav-btn svg {
	width: 22px;
	height: 22px;
}
.nav-btn:hover {
	background: rgba(255, 255, 255, 0.88);
	transform: translateY(-50%) scale(1.06);
}
.nav-btn:active {
	transform: translateY(-50%) scale(0.96);
}

/* ── Progress ────────────────────────────────── */
.reader-progress {
	position: fixed;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 200;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: min(320px, 60vw);
}
.progress-track {
	display: none;
}
.progress-fill {
	display: none;
}
.progress-label {
	font-size: 10.5px;
	color: #ffffff;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

/* ── Drawer toggle button ───────────────────── */
.drawer-toggle {
	position: fixed;
	top: 16px;
	right: 16px;
	z-index: 10001;
	width: 50px;
	height: 50px;
	border: none;
	border-radius: 14px;
	background: rgba(10, 10, 10, 0.7);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #f7c900;
	box-shadow:
		0 2px 12px rgba(0, 0, 0, 0.3),
		0 0 0 1px rgba(247, 201, 0, 0.12),
		inset 0 1px 0 rgba(255, 255, 255, 0.05);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	overflow: hidden;
}
.drawer-toggle:hover {
	background: rgba(10, 10, 10, 0.85);
	box-shadow:
		0 4px 20px rgba(0, 0, 0, 0.4),
		0 0 0 1px rgba(247, 201, 0, 0.25),
		0 0 20px rgba(247, 201, 0, 0.08),
		inset 0 1px 0 rgba(255, 255, 255, 0.06);
	transform: scale(1.05);
}
.drawer-toggle:active {
	transform: scale(0.95);
}
.drawer-toggle__icon {
	width: 22px;
	height: 22px;
	position: absolute;
	transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer-toggle__icon--close {
	opacity: 0;
	transform: rotate(-90deg) scale(0.6);
}
.drawer-toggle--active .drawer-toggle__icon--menu {
	opacity: 0;
	transform: rotate(90deg) scale(0.6);
}
.drawer-toggle--active .drawer-toggle__icon--close {
	opacity: 1;
	transform: rotate(0deg) scale(1);
}

/* ── Drawer backdrop ────────────────────────── */
.drawer-backdrop {
	position: fixed;
	inset: 0;
	z-index: 9999;
	background: rgba(0, 0, 0, 0);
	backdrop-filter: blur(0px);
	-webkit-backdrop-filter: blur(0px);
	pointer-events: none;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.drawer-backdrop--visible {
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	pointer-events: auto;
}

/* ── Drawer panel ───────────────────────────── */
.drawer {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 10000;
	width: min(400px, 88vw);
	height: 100dvh;
	display: flex;
	flex-direction: column;
	background:
		linear-gradient(168deg, rgba(18, 16, 10, 0.97) 0%, rgba(8, 8, 6, 0.98) 100%);
	backdrop-filter: blur(40px) saturate(1.6);
	-webkit-backdrop-filter: blur(40px) saturate(1.6);
	border-left: 1px solid rgba(247, 201, 0, 0.1);
	box-shadow:
		-8px 0 40px rgba(0, 0, 0, 0.5),
		-1px 0 0 rgba(247, 201, 0, 0.06);
	transform: translateX(105%);
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
	pointer-events: none;
}
.drawer--open {
	transform: translateX(0);
	pointer-events: auto;
}

/* Header */
.drawer__header {
	padding: 22px 22px 16px;
	border-bottom: 1px solid rgba(247, 201, 0, 0.08);
	flex-shrink: 0;
}
.drawer__brand {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 18px;
}
.drawer__brand-qi {
	font-family: "Araboto", sans-serif;
	font-weight: 900;
	font-size: 22px;
	color: #f7c900;
	letter-spacing: 0.08em;
	text-shadow: 0 0 20px rgba(247, 201, 0, 0.3);
}
.drawer__brand-sep {
	width: 1px;
	height: 18px;
	background: rgba(247, 201, 0, 0.2);
}
.drawer__brand-title {
	font-family: "Araboto", sans-serif;
	font-weight: 300;
	font-size: 13px;
	color: rgba(255, 255, 255, 0.45);
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

/* Controls row */
.drawer__controls {
	display: flex;
	gap: 8px;
}
.drawer__ctrl {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 10px;
	cursor: pointer;
	color: rgba(255, 255, 255, 0.5);
	font-family: "Araboto", sans-serif;
	font-size: 11.5px;
	letter-spacing: 0.04em;
	transition: all 0.2s ease;
}
.drawer__ctrl:hover {
	background: rgba(247, 201, 0, 0.08);
	border-color: rgba(247, 201, 0, 0.15);
	color: rgba(255, 255, 255, 0.8);
}
.drawer__ctrl svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	color: #f7c900;
	opacity: 0.7;
}
.drawer__ctrl-label {
	white-space: nowrap;
}
.drawer__ctrl-badge {
	margin-left: auto;
	font-size: 8px;
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: #f7c900;
	background: rgba(247, 201, 0, 0.12);
	border-radius: 4px;
	padding: 3px 6px;
}

/* Page list */
.drawer__list {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 12px 14px;
	scrollbar-width: thin;
	scrollbar-color: rgba(247, 201, 0, 0.15) transparent;
}
.drawer__list::-webkit-scrollbar {
	width: 4px;
}
.drawer__list::-webkit-scrollbar-track {
	background: transparent;
}
.drawer__list::-webkit-scrollbar-thumb {
	background: rgba(247, 201, 0, 0.15);
	border-radius: 4px;
}
.drawer__list::-webkit-scrollbar-thumb:hover {
	background: rgba(247, 201, 0, 0.3);
}

/* Chapter dividers */
.drawer__chapter {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 8px 8px;
}
.drawer__chapter:first-child {
	padding-top: 4px;
}
.drawer__chapter-line {
	flex: 1;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(247, 201, 0, 0.15), transparent);
}
.drawer__chapter-label {
	font-family: "Araboto", sans-serif;
	font-weight: 700;
	font-size: 9px;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: rgba(247, 201, 0, 0.5);
	white-space: nowrap;
}

/* Page items */
.drawer__page {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 12px;
	margin: 2px 0;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 12px;
	cursor: pointer;
	text-align: left;
	font-family: "Araboto", sans-serif;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	overflow: hidden;
}
.drawer__page::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 12px;
	background: linear-gradient(135deg, rgba(247, 201, 0, 0.06), transparent);
	opacity: 0;
	transition: opacity 0.25s ease;
}
.drawer__page:hover {
	background: rgba(255, 255, 255, 0.03);
	border-color: rgba(255, 255, 255, 0.06);
}
.drawer__page:hover::before {
	opacity: 1;
}
.drawer__page:hover .drawer__page-arrow {
	opacity: 1;
	transform: translateX(0);
}

/* Active page */
.drawer__page--active {
	background: rgba(247, 201, 0, 0.08);
	border-color: rgba(247, 201, 0, 0.18);
	box-shadow:
		0 0 20px rgba(247, 201, 0, 0.05),
		inset 0 0 12px rgba(247, 201, 0, 0.03);
}
.drawer__page--active::before {
	opacity: 1;
	background: linear-gradient(135deg, rgba(247, 201, 0, 0.1), transparent 60%);
}
.drawer__page--active .drawer__page-num {
	color: #0a0a06;
	background: #f7c900;
	box-shadow: 0 0 12px rgba(247, 201, 0, 0.4);
}
.drawer__page--active .drawer__page-title {
	color: #f7c900;
}
.drawer__page--active .drawer__page-desc {
	color: rgba(255, 255, 255, 0.45);
}

/* Page number badge */
.drawer__page-num {
	width: 34px;
	height: 34px;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 9px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: rgba(255, 255, 255, 0.35);
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.06);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Page info */
.drawer__page-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.drawer__page-title {
	font-size: 13px;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.75);
	letter-spacing: 0.01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 0.25s ease;
}
.drawer__page-desc {
	font-size: 10.5px;
	font-weight: 300;
	color: rgba(255, 255, 255, 0.28);
	letter-spacing: 0.02em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 0.25s ease;
}

/* Arrow */
.drawer__page-arrow {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	opacity: 0;
	transform: translateX(-4px);
	transition: all 0.2s ease;
	color: rgba(247, 201, 0, 0.5);
}
.drawer__page-arrow svg {
	width: 16px;
	height: 16px;
}

/* Footer */
.drawer__footer {
	padding: 14px 22px 18px;
	border-top: 1px solid rgba(247, 201, 0, 0.08);
	flex-shrink: 0;
}
.drawer__progress-mini {
	display: flex;
	align-items: center;
	gap: 12px;
}
.drawer__progress-track {
	flex: 1;
	height: 2px;
	background: rgba(255, 255, 255, 0.06);
	border-radius: 2px;
	overflow: hidden;
}
.drawer__progress-fill {
	height: 100%;
	width: 3.57%;
	background: linear-gradient(90deg, #f7c900, #ffd740);
	border-radius: 2px;
	box-shadow: 0 0 8px rgba(247, 201, 0, 0.3);
}
.drawer__progress-text {
	font-family: "Araboto", sans-serif;
	font-size: 10px;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.3);
	letter-spacing: 0.16em;
	white-space: nowrap;
}

/* ── Page iframe ─────────────────────────────── */
.page-iframe {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
	pointer-events: none;
}

/* ── Back-page inner (black with QI text) ── */
.page-back-inner {
	width: 100%;
	height: 100%;
	background: var(--primary-color);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: "Araboto", sans-serif;
	font-size: 12vw;
	font-weight: 900;
	color: rgba(247, 201, 0, 0.1);
	user-select: none;
	letter-spacing: 0.05em;
}

/* ── Tablet (768px+) ─────────────────────────── */
@media (min-width: 768px) {
	.nav-btn {
		width: 64px;
		height: 64px;
	}
	.nav-btn svg {
		width: 28px;
		height: 28px;
	}
	.nav-btn--prev {
		left: 24px;
	}
	.nav-btn--next {
		right: 24px;
	}

	.drawer-toggle {
		width: 54px;
		height: 54px;
		border-radius: 16px;
		top: 20px;
		right: 20px;
	}
	.drawer-toggle__icon {
		width: 24px;
		height: 24px;
	}

	.drawer {
		width: min(420px, 50vw);
	}
	.drawer__header {
		padding: 26px 26px 18px;
	}
	.drawer__page {
		padding: 14px 14px;
	}
	.drawer__page-num {
		width: 38px;
		height: 38px;
		font-size: 12px;
		border-radius: 10px;
	}
	.drawer__page-title {
		font-size: 14px;
	}
	.drawer__page-desc {
		font-size: 11px;
	}
	.drawer__footer {
		padding: 16px 26px 22px;
	}

	.reader-progress {
		width: min(400px, 55vw);
		bottom: 24px;
	}
	.progress-track {
		height: 3px;
	}
	.progress-label {
		font-size: 12px;
	}
}

/* ── Desktop (1200px+) ───────────────────────── */
@media (min-width: 1200px) {
	.nav-btn {
		width: 72px;
		height: 72px;
	}
	.nav-btn svg {
		width: 32px;
		height: 32px;
	}
	.drawer-toggle {
		width: 58px;
		height: 58px;
	}
}

/* ── Mobile landscape (small screens) ────────── */
@media (max-height: 500px) and (orientation: landscape) {
	/* Scale page iframes to fit small viewports */
	.page-iframe {
		width: calc(100% / var(--mobile-scale));
		height: calc(100% / var(--mobile-scale));
		transform: scale(var(--mobile-scale));
		transform-origin: top left;
	}

	/* Smaller nav buttons */
	.nav-btn {
		width: 38px;
		height: 38px;
	}
	.nav-btn svg {
		width: 16px;
		height: 16px;
	}
	.nav-btn--prev { left: 8px; }
	.nav-btn--next { right: 8px; }

	/* Smaller drawer toggle */
	.drawer-toggle {
		width: 36px;
		height: 36px;
		border-radius: 10px;
		top: 8px;
		right: 8px;
	}
	.drawer-toggle__icon {
		width: 16px;
		height: 16px;
	}

	/* Compact progress bar */
	.reader-progress {
		bottom: 6px;
		width: min(240px, 50vw);
	}
	.progress-label {
		font-size: 8.5px;
	}

	/* Compact drawer */
	.drawer {
		width: min(320px, 75vw);
	}
	.drawer__header {
		padding: 12px 14px 10px;
	}
	.drawer__brand { margin-bottom: 10px; }
	.drawer__brand-qi { font-size: 16px; }
	.drawer__brand-title { font-size: 10px; }
	.drawer__ctrl {
		padding: 6px 8px;
		font-size: 10px;
	}
	.drawer__ctrl svg {
		width: 12px;
		height: 12px;
	}
	.drawer__page {
		padding: 8px 8px;
		gap: 10px;
	}
	.drawer__page-num {
		width: 28px;
		height: 28px;
		font-size: 9px;
		border-radius: 7px;
	}
	.drawer__page-title { font-size: 11px; }
	.drawer__page-desc { font-size: 9px; }
	.drawer__chapter { padding: 10px 6px 6px; }
	.drawer__chapter-label { font-size: 7.5px; }
	.drawer__footer {
		padding: 8px 14px 10px;
	}
	.drawer__progress-text { font-size: 8.5px; }

	/* Use full dynamic viewport */
	#book {
		height: 100dvh;
	}
}

/* ── Very small mobile landscape (< 400px height) ── */
@media (max-height: 400px) and (orientation: landscape) {
	.nav-btn {
		width: 32px;
		height: 32px;
	}
	.nav-btn svg {
		width: 14px;
		height: 14px;
	}
	.nav-btn--prev { left: 4px; }
	.nav-btn--next { right: 4px; }

	.drawer-toggle {
		width: 30px;
		height: 30px;
		border-radius: 8px;
		top: 4px;
		right: 4px;
	}
	.drawer-toggle__icon {
		width: 14px;
		height: 14px;
	}

	.reader-progress {
		bottom: 3px;
	}
	.progress-label {
		font-size: 7.5px;
	}
}
