/*
 * HARCHI KOLO — Compact Desktop catalog grid owner 1.0
 * Scope: laptop/smaller desktop only (1025–1399px + html.hk-compact-desktop).
 *
 * The official HivePress listings DOM is:
 *   .hp-listings.hp-grid > .hp-row > .hp-grid__item
 * Keep .hp-listings as a shell and make the direct card owner (.hp-row) the
 * four-column grid. This prevents any wrapper from becoming a grid item and
 * eliminates the narrow-strip / one-column reflow seen during JS enhancement.
 */
@media (min-width:1025px) and (max-width:1399px) {
	html.hk-compact-desktop body.hk-catalog-page .hp-page__sidebar {
		display: none !important;
	}

	html.hk-compact-desktop body.hk-catalog-page .hp-page__content,
	html.hk-compact-desktop body.hk-catalog-page .hp-listings.hp-grid {
		box-sizing: border-box !important;
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0 !important;
		margin-inline: 0 !important;
		padding-inline: 0 !important;
	}

	/* First paint and enhanced state use the same real card owner. */
	html.hk-compact-desktop body.hk-catalog-page .hp-listings.hp-grid > .hp-row,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hk-catalog-listings-grid {
		box-sizing: border-box !important;
		display: grid !important;
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
		align-items: stretch !important;
		gap: 14px !important;
		width: min(100%, 1180px) !important;
		max-width: 1180px !important;
		min-width: 0 !important;
		margin-inline: auto !important;
		padding: 0 !important;
	}

	html.hk-compact-desktop body.hk-catalog-page .hp-listings.hp-grid > .hp-row > .hp-grid__item,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hk-catalog-listings-grid > .hk-catalog-listing-item {
		box-sizing: border-box !important;
		display: flex !important;
		align-self: stretch !important;
		flex: none !important;
		flex-basis: auto !important;
		width: auto !important;
		min-width: 0 !important;
		max-width: none !important;
		margin: 0 !important;
		padding: 0 !important;
	}

	html.hk-compact-desktop body.hk-catalog-page .hp-listings.hp-grid > .hp-row > .hp-grid__item > :is(.hp-listing,.hp-listing--view-block),
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hk-catalog-listings-grid > .hk-catalog-listing-item > :is(.hp-listing,.hp-listing--view-block) {
		box-sizing: border-box !important;
		width: 100% !important;
		min-width: 0 !important;
		max-width: none !important;
	}

	/* Never allow the outer HivePress shell to masquerade as the card grid. */
	html.hk-compact-desktop body.hk-catalog-page .hp-listings.hp-grid.hk-catalog-listings-grid:not(:has(> .hp-grid__item)) {
		display: block !important;
		width: 100% !important;
		max-width: 100% !important;
	}

	html.hk-compact-desktop body.hk-catalog-page .hp-listings.hp-grid.hk-catalog-listings-grid:not(:has(> .hp-grid__item)) > .hp-row {
		display: grid !important;
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
		gap: 14px !important;
		width: min(100%, 1180px) !important;
		max-width: 1180px !important;
		margin-inline: auto !important;
	}

	/* Keep titles readable even while another script is adding classes. */
	html.hk-compact-desktop body.hk-catalog-page .hp-listing__title,
	html.hk-compact-desktop body.hk-catalog-page .hp-listing__title a {
		overflow-wrap: normal !important;
		word-break: normal !important;
	}
}


/* HARCHI KOLO Core 2.0.98.515 — Compact Desktop catalog balanced density 1.0.
 * Keep four columns and the 2.0.98.513 grid-owner fix intact. The card is
 * scaled as a compact desktop variant: more usable media, readable type and
 * tighter whitespace without turning the layout into oversized 3-column cards.
 */
@media (min-width:1025px) and (max-width:1399px) {
	html.hk-compact-desktop body.hk-catalog-page .hp-listings.hp-grid > .hp-row,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hk-catalog-listings-grid,
	html.hk-compact-desktop body.hk-catalog-page .hp-listings.hp-grid.hk-catalog-listings-grid:not(:has(> .hp-grid__item)) > .hp-row {
		width: min(100%, 1180px) !important;
		max-width: 1180px !important;
		gap: 14px !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing--view-block,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing {
		border-radius: 14px !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__header > .hp-listing__image,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__header > .hp-listing__images {
		aspect-ratio: 7 / 4 !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__content {
		padding: 10px 12px 8px !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__categories,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__category {
		margin-bottom: 3px !important;
		font-size: 10.5px !important;
		line-height: 1.25 !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__title {
		min-height: 38px !important;
		margin: 0 0 4px !important;
		font-size: 16px !important;
		line-height: 1.18 !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__content .hp-listing__details--primary {
		margin-top: 2px !important;
		font-size: 11px !important;
		line-height: 1.34 !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__content .hp-listing__details--secondary,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__content .hp-listing__created-date,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hk-listing-location--card {
		margin-top: 2px !important;
		font-size: 10.5px !important;
		line-height: 1.32 !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hk-listing-location--card {
		margin-block: 3px 0 !important;
	}

	html.hk-compact-desktop body.hk-catalog-page .hk-trust-card-badge {
		margin: 3px 0 4px !important;
		padding: 3px 6px !important;
		font-size: 8.5px !important;
	}

	html.hk-compact-desktop body.hk-catalog-page .hp-listing .hk-listing-views,
	html.hk-compact-desktop body.hk-catalog-page .hp-listing--view-block .hk-listing-views {
		margin-top: 3px !important;
		padding: 3px 6px !important;
		font-size: 9.5px !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__footer {
		grid-template-columns: minmax(0,1fr) 32px !important;
		gap: 7px !important;
		min-height: 40px !important;
		padding: 6px 12px 7px !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__footer .hp-listing__attributes--primary,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__footer .hp-listing__details--primary,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__footer > :first-child {
		font-size: 14.5px !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__footer .hp-listing__actions--primary,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__footer .hp-listing__actions,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__footer > :last-child {
		width: 32px !important;
		min-width: 32px !important;
	}

	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__footer .hp-listing__action--message,
	html.hk-compact-desktop body.hk-catalog-page.hk-catalog-enhanced .hp-listing__footer a[href*="message"] {
		width: 30px !important;
		height: 30px !important;
		min-width: 30px !important;
		min-height: 30px !important;
	}
}
