:root {
  --paper: #fbfaf7;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #666666;
  --accent: #111111;
  --line: #e8e5de;
  --shadow: 0 10px 30px rgba(18, 18, 18, 0.04);
  --radius: 18px;
  --radius-small: 12px;
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Instrument Sans", sans-serif;
  background: #f6f4ef;
  color: var(--ink);
}

body {
  margin: 0;
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.page-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 40px;
}

.site-header,
.catalog-shell,
.section-block,
.book-page,
.site-footer {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
  padding: 14px 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand strong,
.site-nav a,
h1,
h2,
h3 {
  font-family: "Instrument Sans", sans-serif;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f08f57;
  color: white;
  font-weight: 800;
}

.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.site-nav a:hover,
.text-link:hover {
  color: var(--accent);
}

.catalog-shell {
  padding: 14px;
}

.filters {
  display: grid;
  grid-template-columns: 2fr repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.compact {
  grid-template-columns: 2.4fr repeat(3, minmax(140px, 1fr));
}

.filters input,
.filters select {
  min-height: 44px;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fcfcfb;
  padding: 0 14px;
  font: inherit;
}

.results-meta {
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.92rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.book-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.book-cover {
  aspect-ratio: 0.78;
  width: 100%;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f2f2ee;
}

.placeholder {
  display: grid;
  place-items: center;
  padding: 22px;
  text-align: center;
  font-weight: 700;
  color: #444;
}

.book-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
  letter-spacing: -0.025em;
}

.book-author {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.93rem;
}

.hero-author {
  font-size: 1rem;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f3f1ec;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
}

.chip-secondary {
  background: #f7f6f2;
}

.book-card-actions,
.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.button-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.text-link {
  font-weight: 700;
  color: var(--ink);
}

.section-block {
  margin-top: 16px;
  padding: 20px;
}

.pill-grid,
.author-grid {
  display: grid;
  gap: 14px;
}

.pill-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.author-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.pill-card,
.author-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.pill-card.large {
  min-height: 100px;
  align-content: end;
}

.pill-card span,
.author-card span {
  color: var(--muted);
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.page-heading h1,
.book-page h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
  margin: 0;
}

.page-heading p,
.book-description,
.detail-note,
.site-footer p {
  color: var(--muted);
  line-height: 1.6;
}

.page-heading p {
  margin: 0;
  white-space: nowrap;
}

.book-page {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 28px;
  padding: 20px;
}

.book-page-copy {
  display: grid;
  align-content: start;
  gap: 14px;
}

.book-cover-large {
  min-height: 420px;
}

.book-description {
  font-size: 0.98rem;
  margin: 0;
  line-height: 1.72;
  white-space: pre-line;
}

.related-section h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.site-footer {
  display: block;
  margin-top: 16px;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 960px) {
  .book-page,
  .compact,
  .filters {
    grid-template-columns: 1fr;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1400px);
  }

  .catalog-shell,
  .section-block,
  .book-page,
  .site-footer {
    padding: 14px;
  }
}
