/**
 * A book on the page, and the reader it opens into.
 */
.me-book-cover {
	display: block;
	position: relative;
	width: 100%;
	border: 0;
	padding: 0;
	background: none;
	cursor: pointer;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.me-book-cover img {
	display: block;
	width: 100%;
	height: auto;
}

.me-book-cover:hover,
.me-book-cover:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 24px 54px rgba(0, 0, 0, 0.55);
}

/* The spine, so a flat image reads as a book before it is opened. */
.me-book-cover::before {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 14px;
	background: linear-gradient(to right, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
	pointer-events: none;
}

.me-book-hint {
	position: absolute;
	left: 50%;
	bottom: 14px;
	transform: translateX(-50%);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: Inter, system-ui, sans-serif;
	font-size: 0.6rem;
	font-weight: 700;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	color: #0B1120;
	background: #D4AF37;
	border-radius: 999px;
	padding: 7px 16px;
	white-space: nowrap;
}

/* ── The reader ───────────────────────────────────────────────────────── */
.me-book-reader {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	background: rgba(6, 10, 22, 0.97);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.me-book-reader[hidden] {
	display: none;
}

.me-book-bar {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px clamp(16px, 4vw, 32px);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.me-book-title {
	flex: 1;
	min-width: 0;
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-style: italic;
	font-size: clamp(0.95rem, 2vw, 1.3rem);
	color: #F8FAFC;
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.me-book-tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-width: 34px;
	height: 34px;
	padding: 0 12px;
	border-radius: 999px;
	border: 1px solid rgba(212, 175, 55, 0.3);
	background: transparent;
	color: rgba(212, 175, 55, 0.85);
	font-family: Inter, system-ui, sans-serif;
	font-size: 0.6rem;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	cursor: pointer;
	text-decoration: none;
	transition: all 0.2s ease;
}

.me-book-tool:hover,
.me-book-tool:focus-visible {
	background: rgba(212, 175, 55, 0.14);
	border-color: #D4AF37;
	color: #D4AF37;
}

.me-book-tool.is-on {
	background: rgba(212, 175, 55, 0.2);
	color: #F8FAFC;
	border-color: #D4AF37;
}

.me-book-stagewrap {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(10px, 2vw, 24px);
	min-height: 0;
}

.me-book-holder {
	margin: 0 auto;
	max-width: 100%;
}

.me-book-stage {
	margin: 0 auto;
}

/* The library draws on a canvas laid over everything; without this the bar and
   the footer are underneath it and their buttons cannot be pressed. */
.me-book-bar,
.me-book-foot {
	position: relative;
	z-index: 3;
}

.me-book-stagewrap {
	position: relative;
	z-index: 1;
}

.me-book-stage img {
	display: block;
	width: 100%;
	height: 100%;
}

.me-book-foot {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.me-book-where {
	font-family: Inter, system-ui, sans-serif;
	font-size: 0.66rem;
	letter-spacing: 0.2em;
	color: rgba(255, 255, 255, 0.5);
	min-width: 72px;
	text-align: center;
}

@media (max-width: 640px) {
	.me-book-bar {
		gap: 8px;
	}

	.me-book-tool {
		font-size: 0;
		padding: 0;
		letter-spacing: 0;
		gap: 0;
		width: 34px;
	}

	.me-book-tool svg {
		font-size: initial;
	}
}

/* Zoomed in, the book is panned rather than turned. */
.me-book-holder {
	transform-origin: center center;
	transition: transform 0.18s ease-out;
	will-change: transform;
}

.me-book-stagewrap.is-zoomed {
	cursor: grab;
	touch-action: none;
}

.me-book-stagewrap.is-zoomed .me-book-holder {
	transition: none;
}

/* The middle of the page gives the artwork the whole screen. */
.me-book-reader.is-bare .me-book-bar,
.me-book-reader.is-bare .me-book-foot,
.me-book-reader.is-bare .me-book-howto {
	display: none;
}

.me-book-howto {
	font-family: Inter, system-ui, sans-serif;
	font-size: 0.6rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.3);
	text-align: center;
	margin: 0;
	padding: 0 16px calc(10px + env(safe-area-inset-bottom));
	position: relative;
	z-index: 3;
}

@media (max-width: 640px) {
	.me-book-howto {
		font-size: 0.55rem;
		letter-spacing: 0.08em;
	}
}
