/*
 * JTO Accommodation Category Grid
 * Applies only when body has .jto-mphb-category-grid-page.
 */

.jto-mphb-category-grid-page {
	--jto-cg-navy: #102f49;
	--jto-cg-teal: #286f7d;
	--jto-cg-cream: #fbf8f2;
	--jto-cg-border: rgba(16, 47, 73, 0.11);
	--jto-cg-muted: #52606a;
	--jto-cg-desktop-cols: 3;
	--jto-cg-tablet-cols: 2;
	--jto-cg-image-ratio: 4 / 3;
}

.jto-mphb-category-grid-page *,
.jto-mphb-category-grid-page *::before,
.jto-mphb-category-grid-page *::after {
	box-sizing: border-box;
}

/* Full content width and removal of the right sidebar on category archives. */
.jto-mphb-category-grid-fullwidth #secondary,
.jto-mphb-category-grid-fullwidth .sidebar,
.jto-mphb-category-grid-fullwidth .widget-area,
.jto-mphb-category-grid-fullwidth aside[role="complementary"] {
	display: none !important;
}

.jto-mphb-category-grid-fullwidth #primary,
.jto-mphb-category-grid-fullwidth .content-area,
.jto-mphb-category-grid-fullwidth .site-main {
	width: 100% !important;
	max-width: 100% !important;
	float: none !important;
	margin-right: 0 !important;
	margin-left: 0 !important;
}

.jto-mphb-category-grid-fullwidth .site-content {
	width: min(1540px, calc(100% - 64px)) !important;
	max-width: none !important;
	margin-right: auto !important;
	margin-left: auto !important;
}

/* The archive title receives the same visual language as the home page. */
.jto-mphb-category-grid-page .page-header,
.jto-mphb-category-grid-page .archive-header {
	margin: 0 auto 2.2rem !important;
	text-align: center;
}

.jto-mphb-category-grid-page .page-title,
.jto-mphb-category-grid-page .archive-title {
	color: var(--jto-cg-navy);
	font-size: clamp(2.1rem, 4vw, 3.4rem);
	line-height: 1.1;
}

/* Grid wrapper created by the plugin. */
.jto-mphb-category-grid-page .jto-category-grid {
	display: grid !important;
	grid-template-columns: repeat(var(--jto-cg-desktop-cols), minmax(0, 1fr)) !important;
	align-items: stretch;
	gap: 28px;
	width: 100%;
	margin: 0;
	padding: 0;
}

/* Boxed apartment card. */
.jto-mphb-category-grid-page .jto-category-card {
	display: flex !important;
	width: 100% !important;
	min-width: 0 !important;
	height: 100%;
	flex-direction: column !important;
	float: none !important;
	overflow: hidden;
	margin: 0 !important;
	padding: 0 !important;
	border: 1px solid var(--jto-cg-border);
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 12px 34px rgba(16, 47, 73, 0.075);
	transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.jto-mphb-category-grid-page .jto-category-card:hover {
	transform: translateY(-4px);
	border-color: rgba(40, 111, 125, 0.27);
	box-shadow: 0 20px 44px rgba(16, 47, 73, 0.13);
}

/* One clean full-width image replaces the large gallery/slider space. */
.jto-mphb-category-grid-page .jto-category-card__media {
	position: relative !important;
	display: block !important;
	width: calc(100% - 20px) !important;
	aspect-ratio: var(--jto-cg-image-ratio);
	flex: none;
	overflow: hidden !important;
	margin: 10px auto 0 !important;
	padding: 0 !important;
	border: 1px solid rgba(40, 111, 125, 0.18);
	border-radius: 50% / 48% !important;
	background: #eaf0ef;
	text-decoration: none !important;
	isolation: isolate;
}

.jto-mphb-category-grid-page .jto-category-card__media img {
	position: absolute !important;
	inset: 0 !important;
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	min-width: 100% !important;
	max-width: none !important;
	min-height: 100% !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: inherit !important;
	object-fit: cover !important;
	object-position: center center !important;
	transition: transform 430ms cubic-bezier(.2,.75,.25,1);
}

.jto-mphb-category-grid-page .jto-category-card:hover .jto-category-card__media img {
	transform: scale(1.035);
}

/* Original MotoPress gallery remains in the document only as a data source. */
.jto-mphb-category-grid-page .jto-category-card .jto-category-original-media {
	display: none !important;
	height: 0 !important;
	min-height: 0 !important;
	max-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
}

/* Text area inside each card. */
.jto-mphb-category-grid-page .jto-category-card__content {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: 23px 25px 26px;
}

.jto-mphb-category-grid-page .jto-category-card__content h2,
.jto-mphb-category-grid-page .jto-category-card__content h3,
.jto-mphb-category-grid-page .jto-category-card__content .entry-title,
.jto-mphb-category-grid-page .jto-category-card__content .mphb-room-type-title {
	margin: 0 0 12px !important;
	color: var(--jto-cg-navy);
	font-size: clamp(1.45rem, 2vw, 1.9rem);
	line-height: 1.2;
}

.jto-mphb-category-grid-page .jto-category-card__content h2 a,
.jto-mphb-category-grid-page .jto-category-card__content h3 a,
.jto-mphb-category-grid-page .jto-category-card__content .entry-title a,
.jto-mphb-category-grid-page .jto-category-card__content .mphb-room-type-title a {
	color: inherit !important;
	text-decoration: none !important;
}

.jto-mphb-category-grid-page .jto-category-card__content p {
	color: var(--jto-cg-muted);
	line-height: 1.62;
}

.jto-mphb-category-grid-page .jto-category-card__content .entry-content,
.jto-mphb-category-grid-page .jto-category-card__content .entry-summary,
.jto-mphb-category-grid-page .jto-category-card__content .mphb-room-type-excerpt {
	margin: 0 0 17px;
}

/* Compact accommodation attributes. */
.jto-mphb-category-grid-page .jto-category-card__content .mphb-loop-room-type-attributes,
.jto-mphb-category-grid-page .jto-category-card__content .mphb-room-type-attributes,
.jto-mphb-category-grid-page .jto-category-card__content .mphb-single-room-type-attributes {
	margin: 4px 0 18px !important;
	padding: 14px 16px !important;
	border: 0 !important;
	border-radius: 10px;
	background: var(--jto-cg-cream);
	color: var(--jto-cg-muted);
	font-size: 0.92rem;
}

.jto-mphb-category-grid-page .jto-category-card__content ul {
	padding-left: 1.15rem;
}

/* View Details becomes a neat call-to-action. */
.jto-mphb-category-grid-page .jto-category-card .jto-category-card__button {
	display: inline-flex !important;
	align-items: center;
	align-self: flex-start;
	justify-content: center;
	margin-top: auto !important;
	padding: 11px 17px !important;
	border: 1px solid rgba(40, 111, 125, 0.30) !important;
	border-radius: 999px;
	background: transparent !important;
	color: var(--jto-cg-teal) !important;
	font-size: 0.92rem;
	font-weight: 800;
	line-height: 1;
	text-decoration: none !important;
	box-shadow: none !important;
	transition: background 190ms ease, color 190ms ease, transform 190ms ease;
}

.jto-mphb-category-grid-page .jto-category-card .jto-category-card__button:hover {
	transform: translateY(-1px);
	background: var(--jto-cg-teal) !important;
	color: #fff !important;
}

/* Remove duplicate detail blocks produced by some theme templates. */
.jto-mphb-category-grid-page .jto-category-duplicate {
	display: none !important;
}

/* Optional settings. */
.jto-mphb-category-hide-excerpt .jto-category-card__content .entry-content,
.jto-mphb-category-hide-excerpt .jto-category-card__content .entry-summary,
.jto-mphb-category-hide-excerpt .jto-category-card__content .mphb-room-type-excerpt {
	display: none !important;
}

.jto-mphb-category-hide-details .jto-category-card__content .mphb-loop-room-type-attributes,
.jto-mphb-category-hide-details .jto-category-card__content .mphb-room-type-attributes,
.jto-mphb-category-hide-details .jto-category-card__content .mphb-single-room-type-attributes {
	display: none !important;
}

/* Pagination stays outside the card grid. */
.jto-mphb-category-grid-page .navigation.pagination,
.jto-mphb-category-grid-page .mphb-pagination {
	clear: both;
	margin-top: 2.75rem;
	text-align: center;
}

@media (max-width: 1050px) {
	.jto-mphb-category-grid-page .jto-category-grid {
		grid-template-columns: repeat(var(--jto-cg-tablet-cols), minmax(0, 1fr)) !important;
		gap: 22px;
	}

	.jto-mphb-category-grid-fullwidth .site-content {
		width: min(100%, calc(100% - 40px)) !important;
	}
}

@media (max-width: 650px) {
	.jto-mphb-category-grid-page .jto-category-grid {
		grid-template-columns: minmax(0, 1fr) !important;
		gap: 18px;
	}

	.jto-mphb-category-grid-fullwidth .site-content {
		width: calc(100% - 24px) !important;
	}

	.jto-mphb-category-grid-page .jto-category-card {
		border-radius: 13px;
	}

	.jto-mphb-category-grid-page .jto-category-card__content {
		padding: 21px 21px 23px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.jto-mphb-category-grid-page .jto-category-card,
	.jto-mphb-category-grid-page .jto-category-card__media img,
	.jto-mphb-category-grid-page .jto-category-card__button {
		transition: none;
	}
}


/* Override theme rules that can shrink the image inside the oval. */
.jto-mphb-category-grid-page .jto-category-card__media picture,
.jto-mphb-category-grid-page .jto-category-card__media span,
.jto-mphb-category-grid-page .jto-category-card__media figure {
	position: static !important;
	display: contents !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
}

@media (max-width: 650px) {
	.jto-mphb-category-grid-page .jto-category-card__media {
		width: calc(100% - 14px) !important;
		margin-top: 7px !important;
	}
}
