/*
 * Kintsugi: WooCommerce block styling.
 */

/* Product grid: no cards, no borders. Image, title, price. */
.kintsugi-products .wc-block-product-template {
	--kintsugi-gap: var(--wp--preset--spacing--40);
	column-gap: var(--kintsugi-gap);
	row-gap: var(--wp--preset--spacing--60);
}

/* WooCommerce sizes responsive columns for its own 1.25em gap; match ours. */
.kintsugi-products .wc-block-product-template__responsive.columns-2 {
	grid-template-columns: repeat(auto-fill, minmax(max(150px, calc(50% - var(--kintsugi-gap) / 2)), 1fr));
}

.kintsugi-products .wc-block-product-template__responsive.columns-3 {
	grid-template-columns: repeat(auto-fill, minmax(max(150px, calc(33.333% - var(--kintsugi-gap) * 2 / 3)), 1fr));
}

.kintsugi-products .wc-block-product-template__responsive.columns-4 {
	grid-template-columns: repeat(auto-fill, minmax(max(150px, calc(25% - var(--kintsugi-gap) * 3 / 4)), 1fr));
}

.kintsugi-products .wc-block-product {
	text-align: left;
}

.kintsugi-products .wc-block-components-product-image {
	overflow: hidden;
	background: var(--wp--preset--color--cream);
	margin-bottom: var(--wp--preset--spacing--30);
}

.kintsugi-products .wc-block-components-product-image img {
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.kintsugi-products .wc-block-product:hover .wc-block-components-product-image img {
	transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
	.kintsugi-products .wc-block-components-product-image img {
		transition: none;
	}
}

.kintsugi-products .wp-block-post-title {
	margin: 0;
	font-weight: 400;
	line-height: 1.35;
}

.kintsugi-products .wp-block-post-title a {
	text-decoration: none;
}

.kintsugi-products .wp-block-post-title a:hover {
	color: var(--wp--preset--color--ink);
	text-decoration: underline;
}

.kintsugi-products .wc-block-components-product-price {
	margin-top: 0.3em;
}

/* Two columns on phones rather than one long column. */
@media (max-width: 600px) {
	.kintsugi-products .wc-block-product-template__responsive[class*="columns-"] {
		--kintsugi-gap: var(--wp--preset--spacing--30);
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.wp-block-query-pagination {
	margin-top: var(--wp--preset--spacing--60);
	font-size: var(--wp--preset--font-size--small);
}

/* Prices anywhere. */
.wc-block-components-product-price,
.wc-block-grid__product-price,
.woocommerce-Price-amount {
	font-family: var(--wp--preset--font-family--cinzel);
	letter-spacing: 0.02em;
}

/* Single product. */
.kintsugi-product .woocommerce-product-gallery__image,
.kintsugi-product .flex-control-thumbs img {
	background: var(--wp--preset--color--cream);
}

.kintsugi-product .woocommerce-product-gallery .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--wp--preset--spacing--20);
	margin-top: var(--wp--preset--spacing--20) !important;
}

.kintsugi-product .flex-control-thumbs li {
	width: auto !important;
	margin: 0 !important;
}

.kintsugi-product__summary > * + * {
	margin-top: var(--wp--preset--spacing--40);
}

.kintsugi-product__summary .wp-block-post-title {
	margin-top: 0;
}

.kintsugi-product__summary .wp-block-post-excerpt__excerpt {
	margin: 0;
}

.wp-block-add-to-cart-form form.cart {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
	align-items: stretch;
}

.wp-block-add-to-cart-form .quantity .qty {
	width: 4.5em;
	height: 100%;
	text-align: center;
}

.wp-block-add-to-cart-form .single_add_to_cart_button {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--white);
	border-radius: 0 999px 999px 0;
	font-family: var(--wp--preset--font-family--cinzel);
}

.wp-block-add-to-cart-form .single_add_to_cart_button:hover {
	background: var(--wp--preset--color--gold);
	color: var(--wp--preset--color--ink);
}

.kintsugi-product__summary .taxonomy-product_cat {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.wp-block-woocommerce-product-details {
	margin-top: var(--wp--preset--spacing--60);
}

.wp-block-woocommerce-product-details .wc-tabs {
	border-bottom: 1px solid var(--wp--preset--color--cream);
}

.wp-block-woocommerce-product-details .wc-tabs li a {
	text-decoration: none;
}

.wp-block-woocommerce-product-details .wc-tabs li.active a {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--gold);
}

.wp-block-woocommerce-product-details .woocommerce-Tabs-panel h2 {
	display: none;
}

.wp-block-woocommerce-breadcrumbs,
.wp-block-woocommerce-breadcrumbs a {
	color: var(--wp--preset--color--muted);
}

.wp-block-woocommerce-product-results-count,
.wp-block-woocommerce-catalog-sorting {
	font-size: var(--wp--preset--font-size--small);
	margin: 0;
}

/* Cart, checkout, mini cart buttons share the swatch shape. */
.wc-block-components-button:not(.is-link),
.wc-block-mini-cart__footer-actions .wc-block-components-button {
	border-radius: 0 999px 999px 0;
	font-family: var(--wp--preset--font-family--cinzel);
	letter-spacing: 0.06em;
}

.wc-block-components-button:not(.is-link).outlined {
	border: 1px solid var(--wp--preset--color--ink);
}

.wc-block-components-text-input input,
.wc-block-components-combobox .wc-block-components-combobox-control input,
.wc-blocks-components-select .wc-blocks-components-select__select,
.wc-block-components-textarea {
	border-radius: 0 !important;
}

.wc-block-components-text-input input:focus,
.wc-block-components-combobox .wc-block-components-combobox-control input:focus,
.wc-blocks-components-select .wc-blocks-components-select__select:focus {
	border-color: var(--wp--preset--color--gold) !important;
	box-shadow: 0 0 0 1px var(--wp--preset--color--gold) !important;
}

.wc-block-components-quantity-selector {
	border-radius: 0 !important;
}

/* Mini cart drawer floats above the page, so it earns a shadow. */
.wc-block-components-drawer {
	box-shadow: var(--wp--preset--shadow--lift);
}

/* WooCommerce writes the badge colours inline from the icon colour (gold text
   on ink), so they need !important to stay readable. */
.wc-block-mini-cart__badge {
	background-color: var(--wp--preset--color--ink) !important;
	color: var(--wp--preset--color--white) !important;
	border-color: var(--wp--preset--color--white);
	font-weight: 600;
}

/* Notices. */
.wc-block-components-notice-banner {
	border-radius: 0;
}

/* Gallery fills its column; stock of one hides the quantity box entirely. */
.kintsugi-product .wp-block-woocommerce-product-image-gallery {
	max-width: none;
}

.kintsugi-product .wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery {
	width: 100% !important;
	float: none;
}

.wp-block-add-to-cart-form form.cart .quantity:has(input[type="hidden"]) {
	display: none;
}

/* WooCommerce clearfix pseudo elements would become flex items here. */
/* Plugin clearfix rules are more specific than ours, hence !important. */
.wp-block-add-to-cart-form form.cart::before,
.wp-block-add-to-cart-form form.cart::after {
	display: none !important;
}

.wp-block-add-to-cart-form form.cart {
	padding: 0;
}

/* A lone "Description" tab is just noise. */
.wp-block-woocommerce-product-details .wc-tabs:has(> li:only-child) {
	display: none;
}

/* Product Collection has no spacing controls, so space it from what precedes it here. */
.wp-block-post-content > .kintsugi-products:not(:first-child) {
	margin-top: var(--wp--preset--spacing--60);
}

.wp-block-post-content > .kintsugi-section-head + .kintsugi-products {
	margin-top: var(--wp--preset--spacing--50);
}

/* Gallery thumbnails: quiet until chosen. */
.kintsugi-product .woocommerce-product-gallery .flex-control-thumbs img {
	opacity: 0.55;
	transition: opacity 0.2s ease;
}

.kintsugi-product .woocommerce-product-gallery .flex-control-thumbs img:hover,
.kintsugi-product .woocommerce-product-gallery .flex-control-thumbs img.flex-active {
	opacity: 1;
}

.kintsugi-product .woocommerce-product-gallery .flex-control-thumbs img.flex-active {
	box-shadow: inset 0 -2px 0 var(--wp--preset--color--gold);
	outline: 1px solid var(--wp--preset--color--gold);
	outline-offset: -1px;
}

/* Delivery, returns and payment panel under the add to cart button. */
.kintsugi-product-info > * + * {
	margin-top: var(--wp--preset--spacing--30);
}

.kintsugi-product-info__free {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--bronze);
}

.kintsugi-product-info__free::before {
	content: "";
	display: inline-block;
	width: 0.45em;
	height: 0.45em;
	margin-right: 0.6em;
	vertical-align: 0.15em;
	background: var(--wp--preset--color--gold);
	transform: rotate(45deg);
}

.kintsugi-product-info__accordion .wp-block-accordion-heading {
	font-size: var(--wp--preset--font-size--small);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.kintsugi-product-info__accordion .wp-block-accordion-heading__toggle {
	padding: var(--wp--preset--spacing--20) 0;
}

.kintsugi-product-info__accordion .wp-block-accordion-panel {
	font-size: var(--wp--preset--font-size--small);
}

.kintsugi-rates {
	padding-left: 0;
	list-style: none;
}

.kintsugi-rates li + li {
	margin-top: var(--wp--preset--spacing--20);
}

.kintsugi-rates strong {
	font-weight: 600;
}

.kintsugi-payments {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
}

.kintsugi-payments__label {
	margin: 0 var(--wp--preset--spacing--20) 0 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.kintsugi-payments__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0 !important;
	padding: 0;
	list-style: none;
}

.kintsugi-payments__list li {
	display: flex;
}

.kintsugi-payments__list img {
	display: block;
	width: 38px;
	height: 24px;
}

/* Stars: gold outline, filled to the rating. */
.kintsugi-stars {
	display: inline-block;
	line-height: 0;
	color: var(--wp--preset--color--gold);
}

.kintsugi-stars > svg {
	width: 5.4em;
	height: 1em;
	fill: currentColor;
	stroke: currentColor;
	stroke-width: 1.2;
	stroke-linejoin: round;
	overflow: visible;
}

.kintsugi-stars .kintsugi-stars__empty,
.kintsugi-stars .kintsugi-stars__empty svg {
	fill: none;
}

.wc-block-product-review-rating__stars {
	color: var(--wp--preset--color--gold);
}

/* Home reviews: three quotes between hairlines. */
.wp-block-post-content > .kintsugi-home-reviews {
	margin-top: var(--wp--preset--spacing--70);
}

.kintsugi-home-reviews h2 {
	margin-top: var(--wp--preset--spacing--30);
}

.kintsugi-quotes {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	margin: var(--wp--preset--spacing--50) 0 0;
	padding: 0;
	list-style: none;
}

.kintsugi-quotes__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 0 var(--wp--preset--spacing--50);
	text-align: center;
}

.kintsugi-quotes__item + .kintsugi-quotes__item {
	border-left: 1px solid var(--wp--preset--color--cream);
}

.kintsugi-quotes__text {
	flex: 1;
	margin: var(--wp--preset--spacing--30) 0;
	padding: 0;
	border: 0;
}

.kintsugi-quotes__text p {
	margin: 0;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.6;
}

.kintsugi-quotes__name {
	margin: 0;
	font-family: var(--wp--preset--font-family--cinzel);
	letter-spacing: 0.06em;
}

.kintsugi-quotes__meta {
	margin: 0.3em 0 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.kintsugi-quotes__meta a {
	color: inherit;
	text-decoration: none;
}

.kintsugi-quotes__meta a:hover {
	color: var(--wp--preset--color--ink);
	text-decoration: underline;
}

@media (max-width: 781px) {
	.kintsugi-quotes {
		grid-template-columns: 1fr;
	}

	.kintsugi-quotes__item {
		padding: var(--wp--preset--spacing--40) 0;
	}

	.kintsugi-quotes__item + .kintsugi-quotes__item {
		border-left: 0;
		border-top: 1px solid var(--wp--preset--color--cream);
	}
}

/* Product page reviews: summary, then the list, then the form. */
.kintsugi-reviews {
	margin-top: var(--wp--preset--spacing--70);
}

.kintsugi-reviews > h2 {
	margin-bottom: var(--wp--preset--spacing--40);
}

.kintsugi-review-summary {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	padding: var(--wp--preset--spacing--40) 0;
	border-top: 1px solid var(--wp--preset--color--cream);
	border-bottom: 1px solid var(--wp--preset--color--cream);
}

.kintsugi-review-summary > * {
	padding: 0 var(--wp--preset--spacing--50);
}

.kintsugi-review-summary > * + * {
	border-left: 1px solid var(--wp--preset--color--cream);
}

.kintsugi-review-summary__average {
	text-align: center;
}

.kintsugi-review-summary__average .kintsugi-stars {
	font-size: 1.25rem;
}

.kintsugi-review-summary__score {
	margin: 0.4em 0 0;
	font-family: var(--wp--preset--font-family--cinzel);
	font-size: var(--wp--preset--font-size--large);
}

.kintsugi-review-summary__count {
	margin: 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.kintsugi-review-summary__bars {
	margin: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.kintsugi-review-summary__bars li {
	display: flex;
	align-items: center;
	gap: 0.8em;
	line-height: 1.9;
}

.kintsugi-review-summary__bar {
	width: clamp(6rem, 14vw, 10rem);
	height: 0.5rem;
	background: var(--wp--preset--color--cream);
}

.kintsugi-review-summary__bar span {
	display: block;
	height: 100%;
	background: var(--wp--preset--color--gold);
}

.kintsugi-review-summary__n {
	min-width: 1.5em;
}

.kintsugi-review-summary__action {
	display: flex;
	justify-content: center;
}

.kintsugi-review-summary__action .wp-block-button__link {
	white-space: nowrap;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--white);
	border-radius: 0 999px 999px 0;
	font-family: var(--wp--preset--font-family--cinzel);
	letter-spacing: 0.06em;
}

.kintsugi-review-summary__action .wp-block-button__link:hover {
	background: var(--wp--preset--color--gold);
	color: var(--wp--preset--color--ink);
}

@media (max-width: 781px) {
	.kintsugi-review-summary {
		grid-template-columns: 1fr;
		justify-items: center;
		gap: var(--wp--preset--spacing--40);
	}

	.kintsugi-review-summary > * + * {
		border-left: 0;
	}
}

.kintsugi-reviews .wp-block-woocommerce-product-review-template {
	margin: 0;
	padding: 0;
	list-style: none;
}

.kintsugi-reviews .wp-block-woocommerce-product-review-template > li {
	padding: var(--wp--preset--spacing--40) 0;
	border-bottom: 1px solid var(--wp--preset--color--cream);
}

.kintsugi-reviews .wp-block-woocommerce-product-review-template > li > * + * {
	margin-top: 0.6rem;
}

.kintsugi-review__top {
	align-items: center;
}

.kintsugi-review__top .wp-block-woocommerce-product-review-date {
	color: var(--wp--preset--color--muted);
}

.kintsugi-reviews .wp-block-woocommerce-product-review-author-name {
	display: flex;
	align-items: center;
	gap: 0.7em;
}

.kintsugi-verified {
	padding: 0.2em 0.6em;
	font-family: var(--wp--preset--font-family--cinzel);
	font-size: 0.7rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--ink);
}

.kintsugi-reviews .wp-block-woocommerce-product-review-content p {
	margin: 0;
	max-width: 60em;
}

/* The form stays closed until "Write a review" links to it (#respond).
   Styled on the wrapper: WooCommerce resets #respond with two ID selectors. */
.kintsugi-reviews #review_form_wrapper {
	margin-top: var(--wp--preset--spacing--40);
	padding: var(--wp--preset--spacing--50);
	background: var(--wp--preset--color--paper);
}

.kintsugi-reviews #review_form_wrapper:not(:has(#respond:target)) {
	display: none;
}

.kintsugi-reviews #respond {
	scroll-margin-top: 9rem;
}

.kintsugi-reviews .comment-form-rating .stars button {
	color: var(--wp--preset--color--gold);
}

/* Gift extras (order bumps): product page form and basket/checkout summaries. */
.kintsugi-bumps {
	flex-basis: 100%;
	margin: 0;
}

.kintsugi-bumps__title {
	margin: 0 0 0.75em;
	font-family: var(--wp--preset--font-family--cinzel);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.08em;
	color: var(--wp--preset--color--bronze);
}

.kintsugi-bump {
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 16%, transparent);
	background: var(--wp--preset--color--white);
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.kintsugi-bump + .kintsugi-bump {
	margin-top: 0.625rem;
}

.kintsugi-bump:hover {
	border-color: var(--wp--preset--color--gold);
}

.kintsugi-bump.is-selected,
.kintsugi-bump:has(.kintsugi-bump__check:checked) {
	border-color: var(--wp--preset--color--gold);
	background: var(--wp--preset--color--paper);
}

.kintsugi-bump.is-busy {
	opacity: 0.6;
	cursor: progress;
}

/* Tick box, name and price on one row, description beneath. */
.kintsugi-bump__choice {
	display: grid;
	grid-template-columns: 1.25rem 1fr auto;
	column-gap: 0.75rem;
	row-gap: 0.25rem;
	align-items: start;
	padding: 0.875rem 1rem;
	cursor: pointer;
}

.kintsugi-bump__check {
	appearance: none;
	-webkit-appearance: none;
	grid-row: span 2;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0.1em 0 0;
	border: 1px solid var(--wp--preset--color--ink);
	border-radius: 0;
	background: var(--wp--preset--color--white) center / 0.875rem no-repeat;
	cursor: pointer;
}

.kintsugi-bump__check:checked {
	border-color: var(--wp--preset--color--gold);
	background-color: var(--wp--preset--color--gold);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20'%3E%3Cpath fill='%23fff' d='M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z'/%3E%3C/svg%3E");
}

.kintsugi-bump__check:focus-visible {
	outline: 2px solid var(--wp--preset--color--gold);
	outline-offset: 2px;
}

.kintsugi-bump__name {
	font-weight: 600;
	line-height: 1.4;
	color: var(--wp--preset--color--ink);
}

.kintsugi-bump__price {
	line-height: 1.4;
	white-space: nowrap;
	color: var(--wp--preset--color--bronze);
}

.kintsugi-bump__desc {
	grid-column: 2 / -1;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	color: var(--wp--preset--color--muted);
}

/* Card message: shown once the washi card is chosen. */
.kintsugi-bump__message {
	padding: 0 1rem 1rem calc(1rem + 1.25rem + 0.75rem);
}

.kintsugi-bump:not(.is-selected):not(:has(.kintsugi-bump__check:checked)) .kintsugi-bump__message {
	display: none;
}

.kintsugi-bump__message label {
	display: block;
	margin-bottom: 0.375rem;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--ink);
}

.kintsugi-bump__message textarea {
	display: block;
	box-sizing: border-box;
	width: 100%;
	min-height: 5.5rem;
	padding: 0.625rem 0.75rem;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 30%, transparent);
	border-radius: 0;
	background: var(--wp--preset--color--white);
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	color: var(--wp--preset--color--ink);
	resize: vertical;
}

.kintsugi-bump__message textarea:focus {
	outline: none;
	border-color: var(--wp--preset--color--gold);
	box-shadow: 0 0 0 1px var(--wp--preset--color--gold);
}

.kintsugi-bump__message.has-error textarea {
	border-color: #cc1818;
}

.kintsugi-bump__error {
	margin: 0.375rem 0 0;
	font-size: var(--wp--preset--font-size--small);
	color: #cc1818;
}

/* Basket summary sits flush; the checkout summary is a padded card. */
.wc-block-cart .kintsugi-bumps {
	margin: var(--wp--preset--spacing--30) 0;
}

.wc-block-checkout .kintsugi-bumps {
	padding: 1rem;
	border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--ink) 11%, transparent);
}
