/* RentWorks Marketplace pages (/marketplace/ and /marketplace/property/...).
   Loaded only on those pages, after site.css; uses its tokens. No animation. */

.mp-detail [hidden], .mp-results-section [hidden], .mp-search-wrap [hidden] { display: none !important; }

/* ---------- Search ---------- */
.mp-hero { padding-bottom: clamp(24px, 3vw, 36px); }
.mp-hero + section { border-top: 0; }
.mp-search-wrap { padding-bottom: 8px; }
.mp-search {
  display: grid; grid-template-columns: 2fr repeat(3, minmax(0, 1fr)); gap: 14px 16px; align-items: end;
  padding: 20px; background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--r);
}
.mp-search .field label { font-size: .8125rem; }
.mp-search input, .mp-search select { min-height: 46px; }
.mp-search-actions { display: flex; align-items: center; gap: 16px; }
.mp-search-actions .btn { flex: 1; }
.mp-reset { font-size: .875rem; }

.mp-results-section { padding-top: clamp(28px, 4vw, 44px); }
.mp-results-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.mp-count { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin: 0; }
.mp-sort { min-width: 200px; }
.mp-sort label { font-size: .8125rem; }
.mp-note { padding: 16px 18px; background: var(--soft); border-radius: var(--r); color: var(--text); }

.mp-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.mp-card { min-width: 0; }
.mp-card-link {
  display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff;
}
.mp-card-link:hover { border-color: var(--brand-200); color: inherit; }
.mp-card-link:hover .mp-card-title { color: var(--brand); }
.mp-card-photo { position: relative; aspect-ratio: 3 / 2; background: var(--soft); display: grid; place-items: center; color: var(--muted); }
.mp-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.mp-card-photo .icon { width: 40px; height: 40px; }
.mp-card-count { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--r-sm); background: rgba(14,12,20,.72); color: #fff; font-size: .75rem; font-weight: 500; }
.mp-card-body { padding: 14px 16px 16px; }
.mp-card-rent { margin: 0 0 4px; font-weight: 700; color: var(--ink); font-size: 1.15rem; letter-spacing: -.01em; }
.mp-card-title { font-size: 1rem; line-height: 1.35; margin: 0 0 6px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.mp-card-place, .mp-card-facts { margin: 0; font-size: .875rem; color: var(--muted); }

.mp-pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 32px; }
.mp-page { min-width: 44px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); text-align: center; text-decoration: none; font-weight: 500; color: var(--ink); }
.mp-page:hover { border-color: var(--brand); color: var(--brand); }
.mp-page.is-current { background: var(--brand); border-color: var(--brand); color: #fff; }

.mp-safety { margin-top: 40px; padding: 18px 20px; border-left: 3px solid var(--brand); background: var(--soft); border-radius: 0 var(--r) var(--r) 0; }
.mp-safety h2 { font-size: 1.05rem; letter-spacing: -.01em; margin-bottom: 8px; }
.mp-safety ul, .mp-safety p { margin: 0; font-size: .9375rem; }
.mp-safety li + li { margin-top: 4px; }

.mp-landlords { background: var(--brand-50); }
.mp-landlords-inner { display: grid; grid-template-columns: minmax(0, 1.6fr) auto; gap: 32px; align-items: center; }
.mp-landlords h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
.mp-landlords p { margin: 0; color: var(--muted); max-width: 640px; }

/* ---------- Advert ---------- */
.mp-detail { padding-top: 24px; padding-bottom: var(--section); }
.mp-back { margin: 0 0 18px; }
.mp-back-icon { transform: scaleX(-1); }
.mp-gallery { margin-bottom: 28px; }
/* Full width; the height follows the width up to a cap, and photos of any shape fit inside. */
.mp-gallery-main { margin: 0; width: 100%; height: min(60vw, 600px); background: var(--soft); border-radius: var(--r); overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.mp-gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.mp-gallery.is-empty .mp-gallery-main { height: min(30vw, 240px); }
.mp-gallery-main .icon { width: 56px; height: 56px; }
/* A photo that could not be loaded: the placeholder replaces it (no broken-image icon). */
.mp-gallery-main .mp-photo-fallback { display: none; }
.mp-gallery-main.is-broken img { display: none; }
.mp-gallery-main.is-broken .mp-photo-fallback { display: block; }
.mp-thumbs { list-style: none; margin: 10px 0 0; padding: 0; display: flex; gap: 8px; overflow-x: auto; }
.mp-thumb { display: block; padding: 0; border: 2px solid transparent; border-radius: var(--r-sm); background: none; cursor: pointer; }
.mp-thumb img { width: 96px; height: 64px; object-fit: cover; border-radius: 2px; }
.mp-thumb[aria-current="true"] { border-color: var(--brand); }
.mp-thumb.is-empty { width: 100px; height: 68px; display: grid; place-items: center; background: var(--soft); color: var(--muted); }
.mp-thumb.is-empty .icon { width: 24px; height: 24px; }

.mp-columns { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: clamp(28px, 4vw, 56px); align-items: start; }
.mp-type { margin: 0 0 6px; font-size: .8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.mp-title-block h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: 10px; overflow-wrap: anywhere; }
.mp-location { display: flex; gap: 6px; align-items: flex-start; margin: 0 0 10px; color: var(--muted); }
.mp-location .icon { width: 20px; height: 20px; margin-top: 2px; }
.mp-rent { font-size: 1.6rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; margin: 0 0 24px; }

/* Each fact draws its own right and bottom divider (the outer ones are clipped by the border),
   so a part-filled last row stays white instead of showing grey empty boxes. */
.mp-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 32px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.mp-fact { padding: 12px 14px; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.mp-fact dt { font-size: .8125rem; color: var(--muted); }
.mp-fact dd { margin: 2px 0 0; font-weight: 700; color: var(--ink); }

.mp-block { margin-bottom: 32px; }
.mp-block h2 { font-size: 1.35rem; letter-spacing: -.02em; }
.mp-description p { overflow-wrap: anywhere; }
.mp-amenities { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; }
.mp-amenities li { display: flex; align-items: center; gap: 8px; }
.mp-amenities .icon { width: 18px; height: 18px; color: var(--green); stroke-width: 2.25; }
.mp-meta { color: var(--muted); font-size: .875rem; }

.mp-report { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.mp-report summary { cursor: pointer; color: var(--muted); font-size: .9375rem; font-weight: 500; }
.mp-report form { display: grid; gap: 14px; margin-top: 14px; max-width: 480px; }

.mp-contact { position: sticky; top: 96px; display: grid; gap: 16px; }
.mp-contact-card { border: 1px solid var(--line); border-radius: var(--r); padding: 22px; background: #fff; box-shadow: 0 16px 32px -24px rgba(21,18,43,.35); }
.mp-contact-card h2 { font-size: 1.35rem; letter-spacing: -.02em; margin-bottom: 6px; }
.mp-advertiser { font-size: .9375rem; }
.mp-contact-card form { display: grid; gap: 14px; }
.mp-hint { margin: -6px 0 0; font-size: .8125rem; color: var(--muted); }
.mp-send { width: 100%; }
.mp-field-error { margin: 0; font-size: .8125rem; color: #B42318; }
[aria-invalid="true"] { border-color: #B42318 !important; }
.mp-safety-small { margin-top: 0; }
.mp-share { width: 100%; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1000px) {
  .mp-search { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mp-q { grid-column: 1 / -1; }
  .mp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mp-columns { grid-template-columns: minmax(0, 1fr); }
  .mp-contact { position: static; }
  .mp-landlords-inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .mp-search { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 16px; gap: 12px; }
  .mp-search-actions { grid-column: 1 / -1; }
  .mp-grid { grid-template-columns: minmax(0, 1fr); }
  .mp-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mp-amenities { grid-template-columns: minmax(0, 1fr); }
  .mp-sort { min-width: 0; width: 100%; }
}
