/*
 * APKLawn base stylesheet.
 * Stage 2 scope: reset + root variables only (wired to the Customizer in
 * inc/customizer.php). Layout, header/footer, cards, archive grid, single
 * App page, download flow, and responsive rules are built in Stage 3-5.
 */

:root {
	--apklawn-accent: #1a73e8;
	--apklawn-text: #212121;
	--apklawn-bg: #ffffff;
	--apklawn-gray: #6b6b6b;
	--apklawn-border: #eeeeee;
	--apklawn-radius: 12px;
	--apklawn-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: var(--apklawn-font);
	color: var(--apklawn-text);
	background: var(--apklawn-bg);
	line-height: 1.6;
	overflow-x: hidden;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

a {
	color: var(--apklawn-accent);
	text-decoration: none;
}

.container {
	width: 100%;
	max-width: calc(970px + 8vw);
	margin-inline: auto;
	padding-inline: 4vw;
}

/* ==========================================================================
   Stage 3: Header, Footer, Bottom Nav, Modals, Cards, Home, Search
   ========================================================================== */

/* ---- Header ---- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 20;
	background: var(--apklawn-bg);
	border-bottom: 1px solid var(--apklawn-border);
}

.site-header__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-block: 12px;
}

.site-header__logo {
	display: flex;
	align-items: center;
	gap: 8px;
}

.site-header__logo-text {
	font-weight: 700;
	font-size: 1.15rem;
	color: var(--apklawn-text);
}

.site-header__search-btn,
.site-header__menu-btn {
	background: none;
	border: none;
	color: var(--apklawn-text);
	padding: 8px;
	cursor: pointer;
	line-height: 0;
}

/* ---- Breadcrumbs ---- */
.breadcrumbs {
	padding: 10px 0;
}

.breadcrumbs__list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0 4vw;
	font-size: 0.85rem;
	color: var(--apklawn-gray);
}

.breadcrumbs__item {
	display: flex;
	align-items: center;
	gap: 4px;
}

.breadcrumbs__sep {
	margin-left: 4px;
	color: var(--apklawn-gray);
}

/* ---- Modals (search + sidebar) ---- */
body.apklawn-modal-open {
	overflow: hidden;
}

.apklawn-modal[hidden] {
	display: none;
}

.apklawn-modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 40;
}

.apklawn-modal__panel {
	position: fixed;
	top: 10vh;
	left: 50%;
	transform: translateX(-50%);
	width: min(560px, 92vw);
	background: var(--apklawn-bg);
	border-radius: var(--apklawn-radius);
	padding: 20px;
	z-index: 41;
}

.search-modal__form {
	display: flex;
	gap: 8px;
}

.search-modal__form input {
	flex: 1;
	padding: 12px 14px;
	border: 1px solid var(--apklawn-border);
	border-radius: 8px;
	font-size: 1rem;
}

.search-modal__form button {
	padding: 12px 18px;
	background: var(--apklawn-accent);
	color: #fff;
	border: none;
	border-radius: 8px;
	cursor: pointer;
}

.apklawn-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	background: none;
	border: none;
	font-size: 1.5rem;
	cursor: pointer;
	color: var(--apklawn-gray);
}

.apklawn-modal--sidebar .apklawn-sidebar__panel {
	position: fixed;
	top: 0;
	right: 0;
	height: 100%;
	width: min(320px, 85vw);
	background: var(--apklawn-bg);
	z-index: 41;
	padding: 24px 20px;
	overflow-y: auto;
}

.apklawn-sidebar__sections {
	list-style: none;
	margin: 40px 0 0;
	padding: 0;
}

.apklawn-sidebar__sections > li > a {
	display: block;
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--apklawn-text);
	padding: 10px 0;
}

.apklawn-sidebar__subcats {
	list-style: none;
	margin: 0 0 12px;
	padding: 0 0 0 12px;
}

.apklawn-sidebar__subcats a {
	display: block;
	padding: 6px 0;
	color: var(--apklawn-gray);
	font-size: 0.92rem;
}

.apklawn-sidebar__count {
	color: var(--apklawn-gray);
	font-size: 0.8em;
}

/* ---- App Card ---- */
.app-card {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px;
	border: 1px solid var(--apklawn-border);
	border-radius: var(--apklawn-radius);
	color: var(--apklawn-text);
	position: relative;
	background: var(--apklawn-bg);
}

.app-card--grid {
	flex: 0 0 auto;
	width: 160px;
	flex-direction: column;
	align-items: flex-start;
	text-align: left;
}

.app-card__icon {
	width: 64px;
	height: 64px;
	border-radius: 16px;
	overflow: hidden;
	flex: none;
	background: var(--apklawn-border);
	display: flex;
	align-items: center;
	justify-content: center;
}

.app-card__icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.app-card__icon-fallback {
	font-weight: 700;
	font-size: 1.4rem;
	color: var(--apklawn-gray);
}

.app-card__body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.app-card__title {
	font-weight: 600;
	font-size: 0.95rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}

.app-card__developer {
	font-size: 0.8rem;
	color: var(--apklawn-gray);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}

.app-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 0.78rem;
	color: var(--apklawn-gray);
}

.app-card__rating {
	color: #f5a623;
	display: inline-flex;
	gap: 3px;
	align-items: center;
}

.app-card__rating-num {
	color: var(--apklawn-gray);
}

.app-card__badge {
	position: absolute;
	top: 8px;
	right: 8px;
	font-size: 0.65rem;
	padding: 2px 6px;
	border-radius: 6px;
	background: var(--apklawn-border);
	color: var(--apklawn-gray);
}

.app-card--grid .app-card__badge {
	display: none; /* Redundant within a Games/Apps-split section. */
}

/* ---- Home ---- */
.home-hero {
	padding: 32px 0 8px;
	text-align: center;
}

.home-hero__title {
	font-size: 1.6rem;
	margin: 0 0 4px;
}

.home-hero__tagline {
	color: var(--apklawn-gray);
	margin: 0;
}

.home-section {
	padding: 20px 0;
}

.home-section__heading {
	font-size: 1.2rem;
	margin: 0 0 12px;
}

.home-section__row {
	margin-bottom: 18px;
}

.home-section__row-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 8px;
}

.home-section__row-head h3 {
	font-size: 1rem;
	margin: 0;
}

.home-section__row-head a {
	font-size: 0.85rem;
}

.home-section__strip {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	padding-bottom: 4px;
	scroll-snap-type: x proximity;
}

.home-section__strip .app-card {
	scroll-snap-align: start;
}

.category-showcase {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.category-chip {
	padding: 8px 14px;
	border-radius: 999px;
	background: var(--apklawn-border);
	color: var(--apklawn-text);
	font-size: 0.85rem;
	display: inline-flex;
	gap: 6px;
}

.category-chip__count {
	color: var(--apklawn-gray);
}

/* ---- Search Results ---- */
.search-results {
	padding: 20px 0 60px;
}

.search-results__heading {
	font-size: 1.3rem;
	margin: 0 0 14px;
}

.search-results__form {
	display: flex;
	gap: 8px;
	margin-bottom: 14px;
}

.search-results__form input {
	flex: 1;
	padding: 10px 14px;
	border: 1px solid var(--apklawn-border);
	border-radius: 8px;
}

.search-results__form button {
	padding: 10px 16px;
	background: var(--apklawn-accent);
	color: #fff;
	border: none;
	border-radius: 8px;
	cursor: pointer;
}

.search-results__filters {
	display: flex;
	gap: 8px;
	margin-bottom: 16px;
}

.search-results__filters a {
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--apklawn-border);
	color: var(--apklawn-text);
	font-size: 0.85rem;
}

.search-results__filters a.is-active {
	background: var(--apklawn-accent);
	color: #fff;
}

.search-results__count,
.search-results__empty {
	color: var(--apklawn-gray);
	font-size: 0.9rem;
	margin-bottom: 14px;
}

.app-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.app-grid .app-card {
	width: 100%;
}

/* ---- Footer ---- */
.site-footer {
	border-top: 1px solid var(--apklawn-border);
	padding: 32px 0 96px; /* Extra bottom padding clears the fixed bottom-nav bar. */
	margin-top: 20px;
}

.site-footer__inner {
	display: flex;
	flex-direction: column;
	gap: 14px;
	align-items: flex-start;
}

.site-footer__tagline {
	color: var(--apklawn-gray);
	font-size: 0.9rem;
	margin: 4px 0 0;
}

.site-footer__links,
.site-footer__social {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	font-size: 0.9rem;
}

.site-footer__copyright {
	color: var(--apklawn-gray);
	font-size: 0.8rem;
	margin: 0;
}

/* ---- Bottom Nav ---- */
.bottom-nav {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 30;
	display: flex;
	background: var(--apklawn-bg);
	border-top: 1px solid var(--apklawn-border);
	padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav__item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 8px 0 6px;
	font-size: 0.68rem;
	color: var(--apklawn-gray);
	background: none;
	border: none;
	cursor: pointer;
}

.bottom-nav__item.is-active {
	color: var(--apklawn-accent);
}

/* ---- Responsive ---- */
@media (min-width: 782px) {
	.bottom-nav {
		display: none; /* Desktop: rely on header + footer nav instead. */
	}

	.site-footer {
		padding-bottom: 32px;
	}

	.app-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.app-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}
