:root {
  color: #1c2321;
  background: #f4f1ea;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #1c2321;
  --muted: #606a66;
  --line: #ded8cf;
  --paper: #fffdfa;
  --soft: #f4f1ea;
  --sage: #24564a;
  --sage-dark: #173a33;
  --clay: #9c4f3f;
  --blue: #344c63;
  --gold: #b98b49;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 750;
  cursor: pointer;
}

#app {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.page-shell {
  display: grid;
  gap: 18px;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 4px;
}

.nav-brand {
  min-height: 0;
  padding: 0;
  background: transparent;
}

.nav-brand img {
  display: block;
  width: 168px;
  height: auto;
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
}

.nav-link {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.nav-link.active {
  background: var(--sage-dark);
  color: #fff;
}

.home-hero,
.picture-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 24px;
  align-items: stretch;
  padding: 28px 0 10px;
}

.home-copy,
.picture-copy,
.home-feature-panel,
.picture-preview,
.brand-block,
.search-panel,
.buying-guide,
.book-card,
.modal-panel,
.collection-panel,
.roadmap-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.home-copy,
.picture-copy,
.home-feature-panel,
.picture-preview {
  padding: 24px;
}

.home-copy,
.picture-copy {
  display: grid;
  align-content: center;
  gap: 14px;
}

.home-logo {
  display: block;
  width: min(260px, 62vw);
  margin: 0 auto 18px;
  border-radius: 8px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.collection-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 20px;
}

.collection-panel h2,
.featured-section h2,
.picture-preview h2 {
  margin: 0;
}

.collection-panel p,
.picture-preview p,
.mini-book p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.featured-section {
  display: grid;
  gap: 12px;
}

.section-heading,
.results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.featured-books {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.mini-book {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
}

.mini-book img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #e8e3da;
}

.mini-book h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.25;
}

.picture-preview {
  display: grid;
  align-content: center;
  gap: 12px;
  background: #f9f4ec;
}

.picture-mark {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border: 1px solid #dbc7ad;
  border-radius: 50%;
  color: var(--sage-dark);
  background: #fffdfa;
  font-family: Georgia, serif;
  font-size: 3rem;
}

.picture-roadmap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.roadmap-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 16px;
}

.roadmap-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.store-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 24px;
  align-items: stretch;
  padding: 4px 0 0;
}

.brand-block {
  padding: 24px;
}

.brand-logo {
  display: block;
  width: min(210px, 54vw);
  height: auto;
  margin: 0 0 16px;
  border-radius: 6px;
}

.eyebrow,
.book-category,
.result-count,
.format-label {
  margin: 0;
  color: var(--clay);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  max-width: 780px;
  font-size: clamp(2.35rem, 5vw, 4.7rem);
  line-height: 1.01;
  letter-spacing: 0;
}

.store-intro {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.search-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.search-label {
  font-size: 0.84rem;
  font-weight: 800;
}

#catalog-search {
  width: 100%;
  min-height: 46px;
  border: 1px solid #c9c3ba;
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
}

.store-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 6px;
  background: #eef3f1;
}

.stat strong {
  color: var(--sage-dark);
  font-size: 1.05rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.2;
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 0;
}

.tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fffdfa;
  color: var(--ink);
}

.tab.active {
  background: var(--sage-dark);
  color: #fff;
}

.catalog-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.buying-guide {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.buying-guide h2,
.results-heading h2 {
  margin: 0;
  font-size: 1.1rem;
}

.guide-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.step-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.guide-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.catalog-results {
  min-width: 0;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.book-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.book-card:hover,
.book-card:focus-visible,
.mini-book:hover {
  border-color: #b8aa9c;
  box-shadow: 0 16px 34px rgba(31, 35, 33, 0.12);
  transform: translateY(-2px);
  outline: none;
}

.cover-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e8e3da;
}

.book-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.book-card h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.25;
}

.subtitle {
  min-height: 3.9em;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.format-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.format-pill {
  border: 1px solid #d9d0c7;
  border-radius: 999px;
  padding: 4px 8px;
  color: #47504d;
  background: #faf7f0;
  font-size: 0.72rem;
  font-weight: 750;
}

.book-footer,
.card-actions,
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.book-footer {
  justify-content: space-between;
}

.price,
.detail-price {
  color: var(--sage-dark);
  font-size: 1.12rem;
}

.text-button {
  min-height: 34px;
  padding: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
}

.card-actions,
.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.primary-button {
  background: var(--sage-dark);
  color: #fff;
}

.secondary-button {
  background: #e9dfd3;
  color: var(--sage-dark);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed #c9c3ba;
  border-radius: 8px;
  color: var(--muted);
  background: #fffdfa;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(28, 35, 33, 0.72);
}

.modal-panel {
  width: min(1080px, 100%);
  max-height: min(92vh, 900px);
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
}

.close-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  background: var(--ink);
  color: #fff;
  font-size: 1.1rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 22px;
  max-height: calc(92vh - 70px);
  overflow: auto;
  padding: 18px;
}

.detail-cover {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: #e8e3da;
}

.preview-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.preview-strip img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
}

.detail-info {
  display: grid;
  align-content: start;
  gap: 12px;
}

.detail-info h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.1;
}

.detail-subtitle,
.detail-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.highlight-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: #3e4744;
  line-height: 1.45;
}

.purchase-box {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f6f0;
}

.preview-panel {
  width: min(1120px, 100%);
}

.preview-pages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  max-height: calc(92vh - 70px);
  overflow: auto;
  padding: 16px;
  background: #f4f1ea;
}

.preview-page {
  margin: 0;
  display: grid;
  gap: 8px;
}

.preview-page img {
  width: 100%;
  display: block;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(31, 35, 33, 0.12);
}

.preview-page figcaption {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.checkout-panel {
  width: min(560px, 100%);
}

.checkout-message {
  display: grid;
  gap: 10px;
  padding: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.checkout-message p {
  margin: 0;
}

@media (max-width: 900px) {
  .home-hero,
  .picture-hero,
  .store-header,
  .catalog-shell,
  .detail-layout,
  .collection-grid,
  .picture-roadmap {
    grid-template-columns: 1fr;
  }

  .buying-guide {
    position: static;
  }

  .featured-books {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #app {
    width: min(100% - 20px, 1240px);
    padding-top: 10px;
  }

  .site-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-brand img {
    width: 148px;
  }

  .home-hero,
  .picture-hero,
  .store-header {
    gap: 12px;
    padding-top: 4px;
  }

  .home-copy,
  .picture-copy,
  .home-feature-panel,
  .picture-preview,
  .brand-block,
  .search-panel,
  .buying-guide {
    padding: 14px;
  }

  .store-stats,
  .featured-books {
    grid-template-columns: 1fr;
  }

  .books-grid {
    grid-template-columns: 1fr;
  }

  .book-card {
    grid-template-columns: 116px minmax(0, 1fr);
    grid-template-rows: auto;
  }

  .cover-wrap {
    height: 100%;
    min-height: 188px;
  }

  .book-body {
    padding: 12px;
  }

  .subtitle {
    min-height: 0;
  }

  .card-actions,
  .detail-actions {
    grid-template-columns: 1fr;
  }

  .preview-pages {
    grid-template-columns: 1fr;
  }
}
