@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Open+Sans:wght@400;600&display=swap');

/* Animations */
@keyframes backgroundScroll {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 50px 50px;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(1deg);
    }

    100% {
        transform: translateY(0px) rotate(0deg);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(-2deg);
    }

    50% {
        transform: rotate(2deg);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Base Styles with Animations */
body {
    font-family: 'Open Sans', sans-serif;
    background-color: #e1f5fe;
    color: #0277bd;
    /* Animated Pattern */
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23b3e5fc' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    animation: backgroundScroll 20s linear infinite;
}

h1,
h2,
h3 {
    font-family: 'Fredoka One', cursive;
}

header {
    background-color: #81d4fa;
    padding: 2rem;
    text-align: center;
    border-bottom: 5px solid #29b6f6;
    position: relative;
    overflow: hidden;
}

header h1 {
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 3px 3px 0px #0288d1;
    letter-spacing: 2px;
    display: inline-block;
    animation: wiggle 3s ease-in-out infinite;
}

/* Add some cloud-like circles to header background */
header::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 5s ease-in-out infinite;
}

header::after {
    content: '';
    position: absolute;
    bottom: 10px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 7s ease-in-out infinite reverse;
}

.main-nav {
    background-color: #4fc3f7;
    border-radius: 0 0 30px 30px;
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.main-nav a {
    color: #fff;
    font-size: 1.1rem;
    transition: transform 0.2s;
    display: inline-block;
}

.main-nav a:hover {
    color: #e1f5fe;
    text-decoration: none;
    transform: scale(1.1) rotate(-2deg);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.intro-box {
    background-color: #fff;
    border-radius: 30px;
    padding: 2rem;
    text-align: center;
    border: 3px solid #b3e5fc;
    margin-bottom: 4rem;
    position: relative;
    animation: popIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.intro-box::before {
    content: '★';
    position: absolute;
    top: -25px;
    left: 20px;
    font-size: 3rem;
    color: #ffca28;
    animation: spin 10s linear infinite;
}

.intro-box::after {
    content: '★';
    position: absolute;
    bottom: -25px;
    right: 20px;
    font-size: 3rem;
    color: #ffca28;
    animation: spin 8s linear infinite reverse;
}

.book-list {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* Book Items */
.book-item {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50% 20% / 10% 40%;
    padding: 2rem;
    box-shadow: 0 8px 0 #81d4fa;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: float 6s ease-in-out infinite;
}

.book-item:nth-child(even) {
    flex-direction: row-reverse;
    border-radius: 20% 50% / 40% 10%;
    background-color: #fffde7;
    box-shadow: 0 8px 0 #fff59d;
    animation-delay: 1s;
    /* Offset animation */
}

.book-item:nth-child(3) {
    animation-delay: 2s;
}

.book-item:hover {
    transform: scale(1.05) rotate(2deg) !important;
    /* Override animation transform on hover */
    box-shadow: 0 12px 0 #4fc3f7;
    z-index: 10;
}

.book-item img {
    border-radius: 15px;
    border: 5px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 200px;
    flex-shrink: 0;
    transform: rotate(-3deg);
    transition: transform 0.3s;
}

.book-item:hover img {
    transform: rotate(0deg) scale(1.1);
}

.book-item:nth-child(even) img {
    transform: rotate(3deg);
}

.book-item:nth-child(even):hover img {
    transform: rotate(0deg) scale(1.1);
}

.book-details {
    padding: 0 2rem;
    text-align: center;
}

.book-details h3 {
    font-size: 2rem;
    color: #ff80ab;
    margin-bottom: 1rem;
}

.book-details p {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 1.5rem;
}

.cta-button {
    background-color: #ff4081;
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    display: inline-block;
    font-weight: bold;
    box-shadow: 0 4px 0 #c2185b;
    transition: all 0.2s;
    animation: float 3s ease-in-out infinite;
    /* Double float effect! */
}

.cta-button:hover {
    background-color: #f50057;
    box-shadow: 0 2px 0 #c2185b;
    transform: translateY(4px) scale(0.95);
    animation: none;
}

/* Responsiveness */
@media (max-width: 768px) {
    header {
        padding: 1.5rem 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    header::before,
    header::after {
        opacity: 0.5;
        /* Tone down decorations */
        transform: scale(0.7);
    }

    .container {
        padding: 1rem;
    }

    .book-item {
        flex-direction: column !important;
        /* Force column */
        text-align: center;
        padding: 2rem 1rem;
        border-radius: 20px !important;
        /* Simplify shape */
    }

    .book-item img {
        margin: 0 auto 1.5rem auto;
        transform: rotate(0deg) !important;
    }

    .book-details {
        padding: 0;
    }

    .book-details h3 {
        font-size: 1.5rem;
    }

    .intro-box::before,
    .intro-box::after {
        font-size: 2rem;
    }
}