/*
 * Shop hub (feature shop_hub; inc/features/shop-hub.php). Loaded only while the switch is on, on the shop and the product category
 * pages. The pages wear the Hardware procurement page's parts and styles (assets/css/pages/our-range.css under .cc-p-range, and
 * hardware-hub.css and hardware-scenes.css): this file adds only what those pages do not have. The hero picture or drawing, the
 * breadcrumb in the hero, the hero actions, and the spec line on the cards of the shop's own grid.
 *
 * Colour, type, space and motion read tokens.css only. No glow, no gradient other than the picture's fade, no shadow. Nothing moves.
 */

.cc-shop-hub {
	display: block;
}

.cc-shop-hub > * {
	margin-block: 0;
}

/* ------------------------------------------------------------------ hero */

.cc-shop-hub__hero .woocommerce-breadcrumb {
	margin: 0 0 var(--cc-space-l);
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-xs);
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

/* Specific enough to win over .cc-p-range__hero .cc-hero__content > * (our-range.css), which zeroes the margins. */
.cc-shop-hub__hero .cc-hero__content > .cc-shop-hub__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cc-space-s);
	margin: var(--cc-space-l) 0 0;
}

/* The shop picture (P07: a headset on a desk, on the right of the frame). On a phone and tablet it sits under the words and melts
   into the page at its top and bottom; from desktop it fills the right of the hero and fades into the dark on the text side. */
.cc-shop-hub__media--photo {
	aspect-ratio: 4 / 3;
}

.cc-shop-hub__media--photo .cc-shop-hub__img {
	object-position: 78% 55%;
}

.cc-shop-hub__media--photo::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(180deg, var(--cc-color-canvas) 0%, transparent 22%, transparent 70%, var(--cc-color-canvas) 100%);
}

@media (min-width: 48em) {
	.cc-shop-hub__media--photo {
		aspect-ratio: 5 / 2;
	}
}

@media (min-width: 70em) {
	.cc-shop-hub__media--photo {
		left: 26%;
		aspect-ratio: auto;
	}

	.cc-shop-hub__media--photo .cc-shop-hub__img {
		object-position: 70% 50%;
	}

	.cc-shop-hub__media--photo::after {
		background: linear-gradient(90deg, var(--cc-color-canvas) 0%, color-mix(in srgb, var(--cc-color-canvas) 60%, transparent) 26%, transparent 56%), linear-gradient(0deg, var(--cc-color-canvas) 0%, transparent 22%), linear-gradient(180deg, var(--cc-color-canvas) 0%, transparent 24%);
	}
}

/* A category page shows its own drawing instead of the picture: under the words on a phone and tablet, on the right from desktop. */
.cc-shop-hub__media--scene {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: auto;
	padding: 0 var(--cc-space-l) var(--cc-space-xl);
	background: transparent;
}

.cc-shop-hub__scene {
	width: min(100%, 24rem);
	aspect-ratio: 3 / 2;
}

@media (min-width: 70em) {
	.cc-shop-hub__media--scene {
		inset: 0 0 0 auto;
		width: 48%;
		padding: var(--cc-space-xl) var(--cc-space-xxl) var(--cc-space-xl) 0;
	}

	.cc-shop-hub__media--scene::after {
		content: none;
	}

	.cc-shop-hub__scene {
		width: min(100%, 30rem);
	}
}

/* ------------------------------------------------------------------ sections */

/* On a category page the listing follows the hero directly. */
.cc-shop--category .cc-shop-hub__all {
	border-top: 0;
	padding-top: var(--cc-space-l);
}

/* There the heading bar would hold only the search, floating on its own above the category row: the shop page keeps the search. */
.cc-shop--category .cc-shop-hub__all .cc-p-range__head--bar {
	display: none;
}

/* The store notices (a product added to the cart, an error) sit just under the hero, where they are seen; empty, they take no room. */
.cc-shop-hub__notices .woocommerce-notices-wrapper:empty {
	display: none;
}

/* ------------------------------------------------------------------ cards of the shop's own grid */

/* The name to its first comma is the heading and the rest a quiet spec line (inc/features/shop-hub.php), as on the hub cards. */
.cc-shop-hub .cc-shop-grid .cc-shop-card .cc-hub-card__spec {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
	margin: 0;
	padding: var(--cc-space-xxs) var(--cc-space-m) 0;
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
	line-height: 1.4;
}

.cc-shop-hub .cc-shop-grid .cc-hub-card__spec .cc-nobreak {
	white-space: nowrap;
}

.cc-shop-hub .cc-shop-grid .cc-shop-card__price .cc-price--discuss {
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
	font-weight: 400;
}

/* A phone: the card is a list row (shop-listing.css), the photo beside the name, the spec line, the price and the button, as the hub
   cards do (hardware-hub.css). Without this the spec line drops under the photo. */
@media (max-width: 29.99em) {
	.cc-shop-hub .cc-shop-grid .cc-shop-card:has(.cc-hub-card__spec) {
		grid-template-rows: auto auto 1fr auto;
	}

	.cc-shop-hub .cc-shop-grid .cc-shop-card:has(.cc-hub-card__spec) .cc-shop-card__media {
		grid-row: 1 / span 4;
	}

	.cc-shop-hub .cc-shop-grid .cc-shop-card .cc-hub-card__spec {
		grid-column: 2;
		grid-row: 2;
	}

	.cc-shop-hub .cc-shop-grid .cc-shop-card:has(.cc-hub-card__spec) .cc-shop-card__price {
		grid-row: 3;
	}

	.cc-shop-hub .cc-shop-grid .cc-shop-card:has(.cc-hub-card__spec) .cc-shop-card__button {
		grid-row: 4;
	}
}
