/* general demo style */

html {
	height: 100%;
}

*,
*:after,
*:before {
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
	padding: 0;
	margin: 0;
}

.clearfix:before,
.clearfix:after {
	content: " ";
	display: table;
}

.clearfix:after {
	clear: both;
}

.clearfix {
	*zoom: 1;
}

body {
	background: #f6f6f6;
	font-weight: 400;
	font-size: 15px;
	color: #333;
	overflow: scroll;
	overflow-x: hidden;
    /* centering logic */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.demo-2 body {
	background: url(https://tympanus.net/Development/3DBookShowcase/images/wood.jpg);
}

a {
	color: #555;
	text-decoration: none;
}

.container {
	width: 100%;
	position: relative;
}

.main {
	width: 100%;
	max-width: 1060px;
	margin: 0 auto;
	position: relative;
	padding: 0 30px 50px 30px;
    /* center the list inside main */
    display: flex;
    justify-content: center;
}

/* bookshelf */

.bookshelf {
	width: 100%;
	height: 63px;
	z-index: -1;
	margin-top: -25px;
	background: transparent url(https://tympanus.net/Development/3DBookShowcase/images/shelf.png) no-repeat center center;
	position: relative;
}

/* book showcase logic */

.bk-list {
	list-style: none;
	position: relative;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.bk-list li {
	position: relative;
	width: 160px; 
	z-index: 1;
	margin: 0px 30px 150px 30px;
	perspective: 1800px;
}

.bk-info {
	position: relative;
	margin-top: 250px; 
    text-align: center;
}

.bk-info h3 {
	padding: 15px 0 5px;
	margin-bottom: 10px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.3);
	font-size: 18px;
}

.bk-info p {
	line-height: 20px;
	color: #444;
	font-size: 13px;
}

.bk-info button {
	background: #FC756F;
	border: none;
	color: #fff;
	display: inline-block;
	padding: 3px 10px;
	font-weight: 700;
	font-size: 11px;
	text-transform: uppercase;
	cursor: pointer;
	margin-right: 4px;
	box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.15);
}

/* 3d book structure */

.bk-list li .bk-book {
	position: absolute;
	width: 160px;
	height: 220px;
	transform-style: preserve-3d;
	transition: transform .5s;
}

.bk-list li .bk-book.bk-bookdefault:hover {
	transform: rotate3d(0, 1, 0, 35deg);
}

.bk-list li .bk-book > div,
.bk-list li .bk-front > div {
	display: block;
	position: absolute;
    outline: 1px solid transparent;
}

.bk-list li .bk-front {
	transform-style: preserve-3d;
	transform-origin: 0% 50%;
	transition: transform .5s;
	transform: translate3d(0, 0, 20px);
	z-index: 10;
}

/* front cover gradient */
.bk-cover {
    position: relative;
}

.bk-cover:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.02) 0%,
        rgba(0, 0, 0, 0.05) 0.75%,
        rgba(255, 255, 255, 0.5) 1.0%,
        rgba(255, 255, 255, 0.6) 1.3%,
        rgba(255, 255, 255, 0.5) 1.4%,
        rgba(255, 255, 255, 0.3) 1.5%,
        rgba(255, 255, 255, 0.3) 2.4%,
        rgba(0, 0, 0, 0.05) 2.7%,
        rgba(0, 0, 0, 0.05) 3.5%,
        rgba(255, 255, 255, 0.3) 4%,
        rgba(255, 255, 255, 0.3) 4.5%,
        transparent 5.4%,
        transparent 99%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

.bk-list li .bk-front > div {
	z-index: 1;
	backface-visibility: hidden;
	transform-style: preserve-3d;
}

.bk-list li .bk-page {
	transform: translate3d(0, 0, 19px);
	display: none;
	width: 155px;
	height: 210px;
	top: 5px;
	backface-visibility: hidden;
	z-index: 9;
}

.bk-list li .bk-front,
.bk-list li .bk-back,
.bk-list li .bk-front > div {
	width: 160px;
	height: 220px;
}

.bk-list li .bk-left,
.bk-list li .bk-right {
	width: 40px;
	left: -20px;
}

.bk-list li .bk-top,
.bk-list li .bk-bottom {
	width: 155px;
	height: 40px;
	top: -20px;
}

/* back cover container */
.bk-list li .bk-back {
	transform: rotate3d(0, 1, 0, -180deg) translate3d(0, 0, 20px);
	box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
	border-radius: 3px 0 0 3px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* gradient overlay flipped to the right for the back cover */
.bk-back:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    background: linear-gradient(
        to left, /* flipped to 'to left' to appear on the right side of the back */
        rgba(0, 0, 0, 0.02) 0%,
        rgba(0, 0, 0, 0.05) 0.75%,
        rgba(255, 255, 255, 0.5) 1.0%,
        rgba(255, 255, 255, 0.6) 1.3%,
        rgba(255, 255, 255, 0.5) 1.4%,
        rgba(255, 255, 255, 0.3) 1.5%,
        rgba(255, 255, 255, 0.3) 2.4%,
        rgba(0, 0, 0, 0.05) 2.7%,
        rgba(0, 0, 0, 0.05) 3.5%,
        rgba(255, 255, 255, 0.3) 4%,
        rgba(255, 255, 255, 0.3) 4.5%,
        transparent 5.4%,
        transparent 99%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

/* back cover text */
.bk-list li .bk-back p {
    font-family: "Georgia", serif;
    font-size: 10px;
    line-height: 1.5;
    text-align: justify;
    color: #fff;
    opacity: 0.95;
    margin: 0;
    hyphens: auto;
    position: relative;
    z-index: 1;
}

.bk-list li .bk-cover-back {
	background-color: #000;
	transform: rotate3d(0, 1, 0, -179deg);
}

.bk-cover img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0 3px 3px 0;
}

.bk-list li .bk-right {
	height: 210px;
	top: 5px;
	transform: rotate3d(0, 1, 0, 90deg) translate3d(0, 0, 139.5px); 
	backface-visibility: hidden;
}

.bk-list li .bk-left {
	height: 220px;
	transform: rotate3d(0, 1, 0, -90deg) translate3d(0, 0, 0.1px); 
}

.bk-list li .bk-top {
	transform: rotate3d(1, 0, 0, 90deg);
}

.bk-list li .bk-bottom {
	transform: rotate3d(1, 0, 0, -90deg) translate3d(0, 0, 180px);
}

.bk-list li .bk-viewinside .bk-front {
	transform: translate3d(0, 0, 20px) rotate3d(0, 1, 0, -160deg);
}

.bk-list li .bk-book.bk-viewinside {
	transform: translate3d(0, 0, 150px) rotate3d(0, 1, 0, 0deg);
}

.bk-list li .bk-book.bk-viewback {
	transform: translate3d(0, 0, 0px) rotate3d(0, 1, 0, 180deg);
}

.bk-list li .bk-page,
.bk-list li .bk-right,
.bk-list li .bk-top,
.bk-list li .bk-bottom {
	background-color: #fff;
}

.bk-list li .bk-front > div {
	border-radius: 0 3px 3px 0;
	box-shadow: inset 4px 0 10px rgba(0, 0, 0, 0.1);
}

.bk-left h2 {
    width: 220px; 
    height: 40px;
    transform-origin: 0 0;
    transform: rotate(90deg) translateY(-40px);
    color: #fff;
    font-size: 9px; 
    line-height: 40px;
    padding: 0 25px; 
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    font-family: sans-serif;
    display: flex;
    justify-content: center;
}

.bk-left h2 span {
    display: inline-block;
    margin: 0 5px;
}

.bk-left h2 span:first-child {
    font-weight: 400;
    opacity: 0.8;
}

.bk-left h2 span:last-child {
    font-weight: 700;
}

.bk-content {
	position: absolute;
	top: 10px;
	left: 10px;
	bottom: 10px;
	right: 10px;
	padding: 10px;
	overflow: hidden;
	background: #fff;
	opacity: 0;
	pointer-events: none;
	backface-visibility: hidden;
	transition: opacity 0.3s ease-in-out;
	cursor: default;
}

.bk-content-current {
	opacity: 1;
	pointer-events: auto;
}

/* hide the old arrow navigation */
.bk-page nav {
    display: none !important;
}

.bk-page {
    cursor: pointer;
    position: relative;
    background: #fff;
    overflow: hidden; /* keeps the sliding page inside the book bounds */
}

/* visual hint: the permanent small dog-ear fold */
.bk-page::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 15px 15px;
    border-color: transparent transparent #ddd transparent;
    box-shadow: -1px -1px 2px rgba(0,0,0,0.05);
    z-index: 30;
    pointer-events: none;
}

/* page content animation: the "slip" */
.bk-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    background: #fff;
    opacity: 0;
    visibility: hidden;
    /* start position: tucked to the right */
    transform: translateX(100%); 
    transition: transform 0.6s cubic-bezier(0.645, 0.045, 0.355, 1), 
                opacity 0.6s ease;
    z-index: 10;
}

/* current page shown in center */
.bk-content-current {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    z-index: 20;
}

/* page that was just turned, sliding to the left */
.bk-content-was-current {
    opacity: 0;
    visibility: visible;
    transform: translateX(-100%);
    z-index: 25;
    transition: transform 0.6s ease, opacity 0.6s ease;
}

.bk-page nav span {
	display: inline-block;
	width: 15px;
	height: 15px;
	font-size: 10px;
	color: #aaa;
	background: #f0f0f0;
	border-radius: 50%;
}

.bk-front > div, 
.bk-back, 
.bk-left { 
    background-color: var(--book-color, #333); 
}

.bk-cover h2 {
	display: none;
}

.custom-bk-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2; 
}

.bk-back:has(.custom-bk-back) p {
    display: none;
}