/**
 * Library Catalog home page (view/common/library-home.phtml).
 * The shelf of book spines is the one bold element; the rest stays quiet.
 */

.library-home {
    --lh-wood: #6b4429;
    --lh-wood-dark: #3f2615;
    --lh-label: #f6efdf;
    --lh-row: 280px; /* tallest book */
    --lh-scale: 1;
    background:
        radial-gradient(ellipse at 85% 0%, rgba(var(--gsp-keystone-gold-rgb), 0.10), transparent 55%),
        var(--gsp-parchment);
    color: var(--gsp-evergreen);
    padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem);
}

/* Intro: title, count, search */
.lh-intro {
    max-width: 44rem;
}

.lh-title {
    font-family: var(--gsp-font-heading);
    font-size: clamp(2.5rem, 2rem + 2.5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.05;
    margin: 0 0 0.75rem;
}

.lh-lede {
    font-size: 1.125rem;
    line-height: 1.55;
    margin: 0 0 1.75rem;
    max-width: 36rem;
}

.lh-lede strong {
    font-variant-numeric: lining-nums tabular-nums;
}

.lh-search {
    display: flex;
    max-width: 40rem;
    background: #fff;
    border: 2px solid var(--gsp-evergreen);
    border-radius: var(--gsp-radius-md);
    overflow: hidden;
}

.lh-search:focus-within {
    box-shadow: 0 0 0 4px rgba(var(--gsp-keystone-gold-rgb), 0.45);
}

.lh-search-input {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: 0.9rem 1.1rem;
    font-size: 1.0625rem;
    color: var(--gsp-text);
    background: transparent;
}

.lh-search-input:focus {
    outline: none;
}

.lh-search-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    padding: 0 1.4rem;
    font-weight: 600;
    background: var(--gsp-evergreen);
    color: #fff;
}

.lh-search-button:hover,
.lh-search-button:focus-visible {
    background: var(--gsp-evergreen-light);
}

/* The shelf */
.lh-shelf-wrap {
    margin: clamp(2.5rem, 5vw, 3.5rem) 0 0;
}

.lh-shelf {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    list-style: none;
    margin: 0;
    padding: 1.25rem 1rem 0;
    padding-bottom: 18px;
    /* One row of books fills the shelf; books that do not fit wrap onto a
       second row, which is cut off, so the shelf is full at any width. */
    flex-wrap: wrap;
    height: calc(1.25rem + var(--lh-row) + 18px);
    overflow: hidden;
    /* The plank under the books: its top, then its darker front edge. */
    background: linear-gradient(to top, var(--lh-wood) 0 18px, transparent 18px);
    border-bottom: 7px solid var(--lh-wood-dark);
    border-radius: 0 0 3px 3px;
}

.lh-book {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    height: var(--lh-row);
}

/* The first book leans against the others. */
.lh-book:first-child {
    /* rotating about the foot moves the head right by h * sin(7deg) */
    margin-right: calc(var(--h) * 0.125);
    transform: rotate(7deg);
    transform-origin: bottom left;
}

.library-home a.lh-spine {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: var(--w);
    height: calc(var(--h) * var(--lh-scale));
    padding: 22px 0 14px;
    background:
        /* rounded spine: light down the middle, shade at the edges */
        linear-gradient(90deg,
            rgba(0, 0, 0, 0.35) 0%,
            rgba(255, 255, 255, 0.10) 30%,
            rgba(255, 255, 255, 0.04) 60%,
            rgba(0, 0, 0, 0.30) 100%),
        var(--cloth);
    color: var(--ink);
    border-radius: 3px 3px 1px 1px;
    text-decoration: none;
    transition: transform 0.18s ease-out;
}

/* Gilt bands near the head and tail of the spine. */
.lh-spine::before,
.lh-spine::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    height: 5px;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    opacity: 0.7;
}

.lh-spine::before { top: 9px; }
.lh-spine::after { bottom: 6px; }

.lh-spine-title {
    flex: 1 1 auto;
    min-height: 0;
    writing-mode: vertical-rl;
    font-family: var(--gsp-font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lh-book.is-thin .lh-spine-title {
    font-size: 0.7rem;
}

/* Library call-number sticker */
.lh-spine-label {
    flex: 0 0 auto;
    margin-top: 10px;
    margin-bottom: 8px;
    width: calc(100% - 10px);
    padding: 3px 2px;
    background: var(--lh-label);
    color: #2a1a0c;
    border-radius: 2px;
    font-size: 0.56rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.library-home a.lh-spine:hover,
.library-home a.lh-spine:focus-visible {
    transform: translateY(-14px);
    color: var(--ink);
}

.lh-spine:focus-visible {
    outline: 3px solid var(--gsp-keystone-gold);
    outline-offset: 2px;
}

.lh-shelf-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    margin-top: 1.5rem;
    font-size: 0.975rem;
    line-height: 1.4;
}

/* Fixed height (two lines of title, one of byline) so the page below does
   not move as the caption changes from book to book. */
.lh-caption-text {
    flex: 1 1 24rem;
    max-width: 48rem;
    height: 4.3rem;
    overflow: hidden;
}

.lh-caption-text cite {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    font-family: var(--gsp-font-heading);
    font-style: normal;
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.3;
}

.lh-caption-byline {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--gsp-commonwealth-clay-dark);
}

.lh-reshelve {
    color: var(--gsp-evergreen);
    font-weight: 600;
    white-space: nowrap;
}

.lh-reshelve i {
    margin-right: 0.35rem;
}

/* Browse: title initials and index lists */
.lh-browse {
    padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(3rem, 6vw, 5rem);
    color: var(--gsp-text);
}

.lh-heading {
    font-family: var(--gsp-font-heading);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--gsp-evergreen);
    margin: 0 0 1rem;
}

.lh-titles {
    margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.lh-titles-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 1.25rem;
    margin-bottom: 1rem;
}

.lh-titles-head .lh-heading {
    margin: 0;
}

.lh-titles-head a {
    color: var(--gsp-evergreen);
    font-weight: 600;
}

.lh-letters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.lh-letters a {
    flex: 1 0 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.6rem;
    font-family: var(--gsp-font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gsp-evergreen);
    background: var(--gsp-parchment);
    border: 1px solid var(--gsp-parchment-border);
    border-radius: var(--gsp-radius-sm);
    text-decoration: none;
}

.lh-letters a:hover,
.lh-letters a:focus-visible {
    background: var(--gsp-evergreen);
    border-color: var(--gsp-evergreen);
    color: #fff;
}

.lh-indexes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 2.5rem clamp(2rem, 4vw, 3.5rem);
}

.lh-index ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Name ........ count, like the index at the back of a book. */
.lh-index li > a {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.3rem 0;
    color: var(--gsp-text);
    text-decoration: none;
}

.lh-index li > a::after {
    content: "";
    order: 1;
    flex: 1 1 auto;
    border-bottom: 2px dotted var(--gsp-parchment-border);
    transform: translateY(-0.25em);
}

.lh-index-name {
    order: 0;
}

.lh-index-count {
    order: 2;
    font-variant-numeric: tabular-nums;
    color: var(--gsp-commonwealth-clay-dark);
}

.lh-index li > a:hover .lh-index-name,
.lh-index li > a:focus-visible .lh-index-name {
    color: var(--gsp-evergreen);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* "Browse all ..." under each list, like "All titles, A to Z". */
.lh-index-all {
    margin: 0.6rem 0 0;
}

.lh-index-all a {
    color: var(--gsp-evergreen);
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .lh-search-button span {
        display: none;
    }

    .library-home {
        --lh-row: 240px;
        --lh-scale: 0.85;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lh-spine {
        transition: none;
    }
}
