:root {
  --cream: #f7f5f1; --paper: #fffdfa; --ink: #17242d; --muted: #53636e;
  --blue: #dcecf7; --blue-strong: #5f9dc4; --blue-deep: #28698e;
  --line: #dce5e9; --rose: #f5dfe4; --sage: #e7eee8;
  --wrap: 1180px; --gutter: clamp(18px, 4vw, 56px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
h1, h2, h3, p { margin: 0; }
.books-wrap { width: min(100%, var(--wrap)); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: fixed; z-index: 10; top: -80px; left: 20px; padding: 12px 18px; border-radius: 8px; background: var(--ink); color: #fff; }
.skip:focus { top: 18px; }
:focus-visible { outline: 3px solid var(--blue-deep); outline-offset: 3px; }

.books-header { position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); background: rgba(255, 253, 250, .96); backdrop-filter: blur(16px); }
.books-header-inner { position: relative; display: flex; min-height: 72px; align-items: center; gap: 30px; }
.books-brand { display: flex; align-items: center; gap: 9px; min-height: 44px; font-size: 1.2rem; font-weight: 800; letter-spacing: -.04em; }
.books-brand img { width: 38px; height: 38px; border-radius: 11px; }
.books-header nav { display: flex; align-items: center; gap: clamp(12px, 2vw, 28px); margin-left: auto; font-size: .85rem; font-weight: 700; }
.books-header nav a { display: inline-flex; align-items: center; min-height: 44px; }
.books-header nav a:hover, .text-link:hover, .back-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.books-mobile-nav { display: none; }
.language-switcher { display: flex; align-items: center; gap: 5px; font-size: .75rem; }
.language-switcher button { min-width: 44px; min-height: 44px; border: 0; background: none; padding: 5px; color: var(--muted); cursor: pointer; }
.language-switcher button[aria-pressed="true"] { color: var(--ink); font-weight: 800; }
.discovery-footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px 18px; font-size: .82rem; font-weight: 750; }
.discovery-footer-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
.eyebrow { display: block; color: #4b7085; font-size: .69rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.books-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .82fr); align-items: center; gap: clamp(35px, 5vw, 80px); padding-top: clamp(30px, 3.5vw, 48px); padding-bottom: clamp(30px, 3.5vw, 48px); }
.books-hero h1 { max-width: 11ch; margin-top: 13px; font-size: clamp(3.2rem, 4.8vw, 5rem); font-weight: 760; line-height: .98; letter-spacing: -.075em; text-wrap: balance; }
.books-hero p { max-width: 49ch; margin-top: 20px; color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.14rem); }
.hero-image { display: block; width: 100%; height: clamp(250px, 25vw, 315px); object-fit: cover; border-radius: 13px; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; margin-top: 28px; font-size: .83rem; font-weight: 760; }
.pill { padding: 12px 18px; border-radius: 8px; background: var(--blue-deep); color: #fff; }
.pill:hover { background: #1d516f; }
.hero-actions > a:not(.pill) { border-bottom: 1px solid currentColor; padding-bottom: 4px; }
.books-hero.compact, .book-detail { display: block; }
.books-hero.compact { padding-bottom: 40px; }
.books-hero.compact h1 { max-width: 19ch; font-size: clamp(2.9rem, 4.5vw, 4.8rem); }
.books-hero.compact p { max-width: 70ch; }

.books-section { padding-top: clamp(35px, 4vw, 55px); padding-bottom: clamp(50px, 6vw, 80px); border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.section-heading h2 { margin-top: 6px; font-size: clamp(2rem, 2.8vw, 2.8rem); font-weight: 750; letter-spacing: -.055em; line-height: 1.08; }
.section-heading > span, .small-note { color: var(--muted); font-size: .82rem; }
#reading-lists, #browse, .books-section[id] { scroll-margin-top: 95px; }
.collection-grid { border-top: 1px solid var(--line); }
.collection-card { display: grid; grid-template-columns: 32px 116px minmax(0, 1fr) 96px; align-items: center; gap: clamp(14px, 2vw, 26px); min-height: 144px; padding: 16px 12px; border-bottom: 1px solid var(--line); transition: background-color .2s; }
.collection-card:hover { background: var(--paper); }
.collection-card[hidden] { display: none; }
.collection-number { align-self: start; margin-top: 4px; color: #4b6b7b; font-size: .76rem; font-weight: 800; }
.collection-image { display: block; width: 116px; height: 108px; object-fit: cover; border-radius: 6px; }
.collection-copy { min-width: 0; }
.collection-card h3 { margin-top: 5px; font-size: clamp(1.4rem, 2vw, 1.85rem); font-weight: 750; line-height: 1.14; letter-spacing: -.045em; }
.collection-description { display: block; max-width: 65ch; margin-top: 6px; color: var(--muted); font-size: .84rem; }
.collection-card-end { display: flex; align-items: flex-end; flex-direction: column; gap: 18px; color: var(--muted); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.collection-card-end span:last-child { color: var(--blue-deep); font-size: 1.1rem; }

.book-filters { display: grid; grid-template-columns: minmax(170px, 1.6fr) repeat(4, minmax(120px, 1fr)); gap: 12px; margin-bottom: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.collection-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr); gap: 12px; margin-bottom: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.collection-filters label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .7rem; font-weight: 750; }
.collection-filters input, .collection-filters select { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #cdd9df; border-radius: 6px; background: #fff; color: var(--ink); }
.empty-results { padding: 24px 0; color: var(--muted); }
.book-filters label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .7rem; font-weight: 750; }
.book-filters input, .book-filters select { width: 100%; min-height: 42px; padding: 8px 11px; border: 1px solid #cdd9df; border-radius: 6px; outline: none; background: #fff; color: var(--ink); }
.book-filters input:focus, .book-filters select:focus { border-color: var(--blue-deep); box-shadow: 0 0 0 2px rgba(40, 105, 142, .12); }
.result-count { min-height: 24px; color: var(--muted); font-size: .78rem; }
.book-grid { border-top: 1px solid var(--line); }
.book-card { min-width: 0; border-bottom: 1px solid var(--line); }
body[data-books-page="collection"] .book-grid { counter-reset: book-list; }
body[data-books-page="collection"] .book-card { display: grid; grid-template-columns: 35px minmax(0, 1fr); align-items: center; counter-increment: book-list; }
body[data-books-page="collection"] .book-card::before { content: counter(book-list, decimal-leading-zero); color: #7995a4; font-size: .74rem; font-weight: 800; }
.book-card a { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, .22fr) 22px; align-items: center; gap: 18px; min-height: 90px; padding: 15px 10px; }
.book-card--has-cover a { grid-template-columns: 55px minmax(0, 1fr) minmax(150px, .22fr) 22px; }
.book-card a:hover { background: var(--paper); }
.book-card-cover { width: 55px; height: 70px; background: var(--paper); }
.book-card-cover img { display: block; width: 100%; height: 100%; object-fit: contain; }
.book-card h3 { font-size: clamp(1.18rem, 1.6vw, 1.42rem); font-weight: 730; line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
.book-card p { margin-top: 4px; color: var(--muted); font-size: .83rem; }
.book-card-meta { color: #577183; font-size: .76rem; line-height: 1.35; text-transform: capitalize; }
.book-card-arrow { color: var(--blue-deep); font-size: 1.1rem; }
.pagination { display: flex; min-height: 65px; align-items: center; justify-content: center; gap: 10px; margin-top: 22px; }
.pagination button { padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); cursor: pointer; }
.pagination button:disabled { opacity: .4; cursor: default; }

.source-grid, .genre-grid { border-top: 1px solid var(--line); }
.source-card, .genre-grid a { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; align-items: center; gap: 16px; min-height: 84px; padding: 14px 10px; border-bottom: 1px solid var(--line); }
.source-card:hover, .genre-grid a:hover { background: var(--paper); }
.source-card h3, .genre-grid h2 { font-size: 1.34rem; font-weight: 720; line-height: 1.18; letter-spacing: -.035em; }
.source-card > span:last-child, .genre-grid a > span:last-child { color: var(--blue-deep); font-size: .77rem; font-weight: 750; }
.genre-grid h2 { text-transform: capitalize; }
.back-link { display: inline-block; margin-bottom: 20px; font-size: .83rem; font-weight: 750; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .55fr); align-items: start; gap: clamp(40px, 7vw, 100px); margin-top: 20px; }
.book-detail h1 { max-width: 16ch; font-size: clamp(3.3rem, 5vw, 5.8rem); overflow-wrap: anywhere; }
.detail-author { margin-top: 16px !important; color: var(--ink) !important; font-size: 1.2rem !important; }
.detail-description { max-width: 55ch; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.detail-tags span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: .74rem; text-transform: capitalize; }
.detail-cover { max-width: 220px; margin-bottom: 24px; }
.detail-cover img { display: block; width: 100%; height: auto; }
.cover-credit { margin: -10px 0 24px !important; color: var(--muted); font-size: .75rem; }
.cover-credit a { text-decoration: underline; text-underline-offset: 3px; }
.detail-facts { padding: 25px; border-radius: 9px; background: var(--blue); }
.detail-facts dl { margin: 17px 0 0; }
.detail-facts dl > div { padding: 12px 0; border-top: 1px solid #bed6e4; }
.detail-facts dt { color: var(--muted); font-size: .7rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.detail-facts dd { margin: 4px 0 0; font-size: 1.08rem; font-weight: 700; line-height: 1.2; }
.reference-list { padding-left: 20px; }
.reference-list li { margin-top: 9px; }
.reference-list a, .text-link { color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px; }
.fact-source p, .books-source-callout p { max-width: 65ch; margin: 13px 0 18px; color: var(--muted); }
.books-source-callout { width: min(calc(100% - var(--gutter) - var(--gutter)), calc(var(--wrap) - var(--gutter) - var(--gutter))); margin-bottom: 75px; padding: 28px; border: 0; border-radius: 10px; background: var(--blue); }
.books-source-callout h2 { font-size: 1.7rem; font-weight: 740; letter-spacing: -.04em; }
footer { margin-top: 30px; padding: 32px 0; background: #345f79; color: #fff; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: .82rem; }
.footer-inner > a:first-child { font-size: 1.1rem; font-weight: 800; }
.footer-inner p { max-width: 45ch; color: #f4fbff; }

@media (max-width: 1050px) {
  .book-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .book-filters label:first-child { grid-column: span 2; }
}
@media (max-width: 800px) {
  .books-hero { grid-template-columns: 1fr; gap: 25px; }
  .hero-image { height: clamp(210px, 42vw, 340px); }
  .detail-layout { grid-template-columns: minmax(0, 1fr) minmax(220px, .65fr); gap: 28px; }
}
@media (max-width: 960px) {
  body[data-books-page] .books-header-inner { min-height: 72px; flex-wrap: nowrap; gap: 12px; padding-block: 8px; }
  body[data-books-page] .books-desktop-nav { display: none; }
  body[data-books-page] .language-switcher { margin-left: 0; }
  .books-mobile-nav { display: block; margin-left: auto; }
  .books-mobile-nav summary { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 74px; min-height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: .82rem; font-weight: 750; list-style: none; }
  .books-mobile-nav summary::-webkit-details-marker { display: none; }
  .books-mobile-nav[open] summary { background: var(--blue); }
  body[data-books-page] .books-mobile-nav nav { position: absolute; z-index: 10; top: calc(100% - 1px); right: var(--gutter); display: grid; width: min(320px, calc(100vw - 2 * var(--gutter))); margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 0 0 9px 9px; background: var(--paper); box-shadow: 0 18px 32px rgba(23,36,45,.16); white-space: normal; overflow: visible; }
  body[data-books-page] .books-mobile-nav:not([open]) nav { display: none; }
  .books-mobile-nav nav a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 5px; font-size: .92rem; }
  .books-mobile-nav nav a:hover, .books-mobile-nav nav a:focus-visible { background: var(--blue); }
}
@media (max-width: 680px) {
  .collection-filters { grid-template-columns: 1fr; padding: 13px; }
  body[data-books-page] .books-header-inner { min-height: 68px; }
  .books-hero { gap: 19px; padding-top: 22px; padding-bottom: 25px; }
  .books-hero h1 { font-size: clamp(2.85rem, 10vw, 4rem); }
  .books-hero.compact h1 { font-size: clamp(2.8rem, 9vw, 4rem); }
  .books-hero p { margin-top: 14px; }
  .hero-actions { margin-top: 18px; }
  .hero-image { height: 145px; }
  .collection-card { grid-template-columns: 23px 72px minmax(0, 1fr) 18px; gap: 10px; min-height: 103px; padding: 13px 0; }
  .collection-number { font-size: .66rem; }
  .collection-image { width: 72px; height: 76px; }
  .collection-card h3 { font-size: 1.2rem; }
  .collection-description { display: none; }
  .collection-card-end { align-items: center; }
  .collection-card-end span:first-child { display: none; }
  .book-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 13px; }
  .book-filters label:first-child { grid-column: 1 / -1; }
  .book-card a { grid-template-columns: minmax(0, 1fr) 18px; min-height: 84px; gap: 8px; }
  .book-card--has-cover a { grid-template-columns: 48px minmax(0, 1fr) 18px; }
  body[data-books-page="collection"] .book-card { grid-template-columns: 28px minmax(0, 1fr); }
  .book-card-meta { grid-column: 1; grid-row: 2; margin-top: -6px; font-size: .7rem; }
  .book-card--has-cover .book-card-meta { grid-column: 2; }
  .book-card-arrow { grid-column: -2 / -1; grid-row: 1; }
  .source-card, .genre-grid a { grid-template-columns: 1fr auto; }
  .source-card .eyebrow, .genre-grid .eyebrow { grid-column: 1 / -1; }
  .detail-layout { grid-template-columns: 1fr; gap: 36px; }
  .detail-facts { max-width: 450px; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .collection-card { transition: none; }
}
