:root {
  --paper: #fdfbf7;
  --paper-deep: #f5f0e8;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --ink: #2d2a26;
  --muted: #6b6560;
  --muted-soft: #8a8580;
  --accent: #722f37;
  --accent-soft: rgba(114, 47, 55, 0.1);
  --line: #e8e2d9;
  --line-strong: #d4cec4;
  --shadow: 0 12px 32px rgba(45, 42, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
}

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

button,
input {
  font: inherit;
}

.admin-gear-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(247, 242, 230, 0.92);
  box-shadow: 0 18px 36px rgba(15, 18, 28, 0.16);
  color: var(--accent);
  backdrop-filter: blur(16px);
  z-index: 50;
}

.admin-gear-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.catalog-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
}

.catalog-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 12%, rgba(114, 47, 55, 0.08), transparent 18%),
    linear-gradient(rgba(114, 47, 55, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(114, 47, 55, 0.045) 1px, transparent 1px);
  background-size: auto, 60px 60px, 60px 60px;
  background-position: 0 0, 0 0, 0 0;
  opacity: 0.35;
  pointer-events: none;
}

.hero,
.catalog-main {
  position: relative;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 64px 0 32px;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 600;
}

.hero-pill svg,
.filter-label svg,
.metric-icon svg,
.search-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.hero-logo-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 12px;
}

.hero-logo {
  width: 120px;
  height: auto;
}

.hero h1,
.book-title {
  font-family: "Fraunces", serif;
}

.hero h1 {
  margin: 0;
  font-size: clamp(3.25rem, 7vw, 5.25rem);
  line-height: 0.92;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.hero h1 span {
  display: block;
  color: var(--accent);
}

.hero-copy {
  width: min(720px, 100%);
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
}

.metrics-strip {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 40px;
}

.metric-card {
  text-align: center;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: 0 4px 16px rgba(45, 42, 38, 0.08);
  color: var(--accent);
}

.metric-value {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 700;
}

.metric-label {
  margin: 4px 0 0;
  color: var(--muted-soft);
  font-size: 0.92rem;
}

.catalog-main {
  padding-bottom: 88px;
}

.filter-panel {
  padding: 28px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(232, 226, 217, 0.75);
  border-radius: 32px;
  box-shadow: var(--shadow);
}

.search-shell {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-soft);
}

.search-input {
  width: 100%;
  height: 58px;
  padding: 0 18px 0 50px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-input::placeholder {
  color: #a9a5a0;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(114, 47, 55, 0.12);
}

.filter-group + .filter-group {
  margin-top: 24px;
}

.filter-group {
  display: grid;
  gap: 12px;
}

.filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4a4743;
  font-size: 0.95rem;
  font-weight: 600;
}

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

.filter-chip,
.book-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: #5c574f;
  white-space: nowrap;
}

.filter-chip {
  padding: 8px 18px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.filter-chip:hover,
.filter-chip:focus-visible {
  transform: translateY(-1px);
  background: #f5f0e8;
  border-color: var(--line-strong);
  outline: none;
}

.filter-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.results-row {
  margin: 18px 0 16px;
}

.results-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.book-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 2px 10px rgba(45, 42, 38, 0.05);
  text-decoration: none;
  color: inherit;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.book-card:hover,
.book-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(45, 42, 38, 0.12);
  outline: none;
}

.book-title {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.05;
  font-weight: 600;
  transition: color 220ms ease;
}

.book-title-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.book-title-button:hover,
.book-title-button:focus-visible {
  color: var(--accent);
  outline: none;
}

.book-card:hover .book-title,
.book-card:focus-visible .book-title {
  color: var(--accent);
}

.book-author {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 300;
  letter-spacing: 0.02em;
}

.book-rating {
  width: fit-content;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f8f5ef;
  color: #5d584f;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.book-summary {
  margin: 14px 0 16px;
  color: #4a4743;
  font-size: 0.9rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.book-footer {
  margin-top: auto;
}

.book-year {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.book-chip {
  padding: 6px 12px;
  font-size: 0.74rem;
  font-weight: 600;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 48px 24px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.8rem;
  color: var(--ink);
}

.empty-state p {
  margin: 10px 0 0;
}

.detail-dialog {
  width: min(760px, calc(100% - 24px));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.detail-dialog::backdrop {
  background: rgba(26, 24, 21, 0.5);
  backdrop-filter: blur(10px);
}

.detail-sheet {
  position: relative;
  padding: 32px;
  border: 1px solid rgba(232, 226, 217, 0.92);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 64px rgba(45, 42, 38, 0.18);
}

.detail-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.detail-close:hover,
.detail-close:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.detail-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.detail-sheet h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 0.98;
  font-weight: 600;
}

.detail-author {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.detail-summary {
  margin: 20px 0 0;
  color: #433f3a;
  font-size: 1.02rem;
  line-height: 1.8;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.detail-meta-pill {
  display: grid;
  gap: 4px;
  min-width: 132px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(247, 243, 236, 0.9);
}

.detail-meta-label {
  color: var(--muted-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-meta-value {
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 600;
}

.detail-section {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 14px;
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
  font-weight: 600;
}

@media (max-width: 1120px) {
  .books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .hero,
  .catalog-main {
    width: min(100% - 24px, 1120px);
  }

  .hero {
    padding-top: 40px;
  }

  .hero-logo {
    width: 92px;
  }

  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-panel {
    padding: 22px;
    border-radius: 26px;
  }
}

@media (max-width: 620px) {
  .hero h1 {
    font-size: 2.9rem;
  }

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

  .books-grid {
    grid-template-columns: 1fr;
  }

  .chip-row {
    gap: 8px;
  }

  .filter-chip {
    padding-inline: 14px;
  }

  .detail-dialog {
    width: calc(100% - 16px);
  }

  .detail-sheet {
    padding: 24px;
    border-radius: 22px;
  }

  .detail-close {
    top: 14px;
    right: 14px;
  }

  .detail-meta {
    display: grid;
  }
}
