* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #222;
  background: #fafafa;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
a { color: #7a1f1f; text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header { background: #fff; border-bottom: 1px solid #e4e4e4; }
.site-header .wrap { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 14px 16px; }
.brand { display: flex; align-items: center; margin-right: auto; }
.brand img { display: block; height: 54px; width: auto; transition: opacity 0.15s ease; }
.brand:hover img { opacity: 0.8; }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav > a { color: #444; font-weight: 600; padding: 6px 10px; border-radius: 4px; }
.site-nav > a:hover { background: #f2ede6; text-decoration: none; }
.nav-dropdown { position: relative; }
.nav-dropdown summary {
  cursor: pointer; list-style: none; color: #444; font-weight: 600;
  padding: 6px 10px; border-radius: 4px; user-select: none;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after { content: ' \25BE'; }
.nav-dropdown[open] summary { background: #f2ede6; }
.nav-dropdown-menu {
  position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: #fff; border: 1px solid #e4e4e4; border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12); padding: 10px; z-index: 50;
  display: grid; grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 2px 16px;
  max-height: 70vh; max-width: calc(100vw - 32px); overflow: auto;
}
.nav-dropdown-menu a { display: block; padding: 4px 6px; border-radius: 4px; color: #333; font-size: 0.9rem; white-space: nowrap; }
.nav-dropdown-menu a:hover { background: #f6f1ea; text-decoration: none; }

.site-search { position: relative; flex: 1 1 200px; max-width: 320px; }
.site-search input {
  width: 100%; padding: 8px 14px; border: 1px solid #ccc; border-radius: 20px; font-size: 0.9rem;
}
.search-results {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 6px;
  background: #fff; border: 1px solid #e4e4e4; border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12); max-height: 70vh; overflow: auto; z-index: 60;
}
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: #222; }
.search-item:hover { background: #f6f1ea; text-decoration: none; }
.search-item img { width: 32px; height: 44px; object-fit: cover; border-radius: 3px; flex-shrink: 0; background: #eee; }
.search-empty { padding: 12px; color: #777; font-size: 0.9rem; }

@media (max-width: 560px) {
  .site-search { flex-basis: 100%; max-width: none; order: 3; }
}
@media (max-width: 420px) {
  .nav-dropdown-menu { grid-template-columns: 1fr; }
}

main.wrap { padding: 24px 16px 48px; min-height: 60vh; }

h1 { font-size: 1.5rem; margin: 0 0 16px; }

.book-grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px 16px;
}
.book-card { display: flex; flex-direction: column; }
.book-card-cover {
  display: block;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: #eee;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.book-card-cover:hover { transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.book-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-card-title {
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #222;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card-title:hover { text-decoration: underline; }

.pagination { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.page-num {
  min-width: 32px; height: 32px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 0.9rem;
  color: #444;
}
a.page-num:hover { background: #eee; text-decoration: none; }
.page-current { background: #7a1f1f; color: #fff; font-weight: 700; }
.page-ellipsis { color: #999; padding: 0 4px; }

.back { margin-bottom: 16px; }
.book-detail { display: flex; gap: 32px; flex-wrap: wrap; background: #fff; padding: 20px; border-radius: 6px; }
.book-cover { flex: 0 1 auto; max-width: 100%; }
.book-cover img {
  width: auto; height: auto; max-width: 756px; max-height: 1008px;
  border-radius: 4px; display: block; box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
@media (max-width: 480px) {
  .book-cover img { max-width: 100%; }
}
.book-info { flex: 1 1 320px; min-width: 280px; }
.book-info h1 { margin-top: 0; }
.book-meta { color: #666; font-size: 0.9rem; margin-bottom: 16px; }
.book-description p { line-height: 1.5; }

.contact-card { display: flex; gap: 32px; flex-wrap: wrap; background: #fff; padding: 20px; border-radius: 6px; }
.contact-gallery { display: flex; flex-wrap: wrap; gap: 12px; flex: 0 1 auto; max-width: 728px; }
.contact-gallery img {
  width: auto; height: auto; max-width: 510px; max-height: 510px;
  border-radius: 6px; display: block; box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.contact-info { flex: 1 1 260px; min-width: 240px; }
.contact-info p { font-size: 1.05rem; line-height: 1.8; }
.whatsapp-link {
  display: inline-block; background: #25d366; color: #fff; padding: 10px 18px;
  border-radius: 20px; font-weight: 600;
}
.whatsapp-link:hover { background: #1ebe5a; text-decoration: none; }

.empty { color: #777; }

.site-footer { border-top: 1px solid #e4e4e4; color: #999; font-size: 0.85rem; padding: 16px 0; margin-top: 32px; }

@media (max-width: 400px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px 10px; }
}
