:root {
    /* Color Palette - Premium Dark Mode */
    --primary: #e11d48;
    --primary-light: #f43f5e;
    --primary-dark: #be123c;
    --accent: #fbbf24;
    /* Gold for premium accents */

    --background: #020617;
    /* Deepest blue/black */
    --surface: #0f172a;
    --surface-highlight: #1e293b;
    --surface-glass: rgba(15, 23, 42, 0.7);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    --border: #1e293b;
    --border-light: #334155;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Merriweather', serif;
    /* Editorial feel */

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 64px;
    --spacing-3xl: 96px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-glow: 0 0 40px rgba(225, 29, 72, 0.15);
}

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

/* Accessibility: Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Custom scrollbar for the whole site */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Firefox scrollbar */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-serif);
    color: var(--text-primary);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 4rem;
}

h2 {
    font-size: 2.5rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    width: 100%;
}

/* Genre Badges */
.genre-badge {
    display: inline-block;
    padding: 0.35rem 1rem;
    background: rgba(225, 29, 72, 0.1);
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid rgba(225, 29, 72, 0.2);
}

.genre-badge:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2);
}


/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
}

.breadcrumbs a {
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs .separator {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.breadcrumbs .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: var(--spacing-md) 0;
    transition: all 0.3s ease;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-xl);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-family: var(--font-serif);
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
}

/* Search Bar */
.search-bar {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 48px 12px 24px;
    background: var(--surface-highlight);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.1);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 1rem;
    gap: 8px;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: var(--primary-light);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(225, 29, 72, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--surface-highlight);
    border-color: var(--text-primary);
}

/* Hero Section */
.hero {
    padding: 180px 0 100px;
    position: relative;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: -20%;
    right: -10%;
    width: 60%;
    height: 120%;
    background: radial-gradient(circle, rgba(225, 29, 72, 0.15) 0%, rgba(2, 6, 23, 0) 70%);
    filter: blur(60px);
    z-index: -1;
}

.hero-content {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: var(--spacing-2xl);
    align-items: center;
}

.hero-title {
    font-size: 4.5rem;
    line-height: 1.05;
    margin-bottom: var(--spacing-lg);
}

.text-gradient {
    background: linear-gradient(135deg, #fff 30%, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    max-width: 600px;
    margin-bottom: var(--spacing-xl);
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-2xl);
}

.hero-image {
    position: relative;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-book-stack {
    position: relative;
    width: 300px;
    height: 400px;
    perspective: 1000px;
}

.hero-book-stack .book-cover-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform-origin: center bottom;
}

/* Center Book (Main) */
.hero-book-stack .book-cover-wrapper:nth-child(1) {
    z-index: 10;
    transform: translateX(0) scale(1);
}

/* Left Book */
.hero-book-stack .book-cover-wrapper:nth-child(2) {
    z-index: 5;
    transform: translateX(-60px) translateY(20px) scale(0.9) rotate(-10deg);
    filter: brightness(0.7);
}

/* Right Book */
.hero-book-stack .book-cover-wrapper:nth-child(3) {
    z-index: 1;
    transform: translateX(60px) translateY(40px) scale(0.85) rotate(10deg);
    filter: brightness(0.5);
}

/* Hover Effect - Fan out */
.hero-book-stack:hover .book-cover-wrapper:nth-child(1) {
    transform: translateY(-10px) scale(1.05);
}

.hero-book-stack:hover .book-cover-wrapper:nth-child(2) {
    transform: translateX(-100px) translateY(10px) scale(0.9) rotate(-15deg);
    filter: brightness(0.9);
}

.hero-book-stack:hover .book-cover-wrapper:nth-child(3) {
    transform: translateX(100px) translateY(30px) scale(0.85) rotate(15deg);
    filter: brightness(0.8);
}

.hero-stats {
    display: flex;
    gap: var(--spacing-2xl);
    padding: var(--spacing-lg) var(--spacing-xl);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    width: fit-content;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
    font-family: var(--font-sans);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Filters */
.filters {
    padding: var(--spacing-lg) 0;
    margin-bottom: var(--spacing-xl);
}

.filter-scroll {
    display: flex;
    gap: var(--spacing-sm);
    overflow-x: auto;
    padding-bottom: var(--spacing-sm);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-scroll::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: var(--surface-highlight);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.filter-btn.active {
    background: var(--text-primary);
    color: var(--background);
    border-color: var(--text-primary);
}

/* Book Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-xl);
    padding-bottom: var(--spacing-3xl);
}

.book-card {
    background: transparent;
    border-radius: var(--radius-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-8px);
}

.book-cover-wrapper {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--spacing-md);
    transition: all 0.4s ease;
}

.book-card:hover .book-cover-wrapper {
    box-shadow: var(--shadow-xl);
    transform: scale(1.02);
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.book-card:hover .book-cover {
    transform: scale(1.05);
}

.book-content {
    padding: 0 var(--spacing-xs);
}

.book-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
    font-family: var(--font-serif);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Book Detail Page */
.book-detail-header {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 80px;
    padding-bottom: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.book-detail-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(80px) brightness(0.3);
    z-index: -1;
    transform: scale(1.1);
}

.book-detail-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: var(--spacing-3xl);
    align-items: center;
}

.book-detail-cover {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: var(--radius-lg);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.5);
    transform: rotate(-2deg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.book-detail-info h1 {
    font-size: 4.5rem;
    margin-bottom: var(--spacing-sm);
    line-height: 1.1;
}

.book-detail-author {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    font-family: var(--font-serif);
    font-style: italic;
}

.book-stats-row {
    display: flex;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.book-description {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: 65ch;
    margin-bottom: var(--spacing-xl);
}

/* Footer */
.footer {
    margin-top: auto;
    padding: var(--spacing-3xl) 0 var(--spacing-xl);
    border-top: 1px solid var(--border);
    background: var(--background);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-copyright {
    text-align: center;
    color: var(--text-secondary);  /* Improved contrast: #94a3b8 vs #64748b */
    font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Responsive */
@media (max-width: 1024px) {

    /* Hide search bar in header on mobile */
    .header .search-bar {
        display: none;
    }

    /* Reduce header padding on mobile */
    .header {
        padding: var(--spacing-sm) 0;
    }

    /* Reduce hero padding to decrease gap from navbar */
    .hero {
        padding: 100px 0 60px;
    }

    .hero-content,
    .book-detail-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--spacing-xl);
    }

    .hero-image {
        order: -1;
        display: flex;
        justify-content: center;
    }

    .hero-stats,
    .book-stats-row {
        justify-content: center;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons {
        justify-content: center;
    }

    .book-detail-cover {
        width: 280px;
        margin: 0 auto;
        transform: rotate(0);
    }

    .book-description {
        margin-left: auto;
        margin-right: auto;
    }

    h1,
    .hero-title,
    .book-detail-info h1 {
        font-size: 3rem;
    }

    /* Mobile search bar above filters */
    .mobile-search {
        display: block;
        margin-bottom: var(--spacing-md);
    }

    .mobile-search .search-bar {
        max-width: 100%;
    }

    .mobile-search .search-input {
        width: 100%;
        background: var(--surface);
        border: 1px solid var(--border);
    }

    /* Reduce filter section margin on mobile */
    .filters {
        padding: var(--spacing-sm) 0;
        margin-bottom: var(--spacing-md);
    }
}

/* Hide mobile search on desktop */
@media (min-width: 1025px) {
    .mobile-search {
        display: none;
    }
}