/**
 * product-summary: the store's single product blocks (title, rating, short description, price, Add to Cart + Options,
 * product meta). Measured in new-woocommerce.sketch, Shop Product Detail: a 360 wide column, the name (26, bold), the
 * description (14/23), the price (26, bold) with the old price (14) after it, 80×49 image swatches 10 apart, a 70×50
 * framed quantity and a 190×50 black "Add to Cart" (16, bold) 10 apart, categories and tags (12, medium). The rules
 * repeat the layout of the store's block styles so the reference (without them) matches; rules that must win over
 * those styles carry the root class and the form class.
 */
:where(.rt-product-summary) {
	color: var(--rt-color-contrast);
}

.rt-product-summary {
	display: flex;
	flex-direction: column;
	font-family: var(--rt-font-family-body);
}

.rt-product-summary .rt-product-summary__title {
	margin: 0;
	color: inherit;
	font-family: inherit;
	font-size: var(--rt-font-size-large-plus);
	font-weight: var(--rt-font-weight-bold);
	line-height: 1.3;
	letter-spacing: 0;
}

.rt-product-summary .rt-product-summary__rating {
	margin: 0;
	padding-block-start: var(--rt-spacing-20);
	font-size: var(--rt-font-size-small);
}

.rt-product-summary .rt-product-summary__excerpt {
	margin: 0;
	padding-block-start: var(--rt-spacing-30);
	font-size: var(--rt-font-size-small);
	line-height: var(--rt-font-line-height-body);
}

.rt-product-summary .rt-product-summary__excerpt p {
	margin: 0;
}

/* Price: the current price first, the struck-through old price after it. */
.rt-product-summary .rt-product-summary__price {
	margin: 0;
	padding-block-start: 1.3125rem;
	font-size: var(--rt-font-size-large-plus);
	font-weight: var(--rt-font-weight-bold);
	line-height: 1.3;
}

.rt-product-summary .rt-product-summary__price .wc-block-components-product-price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0 0.625rem;
	margin: 0;
	font-size: inherit;
}

.rt-product-summary .rt-product-summary__price del {
	order: 1;
	color: var(--rt-product-summary-old-price);
	font-size: var(--rt-font-size-small);
	font-weight: var(--rt-font-weight-regular);
}

.rt-product-summary .rt-product-summary__price ins {
	text-decoration: none;
}

.rt-product-summary .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Add to Cart + Options: variation selector, stock text, quantity and button, 30 apart. */
.rt-product-summary .rt-product-summary__cart {
	display: flex;
	flex-direction: column;
	gap: 1.875rem;
	margin: 0;
	/* 31px under the price, as the original theme's Add to Cart + Options block (its 30px top margin and the row's 1px) */
	padding-block-start: 1.9375rem;
}

.rt-product-summary__cart > [hidden],
.rt-product-summary__cart .wc-block-components-product-stock-indicator:empty {
	display: none;
}

.rt-product-summary__cart .single_variation_wrap {
	display: contents;
}

/* The store's selector is a list of attributes, each a group with the name and the chips. */
.rt-product-summary__cart > [role="list"] {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.rt-product-summary__cart [role="list"] > div > div {
	display: flex;
	flex-direction: column;
	gap: 0.625rem;
}

.rt-product-summary__cart [role="list"] > div > div > span:first-child {
	font-size: var(--rt-font-size-x-small);
	font-weight: var(--rt-font-weight-medium);
	line-height: 1.2;
}

.rt-product-summary__cart .wc-block-product-filter-chips {
	font-size: var(--rt-font-size-small);
}

.rt-product-summary__cart .wc-block-product-filter-chips__fieldset {
	display: contents;
}

.rt-product-summary__cart .wc-block-product-filter-chips__items {
	display: flex;
	flex-wrap: wrap;
	gap: 0.625rem;
}

/* Text chips (attributes without images): framed boxes as tall as the swatches; the chosen one is filled. */
.rt-product-summary__cart .wc-block-product-filter-chips__item {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	min-height: 3.0625rem;
	margin: 0;
	padding: 0 1.25rem;
	border: 1px solid var(--rt-product-summary-chip-border);
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.rt-product-summary__cart .wc-block-product-filter-chips__item:hover {
	border-color: var(--rt-color-contrast);
}

.rt-product-summary__cart .wc-block-product-filter-chips__item[aria-checked="true"] {
	border-color: var(--rt-product-summary-action);
	background: var(--rt-product-summary-action);
	color: var(--rt-product-summary-action-text);
}

.rt-product-summary__cart .wc-block-product-filter-chips__item:focus-visible {
	outline: 2px solid var(--rt-color-accent);
	outline-offset: 2px;
}

.rt-product-summary__cart .wc-block-product-filter-chips__item:disabled {
	cursor: not-allowed;
	opacity: 0.5;
}

.rt-product-summary__cart .wc-block-product-filter-chips__label {
	display: inline-flex;
	align-items: center;
}

/* Image swatches: an 80×49 picture, the name only for screen readers and as a tooltip; the chosen one is framed. */
.rt-product-summary__cart .wc-block-product-filter-chips:has(.wc-block-product-filter-chips__swatch) .wc-block-product-filter-chips__item {
	min-height: 0;
	padding: 0;
	border: 0;
	background: transparent;
	outline: 1px solid transparent;
	outline-offset: 2px;
	transition: outline-color 0.2s ease;
}

.rt-product-summary__cart .wc-block-product-filter-chips:has(.wc-block-product-filter-chips__swatch) .wc-block-product-filter-chips__item:hover {
	outline-color: var(--rt-product-summary-chip-border);
}

.rt-product-summary__cart .wc-block-product-filter-chips:has(.wc-block-product-filter-chips__swatch) .wc-block-product-filter-chips__item[aria-checked="true"] {
	outline-color: var(--rt-color-contrast);
}

.rt-product-summary__cart .wc-block-product-filter-chips:has(.wc-block-product-filter-chips__swatch) .wc-block-product-filter-chips__item:focus-visible {
	outline: 2px solid var(--rt-color-accent);
}

.rt-product-summary__cart .wc-block-product-filter-chips__swatch {
	display: block;
	width: 5rem;
	height: 3.0625rem;
	border: 0;
	border-radius: 0;
	background-color: var(--rt-product-summary-swatch-surface);
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
}

.rt-product-summary__cart .wc-block-product-filter-chips__swatch ~ .wc-block-product-filter-chips__text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Stock text ("3 in stock", "Out of stock"). */
.rt-product-summary .rt-product-summary__cart .wc-block-components-product-stock-indicator {
	margin: 0;
	font-size: var(--rt-font-size-small);
	font-weight: var(--rt-font-weight-medium);
	line-height: 1.2;
	text-align: start;
}

/* Quantity and button in one row, 10 apart; an out of stock product leaves the row empty. */
.rt-product-summary__cart > div:has(> .wc-block-components-product-button) {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 0.625rem;
}

.rt-product-summary__cart > div[class*="group"]:not(:has(*)) {
	display: none;
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-quantity-selector {
	display: flex;
	box-sizing: border-box;
	width: 5.5rem;
	min-width: 0;
	height: 3.125rem;
	margin: 0;
	border: 1px solid var(--rt-product-summary-field-border);
	border-radius: 0;
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-quantity-selector::after {
	content: none;
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__input {
	flex: 1 1 auto;
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	max-width: none;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font-family: inherit;
	font-size: var(--rt-font-size-small);
	font-weight: var(--rt-font-weight-bold);
	text-align: center;
	appearance: textfield;
}

.rt-product-summary__cart .wc-block-components-quantity-selector__input::-webkit-inner-spin-button,
.rt-product-summary__cart .wc-block-components-quantity-selector__input::-webkit-outer-spin-button {
	margin: 0;
	appearance: none;
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button {
	flex: 0 0 1.5rem;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font-family: inherit;
	font-size: var(--rt-font-size-base);
	opacity: 0.6;
	cursor: pointer;
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:hover {
	opacity: 1;
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button:disabled {
	opacity: 0.3;
	cursor: default;
}

.rt-product-summary__cart .wc-block-components-quantity-selector :focus-visible {
	outline: 2px solid var(--rt-color-accent);
	outline-offset: -2px;
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-product-button {
	margin: 0;
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-product-button .wc-block-components-product-button__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: 11.875rem;
	height: 3.125rem;
	margin: 0;
	padding: 0 2rem;
	border: 0;
	border-radius: 0;
	background: var(--rt-product-summary-action);
	color: var(--rt-product-summary-action-text);
	font-family: inherit;
	font-size: var(--rt-font-size-base);
	font-weight: var(--rt-font-weight-bold);
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-product-button .wc-block-components-product-button__button:hover,
.rt-product-summary .rt-product-summary__cart .wc-block-components-product-button .wc-block-components-product-button__button:focus-visible {
	background: var(--rt-product-summary-action-hover);
	color: var(--rt-product-summary-action-hover-text);
}

.rt-product-summary .rt-product-summary__cart .wc-block-components-product-button .wc-block-components-product-button__button:focus-visible {
	outline: 2px solid var(--rt-color-contrast);
	outline-offset: 2px;
}

/* Until every attribute is chosen the store marks the button disabled (it explains on click). */
.rt-product-summary .rt-product-summary__cart .wc-block-components-product-button .wc-block-components-product-button__button.disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Categories and tags. */
.rt-product-summary .rt-product-summary__meta {
	display: flex;
	flex-direction: column;
	gap: 0.6875rem;
	margin: 0;
	padding-block-start: 1.875rem;
}

.rt-product-summary .rt-product-summary__terms {
	margin: 0;
	font-size: var(--rt-font-size-x-small);
	font-weight: var(--rt-font-weight-medium);
	line-height: 1.2;
}

.rt-product-summary .rt-product-summary__terms a {
	color: inherit;
	text-decoration: none;
	text-underline-offset: 0.2em;
}

.rt-product-summary .rt-product-summary__terms a:hover,
.rt-product-summary .rt-product-summary__terms a:focus-visible {
	text-decoration: underline;
}

/* Phones: the button fills the row next to the quantity. */
@media (width <= 37.5rem) {
	.rt-product-summary .rt-product-summary__cart .wc-block-components-product-button {
		flex: 1 1 auto;
	}

	.rt-product-summary .rt-product-summary__cart .wc-block-components-product-button .wc-block-components-product-button__button {
		width: 100%;
		min-width: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rt-product-summary__cart .wc-block-product-filter-chips__item,
	.rt-product-summary .rt-product-summary__cart .wc-block-components-product-button .wc-block-components-product-button__button {
		transition: none;
	}
}

/*
 * The store's store notice above the cart form (product-summary.js: Add to cart without a chosen option), with
 * The store's own notice look: a light red box, the round icon, a faded dismiss cross.
 */
.rt-product-summary .wc-block-components-notices > .wc-block-components-notice-banner {
	display: flex;
	gap: 0.75rem;
	align-items: stretch;
	box-sizing: border-box;
	margin: 1rem 0;
	padding: 1rem;
	border: 1px solid #cc1818; /* preset-exempt: the store's error notice colour */
	border-radius: 4px;
	background-color: #fff0f0; /* preset-exempt: the store's error notice colour */
	color: #2f2f2f; /* preset-exempt: the store's notice text colour */
	font-size: 0.875rem; /* preset-exempt: the store's notice size */
	font-weight: 400;
	line-height: 1.5;
}

.rt-product-summary .wc-block-components-notice-banner > svg {
	flex-shrink: 0;
	box-sizing: content-box;
	width: 24px;
	height: 24px;
	padding: 2px;
	border-radius: 50%;
	background-color: #cc1818; /* preset-exempt: the store's error notice colour */
	fill: #fff; /* preset-exempt: the store's notice icon colour */
}

.rt-product-summary .wc-block-components-notice-banner .wc-block-components-notice-banner__content {
	flex-grow: 1;
	align-self: center;
	padding-inline-end: 1rem;
}

.rt-product-summary .wc-block-components-notice-banner .wc-block-components-notice-banner__dismiss {
	align-self: flex-start;
	width: 16px;
	height: 16px;
	margin: 0.375rem 0 0 auto;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	opacity: 0.6;
}

.rt-product-summary .wc-block-components-notice-banner .wc-block-components-notice-banner__dismiss svg {
	display: block;
	width: 16px;
	height: 16px;
	fill: currentColor;
}
