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

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: #1d1d1f;
    background: #ffffff;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    overscroll-behavior-y: none;
}

.books-scroll-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.books-scroll-wrapper .book-card {
    pointer-events: auto;
}

.books-grid-scrolling {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(200px);
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    animation: scrollBooks 624s linear infinite;
    will-change: transform;
}

.books-grid-scrolling.paused {
    animation-play-state: paused !important;
    -webkit-animation-play-state: paused !important;
}

.books-grid-scrolling .book-card {
    pointer-events: auto;
    cursor: pointer;
}

@keyframes scrollBooks {
    0% {
        transform: translateX(-50%) translateY(200px);
    }

    100% {
        transform: translateX(-50%) translateY(calc(-50% - 200vh + 200px));
    }
}


.header {
    background: #ffffff;
    border-bottom: 1px solid #d2d2d7;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1d1d1f;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links li {
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: #1d1d1f;
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    line-height: 1.5rem;
}

.nav-links a:hover {
    color: #007aff;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #ffffff;
    color: #1d1d1f;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.search-input::placeholder {
    color: #86868b;
}

.search-clear {
    background: none;
    border: none;
    color: #86868b;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.search-clear:hover {
    color: #1d1d1f;
}

.search-clear.visible {
    display: flex;
}

footer {
    border-top: 1px solid #d2d2d7;
    margin-top: auto;
    padding: 2rem 0;
    text-align: center;
    color: #86868b;
    font-size: 0.875rem;
    position: relative;
    z-index: 100;
    background: #ffffff;
    width: 100%;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

footer p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

footer a {
    color: #007aff;
    text-decoration: none;
    margin: 0 0.5rem;
}

footer a:hover {
    text-decoration: underline;
}

.top-section {
    background: #ffffff;
    position: relative;
    z-index: 100;
    width: 100%;
}

.top-section::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: 0;
    width: 100%;
    height: 50px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 30%, rgba(255, 255, 255, 0.5) 60%, rgba(255, 255, 255, 0.8) 85%, rgba(255, 255, 255, 1) 100%);
    pointer-events: none;
    z-index: 101;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    position: relative;
    z-index: 10;
}

.top-section .container {
    background: transparent;
}

.books-content-spacer {
    min-height: 150vh;
    width: 100%;
    position: relative;
    z-index: 10;
    pointer-events: none;
}

.books-content-spacer>* {
    pointer-events: auto;
}

.books-grid {
    position: relative;
    z-index: 10;
}

.books-grid-static {
    display: none;
    visibility: hidden;
    position: relative;
    z-index: 15;
    margin-top: 2rem;
    pointer-events: auto;
}

.books-grid-static.show-results {
    display: grid !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 15 !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    min-height: auto !important;
    margin-top: 0 !important;
}

.page-header {
    text-align: center;
    margin-bottom: 1rem;
    padding: 0;
}

.page-title {
    font-size: 3.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1d1d1f;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1d1d1f;
    max-width: 600px;
    margin: 0 auto;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.book-card {
    background: #ffffff;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.book-cover {
    width: 100%;
    height: 280px;
    object-fit: cover;
    background: #f5f5f7;
}

.book-content {
    padding: 1rem;
}

.book-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #1d1d1f;
}

.book-author {
    font-size: 0.875rem;
    color: #86868b;
    margin-bottom: 0.75rem;
}

.book-description {
    font-size: 0.9375rem;
    color: #1d1d1f;
    margin-bottom: 1rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-price {
    font-size: 1.25rem;
    font-weight: 600;
    color: #007aff;
    margin-top: auto;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #86868b;
}

.empty-state h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #1d1d1f;
}

@media (max-width: 768px) {
    .page-title {
        font-size: 2.5rem;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }
}
