/*
 * Hardware hub (feature hardware_hub; inc/features/hardware-hub.php). Loaded only while the switch is on, on the Our range page, the
 * shop and the product category archives (the category row); not on a single product, the cart, the checkout, the account pages or a search.
 *
 * Adds the layout of the new sections of /our-range/ (release/live-pages/our-range.html) and the scene tiles. The look of a product
 * card is NOT here: the cards are the existing .cc-shop-card cards styled by assets/css/pages/our-range.css under .cc-p-range, and the
 * lists below reuse the .cc-shop-grid hook that file already styles. The drawings are styled by hardware-scenes.css.
 *
 * The page, top to bottom: hero (unchanged), a quiet jump row, the category tiles (drawn scenes), laptops and workstations (a
 * heading column beside the cards, or across the top from 75em), accessories (a flat band), how it works (a wide drawing and three
 * steps), the closing band.
 * Colour, type, space and motion read tokens.css only. No glow, no gradient, no shadow. Nothing here moves.
 */

/* ------------------------------------------------------------------ anchors */

.cc-p-range__section[id] {
	scroll-margin-top: var(--cc-space-xl);
}

/* ------------------------------------------------------------------ jump row */

.cc-p-range__jump {
	margin: 0;
	border-bottom: 1px solid var(--cc-color-line);
}

.cc-p-range__jump-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--cc-space-xl);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cc-p-range__jump-list > li {
	margin: 0;
	padding: 0;
}

.cc-p-range__jump-list a {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	min-height: var(--cc-target-min);
	border-bottom: 2px solid transparent;
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-xs);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-decoration: none;
	text-transform: uppercase;
}

.cc-p-range__jump-list a:hover {
	border-bottom-color: var(--cc-color-action);
	color: var(--cc-color-white);
}

/* ------------------------------------------------------------------ section rhythm */

/* The tiles section keeps its own padding from our-range.css. The three new sections stand on their own, and the page alternates
   the canvas and one flat, slightly lifted surface the way the Managed IT page does: tiles on the canvas, laptops and workstations
   lifted, accessories on the canvas, how it works lifted, then the closing band. A hairline marks each edge. */
.cc-p-range__section--hw,
.cc-p-range__section--how {
	border-block: 1px solid var(--cc-color-line);
	padding-top: var(--cc-space-section);
	background: color-mix(in srgb, var(--cc-color-raised) 38%, var(--cc-color-canvas));
}

.cc-p-range__section--acc {
	padding-top: var(--cc-space-section);
}

.cc-p-range__lede {
	max-width: 36rem;
	margin: var(--cc-space-m) 0 0;
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-m);
	line-height: 1.55;
	text-wrap: pretty;
}

/* ------------------------------------------------------------------ category tiles: drawn scenes */

/* The scene sits where the photo sat: a flat dark panel with the drawing fitted inside it. */
.cc-feature-hardware_hub .cc-p-range__cat--scene .cc-p-range__scene {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	box-sizing: border-box;
	padding: var(--cc-space-xs);
	background: var(--cc-color-canvas);
}

.cc-feature-hardware_hub .cc-p-range__cat--scene .cc-p-range__scene > svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* A phone: the thumbnail column is closed off by a hairline. */
.cc-feature-hardware_hub .cc-p-range__cat--scene .cc-p-range__pic {
	border-right: 1px solid var(--cc-color-line);
}

@media (min-width: 40em) {
	.cc-feature-hardware_hub .cc-p-range__cat--scene .cc-p-range__pic {
		border-right: 0;
		border-bottom: 1px solid var(--cc-color-line);
	}

	.cc-feature-hardware_hub .cc-p-range__cat--scene .cc-p-range__scene {
		padding: var(--cc-space-m);
	}

	/* There is no icon chip across the foot of the picture, so the body needs no room for it. */
	.cc-feature-hardware_hub .cc-p-range__cat--scene .cc-p-range__body {
		padding: var(--cc-space-l) var(--cc-space-l) 0;
	}
}

/* ------------------------------------------------------------------ laptops and workstations: heading column beside the cards */

.cc-p-range__split {
	display: grid;
	gap: var(--cc-space-xl);
}

.cc-p-range__split > * {
	margin-block: 0;
}

.cc-p-range__side > * {
	margin-block: 0;
}

.cc-p-range__side > * + * {
	margin-top: var(--cc-space-m);
}

.cc-p-range__side .cc-p-range__lede {
	margin-top: var(--cc-space-m);
}

.cc-p-range__side .cc-p-range__title {
	font-size: clamp(1.5rem, 2.2vw, 2rem);
	overflow-wrap: break-word;
}

/* The prices note: a quiet rule in the action colour, not a box. */
.cc-p-range__note {
	max-width: 32rem;
	padding-inline-start: var(--cc-space-m);
	border-inline-start: 2px solid var(--cc-color-action);
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
	line-height: 1.5;
}

.cc-p-range__side .cc-p-range__actions {
	margin-top: var(--cc-space-l);
}

@media (min-width: 64em) {
	.cc-p-range__split {
		grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
		gap: var(--cc-space-xxl);
		align-items: start;
	}

	.cc-p-range__side {
		position: sticky;
		top: var(--cc-space-xl);
	}
}

/* Wide: the heading block lies across the top (the words on the left, the note and the button on the right) and the cards take
   the full width, four across, so the eight laptops and the workstations fill their rows. */
@media (min-width: 75em) {
	.cc-p-range__split {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--cc-space-xl);
	}

	.cc-p-range__side {
		position: static;
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
		column-gap: var(--cc-space-xxl);
		row-gap: var(--cc-space-m);
		align-items: end;
	}

	.cc-p-range__side > * {
		grid-column: 1;
		margin: 0;
	}

	/* The title has the room for one line and the size of the other section titles. */
	.cc-p-range__side .cc-p-range__title {
		max-width: none;
		font-size: clamp(1.6rem, 2.8vw, 2.4rem);
	}

	.cc-p-range__side > .cc-p-range__note {
		grid-column: 2;
		grid-row: 2;
	}

	.cc-p-range__side > .cc-p-range__actions {
		grid-column: 2;
		grid-row: 3;
		align-self: start;
		margin: 0;
	}
}

/* The two lists (laptops, then workstations), each under its own small heading with a link to its category. */
.cc-hub-products--hardware {
	display: grid;
	gap: var(--cc-space-xxl);
}

.cc-hub-group__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0 var(--cc-space-l);
	margin-bottom: var(--cc-space-l);
	padding-bottom: var(--cc-space-xs);
	border-bottom: 1px solid var(--cc-color-line);
}

.cc-hub-group__title {
	margin: 0;
	font-family: var(--cc-font-heading);
	font-size: var(--cc-font-size-l);
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.2;
	text-transform: uppercase;
}

.cc-hub-group__more,
.cc-hub-link {
	display: inline-flex;
	align-items: center;
	min-height: var(--cc-target-min);
	color: var(--cc-color-white);
	font-size: var(--cc-font-size-s);
	text-decoration: underline;
	text-decoration-color: var(--cc-color-action);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.25em;
}

.cc-hub-group__more:hover,
.cc-hub-link:hover {
	color: var(--cc-color-action-hover);
}

/* The lists use the .cc-shop-grid rules of our-range.css (one column, two, three, four). The laptops and workstations come in twos and
   fours, so they go two across from tablet width (beside the heading column from 64em, where there is less room) and four across
   once the heading block lies across the top, and never leave a card alone on the last row. The accessories also go four across
   from 75em. */
.cc-p-range .cc-hub-products--hardware .cc-shop-grid ul.wc-block-product-template {
	margin: 0;
}

@media (min-width: 48em) {
	.cc-p-range .cc-hub-products--hardware .cc-shop-grid ul.wc-block-product-template {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--cc-space-m);
	}
}

@media (min-width: 75em) {
	.cc-p-range .cc-hub-products--hardware .cc-shop-grid ul.wc-block-product-template,
	.cc-p-range .cc-hub-products--accessories .cc-shop-grid ul.wc-block-product-template {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: var(--cc-space-l);
	}
}

/* ------------------------------------------------------------------ the cards of these lists */

/* Under the name (the product name up to its first comma) sits the rest as a quiet spec line, two lines at most. */
.cc-p-range .cc-hub-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);
	font-weight: 400;
	line-height: 1.4;
	text-wrap: pretty;
}

/* "2-in-1" and "Wi-Fi" stay in one piece (inc/features/hardware-hub.php, inc/shop-listing.php wrap them). */
.cc-p-range .cc-hub-card__spec .cc-nobreak {
	white-space: nowrap;
}

/* No price: plain quiet text in the price slot. It is not a link and not a heading, so it takes the same size as the spec line and
   the regular weight (the card's name link is the one link, and the button below it is the action). */
.cc-p-range .cc-hub-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, the photo beside the name, the spec line, the price and the button. */
@media (max-width: 29.99em) {
	.cc-p-range .cc-hub-grid .cc-shop-card {
		grid-template-rows: auto auto 1fr auto;
	}

	.cc-p-range .cc-hub-grid .cc-shop-card .cc-shop-card__media {
		grid-row: 1 / span 4;
	}

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

	.cc-p-range .cc-hub-grid .cc-shop-card .cc-shop-card__price {
		grid-row: 3;
	}

	.cc-p-range .cc-hub-grid .cc-shop-card .cc-shop-card__button {
		grid-row: 4;
	}
}

.cc-hub-products__more {
	margin: var(--cc-space-xl) 0 0;
	text-align: center;
}

.cc-hub-empty a {
	color: var(--cc-color-white);
}

/* ------------------------------------------------------------------ accessories: pages of the list */

.cc-hub-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--cc-space-xs);
	margin-top: var(--cc-space-xl);
}

.cc-hub-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: var(--cc-target-min);
	min-height: var(--cc-target-min);
	padding: 0 var(--cc-space-s);
	border: 1px solid var(--cc-color-line-strong);
	border-radius: var(--cc-radius-s);
	color: var(--cc-color-white);
	font-size: var(--cc-font-size-s);
	text-decoration: none;
}

.cc-hub-pagination a.page-numbers:hover {
	border-color: var(--cc-color-white);
}

.cc-hub-pagination .page-numbers.current {
	background-color: var(--cc-color-white);
	border-color: var(--cc-color-white);
	color: var(--cc-color-canvas);
	font-weight: 600;
}

.cc-hub-pagination .page-numbers.dots {
	border-color: transparent;
}

/* ------------------------------------------------------------------ how it works */

/* The wide drawing sits in a hairline frame from tablet width. Below it the drawing is left out (hardware-scenes.css), and the three
   steps say the same thing, so the frame goes with it. */
.cc-hub-scene--process {
	display: none;
	margin-top: var(--cc-space-xl);
	padding: var(--cc-space-m) var(--cc-space-l);
	border: 1px solid var(--cc-color-line);
	background: var(--cc-color-canvas);
}

@media (min-width: 48em) {
	.cc-hub-scene--process {
		display: block;
	}
}

.cc-p-range__steps {
	display: grid;
	gap: var(--cc-space-l);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cc-p-range__step {
	margin: 0;
	padding: var(--cc-space-m) 0 0;
	border-top: 2px solid var(--cc-color-line-strong);
}

.cc-p-range__step > * {
	margin-block: 0;
}

.cc-p-range__step-title {
	font-family: var(--cc-font-heading);
	font-size: var(--cc-font-size-m);
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.25;
	text-transform: uppercase;
}

.cc-p-range__step-text {
	max-width: 24rem;
	margin-top: var(--cc-space-xs);
	color: var(--cc-color-secondary);
	line-height: 1.55;
}

@media (min-width: 48em) {
	.cc-p-range__steps {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: var(--cc-space-xl);
		margin-top: var(--cc-space-xl);
	}
}

/* ------------------------------------------------------------------ the shop and the category pages: shop by type */

.cc-hub-types {
	margin: 0 0 var(--cc-space-l);
}

.cc-hub-types__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cc-space-xs);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cc-hub-types__list > li {
	flex: none;
	margin: 0;
	padding: 0;
}

/* A phone: one row that scrolls sideways inside its own box, instead of seven wrapped rows above the products. The page itself does
   not scroll sideways. */
@media (max-width: 47.99em) {
	.cc-hub-types__list {
		flex-wrap: nowrap;
		overflow-x: auto;
		padding-bottom: var(--cc-space-xs);
		scroll-padding-inline: var(--cc-space-m);
		scrollbar-width: thin;
	}
}

.cc-hub-types__link {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	min-height: var(--cc-target-min);
	padding: 0 var(--cc-space-m);
	border: 1px solid var(--cc-color-line);
	border-radius: var(--cc-radius-s);
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-xs);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-decoration: none;
	text-transform: uppercase;
}

.cc-hub-types__link:hover {
	border-color: var(--cc-color-white);
	color: var(--cc-color-white);
}

.cc-hub-types__link[aria-current="page"] {
	background-color: var(--cc-color-white);
	border-color: var(--cc-color-white);
	color: var(--cc-color-canvas);
}

@media (prefers-reduced-motion: no-preference) {
	.cc-p-range__jump-list a,
	.cc-hub-types__link,
	.cc-hub-pagination a.page-numbers {
		transition: background-color var(--cc-transition-fast) ease, border-color var(--cc-transition-fast) ease, color var(--cc-transition-fast) ease;
	}
}

/* ------------------------------------------------------------------ high contrast */

/* Forced colours remove the fill that marks the current category and the current page number, so each gets a cue that is not a colour:
   an underline and a second line drawn inside the border, in the text colour. The focus ring is left to the theme. */
@media (forced-colors: active) {
	.cc-hub-types__link[aria-current="page"],
	.cc-hub-pagination .page-numbers.current {
		border-color: CanvasText;
		text-decoration: underline;
		text-decoration-thickness: 3px;
		text-underline-offset: 0.3em;
	}

	.cc-hub-types__link[aria-current="page"]:not(:focus-visible),
	.cc-hub-pagination .page-numbers.current {
		outline: 2px solid CanvasText;
		outline-offset: -5px;
	}
}
