/* The title and filters sit on the library scene; books follow on paper. */
.library-page, .library-page * { box-sizing: border-box; }
.library-page {
    --library-paper: #f4ecdf;
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    margin: 0;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--library-paper);
    color: #263a32;
    font: 16px/1.5 Georgia, "Times New Roman", serif;
    -webkit-font-smoothing: antialiased;
}
.library-page a { color: inherit; text-underline-offset: .25em; }
.library-page .site-header {
    position: absolute;
    z-index: 3;
    inset: 0 0 auto;
    background: linear-gradient(#101b19bf, #101b1999 75%, transparent);
}
.library-page .site-header .dv-navigation { color: #fff8e9; text-shadow: 0 1px 5px #07150ce0; }
.library-page .site-header .site-name .site-mark {
    filter: brightness(0) invert(1) drop-shadow(0 0 .35px #fff);
    opacity: 1;
}
.library-main { flex: 1; min-width: 0; }
.library-main:focus, .library-content:focus { outline: none; }
.library-container { margin-inline: 13.8%; }
.library-hero {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-start;
    min-height: 50vw;
    background: #192c26;
    color: #fff8e9;
}
.library-hero-art {
    position: absolute;
    z-index: -2;
    inset: 0;
    overflow: hidden;
    background: #192c26;
    mask-image: linear-gradient(#000 calc(100% - 18px), transparent);
    pointer-events: none;
}
.library-hero-art picture {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
}
.library-hero-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; }
.library-hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: radial-gradient(ellipse at 50% 24%, #0b1d16b3, transparent 72%);
    mask-image: linear-gradient(#000 78%, transparent 95%);
    pointer-events: none;
}
.library-hero::after {
    content: "";
    position: absolute;
    z-index: -3;
    inset: auto 0 0;
    height: 18px;
    background: var(--library-paper);
}
.library-hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    width: min(1040px, calc(100% - 80px));
    min-width: 0;
    margin-inline: auto;
    padding-block: 112px 36px;
}
.library-hero-intro {
    width: 100%;
    min-width: 0;
    text-align: center;
    text-shadow: 0 2px 6px #07130de6, 0 8px 24px #07130d66;
}
.library-hero h1 {
    margin: 0 auto;
    max-width: 14ch;
    font-size: clamp(40px, 4.2vw, 60px);
    line-height: 1.08;
    letter-spacing: -.035em;
    font-weight: 400;
    overflow-wrap: anywhere;
}
.library-hero-intro p { margin: 10px auto 0; max-width: 76ch; color: #f1e8d4; font-size: 18px; line-height: 1.45; }
.library-content { padding-block: 8px 86px; scroll-margin-top: 20px; }
.library-filters {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    width: 100%;
    max-width: 560px;
    padding: 18px 22px;
    border: 1px solid #b3a68680;
    border-radius: 4px;
    background: #f4ecdfed;
    box-shadow: 0 12px 36px #07130d40;
    color: #263a32;
}
.library-filters fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.library-completion-filter { display: none; }
.library-completion-filter.is-active { display: block; }
@supports selector(:has(*)) {
    .library-completion-filter.is-active { display: none; }
    .library-filters:has(input[name="format"][value="cycle"]:checked) .library-completion-filter { display: block; }
}
.library-filters legend {
    display: block;
    margin-bottom: 6px;
    padding: 0;
    color: #5d6555;
    font: 11px/1.5 system-ui, sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.library-choice-options { display: flex; flex-wrap: wrap; gap: 4px; }
.library-choice-options label { position: relative; cursor: pointer; }
.library-choice-options input {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.library-choice-options span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 17px;
    border-bottom: 2px solid transparent;
    font-size: 17px;
}
.library-choice-options input:checked + span { border-bottom-color: #304b39; background: #314b3912; }
.library-choice-options input:focus-visible + span { outline: 3px solid #406448; outline-offset: 3px; }
.library-genre-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.library-genre-options label {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    line-height: 1.35;
    cursor: pointer;
}
.library-genre-options input { flex: 0 0 16px; width: 16px; height: 16px; margin: 0; accent-color: #304b39; }
.library-genre-options input:focus-visible { outline: 3px solid #406448; outline-offset: 3px; }
.library-filter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.library-filter-actions button {
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid #304b39;
    border-radius: 2px;
    background: #304b39;
    color: #fff8e9;
    font: 16px/1.4 Georgia, "Times New Roman", serif;
    cursor: pointer;
}
.library-filter-actions button:hover { background: #203a2c; }
.library-filter-actions a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
.library-filter-actions :focus-visible { outline: 3px solid #406448; outline-offset: 3px; }
.library-results-count { margin: 18px 0 24px; color: #5d6555; font: 13px/1.5 system-ui, sans-serif; }
.library-page .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
.library-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px; list-style: none; margin: 0; padding: 0; }
.library-item, .library-item article { min-width: 0; height: 100%; }
.library-story {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(210px, 28%) minmax(0, 1fr);
    align-items: center;
    gap: 48px;
    min-height: 380px;
    padding: 40px;
    overflow: hidden;
    border: 1px solid #c6aa704d;
    border-radius: 4px;
    background: #19382e;
    box-shadow: 0 14px 36px #251c1529, 0 2px 8px #261b1a24;
    color: #fff8e9;
    text-decoration: none;
}
.library-story::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(90deg, #0a201c20, #102b2375 28%, #102b23d9 49%, #0a211def);
    pointer-events: none;
}
.library-page .library-story { color: #fff8e9; }
.library-story:focus-visible { outline: 3px solid #fff1bd; outline-offset: 4px; box-shadow: 0 0 0 8px #684721; }
.library-story-visual { position: relative; display: flex; justify-content: center; align-items: center; min-width: 0; }
.library-story-cycle .library-story-visual { padding-right: 56px; }
.library-story-scene {
    position: absolute;
    z-index: -2;
    inset: 0;
    overflow: hidden;
    background: #263e35;
}
.library-story-scene::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px #152c3020; pointer-events: none; }
.library-story-scene picture, .library-story-scene img { display: block; width: 100%; height: 100%; }
.library-story-scene img { object-fit: cover; object-position: center; }
.library-book-group { position: relative; isolation: isolate; width: 192px; flex: 0 0 auto; transition: transform .22s ease; }
.library-story .library-story-cover { position: relative; z-index: 2; width: 100%; }
.library-stack-volume {
    position: absolute;
    inset: 0;
    aspect-ratio: 2 / 3;
    border: 1px solid #879477;
    outline: 1px solid #b3a27866;
    outline-offset: -10px;
    border-radius: 2px 5px 5px 2px;
    background: linear-gradient(90deg, #101d16, #7b8567 2px, #182c20 5px, #344536 10px, #203a2c 12px, #15291f);
    box-shadow: 3px 9px 11px #020d0b75, inset 0 1px 1px #d9d3b34d;
    transform-origin: 50% 90%;
    pointer-events: none;
}
.library-stack-volume::after {
    content: "";
    position: absolute;
    inset: 3px -3px 3px auto;
    width: 4px;
    background: linear-gradient(90deg, #c1b89888, #18271e);
    border-radius: 0 3px 3px 0;
}
.library-stack-volume-back { z-index: 0; transform: translate(39px, -10px) rotate(9deg); }
.library-stack-volume-middle { z-index: 1; transform: translate(19px, -5px) rotate(4deg); }
.library-cover-placeholder {
    position: relative;
    z-index: 2;
    width: 100%;
    aspect-ratio: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border: 1px solid #a59670;
    outline: 1px solid #a5967070;
    outline-offset: -9px;
    border-radius: 2px 4px 4px 2px;
    box-shadow: 2px 12px 16px #172b2c38;
    background: #203b32;
    color: #efe6cf;
    font-size: clamp(13px, 1.3vw, 19px);
    text-align: center;
    overflow-wrap: anywhere;
}
.library-story-copy { display: flex; flex-direction: column; min-width: 0; padding: 0; text-shadow: 0 1px 4px #071b1670; }
.library-story-format { margin: 0 0 13px; color: #dfcfaa; font: 11px/1.5 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .14em; }
.library-story h2 { max-width: 25ch; margin: 0; font-size: clamp(30px, 2.8vw, 40px); line-height: 1.12; letter-spacing: -.025em; font-weight: 400; overflow-wrap: anywhere; text-wrap: balance; }
.library-story-description { max-width: 52ch; margin: 18px 0 0; color: #f1efe1; font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
.library-story-genre { margin: 15px 0 0; color: #d1d5c2; font: 12px/1.5 system-ui, sans-serif; }
.library-story-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 53px;
    width: 100%;
    margin-top: 20px;
    padding-top: 0;
    color: #fff4d6;
    font-size: 16px;
}
.library-story-action > span:first-child { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .25em; }
.library-story-action > span:last-child { font-size: 23px; line-height: 1; }
.library-empty {
    margin: 0;
    padding: 28px 32px;
    border: 1px solid #c1aa7c80;
    border-radius: 4px;
    background: var(--library-paper);
    box-shadow: 0 8px 28px #251c1520;
    font-size: 19px;
    color: #425042;
}
.library-page .dv-page-ending { flex: 0 0 auto; --dv-ending-paper: var(--library-paper); }
@media (hover: hover) {
    .library-story:hover .library-book-group { transform: translateY(-4px); }
    .library-story:hover .library-story-action { color: #fff; }
}
@media (max-width: 991.98px), (min-width: 992px) and (max-aspect-ratio: 1 / 1) {
    .library-container { margin-inline: 8%; }
}
@media (min-width: 900px) and (max-height: 850px) {
    .library-hero-content { padding-block: 104px 28px; }
    .library-hero h1 { font-size: 54px; }
    .library-hero-intro p { font-size: 17px; }
}
@media (max-width: 899px) {
    .library-hero-content { width: calc(100% - 64px); gap: 16px; padding-block: 100px 28px; }
    .library-hero-intro p { font-size: 17px; }
    .library-story { grid-template-columns: 180px minmax(0, 1fr); gap: 30px; padding: 30px; min-height: 330px; }
    .library-book-group { width: 152px; }
    .library-stack-volume-back { transform: translate(31px, -8px) rotate(9deg); }
    .library-stack-volume-middle { transform: translate(15px, -4px) rotate(4deg); }
    .library-story h2 { font-size: 31px; }
    .library-story-description { font-size: 16px; }
}
@media (min-width: 600px) and (max-width: 699.98px) {
    .library-hero-content { padding-top: 128px; }
}
@media (max-width: 599.98px) {
    .library-container { margin-inline: 20px; }
    .library-hero { min-height: 112.5212vw; }
    .library-hero-content { width: calc(100% - 40px); gap: 14px; padding-block: 128px 24px; }
    .library-hero h1 { font-size: 38px; }
    .library-hero-intro p { margin-top: 8px; font-size: 15px; line-height: 1.4; }
    .library-content { padding-block: 6px 57px; }
    .library-filters { gap: 14px; padding: 16px; }
    .library-choice-options span { padding-inline: 12px; font-size: 16px; }
    .library-genre-options { grid-template-columns: minmax(0, 1fr); }
    .library-filter-actions { gap: 8px; }
    .library-filter-actions button { padding-inline: 10px; font-size: 15px; }
    .library-filter-actions a { font-size: 13px; }
    .library-results-count { margin-block: 16px 20px; }
    .library-grid { gap: 24px; }
    .library-story { grid-template-columns: minmax(0, 1fr); gap: 27px; padding: 27px 24px 21px; min-height: 0; }
    .library-story::before { background: linear-gradient(#102b2308, #102b2399 20%, #102b23ed 38%, #0a211df5); }
    .library-story-scene picture { height: clamp(210px, 62vw, 270px); mask-image: linear-gradient(#000 62%, transparent); }
    .library-story-scene img { object-position: 65% top; }
    .library-story-visual { justify-content: flex-start; }
    .library-story-cycle .library-story-visual { padding-right: 0; }
    .library-book-group { width: 112px; }
    .library-stack-volume-back { transform: translate(26px, -5px) rotate(9deg); }
    .library-stack-volume-middle { transform: translate(13px, -3px) rotate(4deg); }
    .library-story-copy { padding: 0; }
    .library-story-format { font-size: 10px; margin-bottom: 10px; }
    .library-story h2 { font-size: 30px; }
    .library-story-description { margin-top: 15px; }
    .library-story-genre { margin-top: 13px; }
    .library-story-action { min-height: 44px; margin-top: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    .library-book-group { transition: none; }
}
