/* Approved red-frame proposal: one fixed desktop width for both detail pages.
   Deliberately excludes header, home, listing pages and mobile layouts.
   Existing gallery scripts continue to handle mobile sizing and controls. */
@media (min-width: 781px) {
  :root:has(body:is([data-ji-page="property"], [data-ji-page="project"])) {
    --ji-detail-width: 665px !important;
    --ji-gallery-width: 665px !important;
  }

  body:is([data-ji-page="property"], [data-ji-page="project"]) main > .hero > .inner,
  body[data-ji-page="project"] main > .ji-section {
    max-width: 665px !important;
    width: 100%;
    margin-inline: auto;
    box-sizing: border-box;
    padding-inline: 36px;
  }

  body[data-ji-page="property"] .ji-detail-main > :is(.ji-gallery, .ji-video-section, .ji-property-equipment, .ji-compact-facts, .ji-property-inquiry, .ji-detail-flow, .ji-location-map, .ji-rent-overview) {
    max-width: 665px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body:is([data-ji-page="property"], [data-ji-page="project"]) .ji-gallery {
    --ji-preview-width: 130px !important;
  }

  body:is([data-ji-page="property"], [data-ji-page="project"]) .ji-gallery .ji-gallery-image {
    height: auto !important;
    min-height: 0;
    aspect-ratio: 3 / 2 !important;
  }

  body:is([data-ji-page="property"], [data-ji-page="project"]) .ji-gallery .ji-gallery-image img {
    object-fit: contain;
    object-position: center center;
  }

  body:is([data-ji-page="property"], [data-ji-page="project"]) .ji-gallery .ji-thumbnail {
    width: var(--ji-preview-width);
    flex-basis: var(--ji-preview-width);
  }

  body:is([data-ji-page="property"], [data-ji-page="project"]) .ji-gallery .ji-thumb-image {
    height: 91px;
  }

  body:is([data-ji-page="property"], [data-ji-page="project"]) .ji-gallery .ji-thumb-image img {
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
  }
}

/* Desktop project list: fit all eight columns within the approved detail width. */
@media (min-width:781px) {
 body[data-ji-page="project"].pv-project .pv-table { width:100%; min-width:0; table-layout:fixed; }
 body[data-ji-page="project"].pv-project .pv-table th,
 body[data-ji-page="project"].pv-project .pv-table td { box-sizing:border-box; padding-inline:4px; }
 body[data-ji-page="project"].pv-project .pv-table th:nth-child(1),
 body[data-ji-page="project"].pv-project .pv-table td:nth-child(1) { width:25.5%; padding-left:0; }
 body[data-ji-page="project"].pv-project .pv-table th:nth-child(2) { width:12%; }
 body[data-ji-page="project"].pv-project .pv-table th:nth-child(3) { width:6.5%; }
 body[data-ji-page="project"].pv-project .pv-table th:nth-child(4) { width:11.5%; }
 body[data-ji-page="project"].pv-project .pv-table th:nth-child(5) { width:8%; }
 body[data-ji-page="project"].pv-project .pv-table th:nth-child(6) { width:14%; }
 body[data-ji-page="project"].pv-project .pv-table th:nth-child(7) { width:12.5%; }
 body[data-ji-page="project"].pv-project .pv-table th:nth-child(8) { width:10%; }
 body[data-ji-page="project"].pv-project .pv-table th button { white-space:normal; min-width:0; overflow-wrap:normal; }
 body[data-ji-page="project"].pv-project .pv-photo { width:100%; height:auto; aspect-ratio:3 / 2; }
 body[data-ji-page="project"].pv-project .pv-photo img { width:100%; height:100%; max-height:none; object-fit:contain; }
 body[data-ji-page="project"].pv-project .pv-detail { white-space:nowrap; }
}

@media (min-width:781px) { body[data-ji-page="project"].pv-project .pv-table .pv-object-top { white-space:normal; overflow-wrap:normal; } }

/* Compact sort headings, with the same fine gold divider as the unit rows. */
body[data-ji-page="project"] .pv-sort-heading{display:inline-flex;align-items:center;justify-content:center;gap:2px;line-height:1.15}
body[data-ji-page="project"] .pv-sort-number-label{display:flex;flex-direction:column;align-items:center;line-height:1.15}
body[data-ji-page="project"] .pv-sort-top-row{display:flex;align-items:center;gap:3px}
body[data-ji-page="project"] .pv-sort-heading-divider{display:block;width:28px;height:1px;background:#c2b6a0;margin:2px auto}
body[data-ji-page="project"] .pv-sort-arrow{flex:none;white-space:nowrap}
@media (min-width:781px){
body[data-ji-page="project"].pv-project .pv-table th{padding:7px 1px}
body[data-ji-page="project"].pv-project .pv-table th:nth-child(3){width:7%}
body[data-ji-page="project"].pv-project .pv-table th:nth-child(4){width:10%}
body[data-ji-page="project"].pv-project .pv-table th:nth-child(5){width:9%}
}

/* Shorter, narrower desktop windows only: keep the approved width on wider desktops. */
@media (min-width:781px) and (max-width:1250px) and (max-height:650px){
 :root:has(body:is([data-ji-page="property"],[data-ji-page="project"])) {--ji-detail-width:600px!important;--ji-gallery-width:600px!important}
 body:is([data-ji-page="property"],[data-ji-page="project"]) main>.hero>.inner,
 body[data-ji-page="project"] main>.ji-section,
 body[data-ji-page="property"] .ji-detail-main>:is(.ji-gallery,.ji-video-section,.ji-property-equipment,.ji-compact-facts,.ji-property-inquiry,.ji-detail-flow,.ji-location-map,.ji-rent-overview){max-width:600px!important}
}
