:root {
    --ink: #2f2a25;
    --muted: #756c64;
    --brown: #4b2e1f;
    --brown-hover: #5b3927;
    --cream: #f7f2eb;
    --paper: #fffdf9;
    --line: rgba(75, 46, 31, 0.14);
    --line-strong: rgba(75, 46, 31, 0.22);
    --gold: #b38c43;
    --shadow: 0 13px 32px rgba(48, 34, 25, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--cream);
    color: var(--ink);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 12% 0%, rgba(179, 140, 67, 0.08), transparent 34rem),
        var(--cream);
}

a,
button,
input,
select {
    -webkit-tap-highlight-color: transparent;
}

.archive-shell {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 42px 0 70px;
}

.archive-header {
    max-width: 760px;
    margin: 0 auto 30px;
    text-align: center;
}

.back-link {
    display: inline-block;
    margin-bottom: 28px;
    color: var(--brown);
    font-size: 0.83rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.back-link:hover {
    border-bottom-color: rgba(75, 46, 31, 0.35);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.archive-header h1 {
    margin: 0;
    font-family: Fraunces, Georgia, serif;
    font-size: clamp(2.35rem, 7vw, 4rem);
    font-weight: 400;
    line-height: 1;
    color: var(--brown);
}

.intro {
    margin: 13px auto 0;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.6;
}

.archive-tools {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    margin: 0 0 28px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 253, 249, 0.84);
    box-shadow: 0 7px 24px rgba(48, 34, 25, 0.04);
}

.search-wrap {
    position: relative;
    display: block;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-52%);
    color: #9a8e84;
    font-family: Georgia, serif;
    font-size: 1.1rem;
    pointer-events: none;
}

.search-wrap input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px 0 39px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.search-wrap input:focus,
.sort-wrap select:focus {
    border-color: rgba(75, 46, 31, 0.5);
    box-shadow: 0 0 0 3px rgba(75, 46, 31, 0.08);
}

.sort-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 0.8rem;
}

.sort-wrap select {
    min-height: 44px;
    padding: 0 34px 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 0.83rem;
}

.result-count {
    min-width: 76px;
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: right;
}

.result-count strong {
    color: var(--brown);
    font-size: 0.9rem;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 30px 22px;
}

.archive-book {
    min-width: 0;
}

.cover-link,
.cover-frame {
    display: block;
}

.cover-link {
    color: inherit;
    text-decoration: none;
}

.cover-frame {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border: 1px solid rgba(75, 46, 31, 0.11);
    border-radius: 9px;
    background:
        linear-gradient(145deg, rgba(255,255,255,.82), rgba(239,231,220,.7));
    box-shadow:
        0 11px 21px rgba(43, 31, 23, 0.10),
        0 2px 6px rgba(43, 31, 23, 0.06);
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease;
}

.cover-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #eee7de;
}

.cover-link:hover .cover-frame,
.cover-link:focus-visible .cover-frame {
    transform: translateY(-4px);
    border-color: rgba(75, 46, 31, 0.22);
    box-shadow:
        0 17px 31px rgba(43, 31, 23, 0.14),
        0 3px 8px rgba(43, 31, 23, 0.08);
}

.cover-link:focus-visible {
    outline: none;
}

.cover-link:focus-visible .cover-frame {
    box-shadow:
        0 0 0 3px rgba(75, 46, 31, 0.12),
        0 17px 31px rgba(43, 31, 23, 0.14);
}

.no-link {
    opacity: 0.96;
}

.book-copy {
    padding: 12px 3px 0;
}

.book-copy h2 {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--ink);
    font-family: Fraunces, Georgia, serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.book-copy p {
    display: -webkit-box;
    overflow: hidden;
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.view-link,
.missing-link {
    display: inline-block;
    margin-top: 9px;
    font-size: 0.75rem;
}

.view-link {
    color: var(--brown);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid rgba(75, 46, 31, 0.25);
}

.view-link:hover {
    border-bottom-color: var(--brown);
}

.missing-link {
    color: #aaa097;
}

.no-results,
.empty-state {
    padding: 52px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state {
    max-width: 600px;
    margin: 60px auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 253, 249, 0.82);
}

.empty-state h2 {
    margin: 0 0 8px;
    color: var(--brown);
    font-family: Fraunces, Georgia, serif;
    font-weight: 400;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1050px) {
    .book-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .book-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .archive-tools {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .result-count {
        grid-column: 1 / -1;
        text-align: left;
        padding-left: 2px;
    }
}

@media (max-width: 650px) {
    .archive-shell {
        width: min(100% - 24px, 560px);
        padding-top: 26px;
    }

    .archive-header {
        margin-bottom: 23px;
    }

    .back-link {
        margin-bottom: 22px;
    }

    .archive-tools {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .sort-wrap {
        justify-content: space-between;
    }

    .sort-wrap select {
        flex: 1;
        max-width: 230px;
    }

    .result-count {
        grid-column: auto;
    }

    .book-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 25px 15px;
    }
}

@media (max-width: 430px) {
    .book-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px 14px;
    }

    .book-copy h2 {
        font-size: 0.96rem;
    }
}
