.marketplace-page { --market-radius: 18px; }
.market-header { display:flex; align-items:center; justify-content:space-between; gap:24px; flex-wrap:wrap; }
.market-eyebrow { color:var(--bs-secondary-color); font-size:.7rem; letter-spacing:.14em; font-weight:700; }
.market-type-tabs,.market-filter-chips { display:flex; flex-wrap:wrap; gap:8px; }
.market-type-tabs .btn { border-radius:999px; }
.market-filter,.market-card { border-radius:var(--market-radius); }
.market-card { overflow:hidden; transition:box-shadow .15s ease; }
.market-card:hover { box-shadow:0 8px 24px #112e2514; }
.market-gallery { position:relative; overflow:hidden; isolation:isolate; background:var(--bs-tertiary-bg); }
.market-gallery .biz-photo-track { aspect-ratio:4/3; }
.market-gallery img { display:block; width:100%; height:100%; object-fit:cover; }
.market-gallery-detail { border-radius:var(--market-radius); }
.market-gallery-detail .biz-photo-track { aspect-ratio:4/3; }
.market-gallery-detail img { object-fit:contain; background:var(--bs-tertiary-bg); }
.market-placeholder { display:flex!important; align-items:center; justify-content:center; flex-direction:column; gap:12px; color:var(--bs-secondary-color); background:var(--bs-tertiary-bg); }
.market-placeholder i { font-size:3rem; }
.market-sponsored { position:absolute; top:12px; left:12px; z-index:3; }
.market-card-title { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; min-height:2.6em; line-height:1.3; overflow-wrap:anywhere; }
.market-price { font-size:1.12rem; font-weight:750; line-height:1.4; }
.market-detail-price { font-size:1.65rem; font-weight:750; line-height:1.2; }
/* Listing page: one grid instead of stacked rows. Phone: photo, details, about, safety. From 992px the photo and "About" fill the left column
   and the details, seller and actions fill the right (about the same height); the safety box then spans both. The spare row absorbs any
   difference in height, so the photo and "About" always stay tight together. */
.market-detail { display:grid; grid-template-columns:minmax(0,1fr); gap:1.25rem; }
.market-detail-info { display:flex; flex-direction:column; gap:.85rem; min-width:0; align-self:start; }
.market-detail-info > * { flex:0 0 auto; } /* Bootstrap's .card-body is flex:1 1 auto: without this the cards swell to soak up any spare height */
.market-detail-warning > .market-warning { margin-top:0!important; }
.market-related { margin-top:2rem; }
@media(min-width:992px) {
 .market-detail { grid-template-columns:minmax(0,7fr) minmax(0,5fr); grid-template-rows:auto auto 1fr auto; column-gap:1.75rem; row-gap:1.25rem; }
 .market-detail-gallery { grid-column:1; grid-row:1; }
 .market-detail-about { grid-column:1; grid-row:2; }
 .market-detail-warning { grid-column:1 / -1; grid-row:4; }
 .market-detail-info { grid-column:2; grid-row:1 / span 3; }
}
@media(min-width:992px) and (max-width:1199.98px) { .market-detail { grid-template-columns:minmax(0,1fr) minmax(0,1fr); } } /* a narrower details column wraps taller: give it half the width */
.market-description { white-space:normal; overflow-wrap:anywhere; line-height:1.8; }
.market-upload-preview { aspect-ratio:4/3; object-fit:contain; border-radius:10px; background:var(--bs-tertiary-bg); }
.market-post-form { max-width:1000px; border-radius:var(--market-radius); padding:clamp(18px,3vw,32px); }
.market-filter-chips .badge { padding:10px 12px; font-size:.8rem; }
.marketplace-page summary { cursor:pointer; }
.marketplace-page :focus-visible { outline:3px solid var(--bs-primary); outline-offset:3px; }
.market-mobile-contact { display:none; }
@media(max-width:767px) { .market-mobile-contact { display:flex; flex-wrap:wrap; gap:8px; position:fixed; left:12px; right:12px; bottom:calc(78px + env(safe-area-inset-bottom)); z-index:1010; background:var(--bs-body-bg); padding:12px; border:1px solid var(--bs-border-color); border-radius:16px; box-shadow:0 5px 25px #102c2926; } .market-mobile-contact .btn { flex:1; } .marketplace-page.has-mobile-contact { padding-bottom:160px!important; } .market-header .display-6 { font-size:2rem; } }
@media(prefers-reduced-motion:reduce) { .market-card { transition:none; } }
.marketplace-page .min-w-0 { min-width:0; }

/* Marketplace upgrade: item-category chips, danger-button contrast */
.market-category-chips { display:flex; flex-wrap:nowrap; gap:8px; overflow-x:auto; padding-bottom:4px; scrollbar-width:thin; -webkit-overflow-scrolling:touch; }
.market-category-chips .btn { border-radius:999px; white-space:nowrap; flex:0 0 auto; }
.marketplace-page .btn-outline-danger { --bs-btn-color:#b02a37; --bs-btn-border-color:#b02a37; --bs-btn-hover-bg:#b02a37; --bs-btn-hover-border-color:#b02a37; --bs-btn-active-bg:#b02a37; --bs-btn-active-border-color:#b02a37; }
.market-type-tabs .btn { flex:0 1 auto; }

/* A card shows only what a buyer scans for: photo, price, title, place (one line each). The save heart sits on the photo. */
.market-card-body { padding:.6rem .75rem .75rem; }
.market-card .market-price { font-size:1.05rem; line-height:1.3; margin:0; }
.market-card .market-card-title { display:block; margin:2px 0 0; font-size:.95rem; font-weight:400; line-height:1.35; min-height:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.market-card .market-card-place { margin:2px 0 0; font-size:.8rem; line-height:1.3; color:var(--bs-secondary-color); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.market-save { position:absolute; top:8px; right:8px; z-index:4; margin:0; }
.market-save.btn, .market-save .btn { width:36px; height:36px; padding:0; border:0; display:inline-flex; align-items:center; justify-content:center; }
@media(pointer:coarse) { .market-save.btn, .market-save .btn { width:44px; height:44px; } }
@media(max-width:575.98px) { .market-card-body { padding:.5rem .6rem .6rem; } .market-card .market-price { font-size:1rem; } }

/* Grid: 2 across on a phone, 3, 4, then 6 on a wide screen. On a wide screen a sponsored listing that won a place is featured: it takes
   2 of the 6 columns (the ordinary listings fill the other 4 in the same row), laid out photo-left / details-right, and is no taller
   than they are. The grid's auto-placement does the rest, so 1, 2, 3 or more sponsored listings all fit without any extra rules. */
.market-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.75rem; }
.market-cell { min-width:0; }
@media(min-width:576px) { .market-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; } }
@media(min-width:992px) { .market-grid { grid-template-columns:repeat(4,minmax(0,1fr)); } }
@media(min-width:1200px) {
 .market-grid { grid-template-columns:repeat(6,minmax(0,1fr)); }
 .market-cell-featured { grid-column:span 2; }
 .market-cell-featured .market-card { flex-direction:row; border-color:#f0b429; box-shadow:0 6px 22px #f0b42933; }
 .market-cell-featured .market-gallery { flex:0 0 56%; min-height:170px; }
 .market-cell-featured .market-gallery .biz-photo-track { position:absolute; inset:0; aspect-ratio:auto; height:100%; }
 .market-cell-featured .market-card-body { flex:1 1 auto; min-width:0; display:flex; flex-direction:column; justify-content:center; padding:1rem; }
 .market-cell-featured .market-card .market-price { font-size:1.25rem; }
 .market-cell-featured .market-card .market-card-title { white-space:normal; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; font-size:1rem; }
}

/* Tighter, even vertical rhythm on the browse page so the first row of listings is in view sooner: no empty "active filters" strip, 10-16 px between blocks. */
.marketplace-page .market-header { margin-bottom:1rem!important; }
.marketplace-page .market-type-tabs, .marketplace-page .market-category-chips { margin-bottom:.65rem!important; }
.market-filter-chips:empty { display:none; }
.marketplace-page .market-warning { margin-bottom:1rem!important; }
