/* 
   Graham & Doddsville - Modernized Books Design System
   Inspired by Premium Financial Newspapers and Library Aesthetics
*/

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-blue: #1e3a8a;
    --primary-blue-light: #3b82f6;
    --primary-blue-dark: #1e40af;
    --secondary-gold: #d4af37;
    --brand-purple: #6B46C1;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-light: #e5e7eb;
    --bg-light: #fdfdfd;
    --bg-section: rgba(250, 251, 252, 0.65);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Global Transitions */
* {
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.books-page {
    background: var(--bg-light);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
}

.books-page-content {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px;
    padding-top: 24px; /* header is in the page flow (css/site-header.css) */
}

/* Header & Navigation - Aligned with Main Site Blue Theme */
.header {
    background: #1e3a8a; /* Primary Blue from main site */
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 2px solid var(--secondary-gold);
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.logo-image {
    height: 44px; /* Increased for visibility */
    width: auto;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-link {
    color: #ffffff; /* White text for blue background */
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--secondary-gold);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.nav-link:hover {
    color: var(--secondary-gold);
}

.nav-link:hover:after {
    transform: scaleX(1);
}

/* Mobile Toggle */
.mobile-menu-toggle {
    background: #f8f9fa; /* Light background for the button */
    border: none;
    cursor: pointer;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-radius: 6px; /* Rounded square like screenshot */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: #333333; /* BLACK lines as requested */
    border-radius: 2px;
}

/* Mobile Drawer - Aligned with Reference Screenshot */
.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 340px;
    height: 100vh;
    background: #ffffff;
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
}

.mobile-drawer.open {
    right: 0;
}

.drawer-header {
    background: #1e3a8a; /* Deep Blue header */
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.drawer-logo {
    height: 38px;
    width: auto;
}

.drawer-close {
    background: none;
    border: none;
    color: white;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.drawer-nav {
    padding: 15px 0;
}

.drawer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.drawer-link {
    display: block;
    color: #333333;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 18px;
    transition: all 0.2s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.01em;
}

.drawer-link:hover {
    background: #f8f9fa;
    color: var(--primary-blue);
    padding-left: 30px;
}

/* Page Title Section - Standardized with Main Site */
.page-title-section {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: var(--radius-lg);
    padding: 0; /* Let inner elements handle padding */
    margin-bottom: 32px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.breadcrumb {
    padding: 16px 32px 0 32px;
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.page-title {
    font-family: var(--font-secondary, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 1.25rem; /* Match reference */
    font-weight: 600;
    color: #1e3a8a !important; /* Match reference blue */
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #e0e0e0;
    padding: 6px 0 6px 32px; /* Adjusted padding */
    background: rgba(250, 251, 252, 0.8);
    height: 38px;
    display: flex;
    align-items: center;
    margin: 16px 0 0 0;
    letter-spacing: -0.02em;
}

.page-subtitle {
    padding: 16px 32px 24px 32px;
    font-size: 1.1rem;
    color: #4b5563; /* Darker gray for better readability */
    line-height: 1.5;
    margin: 0;
}

/* Sort Controls */
.book-sort-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 0 8px;
}

.book-sort-controls label {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.book-sort {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: white;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    box-shadow: var(--shadow-sm);
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
    gap: 32px;
    margin-bottom: 60px;
}

/* Book Card - Premium Look */
.book-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
    border-bottom: 3px solid var(--secondary-gold);
}

.book-cover-link {
    display: block;
    position: relative;
    padding-top: 145%;
    background: #f1f5f9;
    overflow: hidden;
    border-bottom: 1px solid var(--border-light);
}

.book-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    box-sizing: border-box;
}

.book-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.3;
    height: 3em; /* Fixed height for title to align cards */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 500;
}

.book-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.book-price {
    font-weight: 700;
    color: #059669;
    font-size: 1.25rem;
}

.btn-buy {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(30, 58, 138, 0.2);
}

.btn-buy:hover {
    box-shadow: 0 6px 15px rgba(30, 58, 138, 0.3);
    transform: scale(1.05);
}

/* Notes & Disclaimer */
.books-footer-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 60px;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--secondary-gold);
}

.books-footer-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
}

.books-footer-content strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .books-page-content {
        padding: 16px;
        padding-top: 16px;
    }
    
    .page-title {
        padding-left: 20px;
        font-size: 16px;
    }
    
    .breadcrumb, .page-subtitle {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .books-grid {
        gap: 12px;
        grid-template-columns: repeat(2, 1fr); /* Two columns on mobile */
        margin-bottom: 40px;
    }
    
    .book-title {
        font-size: 0.9rem;
        height: 2.6em;
    }

    .book-info {
        padding: 12px;
    }

    .book-price {
        font-size: 1rem;
    }

    .btn-buy {
        padding: 8px 12px;
        font-size: 0.7rem;
    }
}


/* ==========================================================================
   Detailed Book Card (For Warren Buffett Books & specific layouts)
   ========================================================================== */
.book-card-detailed {
    background: #ffffff;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-sm, 0 2px 8px rgba(0,0,0,0.06));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
    height: 100%;
}

.book-card-detailed:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--secondary-gold, #d4af37);
}

.book-card-top {
    display: flex;
    flex-direction: row;
    padding: 24px;
    gap: 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    order: 2;
}

.book-card-detailed .book-cover-link {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.book-card-detailed .book-cover {
    width: 100%;
    max-width: 140px;
    height: auto;
    object-fit: contain;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    border-radius: 2px;
}

.book-card-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 10px;
    width: 120px;
    flex-shrink: 0;
}

.book-card-detailed .book-price {
    font-family: 'Inter', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: #059669;
    background: #ecfdf5;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
    margin-bottom: 4px;
    border: 1px solid #a7f3d0;
}

.book-card-detailed .btn-buy,
.book-card-detailed .btn-summary {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.book-card-detailed .btn-buy {
    color: white;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    box-shadow: 0 4px 10px rgba(30, 58, 138, 0.2);
}

.book-card-detailed .btn-summary {
    color: var(--primary-blue);
    background: white;
    border: 1px solid var(--primary-blue);
}

.book-card-detailed .btn-buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(30, 58, 138, 0.3);
}

.book-card-detailed .btn-summary:hover {
    background: #f8fafc;
    color: var(--primary-blue-dark);
}

.book-card-summary {
    padding: 20px 24px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #475569;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    flex-grow: 1;
    order: 3;
    background: white;
}

.book-card-summary p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card-bottom {
    padding: 20px 24px;
    background: #ffffff;
    order: 1;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    position: relative;
}

.book-card-bottom::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--secondary-gold);
}

.book-card-detailed .book-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.book-card-detailed .book-author {
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Detailed grid overrides */
.detailed-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(350px, 100%), 1fr)) !important;
}
@media (max-width: 768px) {
    .detailed-grid {
        grid-template-columns: 1fr !important;
    }
}

/* User request: Font type and size for recommended books match news articles */
.recommended-book-link, .comma-text, .book-title {
    font-family: Georgia, serif !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #111 !important;
}
