/* Nyumba254 listing cards: one compact, consistent finish for Home, Listings and Saved.
   Loaded last on each page. Selectors start with "html body" so they win over page and polish CSS. */

/* ── shared ─────────────────────────────────────────── */
html body .card { border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 3px 12px rgba(15,110,86,.07); min-width: 0; }
html body .card-img img { width: 100%; height: 100%; object-fit: cover; }
html body .card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; line-height: 1.3; }
html body .card-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html body .card-role, html body .card-trust { min-width: 0; }
@media (hover: none) {
  html body .card:hover, html body .card:focus-visible { transform: none; }
}

/* ── desktop and tablet ─────────────────────────────── */
@media (min-width: 769px) {
  html body .listings-grid { gap: 16px; }
  html body .listings-grid .card-img { aspect-ratio: 3 / 2; }
  html body .listings-grid .card-body { padding: 12px 14px 14px; }
  html body .listings-grid .card-title { font-size: 15px; }
  html body .listings-grid .card-amenities { flex-wrap: nowrap; overflow: hidden; }
  html body .listings-grid .card-amenity-chip { flex: 0 0 auto; white-space: nowrap; }
  html body .listings-grid .card:hover { transform: translateY(-3px); }
}

/* ── phones: compact two-column cards ───────────────── */
@media (max-width: 768px) {
  html body .card { border-radius: 14px; }
  html body .listings-grid .card-img, html body #listings-grid .card-img, html body #unavail-grid .card-img { aspect-ratio: 4 / 3; }
  html body .listings-grid .card-body { padding: 9px 10px 10px; }
  html body .listings-grid .card-title, html body #listings-grid .card-title, html body #unavail-grid .card-title { font-size: 13.5px; line-height: 1.28; margin-bottom: 4px; }
  html body .listings-grid .card-amenities { display: none; }
  html body .listings-grid .card-trust { gap: 4px 6px; margin-bottom: 0; }
  html body .listings-grid .card-foot { margin-top: 8px; padding-top: 0; border-top: 0; }
  html body .listings-grid .card-inquire-btn { min-height: 36px; height: 36px; padding: 0 10px; font-size: 12.5px; border-radius: 10px; }

  /* Saved */
  html body #listings-grid .card-body, html body #unavail-grid .card-body { padding: 9px 10px 10px; }
  html body #listings-grid .chip-row, html body #unavail-grid .chip-row { display: none; }
  html body #listings-grid .card-saved-date, html body #unavail-grid .card-saved-date { font-size: 10.5px; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html body #listings-grid .card-body, html body #unavail-grid .card-body { flex: 1; }
  html body #listings-grid .card-area, html body #unavail-grid .card-area { flex-wrap: wrap; row-gap: 3px; overflow: visible; }
  html body #listings-grid .lp-area-name, html body #unavail-grid .lp-area-name { max-width: 100%; }
  html body #listings-grid .card-actions, html body #unavail-grid .card-actions { display: flex; flex-wrap: nowrap; gap: 5px; margin: auto -10px 0; padding: 4px 10px 2px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  html body #listings-grid .card-actions::-webkit-scrollbar, html body #unavail-grid .card-actions::-webkit-scrollbar { display: none; }
  html body #listings-grid .card-actions .act-btn, html body #unavail-grid .card-actions .act-btn { flex: 0 0 auto; min-height: 34px; padding: 0 11px; font-size: 11.5px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; }
  html body #listings-grid .card-view-btn, html body #unavail-grid .card-view-btn { padding: 8px; font-size: 12.5px; border-radius: 10px; }
}

/* very small phones */
@media (max-width: 360px) {
  html body .listings-grid .card-title, html body #listings-grid .card-title { font-size: 13px; }
}

/* nk-card-size:v1 start */
/* One standard card. Source of truth: Home "Latest listings" card. */
:root { --nk-card-gap: 10px; }
@media (min-width: 769px) { :root { --nk-card-gap: 16px; } }

/* Same photo ratio everywhere (Home, Browse, Saved, skeletons) */
html body .card-img,
html body .listings-grid .card-img,
html body #listings-grid .card-img,
html body #unavail-grid .card-img,
html body .skeleton-img { aspect-ratio: 4 / 3; }

/* Height follows content; cards in the same row stay equal */
html body .card { display: flex; flex-direction: column; }
html body .card-img { flex: 0 0 auto; }
html body .card-body { flex: 1 1 auto; min-width: 0; }
html body .card-title { min-height: 2.6em; }

/* Spec row stays on one line */
html body .card-meta { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
html body .card-meta > span { flex: 0 0 auto; }

/* One gap value for every grid and scroller */
html body .listings-grid,
html body .loading-grid { gap: var(--nk-card-gap); }

@media (max-width: 768px) {
  /* Featured + Recently viewed: exactly the width of a Latest card (2 per screen) */
  html body #featured-listings .listings-grid .card,
  html body #recently-viewed-listings .listings-grid .card {
    flex: 0 0 calc((100% - var(--nk-card-gap)) / 2);
    max-width: none;
    min-width: 0;
  }
  html body #featured-listings .listings-grid .badge-featured,
  html body #recently-viewed-listings .listings-grid .badge-featured { top:7px;left:7px;font-size:9.5px;padding:3px 8px; }
  html body #featured-listings .listings-grid .badge-new,
  html body #recently-viewed-listings .listings-grid .badge-new { top:7px;left:7px;font-size:9.5px;padding:3px 8px; }
  html body #featured-listings .listings-grid .badge-cat,
  html body #recently-viewed-listings .listings-grid .badge-cat { left:7px;bottom:7px;font-size:9.5px;padding:3px 8px; }
  html body #featured-listings .listings-grid .card-body,
  html body #recently-viewed-listings .listings-grid .card-body { padding:9px 10px 10px; }
  html body #featured-listings .listings-grid .card-area,
  html body #recently-viewed-listings .listings-grid .card-area { font-size:10px;margin-bottom:2px; }
  html body #featured-listings .listings-grid .card-area::before,
  html body #recently-viewed-listings .listings-grid .card-area::before { display:none; }
  html body #featured-listings .listings-grid .card-title,
  html body #recently-viewed-listings .listings-grid .card-title { font-size:13px; }
  html body #featured-listings .listings-grid .card-sub,
  html body #recently-viewed-listings .listings-grid .card-sub { display:none; }
  html body #featured-listings .listings-grid .card-role,
  html body #recently-viewed-listings .listings-grid .card-role { flex:0 0 100%;font-size:10.5px;margin-bottom:4px; }
  html body #featured-listings .listings-grid .card-viewing-fee,
  html body #recently-viewed-listings .listings-grid .card-viewing-fee { font-size:10.5px;padding:1px 8px;margin-bottom:5px; }
  html body #featured-listings .listings-grid .card-price,
  html body #recently-viewed-listings .listings-grid .card-price { font-size:14.5px; }
  html body #featured-listings .listings-grid .card-price-overlay,
  html body #recently-viewed-listings .listings-grid .card-price-overlay { left:7px;bottom:6px;font-size:13.5px; }
  html body #featured-listings .listings-grid .card-photo-count,
  html body #recently-viewed-listings .listings-grid .card-photo-count { right:7px;bottom:6px;font-size:10px;padding:2px 6px; }
  html body #featured-listings .listings-grid .card-meta,
  html body #recently-viewed-listings .listings-grid .card-meta { font-size:10.5px;gap:2px 6px;margin-bottom:4px; }
  html body #featured-listings .listings-grid .card-meta .meta-cat,
  html body #recently-viewed-listings .listings-grid .card-meta .meta-cat { font-size:9.5px;padding:1px 7px; }
  html body #featured-listings .listings-grid .card-meta span:nth-child(n+4),
  html body #recently-viewed-listings .listings-grid .card-meta span:nth-child(n+4) { display:none; }
  html body #featured-listings .listings-grid .card-verified-badge,
  html body #recently-viewed-listings .listings-grid .card-verified-badge { display:none; }
}
/* nk-card-size:v1 end */
