/**
 * Phone layout (≤767px) for Pillar and Hub pages: shorter pages, same content.
 *
 * Every item stays in the HTML; only the presentation changes:
 * - card groups (buyer problems, capability cards, advantages, case studies) and certificates
 *   scroll sideways (scroll-snap); assets/js/mobile.js adds the "1 / 6" status, keyboard support
 *   and the region label;
 * - product range, featured products and factory photos: 2 columns;
 * - steps with images: small image left, text right;
 * - key facts: 2-column grid;
 * - section spacing: 20px top and bottom (40px between sections).
 * Desktop and tablet above 767px are unchanged. Loaded last (registry "mobile").
 *
 * @package Hengrui_Child
 */

@media (max-width: 767px) {
	:root {
		--hr-section-padding-y: 20px;
		--hr-m-gap: 12px;
	}

	/* ---------- Sideways card groups ---------- */
	body .hr-ui :is(.hr-pillar__pain, .hr-pillar__capability--card, .hr-pillar__why) .capability-grid,
	body .hr-ui .hr-cases,
	body .hr-ui .hr-certs {
		display: flex;
		flex-wrap: nowrap;
		justify-content: flex-start;
		align-items: stretch;
		gap: var(--hr-m-gap);
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
		padding: 4px 2px 8px;
		overflow-x: auto;
		overflow-y: hidden;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scroll-padding-left: 2px;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	body .hr-ui :is(.hr-pillar__pain, .hr-pillar__capability--card, .hr-pillar__why) .capability-grid::-webkit-scrollbar,
	body .hr-ui .hr-cases::-webkit-scrollbar,
	body .hr-ui .hr-certs::-webkit-scrollbar {
		display: none;
	}

	/* About 85% wide: the next card's edge shows that the row scrolls. */
	body .hr-ui :is(.hr-pillar__pain, .hr-pillar__capability--card, .hr-pillar__why) .capability-grid > *,
	body .hr-ui .hr-cases > * {
		flex: 0 0 85%;
		min-width: 0;
		margin: 0;
		scroll-snap-align: start;
	}

	/* Certificates are portrait images: about 60% wide. */
	body .hr-ui .hr-certs > .hr-cert {
		flex: 0 0 60%;
		margin: 0;
		scroll-snap-align: start;
	}

	body .hr-ui .hr-carousel:focus-visible {
		outline: 2px solid var(--hr-color-accent);
		outline-offset: 2px;
	}

	body .hr-ui .hr-carousel__status {
		margin: 8px 0 0;
		text-align: center;
		font-size: var(--hr-fs-xs);
		font-weight: 700;
		letter-spacing: 0.04em;
		color: var(--hr-color-muted);
	}

	/* ---------- Two-column product range, featured products and factory photos ---------- */
	body .hr-ui .hr-range__grid,
	body .hr-ui .hr-cards,
	body .hr-ui .hr-pillar__gallery,
	body .hr-ui .hr-hub__gallery {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--hr-m-gap);
	}

	body .hr-ui .hr-cards .hr-card {
		padding: 10px;
	}

	body .hr-ui .hr-cards .hr-card__img {
		aspect-ratio: 1 / 1;
	}

	body .hr-ui .hr-cards .hr-card h3 {
		font-size: 0.875rem;
		line-height: 1.35;
		margin: 8px 0 4px;
	}

	body .hr-ui .hr-cards .hr-product-model,
	body .hr-ui .hr-cards .hr-product-specs {
		font-size: 0.75rem;
		margin-bottom: 4px;
	}

	body .hr-ui .hr-cards .hr-card__link {
		font-size: 0.8125rem;
	}

	body .hr-ui :is(.hr-pillar__gallery, .hr-hub__gallery) {
		margin-top: 16px;
	}

	/* Caption kept in full in the HTML, shown on one line. */
	body .hr-ui :is(.hr-pillar__gallery, .hr-hub__gallery) figcaption {
		margin-top: 4px;
		font-size: 0.75rem;
		line-height: 1.4;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	/* ---------- Number band (factory evidence, stat blocks): 2 columns ---------- */
	body .hr-ui .factory-stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	body .hr-pillar .factory-stats > div,
	body .hr-ui .factory-stats > div {
		padding: 12px 10px;
	}

	body .hr-ui .factory-stats .hr-pillar__stat-value {
		font-size: 1.5rem;
		line-height: 1.15;
	}

	body .hr-ui .factory-stats p:not(.hr-pillar__stat-value) {
		font-size: 0.8125rem;
		line-height: 1.35;
	}

	/* ---------- Steps with images: small image left, text right ---------- */
	body .hr-ui ol.hr-steps.hr-steps--media {
		gap: 16px;
	}

	body .hr-ui .hr-steps--media > li {
		display: grid;
		grid-template-columns: 88px minmax(0, 1fr);
		column-gap: 12px;
		align-content: start;
		padding-left: 0;
		min-height: 0;
	}

	body .hr-ui .hr-steps--media > li > .hr-steps__img {
		grid-column: 1;
		grid-row: 1 / span 3;
		width: 88px;
		height: 88px;
		aspect-ratio: 1 / 1;
		object-fit: cover;
		margin: 0;
		border-radius: var(--hr-radius-md);
	}

	body .hr-ui .hr-steps--media > li > :not(.hr-steps__img) {
		grid-column: 2;
	}

	body .hr-ui .hr-steps--media .hr-steps__num {
		position: static;
		justify-self: start;
		margin: 0 0 4px;
		font-size: 0.875rem;
	}

	body .hr-ui .hr-steps--media > li > h3 {
		margin: 0 0 4px;
		padding-top: 0;
		font-size: 1rem;
	}

	body .hr-ui .hr-steps--media > li > p {
		margin: 0;
		font-size: 0.875rem;
		line-height: 1.5;
	}

	/* The connector arrows belong to the number-only layout. */
	body .hr-ui .hr-steps--media > li::before,
	body .hr-ui .hr-steps--media > li::after {
		display: none;
	}

	/* ---------- Key facts: 2-column grid ---------- */
	body .hr-ui .hr-table-wrap {
		overflow: visible;
	}

	body .hr-ui .hr-table {
		display: block;
		width: 100%;
		min-width: 0;
		border: 0;
		background: transparent;
	}

	body .hr-ui .hr-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	body .hr-ui .hr-table tbody {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	body .hr-ui .hr-table tr {
		display: flex;
		flex-direction: column;
		width: auto;
		margin: 0;
		padding: 10px 12px;
		background: var(--hr-color-surface);
		border: 1px solid var(--hr-color-border);
		border-radius: var(--hr-radius-md);
	}

	body .hr-ui .hr-table th,
	body .hr-ui .hr-table td {
		display: block;
		width: auto;
		padding: 0;
		border: 0;
		background: transparent;
	}

	body .hr-ui .hr-table tbody th {
		order: 2;
		font-size: 0.75rem;
		font-weight: 400;
		line-height: 1.35;
		color: var(--hr-color-muted);
	}

	body .hr-ui .hr-table tbody td:nth-child(2) {
		order: 1;
		margin-bottom: 2px;
		font-size: 1rem;
		font-weight: 700;
		line-height: 1.3;
	}

	body .hr-ui .hr-table tbody td:nth-child(3) {
		order: 3;
		margin-top: 4px;
		font-size: 0.6875rem;
		color: var(--hr-color-muted);
	}

	body .hr-ui .hr-table td:empty {
		display: none;
	}
}

@media (min-width: 768px) {
	.hr-carousel__status {
		display: none;
	}
}
