/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Georgia, serif;
    line-height: 1.6;
    color: #1b1915;
    background-color: #f9f2e4;
}

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

/* Header and Navigation */
header {
    background-color: #1b1915;
    color: #f9f2e4;
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgb(0,0,0,0.1);
}

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

.logo h1 {
    font-size: 1.8rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    color: #f9f2e4;
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* Main content */
main {
    margin-top: 80px;
}

/* Breadcrumb Navigation - Left-aligned under logo */
.breadcrumb-nav {
    padding: 0.3rem 0 0 0;
    margin-top: 0.2rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1.2;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: "→";
    margin: 0 0.3rem;
    color: #f8c235;
    opacity: 0.8;
    font-weight: normal;
}

.breadcrumb-item a {
    color: #f8c235;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 400;
    white-space: nowrap;
}

.breadcrumb-item a:hover {
    color: #f9f2e4;
    text-decoration: underline;
}

.breadcrumb-item.active span {
    color: #f9f2e4;
    font-weight: 500;
    opacity: 0.9;
    white-space: nowrap;
}

.breadcrumb-item span {
    color: inherit;
}

/* Hero section */
.hero {
    background-color: #f9f2e4;
    background-image: 
        radial-gradient(circle at 85% 15%, rgb(207, 62, 37, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 15% 85%, rgb(248, 194, 53, 0.12) 0%, transparent 50%),
        linear-gradient(135deg, rgb(207, 62, 37, 0.05) 0%, transparent 100%);
    color: #1b1915;
    text-align: center;
    padding: 60px 0;
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid #cf3e25;
}


.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: bold;
    color: #cf3e25;
    text-shadow: 2px 2px 4px rgb(0,0,0,0.1);
    position: relative;
    z-index: 10;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.8;
    color: #1b1915;
    position: relative;
    z-index: 10;
}

.cta-button {
    background-color: #cf3e25;
    color: #f9f2e4;
    border: 2px solid #cf3e25;
    padding: 12px 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 8px rgb(207, 62, 37, 0.3);
}

.cta-button:hover {
    background-color: #1b1915;
    color: #f9f2e4;
    border-color: #1b1915;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgb(207, 62, 37, 0.4);
}

/* Sections */
section {
    padding: 60px 0;
}

section:nth-child(even) {
    background-color: #f9f1e4;
}

section h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: #1b1915;
}

section p {
    font-size: 1.1rem;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

/* Category showcase */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.category-card {
    background: #f9f2e4;
    border: 2px solid #1f8179;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgb(0,0,0,0.1);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgb(0,0,0,0.2);
    border-color: #f8c235;
}

.category-card h3 {
    color: #1b1915;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.category-card p {
    color: #1b1915;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.category-link {
    display: inline-block;
    background: #cf3e25;
    color: #f9f2e4;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.category-link:hover {
    background: #1f8179;
}

/* Books section */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.book-card {
    background: #f9f2e4;
    border: 1px solid #1f8179;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: left;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgb(0,0,0,0.1);
}

.book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgb(0,0,0,0.15);
}

.book-card h3 {
    color: #1b1915;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.book-author {
    color: #1f8179;
    font-style: italic;
    margin-bottom: 1rem;
}

.book-description {
    color: #1b1915;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.book-link {
    display: inline-block;
    background: #f8c235;
    color: #1b1915;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.book-link:hover {
    background: #cf3e25;
    color: #f9f2e4;
}

.tagline {
    font-size: 1.3rem;
    font-style: italic;
    color: #cf3e25;
    text-align: center;
    margin-bottom: 2rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgb(0,0,0,0.1);
}

/* Dynamic Featured Books Section */
.dynamic-featured-section {
    background-color: #f9f1e4;
    padding: 50px 0;
}

.dynamic-featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.dynamic-featured-card {
    background: #f9f2e4;
    border: 1px solid #1f8179;
    border-radius: 12px;
    padding: 1.2rem;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgb(0,0,0,0.1);
}

.dynamic-featured-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgb(0,0,0,0.15);
}

.dynamic-book-preview {
    margin-bottom: 1rem;
    text-align: center;
}

.dynamic-book-preview img {
    width: 100%;
    max-width: 120px; /* 25% of original size (original was ~300px) */
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgb(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.dynamic-book-preview img:hover {
    transform: scale(1.05);
}

.dynamic-featured-card h3 {
    color: #1b1915;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    min-height: 2.6rem; /* Ensure consistent height for titles */
}

.dynamic-featured-card .book-author {
    color: #1f8179;
    font-style: italic;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.dynamic-featured-card .book-description {
    color: #1b1915;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    line-height: 1.4;
    min-height: 2.8rem; /* Ensure consistent height for descriptions */
}

.dynamic-featured-card .book-link {
    display: inline-block;
    background: #f8c235;
    color: #1b1915;
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.dynamic-featured-card .book-link:hover {
    background: #cf3e25;
    color: #f9f2e4;
}

/* Showcase link styles for clickable bestsellers */
.showcase-link {
    color: inherit;
    text-decoration: none;
    display: block;
    transition: opacity 0.3s ease;
}

.showcase-link:hover {
    opacity: 0.9;
}

/* Header Dad Joke Widget */
.header-widget.dad-joke-widget {
    position: static;
    background: rgb(249, 242, 228, 0.9);
    border: 1px solid #f8c235;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    max-width: 180px;
    min-height: auto;
    box-shadow: 0 1px 3px rgb(0,0,0,0.1);
    color: #1b1915;
    flex-shrink: 0;
}

.header-widget.dad-joke-widget h3 {
    color: #cf3e25;
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
    text-align: center;
    font-weight: bold;
}

.header-widget .dad-joke-text {
    font-size: 0.85rem;
    line-height: 1.2;
    text-align: center;
    margin-bottom: 0;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Dad Joke Widget - Legacy positioning for other pages */
.hero .dad-joke-widget,
.dad-joke-widget {
    position: absolute;
    top: 100px;
    right: 5%;
    transform: none;
    background: rgb(249, 242, 228, 0.95);
    border: 2px solid #f8c235;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 300px;
    min-height: 120px;
    box-shadow: 0 4px 12px rgb(0,0,0,0.2);
    z-index: 2;
    color: #1b1915;
}

.dad-joke-widget h3 {
    color: #cf3e25;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    text-align: center;
    font-weight: bold;
}

.dad-joke-text {
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
    margin-bottom: 0.5rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dad-joke-loading {
    color: #1f8179;
    font-style: italic;
}

.dad-joke-refresh {
    background: #cf3e25;
    color: #f9f2e4;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: block;
    margin: 0 auto;
}

.dad-joke-refresh:hover {
    background: #1f8179;
}

/* Footer */
footer {
    background-color: #1b1915;
    color: #f9f2e4;
    text-align: center;
    padding: 2rem 0;
}

/* Responsive design */
@media (max-width: 768px) {
    /* Adjust main content margin for taller mobile header */
    main {
        margin-top: 140px;
    }
    
    header {
        padding: 0.8rem 0;
    }
    
    nav {
        flex-direction: column;
        gap: 0.8rem;
        padding: 0 15px;
    }
    
    .nav-links {
        flex-direction: row;
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
        order: 1;
    }
    
    .logo {
        order: -1;
        justify-content: center;
    }
    
    .header-widget.dad-joke-widget {
        order: 0;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    section h2 {
        font-size: 2rem;
    }
    
    .hero {
        padding: 60px 0;
    }
    
    .hero::before {
        width: 120px;
        height: 120px;
        left: 3%;
        opacity: 0.2;
    }
    
    .hero::after {
        width: 60px;
        height: 60px;
        right: 3%;
        opacity: 0.1;
    }
    
    .dad-joke-widget {
        position: static;
        transform: none;
        margin: 0 auto 2rem auto;
        max-width: 280px;
    }
    
    /* Mobile responsive for dynamic featured books */
    .dynamic-featured-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .dynamic-featured-card {
        padding: 1rem;
    }
    
    .dynamic-book-preview img {
        max-width: 100px;
    }
    
    .dynamic-featured-card h3 {
        font-size: 1rem;
        min-height: auto;
    }
    
    .dynamic-featured-card .book-description {
        font-size: 0.8rem;
        min-height: auto;
    }
    
    section {
        padding: 40px 0;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    main {
        margin-top: 160px;
    }
    
    .hero {
        padding: 40px 0;
    }
    
    .hero-content h2 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }
    
    .tagline {
        font-size: 1.1rem;
    }
    
    .hero::before,
    .hero::after {
        display: none;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .nav-links {
        gap: 0.5rem;
        font-size: 0.9rem;
    }
    
    .nav-links a {
        padding: 0.2rem 0.4rem;
    }
}
