/**
 * Société Jersiaise, single product
 *
 * Loads after shop.css and only on a product page. Everything shared with the
 * archive, including buttons, prices, notices and the product card used by
 * related products, lives in shop.css.
 *
 * Scoped under .sj-shop for the same reason as everything else. See the note at
 * the top of shop.css.
 *
 * Some selectors here target WooCommerce's own class names, form.cart and
 * .single_add_to_cart_button among them. That is deliberate. Section 4 of the
 * build brief prefers styling Woo markup over forking a template, and the add to
 * cart form is exactly the case where forking would be the wrong trade: payment
 * gateways and variation scripts hook into that markup.
 *
 * @package sj-child
 */

/* -------------------------------------------------------------------------
 * Layout
 * ---------------------------------------------------------------------- */

/**
 * Space above the page.
 *
 * --sj-space-9 is 96px, the nearest step on the spacing scale to the 100px
 * asked for. Four pixels is not worth a value off the scale, which is the one
 * thing tokens.css exists to prevent.
 */

.sj-shop .sj-product {
	padding-block: var(--sj-space-9) var(--sj-section-y);
}

/* The breadcrumb leads the summary column, directly above the title. */

.sj-shop .sj-product__info .sj-breadcrumb {
	padding-block: 0;
	margin-block-end: calc(var(--sj-space-2) * -1);
}

.sj-shop .sj-product__summary {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--sj-space-6);
	align-items: start;
}

@media (min-width: 48rem) {

	/* An even split. The imagery and the buying decision carry equal weight. */

	.sj-shop .sj-product__summary {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: var(--sj-space-7);
	}
}

@media (min-width: 64rem) {

	.sj-shop .sj-product__summary {
		gap: var(--sj-space-8);
	}
}

/* -------------------------------------------------------------------------
 * Gallery
 * ---------------------------------------------------------------------- */

.sj-shop .sj-gallery {
	display: flex;
	flex-direction: column;
	gap: var(--sj-space-3);
}

/**
 * White, like the product tiles on the archive. The page ground is tinted, so a
 * tinted stage would disappear into it and the cover would look unmounted.
 */

.sj-shop .sj-gallery__stage {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: var(--sj-ratio-product);
	padding: var(--sj-space-6);
	margin: 0;
	background-color: var(--sj-color-surface);
	border: var(--sj-border-width) solid var(--sj-color-border);
	border-radius: var(--sj-radius-lg);
}

/* Contained, so a book cover is never cropped. */

.sj-shop .sj-gallery__image {
	max-inline-size: 100%;
	max-block-size: 100%;
	inline-size: auto;
	block-size: auto;
	object-fit: contain;
}

.sj-shop .sj-gallery__placeholder {
	font-size: var(--sj-text-2xs);
	letter-spacing: var(--sj-tracking-none);
	color: var(--sj-color-ink-muted);
}

.sj-shop .sj-gallery__thumbs {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--sj-space-2);
	padding: 0;
	margin: 0;
	list-style: none;
}

@media (min-width: 48rem) {

	.sj-shop .sj-gallery__thumbs {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
}

.sj-shop .sj-gallery__thumb-link {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1;
	padding: var(--sj-space-2);
	overflow: hidden;
	background-color: var(--sj-color-surface);
	border: var(--sj-border-width) solid var(--sj-color-border);
	border-radius: var(--sj-radius-sm);
	transition: border-color var(--sj-duration-fast) var(--sj-ease);
}

.sj-shop .sj-gallery__thumb-link:hover {
	border-color: var(--sj-color-ink-muted);
}

.sj-shop .sj-gallery__thumb-link--current {
	border-color: var(--sj-color-navy);
}

.sj-shop .sj-gallery__thumb-image {
	max-inline-size: 100%;
	max-block-size: 100%;
	object-fit: contain;
}

/* -------------------------------------------------------------------------
 * Summary column
 * ---------------------------------------------------------------------- */

.sj-shop .sj-product__info {
	display: flex;
	flex-direction: column;
	gap: var(--sj-space-4);
}

/**
 * Size, weight, leading, tracking and case all come from the .sj-h2 utility
 * that sj_the_product_title puts on the heading. Only the margin is set here,
 * so the design system stays the single source for the type.
 */

.sj-shop .sj-product__info .product_title {
	margin: 0;
	color: var(--sj-color-navy);
	text-wrap: pretty;
}

.sj-shop .sj-product__info .price {
	display: block;
	font-size: var(--sj-text-xl);
	font-weight: var(--sj-weight-semibold);
	letter-spacing: var(--sj-tracking-heading);
	color: var(--sj-color-navy);
	margin: 0;
}

.sj-shop .sj-product__info .price del {
	font-size: var(--sj-text-md);
	font-weight: var(--sj-weight-regular);
	color: var(--sj-color-ink-body);
}

.sj-shop .sj-product__info .price ins {
	text-decoration: none;
}

.sj-shop .sj-product__info .woocommerce-product-details__short-description {
	margin: 0;
}

/**
 * Attribute list.
 *
 * A description list, because that is what it is: author, publisher and year
 * are terms with values. Laid out as two columns so the labels align.
 */

.sj-shop .sj-product__attributes {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: var(--sj-space-1) var(--sj-space-4);
	padding: 0;
	margin: 0;
	font-size: var(--sj-text-2xs);
	line-height: var(--sj-leading-normal);
	letter-spacing: var(--sj-tracking-none);
}

.sj-shop .sj-product__attribute-label {
	font-weight: var(--sj-weight-bold);
	color: var(--sj-color-ink);
}

.sj-shop .sj-product__attribute-value {
	margin: 0;
	color: var(--sj-color-ink-body);
}

/* -------------------------------------------------------------------------
 * Add to cart
 *
 * WooCommerce markup, styled rather than forked.
 * ---------------------------------------------------------------------- */

.sj-shop .sj-product__info form.cart {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sj-space-3);
	margin: 0;
}

.sj-shop .sj-product__info .quantity {
	display: flex;
	align-items: center;
}

/**
 * The quantity field and the add to basket button are given the same explicit
 * height. Left to themselves they take different padding from different
 * stylesheets and sit a few pixels apart, which is visible because they are
 * side by side.
 */

.sj-shop .sj-product__info .quantity .qty {
	inline-size: var(--sj-space-9);
	block-size: var(--sj-control-height);
	min-block-size: var(--sj-control-height);
	padding: var(--sj-space-2);
	text-align: center;
	background-color: var(--sj-color-surface);
	border: var(--sj-border-width) solid var(--sj-color-border);
	border-radius: var(--sj-radius-sm);
	font-family: var(--sj-font);
	font-size: var(--sj-text-sm);
	color: var(--sj-color-ink);
}

.sj-shop .sj-product__info .single_add_to_cart_button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	block-size: var(--sj-control-height);
	min-block-size: var(--sj-control-height);
	padding-block: 0;
	padding-inline: var(--sj-space-7);
	background-color: var(--sj-color-navy);
	border: var(--sj-border-width) solid var(--sj-color-navy);
	border-radius: var(--sj-radius-sm);
	font-family: var(--sj-font);
	font-size: var(--sj-text-sm);
	font-weight: var(--sj-weight-bold);
	letter-spacing: var(--sj-tracking-tight);
	text-transform: none;
	white-space: normal;
	color: var(--sj-color-ink-inverse);
	cursor: pointer;
	transition: background-color var(--sj-duration-fast) var(--sj-ease);
}

.sj-shop .sj-product__info .single_add_to_cart_button:hover {
	background-color: var(--sj-color-navy-deep);
	border-color: var(--sj-color-navy-deep);
}

.sj-shop .sj-product__info .single_add_to_cart_button:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.sj-shop .sj-product__info .stock.out-of-stock {
	margin: 0;
	font-weight: var(--sj-weight-semibold);
	color: var(--sj-color-error);
}

.sj-shop .sj-product__info .stock.in-stock {
	margin: 0;
	font-size: var(--sj-text-2xs);
	letter-spacing: var(--sj-tracking-none);
	color: var(--sj-color-success);
}

/**
 * Product meta, the SKU and category line Woo prints below add to cart.
 */

.sj-shop .sj-product__info .product_meta {
	display: flex;
	flex-direction: column;
	gap: var(--sj-space-1);
	padding-block-start: var(--sj-space-4);
	border-block-start: var(--sj-border-width) solid var(--sj-color-border);
	font-size: var(--sj-text-3xs);
	letter-spacing: var(--sj-tracking-none);
	color: var(--sj-color-ink-body);
}

.sj-shop .sj-product__info .product_meta a {
	color: var(--sj-color-navy);
	text-decoration: underline;
	text-underline-offset: var(--sj-border-width-thick);
}

/* -------------------------------------------------------------------------
 * Description and related
 * ---------------------------------------------------------------------- */

.sj-shop .related.products,
.sj-shop .up-sells.products {
	padding-block-start: var(--sj-space-8);
}

/**
 * Related products fill the container.
 *
 * The archive grid is five across at the widest breakpoint, and related
 * products returns four, which left a visible hole in the row. Four equal
 * columns of their own makes the block span the page properly.
 */

.sj-shop .related.products .sj-product-grid,
.sj-shop .up-sells.products .sj-product-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 48rem) {

	.sj-shop .related.products .sj-product-grid,
	.sj-shop .up-sells.products .sj-product-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.sj-shop .sj-product__description {
	margin-block: var(--sj-space-2) 0;
}

.sj-shop .sj-product__section-title,
.sj-shop .related.products > h2,
.sj-shop .up-sells.products > h2 {
	margin-block-end: var(--sj-space-5);
	font-size: var(--sj-text-xl);
	font-weight: var(--sj-weight-bold);
	line-height: var(--sj-leading-snug);
	letter-spacing: var(--sj-tracking-heading);
	text-transform: none;
	color: var(--sj-color-navy);
}

.sj-shop .sj-prose {
	max-inline-size: var(--sj-container-narrow);
	text-wrap: pretty;
}

/**
 * Inside the summary the description fills its column. The prose measure exists
 * for full width running text, and applying it here just leaves a ragged gap
 * down the right of the buying column.
 */

.sj-shop .sj-product__info .sj-prose,
.sj-shop .sj-product__description {
	max-inline-size: none;
}

.sj-shop .sj-prose p {
	margin-block: 0 var(--sj-space-4);
}

.sj-shop .sj-prose p:last-child {
	margin-block-end: 0;
}

.sj-shop .sj-prose a {
	color: var(--sj-color-navy);
	text-decoration: underline;
	text-underline-offset: var(--sj-border-width-thick);
}

.sj-shop .sj-prose ul,
.sj-shop .sj-prose ol {
	padding-inline-start: var(--sj-space-5);
	margin-block: 0 var(--sj-space-4);
}

.sj-shop .sj-prose li {
	margin-block-end: var(--sj-space-1);
}
