/**
 * AuthorKit Bookshelf - Monochrome Design System
 * Minimalist black & white design matching authorkit-site aesthetic
 */

/* ============================================================================
   Global Monochrome Enforcement
   ========================================================================= */
* {
    border-radius: 0 !important;
    box-shadow: none !important;
    transition: none !important;
}

/* Remove any browser default highlighting/marks */
mark {
    background: transparent;
    color: inherit;
}

body {
    font-family: var(--font-body);
    color: var(--color-black);
    background: var(--color-white);
    line-height: 1.7;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headline);
    font-weight: 700;
    color: var(--color-black);
}

/* Ensure CTA section text has no background */
.cta-section h2,
.cta-section p {
    background: transparent;
}

/* ============================================================================
   Container
   ========================================================================= */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

@media (min-width: 640px) {
    .container {
        padding: 0 24px;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 32px;
    }
}

/* Wider container for book grids on large screens */
@media (min-width: 1600px) {
    .featured-books .container,
    .browse-content .container,
    .genre-links .container {
        max-width: 1600px;
    }
}

@media (min-width: 1920px) {
    .featured-books .container,
    .browse-content .container,
    .genre-links .container {
        max-width: 1800px;
    }
}

/* ============================================================================
   Header / Navigation
   ========================================================================= */
.site-header {
    background: var(--color-white);
    border-bottom: 1px solid var(--color-black);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

@media (min-width: 1024px) {
    .header-content {
        padding: 0 2rem;
    }
}

.logo img {
    height: 40px;
    width: auto;
    aspect-ratio: 346 / 70;
}

/* Mobile logo sizing */
@media (max-width: 768px) {
    .logo img {
        height: 32px;
    }
}

@media (max-width: 480px) {
    .logo img {
        height: 28px;
    }
}

.main-nav {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

/* Nav links - exclude buttons */
.main-nav a:not(.btn-primary) {
    color: var(--color-black);
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    font-family: var(--font-ui);
}

.main-nav a:not(.btn-primary):hover {
    text-decoration: underline;
}

/* Primary button - isolated from nav link styles */
.btn-primary {
    background: var(--color-black);
    color: var(--color-white);
    border: 2px solid var(--color-black);
    padding: 12px 24px;
    font-weight: 600;
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1;
    min-height: 44px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    background: var(--color-white);
    color: var(--color-black);
    text-decoration: none;
}

/* Mobile Menu Button - hidden on desktop, shown on mobile */
.mobile-menu-button {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 0;
    box-shadow: none;
    transition: none;
}

@media (max-width: 768px) {
    .mobile-menu-button {
        display: block;
    }
}

/* Mobile Menu Icon - black stroke */
.mobile-menu-icon {
    width: 24px;
    height: 24px;
    stroke: var(--color-black);
    stroke-width: 2;
}

/* Mobile Menu Container - dropdown from header */
.mobile-menu {
    position: absolute;
    top: 100%;
    right: 16px;
    background: var(--color-white);
    border: 1px solid var(--color-black);
    width: 200px;
    border-radius: 0;
    box-shadow: none;
    transition: none;
    z-index: 100;
}

.mobile-menu.hidden {
    display: none;
}

/* Mobile Navigation Links - full width with subtle borders */
.mobile-nav-link {
    display: block;
    padding: 16px 24px;
    color: var(--color-black);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 500;
    border-radius: 0;
    box-shadow: none;
    transition: none;
}

.mobile-nav-link:last-child {
    border-bottom: none;
}

.mobile-nav-link:hover {
    background: var(--color-cream);
}

/* ============================================================================
   Hero Section
   ========================================================================= */
.bookshelf-hero {
    background: var(--color-cream);
    padding: 60px 0;
}

.hero-content {
    text-align: center;
}

.bookshelf-hero h1 {
    font-family: var(--font-headline);
    font-size: var(--text-h1);
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--color-black);
    line-height: var(--leading-tight);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: var(--text-body);
    margin-bottom: 30px;
    color: var(--color-black);
    line-height: var(--leading-relaxed);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin: 30px 0;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-family: var(--font-headline);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-black);
    line-height: 1;
    display: block;
    margin-bottom: 5px;
}

.stat-label {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-black);
    font-weight: 400;
}

.btn-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-white);
    color: var(--color-black);
    border: 2px solid var(--color-white);
    padding: 12px 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    font-family: var(--font-ui);
    min-height: 44px;
    cursor: pointer;
}

.btn-cta:hover {
    background: var(--color-black);
    color: var(--color-white);
    border-color: var(--color-white);
}

/* ============================================================================
   Section Headers
   ========================================================================= */
.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-family: var(--font-headline);
    font-size: var(--text-h2);
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 10px;
}

.section-header p {
    font-family: var(--font-body);
    font-size: var(--text-body);
    color: var(--color-black);
    max-width: 600px;
    margin: 0 auto;
}

/* Books Header with Sort */
.books-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
}

.books-header-left h2 {
    font-family: var(--font-headline);
    font-size: var(--text-h2);
    font-weight: 700;
    color: var(--color-black);
    margin: 0 0 5px 0;
}

.books-count {
    font-family: var(--font-body);
    font-size: var(--text-small);
    color: var(--color-black);
    margin: 0;
}

.books-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-label {
    font-family: var(--font-ui);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-black);
}

.index-sort-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--color-black);
    font-size: 0.875rem;
    background: var(--color-white);
    cursor: pointer;
    color: var(--color-black);
    font-weight: 500;
    font-family: var(--font-ui);
}

.index-sort-select:focus {
    outline: none;
    border-width: 2px;
    margin: -1px;
}

/* ============================================================================
   Featured Books Section
   ========================================================================= */
.featured-books {
    padding: 60px 0;
    background: var(--color-white);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.section-footer {
    text-align: center;
    margin-top: 40px;
}

.btn-secondary {
    display: inline-block;
    background: var(--color-white);
    color: var(--color-black);
    padding: 12px 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    border: 2px solid var(--color-black);
    font-family: var(--font-ui);
    min-height: 44px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--color-black);
    color: var(--color-white);
}

/* ============================================================================
   Book Card - Monochrome Style
   ========================================================================= */
.book-card {
    background: var(--color-white);
    border: 1px solid var(--color-black);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.book-card:hover {
    border-width: 2px;
    margin: -1px;
}

.book-cover-wrapper {
    position: relative;
    width: 100%;
    padding-top: 145%;
    background: #f9f9f9;
    overflow: hidden;
}

.book-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* View count badge overlay */
.view-count-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--color-black);
    color: var(--color-white);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
    font-family: var(--font-ui);
}

.view-count-badge svg {
    opacity: 0.9;
    flex-shrink: 0;
}

.view-count-badge span {
    line-height: 1;
}

.book-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.book-title {
    font-family: var(--font-headline);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-black);
    line-height: 1.3;
    margin: 0;
    min-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-black);
    margin: 0;
    font-weight: 400;
}

.book-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 2px 0;
}

.genre-badge {
    background: var(--color-white);
    color: var(--color-black);
    border: 1px solid var(--color-black);
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--font-ui);
}

.book-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    margin: 2px 0;
    font-family: var(--font-ui);
}

.stars {
    color: var(--color-black);
    font-size: 12px;
    letter-spacing: 0.5px;
}

.book-rating .rating-value {
    font-weight: 600;
    color: var(--color-black);
}

.book-rating .review-count {
    color: var(--color-black);
}

.book-description {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--color-black);
    line-height: 1.5;
    display: none;
}

.book-actions {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: center;
}

.btn-buy {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border: 2px solid var(--color-black);
    background: var(--color-black);
    color: var(--color-white);
    font-family: var(--font-ui);
    min-height: 40px;
}

.btn-buy:hover {
    background: var(--color-white);
    color: var(--color-black);
}

.btn-view-site {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    padding: 0;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--color-black);
    background: var(--color-white);
    color: var(--color-black);
}

.btn-view-site:hover {
    background: var(--color-black);
    color: var(--color-white);
}

.btn-view-site svg {
    width: 16px;
    height: 16px;
}

/* ============================================================================
   Genre Links Section
   ========================================================================= */
.genre-links {
    padding: 60px 0;
    background: var(--color-white);
}

.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.genre-card {
    background: var(--color-cream);
    border: 1px solid var(--color-black);
    padding: 24px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--color-black);
}

.genre-card:hover {
    border-width: 2px;
    margin: -1px;
}

.genre-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}

.genre-name {
    font-family: var(--font-headline);
    font-size: 15px;
    font-weight: 600;
}

/* ============================================================================
   CTA Section
   ========================================================================= */
.cta-section {
    background: var(--color-black);
    color: var(--color-white);
    padding: 60px 0;
    text-align: center;
}

.cta-content {
    position: relative;
}

.cta-section h2 {
    font-family: var(--font-headline);
    font-size: var(--text-h2);
    margin-bottom: 15px;
    font-weight: 700;
    color: var(--color-white);
}

.cta-section p {
    font-family: var(--font-body);
    font-size: var(--text-body);
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    color: var(--color-white);
}

/* ============================================================================
   Browse Page
   ========================================================================= */
.browse-header {
    background: var(--color-cream);
    padding: 50px 0;
    text-align: center;
}

.browse-header h1 {
    font-family: var(--font-headline);
    font-size: var(--text-h1);
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--color-black);
}

.browse-header p {
    font-family: var(--font-body);
    font-size: var(--text-body);
    color: var(--color-black);
}

.browse-content {
    padding: 40px 0;
    background: var(--color-white);
    min-height: 600px;
}

.browse-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: start;
}

.browse-layout.sidebar-collapsed {
    grid-template-columns: 60px 1fr;
}

/* ============================================================================
   Sidebar - Filters
   ========================================================================= */
.browse-sidebar {
    background: var(--color-white);
    padding: 20px;
    border: 1px solid var(--color-black);
    position: sticky;
    top: 80px;
}

.browse-sidebar.collapsed {
    padding: 10px;
}

.sidebar-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: var(--color-white);
    border: 2px solid var(--color-black);
    cursor: pointer;
    color: var(--color-black);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 15px;
    font-family: var(--font-ui);
}

.sidebar-toggle:hover {
    background: var(--color-black);
    color: var(--color-white);
}

.sidebar-toggle svg {
}

.browse-sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(90deg);
}

.sidebar-toggle-text {
    display: none;
}

.sidebar-content {
    max-height: 2000px;
    overflow: hidden;
    opacity: 1;
}

.browse-sidebar.collapsed .sidebar-content {
    max-height: 0;
    opacity: 0;
}

.browse-sidebar.collapsed .sidebar-toggle {
    margin-bottom: 0;
}

.filter-section {
    margin-bottom: 25px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h3 {
    font-family: var(--font-ui);
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--color-black);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-black);
    font-size: 15px;
    font-family: var(--font-ui);
    background: var(--color-white);
}

.search-input:focus {
    outline: none;
    border-width: 2px;
    margin: -1px;
}

.search-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.genre-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.genre-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 8px;
}

.genre-checkbox:hover {
    background: rgba(0, 0, 0, 0.05);
}

.genre-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-black);
}

.genre-checkbox label {
    cursor: pointer;
    font-size: 14px;
    color: var(--color-black);
    font-weight: 500;
    font-family: var(--font-ui);
}

.sort-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-black);
    font-size: 15px;
    background: var(--color-white);
    cursor: pointer;
    font-family: var(--font-ui);
}

.sort-select:focus {
    outline: none;
    border-width: 2px;
    margin: -1px;
}

.btn-reset {
    width: 100%;
    padding: 10px 14px;
    background: var(--color-white);
    border: 2px solid var(--color-black);
    font-weight: 600;
    cursor: pointer;
    color: var(--color-black);
    font-size: 14px;
    font-family: var(--font-ui);
}

.btn-reset:hover {
    background: var(--color-black);
    color: var(--color-white);
}

/* ============================================================================
   Browse Main Content
   ========================================================================= */
.browse-main {
    min-height: 600px;
}

.browse-controls {
    margin-bottom: 25px;
    padding: 0;
    background: transparent;
    border: none;
}

.results-count {
    font-family: var(--font-ui);
    font-size: 15px;
    color: var(--color-black);
}

.results-count strong {
    color: var(--color-black);
    font-weight: 700;
}

/* ============================================================================
   Pagination
   ========================================================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    background: var(--color-white);
    border: 1px solid var(--color-black);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-black);
    font-family: var(--font-ui);
}

.page-btn:hover:not(:disabled):not(.active) {
    background: rgba(0, 0, 0, 0.05);
}

.page-btn.active {
    background: var(--color-black);
    color: var(--color-white);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================================
   Utility States
   ========================================================================= */
.loading,
.error,
.no-books {
    text-align: center;
    padding: 60px 20px;
    background: var(--color-white);
    border: 1px solid var(--color-black);
}

.loading,
.no-books {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-black);
}

.no-books h2 {
    margin: 0 0 15px 0;
    font-family: var(--font-headline);
    font-size: 28px;
    color: var(--color-black);
}

.no-books p {
    margin: 0 0 25px 0;
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-black);
}

.error {
    color: var(--color-black);
    border-color: var(--color-black);
}

.no-books-icon {
    font-size: 4rem;
    opacity: 0.3;
}

/* ============================================================================
   Footer
   ========================================================================= */
.site-footer {
    background: var(--color-white);
    color: var(--color-black);
    padding: 64px 0 32px;
    border-top: 1px solid var(--color-black);
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 48px;
    margin-bottom: 48px;
}

.footer-section h3 {
    font-family: var(--font-headline);
    font-size: 20px;
    margin-bottom: 16px;
    font-weight: 700;
}

.footer-section p {
    font-family: var(--font-body);
    color: var(--color-black);
    line-height: 1.6;
    font-size: 16px;
    margin-bottom: 8px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    font-family: var(--font-ui);
    color: var(--color-black);
    text-decoration: none;
    font-size: 16px;
    display: block;
    padding: 4px 0;
}

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

.footer-bottom {
    max-width: 1280px;
    margin: 48px auto 0;
    padding: 32px 32px 0 32px;
    border-top: 1px solid rgba(0,0,0,0.1);
    text-align: center;
    color: var(--color-black);
    font-size: 16px;
    font-family: var(--font-ui);
}

/* ============================================================================
   Responsive Design
   ========================================================================= */
@media (max-width: 1024px) {
    .browse-layout {
        grid-template-columns: 250px 1fr;
        gap: 25px;
    }

    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 769px) {
    .mobile-menu-button {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .hero-stats {
        gap: 30px;
    }

    .stat-number {
        font-size: var(--text-h1);
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
        gap: 12px;
    }

    .books-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .books-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .index-sort-select {
        flex: 1;
    }

    .browse-layout {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .browse-layout.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    .browse-sidebar {
        position: static;
        top: auto;
    }

    .browse-sidebar.collapsed {
        padding: 10px;
    }

    .genre-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .main-nav {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }

    .book-actions {
        flex-direction: row;
    }
}
