:root {
	--nav-buttons-height: 10vh; /* Approximate height of the navigation buttons */
}

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	font-family: 'Canterbury', cursive;
	background: #2d2013;
	/* Removed overflow: hidden; to allow scrolling if needed */
}

.layout {
	display: none;
	height: calc(100vh - 50px); /* Adjust height to account for fixed backlink in index.html */
	width: 100vw;
	flex-direction: column; /* Ensure vertical stacking for content */
}

.layout.active {
	display: flex;
}

.nav-buttons {
	position: fixed; /* Use fixed to keep it at the bottom */
	bottom: 0; /* Align to the very bottom */
	width: 100%;
	display: flex;
	justify-content: space-around;
	z-index: 10;
	background-color: #2d2013; /* Add a background to prevent content showing through */
	padding: 1vh 0; /* Add some vertical padding */
	box-sizing: border-box; /* Include padding in the width/height */
	height: var(--nav-buttons-height); /* Set a fixed height */
}

.nav-buttons button {
	padding: 1.5vh 3vw;
	font-size: 2.5vw;
	background-color: #3e2a14;
	color: #f0e6c2;
	border: 2px solid #d1ba8b;
	cursor: pointer;
	font-family: 'Canterbury', cursive;
	border-radius: 8px;
}

/* DESKTOP STYLES */
.desktop .book {
	margin: auto;
	width: 90vw;
	max-width: 900px;
	height: 70vh;
	max-height: 800px;
	position: relative;
	border: 8px solid #5c3a1e;
	box-shadow: 0 0 20px #000 inset, 0 0 60px #3b2a1a;
	background: url('leather-texture.jpg');
	background-size: cover;
	display: flex;
	flex-direction: column;
}

.desktop .page {
	display: none;
	width: 100%;
	height: 100%;
	background: url('parchment-texture.jpg') #f6f1d3;
	background-size: cover;
	border: 1px solid #bca77a;
	box-shadow: 0 5px 15px rgba(0,0,0,0.5);
	padding: 20px;
	box-sizing: border-box;
	flex-direction: row;
}

.desktop .page.visible {
	display: flex;
}

.desktop .image-section, .desktop .text-section {
	width: 50%;
	display: flex;
	justify-content: center;
	align-items: center;
}

.desktop .text-section {
	font-size: 1.1em;
	line-height: 1.6;
	color: #2d2013;
	text-align: center;
	white-space: pre-line;
	padding: 20px;
	overflow-y: auto;
}

.desktop .image-section img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border: 2px solid #bca77a;
	box-shadow: 2px 2px 10px rgba(0,0,0,0.3);
}

/* Cover Page Styles for Desktop */
.desktop .page.cover {
	background: url('leather-texture.jpg') #3e2a14;
	background-size: cover;
	box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.8);
	color: #f8e8c8;
	text-align: center;
	justify-content: center;
	align-items: center;
	flex-direction: column;
}

.desktop .page.cover h1 {
	font-size: 3em;
	margin-bottom: 2vh;
	text-transform: uppercase;
	border-bottom: 2px solid #d1ba8b;
	display: inline-block;
	padding-bottom: 1vh;
}

.desktop .page.cover h3 {
	font-size: 1.5em;
	font-style: italic;
}

/* Intro Page Styles for Desktop */
.desktop .page.intro .text-section {
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 90%;
}


/* MOBILE STYLES */
.mobile {
	height: calc(100vh - 50px); /* Ensure mobile layout takes up remaining height, adjusted for fixed backlink */
	display: flex; /* Make it a flex container */
	flex-direction: column; /* Stack children vertically */
}

.mobile .book {
	width: 100vw;
	height: 100%; /* Book takes up remaining height of the layout */
	background: url('leather-texture.jpg') #3e2a14;
	background-size: cover;
	box-shadow: inset 0 0 60px rgba(0,0,0,0.8);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

.mobile .page {
	display: none;
	width: 100vw;
	height: 100%; /* Page takes full height of the book */
	position: absolute; /* Pages are absolutely positioned within the book to stack on top */
	background: url('parchment-texture.jpg') #f6f1d3;
	background-size: cover;
	border: 2px solid #bca77a;
	box-shadow: 0 5px 15px rgba(0,0,0,0.5);
	flex-direction: column;
	justify-content: flex-start;
	box-sizing: border-box; /* Include padding in height */
	padding-bottom: var(--nav-buttons-height); /* Add padding to account for nav buttons */
}

.mobile .page.visible {
	display: flex;
}

.mobile .image-section {
	height: 60%; /* Take 60% of the available page height */
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 1vh 2vw; /* Add some padding */
	box-sizing: border-box;
}

.mobile .image-section img {
	max-height: 100%;
	max-width: 100%;
	object-fit: contain;
	border: 1px solid #bca77a;
	box-shadow: 2px 2px 10px rgba(0,0,0,0.3);
}

.mobile .text-section {
	height: 40%; /* Take 40% of the available page height */
	padding: 1vh 4vw;
	font-size: 4vw;
	line-height: 1.5;
	color: #2d2013;
	text-align: center;
	overflow-y: auto;
	box-sizing: border-box;
}

/* Cover Page Styles for Mobile */
.mobile .page.cover {
	background: url('leather-texture.jpg') #3e2a14;
	background-size: cover;
	box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.8);
	color: #f8e8c8;
	text-align: center;
	justify-content: center;
	align-items: center;
}

@media (max-width: 767px) {
	.mobile .page.cover h1 {
	  font-size: 6vw;
	  margin-bottom: 1.5vh;
	}

	.mobile .page.cover h3 {
	  font-size: 3vw;
	}
}

.mobile .page.cover h1 {
	font-size: 8vw;
	margin-bottom: 2vh;
	text-transform: uppercase;
	border-bottom: 2px solid #d1ba8b;
	display: inline-block;
	padding-bottom: 1vh;
	font-family: sans-serif;
}

.mobile .page.cover h3 {
	font-size: 4.5vw;
	font-style: italic;
}

/* Intro Page Styles for Mobile */
.mobile .page.intro .text-section {
	height: 50%; /* Adjust intro page text section height */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4vw;
}

.back-to-cover-button {
	padding: 1.5vh 3vw;
	font-size: 2.5vw;
	background-color: #3e2a14;
	color: #f0e6c2;
	border: 2px solid #d1ba8b;
	cursor: pointer;
	font-family: 'Canterbury', cursive;
	border-radius: 8px;
	margin-top: 20px;
}

.nav-buttons {
	display: flex;
	justify-content: space-around;
	align-items: center;
}

.nav-buttons #nextButton,
.nav-buttons #backToCoverButton {
	display: none;
}