/* Section navigation and whole-object presentation. Book cover rules stay in style.css. */
.catalog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.catalog-context {
  font-size: 0.75rem;
  color: var(--muted);
}
.catalog-heading h1 {
  font-size: 1.5rem;
  margin: 0;
}
.section-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line, var(--line));
  margin: 4px 0;
}
.section-tabs button {
  flex: 1;
  min-height: 44px;
  border: 0;
  background: transparent;
  border-radius: 0;
  font-weight: 600;
}
.section-tabs button[aria-current="page"] {
  color: var(--brand);
  box-shadow: inset 0 -3px var(--brand);
  background: var(--brand-soft);
}
.section-tabs button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.catalog-empty {
  padding: 16px 0;
  max-width: 620px;
}
.catalog-empty h2 {
  font-size: 1.1rem;
  margin: 0 0 8px;
}
.catalog-empty p {
  margin: 8px 0 12px;
}
.capture-section {
  max-width: 280px;
  margin: 8px 0;
}
.listing-section {
  font-size: 0.75rem;
  color: var(--muted);
}
.object-card {
  height: auto;
  align-self: start;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}
.object-card.is-owned {
  background: var(--brand-soft);
  border-color: var(--line-strong);
}
.object-media {
  position: relative;
}
.object-photo {
  width: 100%;
  height: 190px;
  display: block;
  overflow: hidden;
  padding: 8px;
  border: 0;
  background: var(--surface-subtle);
  border-radius: 0;
}
.object-photo img {
  display: block;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  width: 100%;
  object-fit: contain;
}
.object-card .book-info {
  height: auto;
  width: auto;
  padding: 12px;
  margin: 0;
}
.object-card .book-title {
  display: block;
}
.object-card h2 {
  margin: 3px 0;
  font-size: 1rem;
}
.object-card .book-info p {
  margin: 4px 0;
}
.object-card .book-actions {
  flex-wrap: wrap;
  gap: 6px;
}
.object-card .book-actions button {
  min-height: 44px;
}
.object-detail {
  clear: both;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  max-width: 100%;
}
.object-detail .book-actions {
  flex-wrap: wrap;
}
.object-detail .book-actions button,
.book-detail .detail-actions button {
  flex: 1 1 180px;
  white-space: nowrap;
}
/* Personal dual-currency totals need room alongside the pickup identity. */
.pickup-card .pickup-card-head {
  height: auto;
  flex-wrap: wrap;
}
.pickup-card-head > div {
  min-width: 0;
}
.pickup-total {
  max-width: 100%;
  white-space: normal;
}
.object-gallery {
  min-width: 0;
}
.object-detail .detail-cover {
  width: 100%;
  height: 360px;
  max-width: 100%;
  object-fit: contain;
  box-shadow: none;
  transform: none;
  background: var(--surface-subtle);
}
.photo-thumbnails {
  display: flex;
  gap: 6px;
  overflow: auto;
  margin: 8px 0;
}
.photo-thumbnails button {
  width: 60px;
  height: 60px;
  flex: none;
  padding: 2px;
}
.photo-thumbnails img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.object-description,
.object-facts dd {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.object-facts {
  display: grid;
  gap: 10px;
  font-size: 0.9rem;
}
.object-facts dt {
  font-weight: 600;
}
.object-facts dd {
  margin: 2px 0 0;
}
.object-review-photos .flow-saved-photos img {
  object-fit: contain;
  width: 120px;
  height: 90px;
}
.object-review-photos .flow-saved-photos {
  margin: 8px 0;
}
@media (max-width: 600px) {
  .pickup-card-head .pickup-total {
    flex-basis: 100%;
    padding-top: 0;
  }
  .object-detail {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .object-detail .detail-cover {
    height: 230px;
  }
  .object-photo {
    height: 150px;
  }
  .catalog-context {
    font-size: 0.75rem;
    color: var(--muted);
  }
  .catalog-heading h1 {
    font-size: 1.3rem;
  }
  .object-card .book-info {
    padding: 10px;
  }
}

/* Browse controls are one compact row, wrapping into two on phones. */
.catalog .search-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px minmax(150px, 200px) auto auto;
  gap: 8px;
}
.catalog .search-row > [name="sort"] {
  min-width: 0;
  width: 100%;
}
.catalog .catalog-community {
  width: auto;
  margin: 0;
  min-width: 0;
  font-size: 0;
}
.catalog .catalog-community select {
  width: 100%;
  min-width: 0;
  max-width: none;
  font-size: 0.8rem;
  min-height: 44px;
}
.catalog .catalog-meta {
  margin: 4px 0;
  min-height: 20px;
  height: auto;
  max-height: none;
  font-size: 0.8rem;
}
.catalog .catalog-meta .reset-link {
  min-height: 20px;
  padding: 0 4px;
}
.catalog .catalog-browse-row {
  grid-column: 1/-1;
  margin: 0;
}
.catalog .filter-panel .genre-row {
  flex-wrap: wrap;
}
.catalog .genre-row[hidden] {
  display: none;
}
.catalog .filter-panel[hidden] {
  display: none;
}
.catalog:has(.catalog-empty) .pagination:empty {
  display: none;
}
.object-card .object-photo {
  flex: none;
}
.inventory-grid .object-card {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
  padding: 12px !important;
}
.inventory-grid .object-photo {
  width: 100px;
  height: 100px;
}
.inventory-grid .object-card .book-info {
  padding: 0;
}
.seller-basket-books .object-card {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
}
.seller-basket-books .object-card .book-cover img {
  object-fit: contain;
  transform: none;
  box-shadow: none;
}
@media (max-width: 600px) {
  .catalog .search-row {
    grid-template-columns: 104px minmax(0, 1fr) 44px 44px;
  }
  .catalog .search-field {
    grid-column: 1 / span 2;
    grid-row: 1;
  }
  .catalog .search-row > [name="sort"] {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-height: 44px;
  }
  .catalog .catalog-community {
    grid-column: 2 / -1;
    grid-row: 2;
  }
  .catalog #filter-toggle {
    grid-column: 3;
    grid-row: 1;
    width: 44px;
    padding: 8px;
  }
  .catalog #filter-toggle span {
    display: none;
  }
  .catalog #toggle-layout {
    grid-column: 4;
    grid-row: 1;
  }
  .catalog .catalog-meta .reset-link {
    min-height: 44px;
  }
  .catalog .catalog-meta {
    margin: 6px 0;
  }
  .catalog .catalog-community select {
    min-height: 44px;
  }
  .catalog .section-tabs button {
    padding: 8px;
  }
  .inventory-grid .object-card {
    grid-template-columns: 80px minmax(0, 1fr);
  }
  .inventory-grid .object-photo {
    width: 80px;
    height: 80px;
  }
}
.terms-copy {
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.6;
  padding: 12px;
  border: 1px solid var(--line);
}
#terms-dialog {
  width: min(850px, calc(100% - 24px));
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  --cover-height: 220px;
  --info-height: 130px;
  --row-height: 350px;
}
.listing-grid .book-card {
  min-width: 0;
}
.listing-grid .object-photo {
  height: 220px;
}
@media (max-width: 600px) {
  .listing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .listing-grid .object-photo {
    height: 160px;
  }
}
@media (max-width: 350px) {
  .listing-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .listing-grid .object-photo {
    height: 210px;
  }
}

.object-research { padding: 16px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--brand-soft); }
.object-research h3 { margin: 0 0 8px; }
.object-research > p { font-size: 13px; margin: 8px 0 12px; }
.object-research > .flow-help { margin-bottom: 0; font-size: 12px; }
#capture-manual { margin-top: 12px; }
.capture-context {
  margin-top: 18px;
}

/* Thumbnail geometry belongs to the section, never the uploaded image. */
.shelves:not(.list-view) .book-cover {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #e9e5dc;
}
.shelves:not(.list-view) .book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  filter: none;
}
.shelves:not(.list-view) .book-cover:hover img { transform: none; }
.shelves:not(.list-view) .book-cover .cover-fallback { width: 100%; height: 100%; }
.listing-grid .object-photo {
  height: auto;
  aspect-ratio: 4 / 3;
  flex-shrink: 0;
  position: relative;
}
.listing-grid .object-photo img {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
  object-position: center;
}

/* Owner-only activity shares one compact treatment across all listing kinds. */
.inventory-grid .book-info { height: auto; min-height: 112px; }
.listing-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.listing-metrics > div { display: flex; flex-direction: column-reverse; gap: 1px; }
.listing-metrics dt { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.listing-metrics dd { margin: 0; font-size: 0.9rem; font-weight: 650; color: var(--brand); font-variant-numeric: tabular-nums; }
.metrics-help { margin: 0 0 12px; font-size: 0.78rem; color: var(--muted); }
.metrics-help summary { cursor: pointer; width: fit-content; padding: 5px 0; }
.metrics-help p { max-width: 680px; margin: 6px 0; }
.skeleton-metrics { display: flex; gap: 12px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 10px; }
.skeleton-metrics .skeleton-block { height: 32px; }
.skeleton-metrics .skeleton-block { flex: 1; width: 0; min-width: 0; }

.currency-settings { margin: 0; padding: 0; border: 0; min-width: 0; }
.currency-settings:disabled { opacity: .75; }
.price-entry { min-width: 0; }
.price-entry-control { display: flex; gap: 6px; margin-top: 4px; }
.price-entry-control input { flex: 1; min-width: 0; width: 100%; margin: 0; }
.price-entry-control select { flex: 0 0 88px; width: 88px; margin: 0; }
.price-community-label { margin-top: 8px; font-size: .75rem; }
.price-community-label select { font-size: .8rem; width: 100%; }
.price-entry .price-conversion { font-size: .75rem; margin: 6px 0 0; }
@media (max-width: 600px) {
  .form-grid > .price-entry,
  .review-decisions > .price-entry { grid-column: 1 / -1; }
}
