/* Our Library Card — matches the approved mock-up. System fonts only (no third-party requests). */
:root {
  --ink: #16181F; --muted: #4A4D57; --line: #E4E2DC; --accent: #A63A12; --accent-dark: #7C2A0B;
  --bg: #FFFFFF; --soft: #F6F5F1;
  --head: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; }
a { color: var(--accent); } a:hover { color: var(--accent-dark); }
h1, h2, h3 { font-family: var(--head); letter-spacing: -0.01em; line-height: 1.1; }
img { display: block; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; } .skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

header.site { border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-family: var(--head); font-weight: 700; font-size: 21px; }
header nav { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
header nav > a { padding: 12px 12px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15px; }
header nav > a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--ink); border-radius: 999px; background: #fff; color: var(--ink); font: 600 14px var(--body); text-decoration: none; cursor: pointer; }
.pill:hover { background: var(--soft); color: var(--ink); }
form.inline { display: inline; }

main { padding-top: 40px; padding-bottom: 64px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent); }
.small { font-size: 14px; color: var(--muted); }

.hero { display: flex; flex-wrap: wrap; gap: 40px; align-items: center; padding-bottom: 40px; border-bottom: 1px solid var(--line); }
.hero + .hero { padding-top: 40px; }
.hero-text { flex: 999 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.hero h1 { margin: 0; font-size: clamp(34px, 5vw, 52px); }
.by { margin: 0; font-size: 19px; color: var(--muted); }
.note { margin: 0; color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font: 600 15px var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { background: #000; color: #fff; }

.cover { width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; background: var(--soft); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.cover.big { flex: 0 0 220px; width: 220px; }
.cover.mini { flex: 0 0 56px; width: 56px; min-width: 56px; height: 84px; border-radius: 3px; }
.tile { color: #fff; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; }
.tile-title { font-family: var(--head); font-weight: 700; font-size: 16px; line-height: 1.2; }
.tile-author { font-size: 12px; opacity: .92; }
.cover.big .tile-title { font-size: 24px; }
.cover.mini.tile { padding: 4px; } .cover.mini .tile-title { font-size: 8px; } .cover.mini .tile-author { display: none; }
.tile-0 { background: #2F4858; } .tile-1 { background: #7A3E2B; } .tile-2 { background: #3D5A40; }
.tile-3 { background: #5B4B8A; } .tile-4 { background: #8A5A1F; } .tile-5 { background: #1F5F6B; }

.next { margin-top: 28px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; }
.next.empty { border-style: dashed; border-color: #C9C6BD; }
.next.empty p:last-child { margin: 4px 0 0; }
.next h2 { margin: 0 0 12px; font-size: 20px; }
.next-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 20px; }
.next-list li { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.next-list p { margin: 0; }

.all { padding-top: 48px; }
.all-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; }
.all-head h2 { margin: 0; font-size: 32px; }
.all-head p { margin: 0; color: var(--muted); }
.year { margin-top: 36px; }
.year-head { display: flex; gap: 12px; align-items: baseline; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 20px; }
.year-head h3 { margin: 0; font-size: 24px; }
.year-head span { color: var(--muted); font-size: 14px; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 28px 20px; }
.book { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.book .eyebrow { margin-top: 4px; }
.t { margin: 0; font-weight: 600; font-size: 15px; line-height: 1.3; }
.a { margin: 0; font-size: 14px; color: var(--muted); }
.gr { font-size: 13px; font-weight: 500; }

.stars { position: relative; display: inline-block; vertical-align: -3px; line-height: 0; white-space: nowrap; }
.stars svg { width: 15px; height: 15px; margin-right: 1px; stroke: var(--accent); stroke-width: 2; }
.stars-base svg { fill: none; }
.stars-fill { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; }
.stars-fill svg { fill: var(--accent); }
.p0 { width: 0%; } .p1 { width: 5%; } .p2 { width: 10%; } .p3 { width: 15%; } .p4 { width: 20%; } .p5 { width: 25%; } .p6 { width: 30%; } .p7 { width: 35%; } .p8 { width: 40%; } .p9 { width: 45%; } .p10 { width: 50%; } .p11 { width: 55%; } .p12 { width: 60%; } .p13 { width: 65%; } .p14 { width: 70%; } .p15 { width: 75%; } .p16 { width: 80%; } .p17 { width: 85%; } .p18 { width: 90%; } .p19 { width: 95%; } .p20 { width: 100%; } 
.club, .who { margin: 0; font-size: 13px; color: var(--muted); }
.rate { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.rate-label { margin: 0; font-weight: 500; font-size: 13px; color: var(--muted); }
.rate-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stars.big svg { width: 28px; height: 28px; margin-right: 2px; stroke-width: 1.6; }
.star-input { position: relative; display: inline-block; padding: 8px 0; line-height: 0; }
.star-input input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none; background: transparent; touch-action: pan-y; }
.star-input input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 1px; height: 28px; }
.star-input input[type="range"]::-moz-range-thumb { width: 1px; height: 28px; border: 0; }
.star-input:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.rate-val { font-weight: 600; font-size: 16px; }
.rate-val:empty { display: none; }
.book .rate-row { gap: 8px; }
.book .stars.big svg { width: 22px; height: 22px; }
.rate .save { min-height: 40px; padding: 6px 16px; border: 1px solid var(--ink); border-radius: 999px; background: var(--ink); color: #fff; font: 600 14px var(--body); cursor: pointer; }
.rate .save:hover { background: #000; }
.rate .save[hidden] { display: none; }
.rate-clear { margin: 0; }
.rate-clear .link { min-height: 32px; padding: 0; font-size: 13px; }
.link { min-height: 44px; border: 0; background: none; color: var(--accent); font: 500 13px var(--body); text-decoration: underline; cursor: pointer; padding: 0 10px; }
.link.danger { color: #9B1C1C; }

.page-h { margin: 0 0 24px; font-size: 36px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-bottom: 28px; }
.card h2 { margin: 0 0 12px; font-size: 22px; }
.card.msg { max-width: 640px; }
.flash { padding: 12px 16px; background: #EEF6EE; border: 1px solid #B9D8B9; border-radius: 8px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 6px; }
input, select { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid #B8B5AC; border-radius: 6px; font: 16px var(--body); background: #fff; color: var(--ink); }
input[type="file"] { padding: 9px; }
.stack .btn { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 0 16px; }
.row > div { flex: 1 1 200px; }
.row .end { display: flex; align-items: flex-end; padding-bottom: 0; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.list li { display: flex; gap: 14px; align-items: flex-start; }
.list li > div { min-width: 0; }
.table-scroll { overflow-x: auto; margin-top: 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }

.title-link { color: inherit; text-decoration: none; }
.title-link:hover { color: var(--accent); text-decoration: underline; }
.cover-link { display: block; }
.cover-link:hover .cover { box-shadow: 0 2px 10px rgba(0,0,0,.22); }
.book-hero { border-bottom: 0; padding-bottom: 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.group-top { display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: center; margin-bottom: 20px; }
.avg { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.avg-num { font-family: var(--head); font-weight: 700; font-size: 44px; line-height: 1; }
.spread { width: auto; min-width: 280px; }
.spread th, .spread td { border: 0; padding: 3px 8px 3px 0; font-weight: 500; }
.spread .n { color: var(--muted); text-align: right; }
.spread-bar { display: block; width: 180px; height: 10px; border-radius: 5px; background: var(--soft); overflow: hidden; }
.spread-fill { display: block; height: 100%; background: var(--accent); }
.raters { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.raters li { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.who-name { min-width: 140px; font-weight: 600; }

footer.site { border-top: 1px solid var(--line); }
footer .bar { font-size: 14px; color: var(--muted); }

@media (max-width: 560px) {
  .cover.big { flex-basis: 160px; width: 160px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .all-head h2 { font-size: 26px; }
}
