/**
 * Huawei-style market shell (/apps/, /games/, home, list templates).
 *
 * @package APK_Play_Theme
 */

/*
 * Visually-hidden labels. The market shell dequeues `components.css`
 * (see `inc/theme-hooks.php`) to keep the home/apps/games/category
 * pages lean, so the `.screen-reader-text` utility class is not
 * available there by default. Copying the WCAG-standard recipe in
 * here lets the search form ship a `<label class="screen-reader-text">`
 * for AT users without forcing the visual layout to reflow when CSS
 * loads asynchronously (height/width 1px, clipped, no flow).
 */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

:root {
	--hw-bg: #f5f6f8;
	--hw-card: #fff;
	--hw-text: #111827;
	--hw-muted: #4b5563;
	--hw-blue: #1d4ed8;
	--hw-chip: #eceff4;
	--hw-line: #e5e7eb;
	--hw-cta-min-h: 36px;
}

html,
body {
	height: 100%;
	margin: 0;
	background: var(--hw-bg);
}

body {
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	color: var(--hw-text);
}

.hw-shell {
	min-height: 100vh;
	background: var(--hw-bg);
	padding: 0 0 74px;
}

.hw-main {
	padding: 10px 10px 18px;
}

/* Regular WordPress pages (About/Privacy/Terms/Disclaimer/Contact)
 * are rendered inside the same market shell header/footer. Give them
 * a readable card layout so content is not shown as raw text on gray bg.
 */
.hw-main > article.page,
.hw-main > article.type-page {
	background: var(--hw-card);
	border: 1px solid var(--hw-line);
	border-radius: 14px;
	padding: 16px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.hw-main > article.page .entry-content,
.hw-main > article.type-page .entry-content {
	margin: 0;
	color: #0f172a;
	font-size: 18px;
	line-height: 1.7;
}

.hw-main > article.page .entry-content h1,
.hw-main > article.page .entry-content h2,
.hw-main > article.page .entry-content h3,
.hw-main > article.type-page .entry-content h1,
.hw-main > article.type-page .entry-content h2,
.hw-main > article.type-page .entry-content h3 {
	color: #0f172a;
	line-height: 1.35;
	letter-spacing: -0.01em;
	margin: 1.1em 0 0.45em;
}

.hw-main > article.page .entry-content h1,
.hw-main > article.type-page .entry-content h1 {
	font-size: clamp(1.5rem, 6vw, 2rem);
	margin-top: 0;
}

.hw-main > article.page .entry-content h2,
.hw-main > article.type-page .entry-content h2 {
	font-size: clamp(1.25rem, 5vw, 1.6rem);
}

.hw-main > article.page .entry-content h3,
.hw-main > article.type-page .entry-content h3 {
	font-size: clamp(1.1rem, 4.4vw, 1.35rem);
}

.hw-main > article.page .entry-content p,
.hw-main > article.type-page .entry-content p {
	margin: 0 0 0.8em;
}

.hw-main > article.page .entry-content ul,
.hw-main > article.page .entry-content ol,
.hw-main > article.type-page .entry-content ul,
.hw-main > article.type-page .entry-content ol {
	padding-left: 1.35em;
	margin: 0.4em 0 1em;
}

.hw-main > article.page .entry-content li,
.hw-main > article.type-page .entry-content li {
	margin: 0.22em 0;
}

.hw-page-title {
	margin: 4px 0 10px;
	padding: 0 0 0 12px;
	border-left: 3px solid var(--hw-blue);
	font-size: clamp(1.25rem, 4.6vw, 1.5rem);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.02em;
	color: var(--hw-text);
}

.hw-list-intro {
	margin: 0 0 16px;
	padding: 10px 12px;
	font-size: 0.875rem;
	line-height: 1.6;
	color: var(--hw-muted);
	background: var(--hw-card);
	border: 1px solid var(--hw-line);
	border-radius: 12px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.adr-editorial-strip {
	margin: 0 0 16px;
	padding: 10px 12px;
	font-size: 0.8125rem;
	line-height: 1.55;
	color: var(--hw-muted);
	background: rgba(59, 130, 246, 0.06);
	border: 1px solid rgba(59, 130, 246, 0.18);
	border-radius: 12px;
}

.adr-editorial-strip a {
	color: var(--hw-accent, #2563eb);
	font-weight: 600;
	text-decoration: none;
}

.adr-editorial-strip a:hover {
	text-decoration: underline;
}

.adr-detail-guide-links {
	margin: 0;
	padding-left: 1.1rem;
}

.adr-detail-guide-links li + li {
	margin-top: 0.35rem;
}

.hw-banner-row {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	overflow-y: hidden;
	padding-bottom: 4px;
	scrollbar-width: none;
	-ms-overflow-style: none;
	scroll-snap-type: x mandatory;
}

.hw-banner-row::-webkit-scrollbar {
	display: none;
}

.hw-banner {
	position: relative;
	flex: 0 0 76%;
	height: 110px;
	border-radius: 14px;
	overflow: hidden;
	background: #dbe4f8;
	scroll-snap-align: start;
}

.hw-banner.small {
	flex-basis: 52%;
}

.hw-banner img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.hw-banner-fallback {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	color: #334155;
}

.hw-section {
	margin-top: 14px;
	background: #fff;
	border: 1px solid var(--hw-line);
	border-radius: 14px;
	padding: 10px 8px 8px;
	box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.hw-sec-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 4px 8px;
}

.hw-sec-head h2,
.hw-sec-head h3 {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.1px;
}

.hw-sec-head a {
	font-size: 14px;
	color: #374151;
	text-decoration: none;
}

.hw-grid {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 12px 8px;
}

.hw-app {
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	min-width: 0;
}

.hw-app > a {
	display: block;
	flex: 1 1 auto;
}

.hw-app a {
	text-decoration: none;
	color: inherit;
}

.hw-icon {
	width: 58px;
	height: 58px;
	border-radius: 14px;
	object-fit: cover;
	display: block;
	margin: 0 auto 6px;
	box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.hw-name {
	font-size: 12px;
	line-height: 1.3;
	min-height: 32px;
	max-height: 32px;
	overflow: hidden;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.hw-install {
	margin-top: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--hw-cta-min-h, 36px);
	min-width: 44px;
	padding: 8px 10px;
	border-radius: 10px;
	background: #dbeafe;
	color: var(--hw-blue);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	box-sizing: border-box;
	max-width: 100%;
	border: 1px solid #bfdbfe;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.hw-install:active {
	transform: scale(0.98);
}

.hw-app-actions {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 6px;
	margin-top: 6px;
	width: 100%;
}

.hw-app-actions .hw-install {
	margin-top: 0;
	width: 100%;
}

/* front.css `.adr-download-btn` hero styles must not apply in grid/list cards. */
.hw-grid .hw-install.adr-download-btn,
.hw-grid .hw-install.adr-visit-site-btn,
.hw-row .hw-install.adr-download-btn,
.hw-row .hw-install.adr-visit-site-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--hw-cta-min-h, 36px);
	padding: 8px 10px;
	border-radius: 10px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-shadow: none;
	box-shadow: none;
	transform: none;
	filter: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hw-grid .hw-install.adr-download-btn,
.hw-row .hw-install.adr-download-btn {
	background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
	border-color: #1e40af;
	color: #fff !important;
}

.hw-grid .hw-install.adr-download-btn:hover,
.hw-grid .hw-install.adr-download-btn:active,
.hw-grid .hw-install.adr-download-btn:focus-visible,
.hw-row .hw-install.adr-download-btn:hover,
.hw-row .hw-install.adr-download-btn:active,
.hw-row .hw-install.adr-download-btn:focus-visible {
	transform: none;
	box-shadow: none;
	filter: none;
	background: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
	color: #fff !important;
}

.hw-grid .hw-install.adr-visit-site-btn,
.hw-row .hw-install.adr-visit-site-btn {
	background: #fff;
	border-color: #cbd5e1;
	color: #1e40af !important;
}

.hw-grid .hw-install.adr-visit-site-btn:hover,
.hw-grid .hw-install.adr-visit-site-btn:active,
.hw-row .hw-install.adr-visit-site-btn:hover,
.hw-row .hw-install.adr-visit-site-btn:active {
	background: #f8fafc;
	border-color: #94a3b8;
}

.hw-list {
	margin-top: 6px;
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--hw-line);
}

.hw-row {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 12px 12px;
	border-bottom: 1px solid var(--hw-line);
}

.hw-row:last-child {
	border-bottom: 0;
}

.hw-row .hw-icon {
	margin: 0;
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
}

.hw-row-main {
	min-width: 0;
	flex: 1 1 auto;
}

.hw-row-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hw-row-title a {
	text-decoration: none;
	color: inherit;
}

.hw-row-meta {
	font-size: 12px;
	color: var(--hw-muted);
	margin-top: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hw-row .hw-install {
	margin-top: 0;
}

.hw-row .hw-app-actions,
.hw-app-actions--row {
	margin-top: 0;
	flex: 0 0 92px;
	width: 92px;
	max-width: 92px;
	min-width: 92px;
	align-self: center;
}

.hw-app-actions--row .hw-install {
	min-height: 40px;
	padding: 10px 8px;
	font-size: 12px;
}

.hw-bottom {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9;
	background: #fff;
	border-top: 1px solid var(--hw-line);
	display: flex;
	justify-content: space-around;
	padding: 8px 0;
}

.hw-nav {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	text-decoration: none;
}

.hw-nav svg {
	width: 21px;
	height: 21px;
}

.hw-nav:not(.is-on) {
	color: #4b5563;
}

.hw-nav.is-on {
	color: #1d4ed8;
}

.hw-empty {
	background: #fff;
	border: 1px solid var(--hw-line);
	border-radius: 12px;
	padding: 14px;
	color: #4b5563;
}

.hw-site-footer {
	padding: 16px 12px 4px;
	text-align: center;
	font-size: 12px;
	color: #4b5563;
}

.hw-site-footer a {
	text-decoration: none;
	color: #1d4ed8;
}

.hw-site-footer a:hover {
	text-decoration: underline;
}

.hw-site-footer-inner {
	max-width: 880px;
	margin: 0 auto;
}

.hw-site-footer .adr-footer-extra-row {
	display: block;
	width: 100%;
	margin-top: 4px;
	font-size: 12px;
	font-weight: 500;
	color: #334155;
}

.hw-site-footer .adr-footer-extra-row a {
	color: #334155;
}

.hw-site-footer .adr-footer-meta-row {
	display: block;
	width: 100%;
	margin-top: 4px;
	font-size: 12px;
	font-weight: 400;
	color: #4b5563;
}

.hw-site-footer .adr-footer-meta-row a {
	color: #4b5563;
}

.hw-site-footer-sep {
	color: #4b5563;
}

/* On regular WP pages we render `footer.site-footer` while `.hw-bottom`
 * is fixed at viewport bottom. Keep footer fully visible above bottom nav
 * and normalize typography to mobile footer size.
 */
body.apk-hw-market .site-footer {
	padding: 14px 10px calc(80px + env(safe-area-inset-bottom));
	text-align: center;
	font-size: 12px;
	line-height: 1.45;
	color: #4b5563;
}

body.apk-hw-market .site-footer a {
	color: #1d4ed8;
	text-decoration: none;
}

body.apk-hw-market .site-footer a:hover {
	text-decoration: underline;
}

body.apk-hw-market .site-footer .site-info {
	font-size: 12px;
	line-height: 1.45;
}

body.apk-hw-market .site-footer .adr-footer-nav-row,
body.apk-hw-market .site-footer .adr-footer-extra-row,
body.apk-hw-market .site-footer .adr-footer-meta-row {
	display: block;
	width: 100%;
	font-size: 12px;
	line-height: 1.45;
}

.apk-apps-market-top.hw-market-top-bar {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--hw-bg);
	padding: 8px 14px 10px;
}

.hw-breadcrumb-bar {
	padding: 0 14px 4px;
	background: var(--hw-bg);
}

.hw-breadcrumb-bar .pdc-breadcrumb.hw-top {
	margin: 0;
	padding: 0 0 8px;
	font-size: 13px;
	line-height: 1.45;
	color: var(--hw-muted);
	display: block;
	position: static;
	z-index: auto;
}

.hw-breadcrumb-bar .pdc-breadcrumb.hw-top a {
	color: var(--hw-blue);
	text-decoration: none;
}

.hw-breadcrumb-bar .pdc-breadcrumb.hw-top a:hover {
	text-decoration: underline;
}

.hw-breadcrumb-bar .pdc-breadcrumb-sep {
	color: #94a3b8;
}

.hw-breadcrumb-bar .pdc-breadcrumb-current {
	color: var(--hw-text);
	font-weight: 600;
}

#page > .hw-breadcrumb-bar {
	padding: 0 14px 4px;
}

/* Logged-in sessions include WP admin bar; reserve sticky offset to
 * prevent header jump/overlap in RUM traces (CLS on editor/admin views).
 */
body.admin-bar .apk-apps-market-top.hw-market-top-bar {
	top: 32px;
}

@media screen and (max-width: 782px) {
	body.admin-bar .apk-apps-market-top.hw-market-top-bar {
		top: 46px;
	}

	:root {
		--hw-cta-min-h: 38px;
	}

	.hw-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 14px 8px;
		padding: 0 2px 4px;
	}

	.hw-icon {
		width: 64px;
		height: 64px;
		border-radius: 16px;
	}

	.hw-name {
		font-size: 12px;
		min-height: 34px;
		max-height: 34px;
	}

	.hw-grid .hw-install,
	.hw-grid .hw-install.adr-download-btn,
	.hw-grid .hw-install.adr-visit-site-btn {
		min-height: 38px;
		padding: 9px 6px;
		font-size: 12px;
		border-radius: 10px;
	}

	.hw-row {
		padding: 14px 12px;
	}

	.hw-row .hw-icon {
		width: 60px;
		height: 60px;
	}

	.hw-row .hw-app-actions,
	.hw-app-actions--row {
		flex-basis: 96px;
		width: 96px;
		max-width: 96px;
		min-width: 96px;
	}

	.hw-app-actions--row .hw-install {
		min-height: 44px;
		font-size: 12px;
	}
}

@media screen and (max-width: 380px) {
	.hw-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 14px 10px;
	}

	.hw-grid .hw-install {
		font-size: 11px;
	}
}

.apk-apps-market-top .hw-tabs {
	display: flex;
	gap: 14px;
	white-space: nowrap;
	overflow: auto;
	padding: 2px 0 10px;
	-webkit-overflow-scrolling: touch;
}

.apk-apps-market-top .hw-tabs a {
	color: var(--hw-muted);
	text-decoration: none;
	font-size: 16px;
}

.apk-apps-market-top .hw-tabs a.is-on {
	color: var(--hw-text);
	font-weight: 700;
}

.apk-apps-market-top .hw-search {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #e5e7eb;
	border-radius: 16px;
	padding: 8px 12px;
	color: #4b5563;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.apk-apps-market-top .hw-search svg {
	display: block;
	width: 18px;
	height: 18px;
	max-width: 18px;
	max-height: 18px;
	flex: 0 0 18px;
	color: currentColor;
}

.apk-apps-market-top .hw-search input {
	border: 0;
	background: transparent;
	outline: 0;
	flex: 1;
	min-width: 0;
	font-size: 15px;
	color: var(--hw-text);
}

.apk-apps-market-top .hw-search input::placeholder {
	color: #52525b;
	opacity: 1;
}

.hw-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 10px;
	margin: 20px 0 8px;
	padding: 10px 0;
}

.hw-pagination .hw-page-link {
	min-width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 10px;
	border-radius: 10px;
	background: #fff;
	border: 1px solid #e5e7eb;
	color: #111827;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	box-sizing: border-box;
}

.hw-pagination .hw-page-link:hover {
	border-color: #cbd5e1;
	color: #0f172a;
}

.hw-pagination .hw-page-link.is-current {
	background: #1d4ed8;
	border-color: #1d4ed8;
	color: #fff;
}

.hw-pagination .hw-page-link.is-current:hover {
	color: #fff;
}

.hw-pagination .hw-page-prev,
.hw-pagination .hw-page-next {
	padding: 0 14px;
}

/* Keep sections in normal flow: `content-visibility:auto` can trigger
 * measurable layout shifts when intrinsic-size guesses are corrected.
 */
.hw-main > .hw-section {
	content-visibility: visible;
	contain-intrinsic-size: none;
}

.hw-banner-row .hw-banner img.hw-banner-img {
	object-fit: cover;
}

.hw-grid .hw-icon,
.hw-list .hw-icon {
	aspect-ratio: 1 / 1;
	display: block;
}

/*
 * `fetchpriority` is an HTML attribute, not a CSS property — an
 * earlier revision shipped `.hw-grid img, .hw-list img { fetchpriority:
 * low; }` here, which CSS parsers treat as an unknown declaration and
 * silently drop. The intent (deprioritize non-LCP grid/list thumbs) is
 * already enforced where it matters: the rendered `<img>` tags in
 * `hw-app` / `hw-row` markup set `fetchpriority="low"` directly on the
 * element. The CSS rule was a no-op that only served to trip
 * stylelint/IDE validators.
 */
.hw-404-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 48vh;
	padding: 40px 16px 32px;
	text-align: center;
}

.hw-404-code {
	font-size: 72px;
	font-weight: 700;
	line-height: 1;
	color: var(--hw-primary, #007dff);
	margin: 0 0 8px;
	opacity: 0.88;
}

.hw-404-title {
	font-size: 22px;
	font-weight: 600;
	color: #1f2937;
	margin: 0 0 12px;
}

.hw-404-desc {
	font-size: 15px;
	color: #4b5563;
	max-width: 420px;
	margin: 0 0 24px;
	line-height: 1.55;
}

.hw-404-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	justify-content: center;
}

.hw-404-btn {
	display: inline-flex;
	align-items: center;
	padding: 12px 20px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: opacity 0.15s;
}

.hw-404-btn:hover {
	opacity: 0.92;
}

.hw-404-btn-primary {
	background: var(--hw-primary, #007dff);
	color: #fff;
}

.hw-404-btn-secondary {
	background: #fff;
	border: 1px solid var(--hw-line, #e5e7eb);
	color: #1f2937;
}
