/* =====================================================================
   Landing page (Home_Page.php). Navigation, footer and base styles live
   in common.css; everything here is scoped under .home-page.
   ===================================================================== */

.home-page {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 16px 20px 48px;
}

/* ---------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------- */

.home-page .home-hero {
    text-align: center;
    color: #fff;
    background-color: #3a2a1d;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.55)),
        url("../imges/header.jpeg");
    /* The WebP copy where supported; other browsers keep the JPEG above. */
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.55)),
        image-set(url("../imges/header.webp") type("image/webp"), url("../imges/header.jpeg") type("image/jpeg"));
    background-size: cover;
    background-position: center;
    border-radius: 30px;
    padding: 56px 24px;
    margin: 10px 0 12px;
}

/* Dark hero photo: a yellow-only focus ring (the dark outline would disappear). */
.home-page .home-hero :focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
    box-shadow: none;
}

.home-hero h1 {
    font-size: clamp(1.6rem, 3vw + 1rem, 2.5rem);
    line-height: 1.2;
    margin: 0 0 12px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.home-hero-greeting {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.home-hero-count {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 24px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.home-page .home-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 26px;
    font-size: 1.05rem;
}

/* ---------------------------------------------------------------------
   Sections
   --------------------------------------------------------------------- */

.home-section {
    padding: 20px 0 8px;
}

.home-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 16px;
}

.home-section-title {
    font-size: 1.5rem;
    margin: 0 0 14px;
}

.home-see-all {
    font-weight: 700;
}

.home-empty {
    margin: 0;
    padding: 24px 16px;
    text-align: center;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border-radius: var(--radius);
}

/* Genre chips keep the original black "button" look of the genre tiles. */
.genre-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.genre-chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 18px;
    border: 1px solid #000;
    border-radius: 5px;
    background-color: #000;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.genre-chip:visited {
    color: #fff;
}

.genre-chip:hover {
    background-color: #fff;
    color: #000;
}

/* ---------------------------------------------------------------------
   Horizontal book rows (scroll inside the row, never the page)
   --------------------------------------------------------------------- */

.books-row {
    display: flex;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 8px 6px 16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 6px;
    scrollbar-width: thin;
    scrollbar-color: #8a8a8a #e0e0e0;
}

.books-row::-webkit-scrollbar {
    height: 10px;
}

.books-row::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 10px;
}

.books-row::-webkit-scrollbar-thumb {
    background: #8a8a8a;
    border-radius: 10px;
}

.home-book {
    flex: 0 0 clamp(150px, 40vw, 200px);
    scroll-snap-align: start;
}

/* position: relative keeps the absolutely positioned .sr-only labels inside the
   horizontally scrolling row (otherwise they widen the whole page on phones). */
.home-book-link {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #ecf0f1;
    border: 1px solid #c9d0d3;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    color: var(--color-text);
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.home-book-link:visited,
.home-book-link:hover {
    color: var(--color-text);
}

.home-book-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Inset two-tone ring: the row scrolls horizontally, so an outer ring could be clipped. */
.home-book-link:focus-visible {
    outline: 3px solid var(--color-focus-ink);
    outline-offset: -3px;
    box-shadow: inset 0 0 0 6px var(--color-focus), 0 4px 6px rgba(0, 0, 0, 0.1);
}

.home-book-cover {
    padding: 12px 12px 0;
}

.home-book-cover img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 380 / 605;
    object-fit: cover;
    border-radius: 4px;
    background-color: #d9dee0;
}

.home-book-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px 14px;
}

.home-book-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-book-author {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.home-book-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 8px;
    margin: auto 0 0;
    padding-top: 8px;
}

.home-book-price {
    font-weight: 800;
}

.home-book-note {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    background-color: var(--color-primary);
    color: #fff;
}

/* Availability: "In stock", "Only N left" or "Out of stock". */
.home-book .stock-badge {
    align-self: flex-start;
    margin: 6px 0 0;
    padding: 2px 8px;
    border-radius: var(--radius-lg);
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.home-book .stock-badge.stock-low {
    background: #fff4e5;
    color: #7a4100;
}

.home-book .stock-badge.stock-out {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */

@media (max-width: 768px) {
    .home-page .home-hero {
        border-radius: 20px;
        padding: 40px 18px;
    }

    .home-section-title {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .home-page {
        padding: 12px 16px 40px;
    }

    .home-hero-count {
        font-size: 1rem;
    }

    .home-page .home-cta {
        width: 100%;
    }

    .books-row {
        gap: 14px;
    }

    .genre-chip {
        padding: 8px 14px;
    }
}
