@font-face {
  font-family: 'Noto Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/noto-sans-latin-variable.woff2') format('woff2');
}

@font-face {
  font-family: 'Noto Sans';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/noto-sans-latin-variable-italic.woff2') format('woff2');
}

:root {
  --paper: #ffffff;
  --paper-light: #ffffff;
  --paper-deep: #f2f2f0;
  --ink: #171717;
  --ink-muted: #666666;
  --line: #e5e5e3;
  --accent: #171717;
  --accent-dark: #333333;
  --success: #35634a;
  --danger: #a1372d;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Noto Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'SFMono-Regular', Consolas, monospace;
  --container: 88rem;
  --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-underline-offset: 0.22em; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 0.18rem solid var(--accent); outline-offset: 0.2rem; }
[hidden] { display: none !important; }
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: var(--paper-light);
  transform: translateY(-160%);
  transition: transform 180ms ease;
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  width: min(calc(100% - 3rem), var(--container));
  margin: 0 auto;
  padding: 1.25rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 0.85rem; align-items: center; text-decoration: none; }
.brand img { width: 5.3rem; height: auto; object-fit: contain; }
.brand span { font: 600 0.76rem/1 var(--sans); letter-spacing: 0.15em; text-transform: uppercase; }
.site-header nav { display: flex; gap: clamp(1rem, 3vw, 2.6rem); align-items: center; }
.site-header nav a { min-height: 2.75rem; display: inline-flex; align-items: center; font-size: 0.86rem; font-weight: 600; text-decoration: none; }

main { overflow: clip; }
.eyebrow {
  margin: 0 0 1.2rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.catalog {
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(18rem, 0.28fr) minmax(0, 1fr);
  min-height: 55rem;
}
.filters {
  padding: clamp(2rem, 4vw, 4rem) clamp(1.5rem, 3vw, 3.5rem);
  border-right: 1px solid var(--line);
  background: #fafafa;
}
.section-heading h1 {
  margin: 0 0 2.5rem;
  font: 500 clamp(2rem, 3vw, 2.75rem)/1 var(--sans);
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.search-form { display: grid; gap: 1.25rem; }
.field { display: grid; gap: 0.5rem; }
.field label { color: var(--ink-muted); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.field input {
  width: 100%;
  padding: 0.8rem 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-muted);
  border-radius: 0;
}
.field input::placeholder { color: #6f6f6f; opacity: 1; }
.field input:focus { border-color: var(--accent); outline: 0; box-shadow: 0 1px 0 var(--accent); }
.field-main input { font: 400 1rem/1.4 var(--sans); }
.advanced-filters { padding: 0.3rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced-filters summary { padding: 0.75rem 0; cursor: pointer; font-size: 0.86rem; font-weight: 600; }
.advanced-fields { padding: 0.8rem 0 1.1rem; display: grid; gap: 1.25rem; }
.button {
  min-height: 2.9rem;
  padding: 0.72rem 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}
.button:hover { background: var(--ink); color: var(--paper-light); }
.button:active { transform: translateY(1px) scale(0.99); }
.button-primary { color: var(--paper-light); background: var(--accent); border-color: var(--accent); }
.search-form > .button-primary { margin-top: 0.6rem; }
.button-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button:disabled, .button[aria-disabled='true'] { opacity: .48; cursor: not-allowed; transform: none; }
.button:disabled:hover, .button[aria-disabled='true']:hover { background: transparent; color: var(--ink); }
.text-button { min-height: 2.75rem; justify-self: start; display: inline-flex; align-items: center; padding: 0.55rem 0; border: 0; background: none; color: var(--ink-muted); cursor: pointer; text-decoration: underline; text-underline-offset: 0.25rem; }
.text-button:hover { color: var(--accent); }

.results-region { padding: clamp(2rem, 4vw, 4rem) clamp(1.5rem, 3vw, 3.5rem) 5rem; }
.results-header { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2.5rem; }
.results-header p { margin: 0; font: 600 0.78rem/1 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.results-rule { height: 1px; flex: 1; background: var(--line); }
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(2.5rem, 4vw, 5rem) clamp(1.3rem, 2.5vw, 3rem);
}
.book-card { min-width: 0; animation: enter 500ms both cubic-bezier(.2,.7,.2,1); }
.entry-1 { animation-delay: 45ms; }
.entry-2 { animation-delay: 90ms; }
.entry-3 { animation-delay: 135ms; }
.entry-4 { animation-delay: 180ms; }
.entry-5 { animation-delay: 225ms; }
.entry-6 { animation-delay: 270ms; }
.entry-7 { animation-delay: 315ms; }
.entry-8 { animation-delay: 360ms; }
.book-card:nth-child(3n+2) { margin-top: 0; }
.book-cover { position: relative; margin: 0 0 1.35rem; aspect-ratio: 0.76; overflow: hidden; background: var(--paper-deep); border: 1px solid var(--line); box-shadow: none; }
.book-cover::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(32,32,30,.1); pointer-events: none; }
.book-cover picture { display: block; width: 100%; height: 100%; }
.book-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.book-kicker { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0 0 0.55rem; color: var(--accent); font: 600 0.68rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.book-title { margin: 0; font: 500 clamp(1.15rem, 1.6vw, 1.5rem)/1.2 var(--sans); letter-spacing: -0.02em; text-wrap: balance; }
.book-author { margin: 0.7rem 0 0; color: var(--ink-muted); font-size: 0.9rem; }
.book-detail { margin-top: 1rem; border-top: 1px solid var(--line); }
.book-detail summary { min-height: 2.75rem; display: flex; align-items: center; padding: 0.72rem 0; cursor: pointer; font-size: 0.76rem; font-weight: 700; }
.book-detail-body { padding: 0.3rem 0 1.2rem; }
.book-description { max-width: 65ch; color: var(--ink-muted); font-family: var(--sans); font-size: 0.9rem; }
.book-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8rem; margin: 1rem 0; }
.book-meta-item dt { color: var(--ink-muted); font-size: 0.65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.book-meta-item dd { margin: .1rem 0 0; font: 0.76rem/1.3 var(--mono); overflow-wrap: anywhere; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 1rem 0 0; list-style: none; }
.tag-list li { padding: .25rem .5rem; border: 1px solid var(--line); font-size: .68rem; }

.pagination { margin-top: 5rem; display: flex; justify-content: center; flex-wrap: wrap; gap: 0.4rem; }
.page-button { min-width: 2.75rem; height: 2.75rem; padding: 0 0.7rem; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.page-button:hover:not(:disabled), .page-button.is-current { color: var(--paper-light); background: var(--ink); border-color: var(--ink); }
.page-button:disabled { opacity: 0.38; cursor: not-allowed; }
.page-gap { align-self: center; padding: 0 .35rem; }
.empty-state, .error-state { max-width: 38rem; margin: 5rem auto; padding: 3rem; border: 1px solid var(--line); text-align: center; }
.empty-state h2, .error-state h2 { margin: 0 0 1rem; font: 400 2rem/1.1 var(--serif); }

.skeleton { display: block; background: var(--paper-deep); animation: pulse 1.3s ease-in-out infinite alternate; }
.skeleton-cover { aspect-ratio: .76; margin-bottom: 1.35rem; }
.skeleton-line { height: .8rem; margin-top: .65rem; }
.skeleton-line-short { width: 38%; }
.site-footer { padding: 2rem max(1.5rem, calc((100vw - var(--container)) / 2)); background: var(--paper); color: var(--ink-muted); border-top: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; font-size: .82rem; }
.site-footer p { margin: 0; max-width: 36rem; }

@keyframes enter { from { opacity: 0; transform: translateY(1rem); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { to { opacity: .5; } }

@media (max-width: 70rem) {
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-card:nth-child(3n+2) { margin-top: 0; }
  .book-card:nth-child(even) { margin-top: 0; }
}
@media (max-width: 52rem) {
  .site-header { width: min(calc(100% - 2rem), var(--container)); align-items: flex-start; }
  .site-header nav { gap: .8rem; flex-direction: column; align-items: flex-end; }
  .catalog { grid-template-columns: 1fr; }
  .filters { border-right: 0; border-bottom: 1px solid var(--line); }
  .section-heading h1 { margin-bottom: 2rem; }
}
@media (max-width: 36rem) {
  .brand span { display: none; }
  .book-grid { grid-template-columns: 1fr; gap: 3.5rem; }
  .book-card:nth-child(even) { margin-top: 0; }
  .results-region, .filters { padding-left: 1rem; padding-right: 1rem; }
  .site-footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
