/* ==========================================================================
   Homepage. Builds on paper.css (colors, header, frames); this file holds
   the hero, book plates and the scroll reveal.
   Loaded only by templates/index.html; every rule is scoped to body.home.
   ========================================================================== */

.home .main-content {
    padding-top: 0;
}

/* Sections that span the full window width, outside the page container */
.home-bleed {
    width: 100vw;
    margin-inline: calc(50% - 50vw);
}

/* --------------------------------------------------------------------------
   Header: transparent over the hero, solid paper once the page scrolls
   -------------------------------------------------------------------------- */

.home .navbar {
    position: fixed;
    top: 0;
    inset-inline: 0;
    background: transparent !important;
    box-shadow: none;
    backdrop-filter: none;
    padding: 1.25rem 0;
    border-bottom: 1px solid transparent;
    transition: background-color 0.3s ease, border-color 0.3s ease, padding 0.3s ease;
}

.home .navbar.is-solid {
    background: var(--paper) !important;
    border-bottom-color: var(--rule);
    padding: 0.6rem 0;
}

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

.home-hero {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding: 7rem 0 3rem;
    border-bottom: var(--frame);
}

.home-hero-inner {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding-inline: 1.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: center;
    gap: 3rem;
}

.home-display {
    font-family: var(--display);
    font-weight: 900;
    font-size: clamp(2.6rem, 5.4vw, 6.25rem);
    line-height: 1.02;
    text-wrap: balance;
    letter-spacing: -0.01em;
    margin: 0 0 1.75rem;
}

.home-display .line {
    display: block;
    animation: home-rise 1s var(--ease-out) both;
}

.home-display .accent {
    color: var(--accent);
    animation-delay: 0.15s;
}

.home-hero-tagline {
    font-size: clamp(1.1rem, 1.6vw, 1.35rem);
    color: var(--ink-soft);
    max-width: 34em;
    margin-bottom: 1.5rem;
    animation: home-rise 1s var(--ease-out) 0.3s both;
}

.home-promises {
    list-style: none;
    padding: 0.75rem 0;
    margin: 0 0 2.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0;
    border-top: var(--frame);
    border-bottom: var(--frame);
    font-weight: 700;
    font-size: 1rem;
    animation: home-rise 1s var(--ease-out) 0.4s both;
}

.home-promises li + li::before {
    content: '·';
    color: var(--accent);
    padding-inline: 0.75rem;
}

/* The engraving prints straight onto the paper. The entrance animation is on
   the image itself: animating the link would isolate the blend from the page */
.home-hero-art {
    display: block;
    text-align: center;
}

/* Framed like the book plates below */
.home-hero-art img {
    max-width: 100%;
    max-height: 78vh;
    width: auto;
    height: auto;
    border: var(--frame);
    padding: 10px;
    background: var(--paper-deep);
    filter: grayscale(1) contrast(1.1);
    mix-blend-mode: multiply;
    animation: home-fade 1.6s ease 0.2s both;
}

.home.dark-mode .home-hero-art img {
    filter: grayscale(1) contrast(1.05) brightness(0.85);
    mix-blend-mode: normal;
}

@keyframes home-rise {
    from { opacity: 0; transform: translateY(0.6em); }
    to { opacity: 1; transform: none; }
}

@keyframes home-fade {
    from { opacity: 0; transform: scale(1.04); }
    to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Section titles: display type followed by a rule to the edge
   -------------------------------------------------------------------------- */

.home-section-title {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-family: var(--display);
    font-weight: 900;
    font-size: clamp(2.2rem, 5vw, 3.75rem);
    margin: 6rem 0 3rem;
}

.home-section-title::after {
    content: '';
    flex: 1;
    border-top: var(--frame);
}

.home.dark-mode .plate-art img {
    mix-blend-mode: normal;
    filter: grayscale(1) contrast(1.05) brightness(0.85);
}

/* --------------------------------------------------------------------------
   All books: framed plates
   -------------------------------------------------------------------------- */

.plates {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 3rem 2rem;
}

.plate-link {
    display: block;
    text-decoration: none;
}

.plate-art {
    display: block;
    aspect-ratio: 3 / 4;
    border: var(--frame);
    padding: 10px;
    background: var(--paper-deep);
    overflow: hidden;
}

.plate-art img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(1) contrast(1.1);
    mix-blend-mode: multiply;
    transition: filter 0.5s ease, transform 0.8s var(--ease-out);
}

.plate-link:hover .plate-art img,
.plate-link:focus-visible .plate-art img,
.home.dark-mode .plate-link:hover .plate-art img {
    filter: none;
    transform: scale(1.03);
}

.plate-title {
    display: block;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.45rem;
    line-height: 1.2;
    margin-top: 1rem;
}

.plate-link:hover .plate-title {
    color: var(--accent);
}

.plate-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin: 0.25rem 0 0;
}

.plate-views {
    font-size: 0.85rem;
}

.plate-audio {
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   My list: the reader's saved books (main.js), above all books
   -------------------------------------------------------------------------- */

.home-my-list[hidden] {
    display: none;
}

.home-my-list .home-section-title {
    margin-bottom: 1rem;
}

.my-list-note {
    color: var(--ink-soft);
    margin: 0 0 2rem;
}

.my-list-remove {
    padding: 0;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--rule-soft);
    color: var(--ink-soft);
    font-size: 0.85rem;
    cursor: pointer;
}

.my-list-remove:hover,
.my-list-remove:focus-visible {
    color: var(--accent);
    border-bottom-color: currentColor;
}

.home-empty {
    color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Scroll reveal. Content is hidden only once main.js has added .reveal-ready,
   so the page still shows everything without JavaScript.
   -------------------------------------------------------------------------- */

.home.reveal-ready .reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.9s ease var(--reveal-delay, 0ms),
                transform 0.9s var(--ease-out) var(--reveal-delay, 0ms);
}

.home.reveal-ready .reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
    .home-hero-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .home-hero-art img {
        max-height: 50vh;
    }
}

@media (max-width: 767.98px) {
    /* On phones the page opens straight on the book list. The hero
       stays in the DOM, visually hidden, so the page keeps its <h1> */
    .home-hero {
        position: absolute;
        width: 1px;
        height: 1px;
        min-height: 0;
        padding: 0;
        border: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    /* display: none keeps the lazy-loaded image from downloading at all */
    .home-hero-art {
        display: none;
    }

    .home-library {
        padding-top: 3rem;
    }

    .home-hero-inner {
        padding-inline: 1rem;
    }

    /* One promise per line: a wrapped row would break mid-phrase or start
       a line with a separator dot on narrow phones */
    .home-promises {
        flex-direction: column;
        gap: 0.4rem;
    }

    .home-promises li {
        display: flex;
        align-items: baseline;
        gap: 0.6rem;
    }

    .home-promises li::before,
    .home-promises li + li::before {
        content: '';
        flex: none;
        width: 0.9rem;
        height: 1.5px;
        background: var(--accent);
        padding: 0;
        transform: translateY(-0.3em);
    }

    .home-section-title {
        margin: 4rem 0 2rem;
    }

    .plates {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2rem 1rem;
    }

    .plate-title {
        font-size: 1.15rem;
    }
}

/* --------------------------------------------------------------------------
   Reduced motion: everything visible and still
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .home *,
    .home *::before,
    .home *::after {
        animation: none !important;
        transition: none !important;
    }

    .home.reveal-ready .reveal {
        opacity: 1;
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   All books: search box (filters the plates as you type, see main.js)
   -------------------------------------------------------------------------- */

.library-search {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    max-width: 36rem;
    margin-bottom: 2.5rem;
}

.library-search-hint {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

/* Reading lists: a second row of chips under the categories */
.category-nav + .reading-lists {
    margin-block-start: -1rem;
}

.reading-lists-label {
    margin: 0 0 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.library-empty {
    font-size: 1.1rem;
    color: var(--ink-soft);
}

.library-empty a {
    color: var(--accent);
    font-weight: 700;
}

.plate[hidden] {
    display: none;
}
