/**
 * Home Page - Book-inspired aesthetic
 * Clean, readable, elegant like a book cover
 */

.home {
    min-height: 80vh;
    background: #ffffff;
}

/* Hero - Like a book title page */
.home__hero {
    text-align: center;
    padding: 5rem 2rem 4rem;
}

.home__title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(2.5rem, 7vw, 4rem);
    font-weight: 400;
    color: #2c2c2c;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.home__subtitle {
    font-family: Georgia, serif;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-style: italic;
    color: #666;
    font-weight: 400;
    letter-spacing: 0.15em;
    margin-bottom: 3.5rem;
}

.home__search {
    max-width: 520px;
    margin: 0 auto;
}

.home__input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-family: Georgia, serif;
    font-size: 1rem;
    border: 1px solid #d0ccc5;
    border-radius: 2px;
    background: #fff;
    outline: none;
    transition: all 0.3s ease;
}

.home__input:focus {
    border-color: #8b7355;
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.1);
}

.home__input::placeholder {
    color: #999;
    font-style: italic;
}

/* Search Results */
.home__results {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    min-width: min(480px, 95vw);
    max-width: 600px;
    background: #fff;
    border: 1px solid #d0ccc5;
    border-radius: 10px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.18);
    max-height: 450px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.home__results-loading,
.home__results-empty,
.home__results-error {
    padding: 1.5rem;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 1rem;
}

.home__result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f0ede8;
    transition: background 0.2s;
}

.home__result:last-child {
    border-bottom: none;
}

.home__result:hover {
    background: #f5f4f2;
}

.home__result-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: #2c2c2c;
    margin-bottom: 0.4rem;
    line-height: 1.45;
}

.home__result-author {
    font-size: 1rem;
    color: #666;
    font-style: italic;
}

.home__result-content {
    flex: 1;
    min-width: 0;
}

.home__result-btn {
    padding: 0.6rem 1.25rem;
    background-color: #8b7355;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.home__result-btn:hover {
    background-color: #6b5645;
}

.home__search {
    position: relative;
}

/* Section headers - Chapter style */
.home__section {
    padding: 3rem 0;
}

.home__section:first-of-type {
    padding-top: 2rem;
}

.home__section:last-of-type {
    padding-bottom: 4rem;
}

.home__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 2rem;
    margin-bottom: 2rem;
}

.home__label {
    font-family: Georgia, serif;
    font-size: 0.85rem;
    font-weight: 400;
    color: #8b7355;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.home__link {
    font-family: Georgia, serif;
    font-size: 0.9rem;
    font-style: italic;
    color: #999;
    transition: color 0.3s;
}

.home__link:hover {
    color: #8b7355;
}

/* Carousel - Book shelf feel */
.carousel {
    position: relative;
}

.carousel__track {
    display: flex;
    gap: 1.75rem;
    padding: 1rem 2rem 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel__track::-webkit-scrollbar {
    display: none;
}

.carousel__item {
    flex: 0 0 auto;
    width: 140px;
    scroll-snap-align: start;
}

.carousel__item img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 2px;
    background: #e8e5e0;
    box-shadow: 
        2px 2px 8px rgba(0,0,0,0.1),
        0 0 0 1px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.carousel__item:hover img {
    transform: translateY(-6px);
    box-shadow: 
        4px 8px 20px rgba(0,0,0,0.15),
        0 0 0 1px rgba(0,0,0,0.05);
}


/* Responsive - Tablet */
@media screen and (max-width: 800px) {
    .home__hero {
        padding: 4rem 1.5rem 3rem;
    }
    
    .home__subtitle {
        margin-bottom: 3rem;
    }
    
    .home__section {
        padding: 2.5rem 0;
    }
    
    .carousel__item {
        width: 125px;
    }
    
    .carousel__track {
        gap: 1.5rem;
        padding: 0.875rem 1.5rem 1.25rem;
    }
    
    .home__header {
        padding: 0 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .home__results {
        max-height: 400px;
    }
}

/* Responsive - Mobile */
@media screen and (max-width: 600px) {
    .home__hero {
        padding: 3rem 1rem 2rem;
    }
    
    .home__title {
        letter-spacing: 0.05em;
    }
    
    .home__subtitle {
        margin-bottom: 2rem;
        letter-spacing: 0.1em;
    }
    
    .home__input {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .home__section {
        padding: 1.75rem 0;
    }
    
    .home__section:first-of-type {
        padding-top: 1.5rem;
    }
    
    .home__section:last-of-type {
        padding-bottom: 2.5rem;
    }
    
    /* Exactly 2 items visible in carousel - no peeking */
    .carousel__item {
        width: calc(50vw - 1.25rem);
        max-width: calc(50% - 0.5rem);
        flex-shrink: 0;
    }
    
    .carousel__track {
        gap: 1rem;
        padding: 0.5rem 1rem 1rem;
        flex-wrap: nowrap;
        scroll-snap-type: x mandatory;
    }
    
    .carousel__item:first-child {
        scroll-snap-align: start;
    }
    
    .carousel {
        overflow: hidden;
    }
    
    .home__header {
        padding: 0 1rem;
        margin-bottom: 1.25rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .home__label {
        font-size: 0.8rem;
    }
    
    .home__link {
        font-size: 0.85rem;
    }
    
    .carousel__item:hover img {
        transform: none;
    }
    
    .home__results {
        min-width: 100%;
        max-height: 60vh;
        border-radius: 8px;
        left: 0;
        transform: none;
    }
    
    .home__result {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .home__result-btn {
        width: 100%;
        text-align: center;
    }
}

/* Responsive - Small phones */
@media screen and (max-width: 400px) {
    .home__hero {
        padding: 2.5rem 0.75rem 1.75rem;
    }
    
    .home__title {
        font-size: 2rem;
    }
    
    .home__subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .carousel__item {
        width: 100px;
    }
    
    .carousel__track {
        gap: 0.75rem;
        padding: 0.5rem 0.75rem 0.875rem;
    }
    
    .home__header {
        padding: 0 0.75rem;
    }
}
