/*
 * Comm Centre theme: single product page.
 *
 * Loaded on every page after base.css (assets/css/pages/*.css), so every rule is scoped by .cc-product-page, the class on
 * main in templates/single-product.html. shop.css loads later and holds the older .cc-pdp-shop rules, so these selectors
 * carry one more class and win without !important. Variables from tokens.css only.
 *
 * Order on the page: breadcrumb, then the buying area (gallery, name, price, short description, purchase form, delivery
 * line, SKU and category), then the sections (the plugin's in the box and required parts, description, specifications,
 * extras, policies), then related products.
 */

/* ------------------------------------------------------------------ head and buying area */

.cc-product-page .cc-shop-head {
	padding-block: var(--cc-space-l) 0;
}

.cc-product-page .cc-pdp-shop {
	gap: var(--cc-space-l);
	padding-block: var(--cc-space-m) var(--cc-space-xl);
}

@media (min-width: 62em) {
	.cc-product-page .cc-pdp-shop {
		grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
		gap: var(--cc-space-xxl);
		align-items: start;
	}
}

/* Below the two column width the gallery sits above the details and does not grow past a comfortable size. */
@media (max-width: 61.99em) {
	.cc-product-page .cc-pdp-shop__media {
		max-width: 36rem;
	}
}

/* ------------------------------------------------------------------ gallery */

/* Product photos arrive as transparent PNGs, white backed JPEGs and the odd dark one. A plain white tile is the one
   neutral that suits all of them, and it keeps the thumbnails readable too. */
/* WooCommerce's own layout sheet floats the gallery to 48 percent and each thumbnail to 25 percent, with selectors that
   start at .woocommerce div.product. Those are heavier than anything a theme should write, so these few properties
   take !important. */
.cc-product-page .cc-pdp-shop .wp-block-woocommerce-product-image-gallery,
.cc-product-page .cc-pdp-shop .woocommerce-product-gallery {
	max-width: 40rem;
}

.cc-product-page .cc-pdp-shop .woocommerce-product-gallery {
	float: none !important;
	width: 100% !important;
	margin: 0 !important;
}

.cc-product-page .cc-pdp-shop .woocommerce-product-gallery__image {
	background: var(--cc-color-white);
	border-color: var(--cc-color-line);
}

.cc-product-page .cc-pdp-shop .woocommerce-product-gallery__image a {
	display: block;
	width: 100%;
	height: 100%;
}

.cc-product-page .cc-pdp-shop .woocommerce-product-gallery__image img {
	width: 100%;
	height: 100%;
	max-height: none;
	padding: var(--cc-space-m);
	box-sizing: border-box;
	object-fit: contain;
}

/* The illustration that stands in when a product has no photo keeps its own caption and a quieter tile. */
.cc-product-page .cc-pdp-shop .woocommerce-product-gallery__image--placeholder {
	background: var(--cc-color-raised);
}

.cc-product-page .cc-pdp-shop .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(4.25rem, 1fr));
	gap: var(--cc-space-s);
	margin: var(--cc-space-s) 0 0;
	padding: 0;
	list-style: none;
}

.cc-product-page .cc-pdp-shop .flex-control-thumbs li {
	float: none !important;
	clear: none !important;
	width: auto !important;
	margin: 0 !important;
}

.cc-product-page .cc-pdp-shop .flex-control-thumbs img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	box-sizing: border-box;
	padding: var(--cc-space-xxs);
	background: var(--cc-color-white);
	border: 1px solid var(--cc-color-line);
	border-radius: var(--cc-radius-s);
	object-fit: contain;
	opacity: 1 !important; /* WooCommerce dims inactive thumbnails to half, which turns the white tile grey. */
	cursor: pointer;
	transition: border-color var(--cc-transition-fast) ease-out;
}

.cc-product-page .cc-pdp-shop .flex-control-thumbs img:hover {
	border-color: var(--cc-color-line-strong);
}

.cc-product-page .cc-pdp-shop .flex-control-thumbs img.flex-active {
	border-color: var(--cc-color-action);
	outline: 1px solid var(--cc-color-action);
}

/* ------------------------------------------------------------------ details column */

.cc-product-page .cc-pdp-shop__info > * + * {
	margin-top: var(--cc-space-m);
}

/* A product name reads as a name: the heading face in sentence case at a calm size, two or three lines at most. */
.cc-product-page .cc-pdp-shop__title {
	font-family: var(--cc-font-heading);
	font-size: var(--cc-font-size-xl);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	overflow-wrap: break-word;
}

/* Price and stock on one line. */
.cc-product-page .cc-pdp-shop__pricing {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--cc-space-xxs) var(--cc-space-m);
}

.cc-product-page .cc-pdp-shop__pricing > * {
	margin: 0;
}

.cc-product-page .cc-pdp-shop__price,
.cc-product-page .cc-pdp-shop__price .wc-block-components-product-price {
	margin: 0;
	color: var(--cc-color-white);
	font-family: var(--cc-font-heading);
	font-size: var(--cc-font-size-xl);
	font-weight: 700;
	line-height: 1.15;
}

.cc-product-page .cc-pdp-shop__stock,
.cc-product-page .cc-pdp-shop .wc-block-components-product-stock-indicator {
	margin: 0;
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
	font-weight: 600;
}

.cc-product-page .cc-pdp-shop .wc-block-components-product-stock-indicator--out-of-stock {
	color: var(--cc-color-error);
}

.cc-product-page .cc-pdp-shop .wc-block-components-product-stock-indicator:empty {
	display: none;
}

/* A simple product's purchase form repeats the stock message the line under the price already shows. The message a
   variable product prints for the chosen option sits deeper in the form and stays. */
.cc-product-page .cc-pdp-shop .wc-block-add-to-cart-form > p.stock {
	display: none;
}

/* Short description. */
.cc-product-page .cc-pdp-shop__summary {
	max-width: 60ch;
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-m);
	line-height: 1.6;
}

.cc-product-page .cc-pdp-shop__summary p {
	margin: 0;
}

.cc-product-page .cc-pdp-shop__summary p + p,
.cc-product-page .cc-pdp-shop__summary ul,
.cc-product-page .cc-pdp-shop__summary ol {
	margin-top: var(--cc-space-s);
}

.cc-product-page .cc-pdp-shop__summary ul,
.cc-product-page .cc-pdp-shop__summary ol {
	margin-bottom: 0;
	padding-left: var(--cc-space-l);
}

/* The purchase row: quantity, then the button, both the same height. WooCommerce's clearfix pseudo elements would become
   flex items and push the row in, and its block styles add margins and floats with heavier selectors than a theme should
   write, so those few properties take !important. */
.cc-product-page .cc-pdp-shop form.cart:not(.variations_form),
.cc-product-page .cc-pdp-shop .woocommerce-variation-add-to-cart {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: var(--cc-space-s);
	margin: 0;
}

.cc-product-page .cc-pdp-shop form.cart::before,
.cc-product-page .cc-pdp-shop form.cart::after,
.cc-product-page .cc-pdp-shop .woocommerce-variation-add-to-cart::before,
.cc-product-page .cc-pdp-shop .woocommerce-variation-add-to-cart::after {
	content: none !important;
	display: none !important;
}

.cc-product-page .cc-pdp-shop form.cart .quantity {
	flex: 0 0 auto;
	float: none !important;
	margin: 0 !important;
}

.cc-product-page .cc-pdp-shop form.cart .quantity .qty {
	width: 4.5rem;
	height: 100%;
	min-height: 3rem;
	margin: 0 !important;
}

.cc-product-page .cc-pdp-shop form.cart .single_add_to_cart_button {
	flex: 1 1 auto;
	float: none;
	min-height: 3rem;
	max-width: 20rem;
	margin: 0;
}

.cc-product-page .cc-pdp-shop .wc-block-add-to-cart-form form.cart {
	margin-bottom: 0;
}

/* Choices on a variable product sit above the same row: the label over its select, each choice a short block. WooCommerce
   prints them in a table, and table cells carry padding that would leave a wide empty band. */
.cc-product-page .cc-pdp-shop table.variations {
	width: 100%;
	margin: 0 0 var(--cc-space-m);
	border: 0;
}

.cc-product-page .cc-pdp-shop table.variations :where(tbody, tr, th, td) {
	display: block;
	padding: 0;
	border: 0;
}

.cc-product-page .cc-pdp-shop table.variations tr + tr {
	margin-top: var(--cc-space-m);
}

.cc-product-page .cc-pdp-shop table.variations th.label {
	margin-bottom: var(--cc-space-xs);
	color: var(--cc-color-white);
	font-weight: 600;
}

.cc-product-page .cc-pdp-shop table.variations select {
	width: 100%;
	min-height: var(--cc-target-min);
}

/* "Clear" shows only once a choice is made. Until then it takes no room. */
.cc-product-page .cc-pdp-shop a.reset_variations {
	display: inline-flex;
	align-items: center;
	min-height: var(--cc-target-min);
	margin-top: 0;
	padding-block: 0;
	color: var(--cc-color-white);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.cc-product-page .cc-pdp-shop a.reset_variations[style*="hidden"] {
	display: none;
}

/* The price and stock message of the chosen option. Empty until a choice is made, and then it takes no margin. */
.cc-product-page .cc-pdp-shop .woocommerce-variation.single_variation {
	margin: 0 0 var(--cc-space-m);
}

.cc-product-page .cc-pdp-shop .woocommerce-variation.single_variation:empty {
	margin: 0;
}

.cc-product-page .cc-pdp-shop .woocommerce-variation-price {
	color: var(--cc-color-white);
	font-family: var(--cc-font-heading);
	font-size: var(--cc-font-size-l);
	font-weight: 700;
}

/* An express payment button, when the store offers one, sits under the row with a little air. */
.cc-product-page .cc-pdp-shop .wcpay-express-checkout-wrapper {
	margin-top: var(--cc-space-s);
}

/* The delivery line is small print under the button. */
.cc-product-page .cc-pdp-shop__delivery {
	margin-top: var(--cc-space-s);
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
}

/* SKU, category and tags: one quiet line under a rule, only when there is something to show. */
.cc-product-page .cc-pdp-shop__meta {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cc-space-xxs) var(--cc-space-l);
	margin-top: var(--cc-space-l);
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-s);
}

.cc-product-page .cc-pdp-shop__meta:has(> *) {
	padding-top: var(--cc-space-m);
	border-top: 1px solid var(--cc-color-line);
}

/* None of the three blocks printed anything (no SKU, no real category, no tags): no empty band either. */
.cc-product-page .cc-pdp-shop__meta:not(:has(> *)) {
	display: none;
}

.cc-product-page .cc-pdp-shop__meta > * {
	margin: 0;
}

.cc-product-page .cc-pdp-shop__meta .wp-block-post-terms__prefix,
.cc-product-page .cc-pdp-shop__meta .sku_wrapper {
	color: var(--cc-color-secondary);
}

.cc-product-page .cc-pdp-shop__meta a {
	display: inline-block;
	padding-block: var(--cc-space-xxs);
	color: var(--cc-color-white);
}

.cc-product-page .cc-pdp-shop__meta .sku {
	color: var(--cc-color-white);
}

/* ------------------------------------------------------------------ sections below the buying area */

/* The container itself adds no spacing: each section brings its own rule and padding, so a page with no sections has
   no empty band. */
.cc-product-page .cc-pdp-body {
	display: block;
	padding-block: 0;
	border: 0;
}

.cc-product-page .cc-pdp-body > * {
	margin-block: 0;
}

.cc-product-page .cc-pdp-body > .cc-product-section,
.cc-product-page .cc-pdp-section,
.cc-product-page .cc-pdp-related__grid {
	padding-block: var(--cc-space-xl);
	border-top: 1px solid var(--cc-color-line);
}

.cc-product-page .cc-pdp-body > .cc-product-section + .cc-product-section {
	margin-top: 0;
}

.cc-product-page .cc-product-section__title,
.cc-product-page .cc-pdp-section__title {
	margin: 0 0 var(--cc-space-m);
	font-size: var(--cc-font-size-l);
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

/* Description: a reading column. Text keeps to about 65 characters a line; tables and pictures may use the full width. */
.cc-product-page .cc-pdp-description .wc-block-product-description,
.cc-product-page .cc-pdp-description .wc-block-product-description > * {
	margin-block: 0;
}

.cc-product-page .cc-pdp-description .wc-block-product-description > * + * {
	margin-top: var(--cc-space-m);
}

.cc-product-page .cc-pdp-description {
	color: var(--cc-color-secondary);
	font-size: var(--cc-font-size-m);
	line-height: 1.7;
}

.cc-product-page .cc-pdp-description :where(p, ul, ol, dl, blockquote, h3, h4, h5, h6) {
	max-width: 65ch;
}

.cc-product-page .cc-pdp-description :where(h3, h4, h5, h6) {
	color: var(--cc-color-white);
	font-family: var(--cc-font-heading);
	line-height: 1.25;
	letter-spacing: 0;
	text-transform: none;
}

.cc-product-page .cc-pdp-description h3 {
	margin-top: var(--cc-space-l);
	font-size: var(--cc-font-size-l);
}

.cc-product-page .cc-pdp-description :where(h4, h5, h6) {
	margin-top: var(--cc-space-l);
	font-family: var(--cc-font-body);
	font-size: var(--cc-font-size-m);
	font-weight: 600;
}

.cc-product-page .cc-pdp-description > .wc-block-product-description > :first-child {
	margin-top: 0;
}

.cc-product-page .cc-pdp-description :where(strong, b) {
	color: var(--cc-color-white);
	font-weight: 600;
}

.cc-product-page .cc-pdp-description a {
	color: var(--cc-color-action);
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.cc-product-page .cc-pdp-description a:hover {
	color: var(--cc-color-action-hover);
}

.cc-product-page .cc-pdp-description :where(ul, ol) {
	padding-left: var(--cc-space-l);
}

.cc-product-page .cc-pdp-description li + li {
	margin-top: var(--cc-space-xs);
}

.cc-product-page .cc-pdp-description li > :where(p, ul, ol) {
	margin: var(--cc-space-xs) 0 0;
}

.cc-product-page .cc-pdp-description li > p:first-child {
	margin-top: 0;
}

.cc-product-page .cc-pdp-description li::marker {
	color: var(--cc-color-action);
}

.cc-product-page .cc-pdp-description img {
	display: block;
	max-width: 100%;
	height: auto;
}

/* Tables: description tables and the specification table share one quiet style. */
.cc-product-page .cc-pdp-table {
	max-width: 100%;
	overflow-x: auto;
}

.cc-product-page .cc-pdp-table:focus-visible {
	outline: var(--cc-focus-width) solid var(--cc-color-focus);
	outline-offset: var(--cc-focus-offset);
}

.cc-product-page .cc-pdp-description table,
.cc-product-page .cc-pdp-specs table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--cc-font-size-s);
	line-height: 1.5;
}

.cc-product-page .cc-pdp-description :where(th, td),
.cc-product-page .cc-pdp-specs :where(th, td) {
	padding: var(--cc-space-s) var(--cc-space-m) var(--cc-space-s) 0;
	border: 0;
	border-bottom: 1px solid var(--cc-color-line);
	text-align: left;
	vertical-align: top;
}

.cc-product-page .cc-pdp-description th,
.cc-product-page .cc-pdp-specs th {
	color: var(--cc-color-white);
	font-weight: 600;
}

.cc-product-page .cc-pdp-description thead th {
	border-bottom-color: var(--cc-color-line-strong);
}

.cc-product-page .cc-pdp-specs {
	color: var(--cc-color-secondary);
}

.cc-product-page .cc-pdp-specs figure {
	margin: 0;
}

.cc-product-page .cc-pdp-specs table {
	max-width: 48rem;
}

.cc-product-page .cc-pdp-specs tbody th {
	width: 11rem;
}

.cc-product-page .cc-pdp-specs td p {
	margin: 0;
}

/* The plugin's lists (in the box, required parts) keep the same pace as the description. */
.cc-product-page .cc-pdp-body .cc-product-list {
	max-width: 65ch;
}

/* ------------------------------------------------------------------ related products */

/* The rule sits on the grid, inside the content column, so it lines up with the sections above it. */
.cc-product-page .cc-pdp-related {
	padding-block: 0 var(--cc-space-section);
}

.cc-product-page .cc-pdp-related__grid .wc-block-product-template {
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40em) {
	.cc-product-page .cc-pdp-related__grid .wc-block-product-template {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 64em) {
	.cc-product-page .cc-pdp-related__grid .wc-block-product-template {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* Reduced motion: no transition on the thumbnails. */
@media (prefers-reduced-motion: reduce) {
	.cc-product-page .cc-pdp-shop .flex-control-thumbs img {
		transition: none;
	}
}
