/**
 * Shop landing hub — game-picker tiles that replace the flat "all products"
 * shop page (astra-child/parts/shop-hub.php + the $pc_show_shop_hub branch
 * in astra-child/woocommerce/archive-product.php).
 *
 * Desktop (min-width:1026px): a 2x2 grid of tall tiles. Mobile (max-width:
 * 1025px, the nav shell's breakpoint): the same tiles stacked in one column
 * and scaled down, under the Shop tab's pinned root header (the brand mark,
 * "Shop" and the catalog link) — design handoff screen 6a, with the brand
 * mark system's root header.
 *
 * Design tokens (--accent, --pc-parchment, --radius-pill, --font-display,
 * etc.) are defined once in nav-shell.css, loaded sitewide and declared as
 * this file's dependency in pcf_enqueue_styles() — not redeclared here.
 */

/* The hub replaces the flat grid at every width; archive-product.php only
   adds .pc-shop-hub-flat-grid while the hub is showing. */
.pc-shop-hub-flat-grid {
	display: none;
}

.pc-shop-hub__title,
.pc-shop-hub-tile__cta-short,
.pc-shop-hub__browse-short {
	display: none;
}

@media (min-width: 1026px) {

	.pc-shop-hub {
		display: block;
		/* width:100% (not just max-width) matters here: <main class="page-holder">
		   is a column flex container (astra-child's own _base.scss), and a
		   flex item with width:auto plus margin:0 auto has its cross-axis
		   stretch overridden by the auto margins, collapsing it to its
		   content's width instead of the container's — explicit width:100%
		   gives max-width something to actually clamp. */
		width: 100%;
		/* Deliberately its own container rather than the site's bootstrap
		   .container (which maxes out at 1172/1320px, not 1200px) — the
		   handoff specifies 1200px as final. */
		max-width: 1200px;
		margin: 0 auto;
		padding: 40px 24px 88px;
		box-sizing: border-box;
		--pc-shop-hub-ink: #2a1d12;
	}

	.pc-shop-hub__browse {
		display: flex;
		justify-content: flex-end;
		margin-bottom: 28px;
	}

	/* The mobile root header's mark and title; desktop has the hero. */
	.pc-shop-hub__browse .pc-header-brand {
		display: none;
	}

	.pc-shop-hub__browse-link {
		font-family: var(--font-ui);
		font-size: 0.85rem;
		font-weight: 600;
		color: var(--text-muted);
		text-decoration: none;
	}

	.pc-shop-hub__browse-link:hover {
		text-decoration: underline;
	}

	.pc-shop-hub__grid {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 28px;
	}

	/* The whole tile is the link (not just the CTA, as in the original
	   design reference) — a bigger, more forgiving click target, and it
	   avoids nesting an <a> inside an <a> for the CTA pill (invalid HTML). */
	.pc-shop-hub-tile {
		position: relative;
		display: block;
		overflow: hidden;
		height: 400px;
		border-radius: var(--radius-lg);
		border: var(--bw-default) solid var(--pc-shop-hub-ink);
		text-decoration: none;
		color: inherit;
		box-shadow:
			-1px 3px 6px rgba(35, 33, 22, 0.18),
			-3px 11px 11px rgba(35, 33, 22, 0.14),
			-7px 24px 15px rgba(35, 33, 22, 0.08);
		transition: box-shadow 0.25s ease-in-out;
	}

	.pc-shop-hub-tile:hover,
	.pc-shop-hub-tile:focus-visible {
		box-shadow:
			-2px 6px 10px rgba(35, 33, 22, 0.30),
			-5px 16px 18px rgba(35, 33, 22, 0.24),
			-10px 30px 24px rgba(35, 33, 22, 0.18);
	}

	.pc-shop-hub-tile__accent {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 6px;
		background: var(--pc-shop-hub-accent);
		z-index: 3;
		pointer-events: none;
	}

	.pc-shop-hub-tile__collage {
		position: absolute;
		top: 6px;
		left: 0;
		right: 0;
		height: 256px;
		overflow: hidden;
		background: var(--surface-sunken);
	}

	/* Oversized (inset:-6%) so the hover zoom never reveals empty edges. */
	.pc-shop-hub-tile__collage-inner {
		position: absolute;
		inset: -6%;
		display: grid;
		grid-template-columns: 1fr 1fr;
		grid-template-rows: 1fr 1fr;
		gap: 3px;
		transition: transform 0.6s ease-in-out;
		transform: scale(1);
	}

	.pc-shop-hub-tile:hover .pc-shop-hub-tile__collage-inner,
	.pc-shop-hub-tile:focus-visible .pc-shop-hub-tile__collage-inner {
		transform: scale(1.06);
	}

	.pc-shop-hub-tile__thumb {
		display: block;
		overflow: hidden;
	}

	.pc-shop-hub-tile__thumb img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	.pc-shop-hub-tile__text {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		height: 138px;
		background: var(--pc-shop-hub-ink);
		z-index: 2;
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		justify-content: center;
		gap: 10px;
		padding: 0 28px;
		box-sizing: border-box;
	}

	.pc-shop-hub-tile__title {
		font-family: var(--font-display);
		font-weight: 600;
		font-size: 1.65rem;
		line-height: 1.15;
		color: var(--pc-parchment);
		margin: 0;
	}

	.pc-shop-hub-tile__cta {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		padding: 12px 20px;
		border-radius: var(--radius-pill);
		font-family: var(--font-ui);
		font-weight: 700;
		font-size: 0.9rem;
		white-space: nowrap;
		background: rgba(249, 223, 190, 0.12);
		color: var(--pc-parchment);
		border: var(--bw-default) solid rgba(249, 223, 190, 0.4);
		transition: var(--motion-default);
	}

	.pc-shop-hub-tile:hover .pc-shop-hub-tile__cta,
	.pc-shop-hub-tile:focus-visible .pc-shop-hub-tile__cta {
		background: var(--accent);
		color: #fff;
		border-color: var(--accent);
	}

	@media (prefers-reduced-motion: reduce) {
		.pc-shop-hub-tile,
		.pc-shop-hub-tile__collage-inner,
		.pc-shop-hub-tile__cta {
			transition: none;
		}
	}
}

@media (max-width: 1025px) {

	.pc-shop-hub {
		display: block;
		padding: 16px 18px 24px;
		--pc-shop-hub-ink: var(--pc-brown-dark);
	}

	/* The root header (nav-shell.css's .pc-root-header), edge to edge and
	   pinned to the top while the tiles scroll under it. Sticky engages here
	   because astra-child's product-tile.css already turns <main
	   class="page-holder">'s overflow:hidden off on WooCommerce pages. Above
	   .container's z-index:20. */
	.pc-shop-hub__browse {
		position: sticky;
		top: 0;
		z-index: 30;
		margin: -16px -18px 16px;
	}

	.pc-shop-hub__browse-link {
		flex: none;
		font-family: var(--font-ui);
		font-size: 0.75rem;
		font-weight: 700;
		color: var(--pc-brown-50) !important;
		text-decoration: none;
		white-space: nowrap;
	}

	.pc-shop-hub__browse-long {
		display: none;
	}

	.pc-shop-hub__browse-short {
		display: inline;
	}

	.pc-shop-hub__grid {
		display: grid;
		grid-template-columns: 1fr;
		gap: 14px;
	}

	.pc-shop-hub-tile {
		display: flex;
		flex-direction: column;
		overflow: hidden;
		border-radius: var(--radius-lg);
		border: 1px solid var(--pc-shop-hub-ink);
		box-shadow: var(--shadow-sm);
		text-decoration: none !important;
		-webkit-tap-highlight-color: transparent;
	}

	.pc-shop-hub-tile__accent {
		display: block;
		height: 5px;
		background: var(--pc-shop-hub-accent);
	}

	.pc-shop-hub-tile__collage {
		display: block;
		height: 108px;
		overflow: hidden;
		background: var(--surface-sunken);
	}

	.pc-shop-hub-tile__collage-inner {
		display: grid;
		grid-template-columns: 1fr 1fr;
		grid-template-rows: 1fr 1fr;
		gap: 2px;
		height: 100%;
	}

	.pc-shop-hub-tile__thumb {
		display: block;
		overflow: hidden;
		background: var(--pc-tan);
	}

	.pc-shop-hub-tile__thumb img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
	}

	.pc-shop-hub-tile__text {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		min-height: 56px;
		padding: 8px 12px 8px 16px;
		background: var(--pc-shop-hub-ink);
	}

	.pc-shop-hub-tile__title {
		font-family: var(--font-display);
		font-size: 0.98rem;
		font-weight: 600;
		line-height: 1.2;
		color: var(--pc-parchment);
	}

	.pc-shop-hub-tile__cta {
		flex: none;
		display: inline-flex;
		align-items: center;
		gap: 6px;
		min-height: 36px;
		padding: 0 14px;
		border-radius: var(--radius-pill);
		background: var(--accent);
		font-family: var(--font-ui);
		font-size: 0.8rem;
		font-weight: 700;
		color: #fff;
	}

	.pc-shop-hub-tile__cta-long {
		display: none;
	}

	.pc-shop-hub-tile__cta-short {
		display: inline;
	}
}

/* ---------- Tablets ----------
   The phone's stacked tiles, two to a row, with a taller collage. */
@media (min-width: 600px) and (max-width: 1025px) {
	.pc-shop-hub {
		padding: 20px 24px 32px;
	}

	.pc-shop-hub__browse {
		margin: -20px -24px 20px;
	}

	.pc-shop-hub__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 20px;
	}

	.pc-shop-hub-tile__collage {
		height: 190px;
	}

	.pc-shop-hub-tile__text {
		min-height: 64px;
		padding: 10px 14px 10px 18px;
	}

	.pc-shop-hub-tile__title {
		font-size: 1.1rem;
	}
}
