/* Petty's single product page: only what blocks cannot say. The template (tools/build-woo-specs.py) sets spacing, type,
   colours, borders and layouts as block attributes and uses the Card and Accordion variations. Here: the sticky summary,
   WooCommerce internals (gallery, buy box, stock, specifications, review list and form), the rating chip and the
   review grid. Token variables only. */

/* ---------- layout: the summary follows the gallery on desktop ---------- */
.pty-product > .wp-block-column { min-width: 0; }
@media (min-width: 1024px) {
	.pty-product__summary { position: sticky; top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--wp--custom--layout--header-height) + var(--wp--preset--spacing--40)); }
}

/* ---------- gallery ---------- */
.wp-block-woocommerce-product-gallery { display: grid; gap: var(--wp--preset--spacing--30); overflow-x: clip; }
.wp-block-woocommerce-product-gallery-large-image { border-radius: var(--wp--custom--radius--image); overflow: clip; background: var(--wp--preset--color--accent-5); }
.wc-block-product-gallery-large-image { aspect-ratio: var(--wp--custom--image--product) !important; }
.wc-block-product-gallery-large-image img, .wp-block-woocommerce-product-gallery-large-image img { width: 100% !important; height: 100% !important; object-fit: cover; display: block; border-radius: 0; }
.wc-block-product-gallery-thumbnails, .wc-block-product-gallery-thumbnails__scrollable { height: auto !important; max-height: none !important; }
.wc-block-product-gallery-thumbnails__scrollable { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--wp--preset--spacing--30); }
.wc-block-product-gallery-thumbnails__thumbnail { border: var(--wp--custom--border--strong) solid transparent; border-radius: var(--wp--custom--radius--input); overflow: clip; aspect-ratio: var(--wp--custom--image--avatar); background: var(--wp--preset--color--accent-5); cursor: pointer; }
.wc-block-product-gallery-thumbnails__thumbnail--active, .wc-block-product-gallery-thumbnails__thumbnail[aria-current="true"] { border-color: var(--wp--preset--color--contrast); }
.wc-block-product-gallery-thumbnails__thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wc-block-product-gallery-large-image-next-previous button { width: var(--wp--custom--control--min); height: var(--wp--custom--control--min); border-radius: var(--wp--custom--radius--badge); background: var(--wp--preset--color--surface); color: var(--wp--preset--color--contrast); border: 0; box-shadow: var(--wp--preset--shadow--sm); }
/* gallery lightbox close: the store ink, not the browser's black */
.wc-block-product-gallery-dialog__close-button { color: var(--wp--preset--color--contrast); }

/* ---------- summary: excerpt paragraphs and stock line ---------- */
.pty-product__summary .wp-block-post-excerpt p { margin: 0; }
.wc-block-components-product-stock-indicator { margin: 0; font-size: var(--wp--preset--font-size--small); font-weight: var(--wp--custom--font-weight--semibold); color: var(--wp--preset--color--success); }
.wc-block-components-product-stock-indicator--out-of-stock { color: var(--wp--preset--color--error); }
.wc-block-components-product-stock-indicator--low-stock { color: var(--wp--preset--color--warning); }
.wp-block-woocommerce-product-meta a { color: var(--wp--preset--color--link); }

/* ---------- buy box (WooCommerce's add to cart with options) ---------- */
.wp-block-woocommerce-add-to-cart-with-options { display: flex; flex-direction: column; gap: var(--wp--preset--spacing--30); padding: var(--wp--preset--spacing--40); border-radius: var(--wp--custom--radius--card); background: var(--wp--preset--color--surface); border: var(--wp--custom--border--hairline) solid var(--wp--preset--color--accent-6); }
.wp-block-woocommerce-add-to-cart-with-options form { display: flex; flex-direction: column; gap: var(--wp--preset--spacing--30); margin: 0; }
/* the buy box children bring their own margins and an empty variation wrapper: one rhythm instead */
.wp-block-woocommerce-add-to-cart-with-options > *, .wp-block-woocommerce-add-to-cart-with-options .wp-block-group, .wp-block-woocommerce-add-to-cart-with-options .wc-block-components-product-stock-indicator { margin: 0 !important; }
.wp-block-woocommerce-add-to-cart-with-options .single_variation_wrap, .wp-block-woocommerce-add-to-cart-with-options .wp-block-woocommerce-add-to-cart-with-options-variation-description:empty { display: contents; }
.wp-block-woocommerce-add-to-cart-with-options-variation-selector-attribute { display: grid; gap: var(--wp--preset--spacing--30); }
.wp-block-woocommerce-add-to-cart-with-options-variation-selector-attribute .wp-block-group { gap: var(--wp--preset--spacing--20) !important; }
.wp-block-woocommerce-add-to-cart-with-options-variation-selector-attribute-name { margin: 0; font-size: var(--wp--preset--font-size--small); font-weight: var(--wp--custom--font-weight--semibold); color: var(--wp--preset--color--accent-4); }
.wp-block-woocommerce-add-to-cart-with-options .wc-block-product-filter-chips__item { min-height: var(--wp--custom--control--min); }
.wp-block-woocommerce-add-to-cart-with-options > .wp-block-group.is-layout-flex { gap: var(--wp--preset--spacing--30) !important; flex-wrap: nowrap; align-items: stretch; }
/* the button drops below the quantity rather than squeezing its label onto several lines */
.wp-block-woocommerce-add-to-cart-with-options .is-layout-flex:has(> .wc-block-components-product-button) { flex-wrap: wrap; }
.wp-block-woocommerce-add-to-cart-with-options .wc-block-components-product-button { flex: 1 1 auto; min-width: max-content; }
.wp-block-woocommerce-add-to-cart-with-options .wc-block-components-product-button .wp-block-button__link { white-space: nowrap; }
.wp-block-woocommerce-add-to-cart-with-options .wc-block-components-product-button .wp-block-button__link { width: 100%; }
.wp-block-woocommerce-add-to-cart-with-options .wc-block-components-product-button__button { flex: 1; min-height: var(--wp--custom--control--button-height); background: var(--wp--preset--color--accent-1); color: var(--wp--preset--color--on-accent); box-shadow: none; }
.wp-block-woocommerce-add-to-cart-with-options .wc-block-components-product-button__button:hover { background: var(--wp--preset--color--accent-1-strong); }

/* ---------- about: the description's own paragraphs ---------- */
.wp-block-woocommerce-product-description { max-width: var(--wp--custom--layout--content); }
.wp-block-woocommerce-product-description p { margin: 0 0 var(--wp--preset--spacing--30); }
.wp-block-woocommerce-product-description > :last-child { margin-bottom: 0; }

/* ---------- specifications (kit: pty-specs): the table becomes small tiles on the tinted card ---------- */
.wp-block-woocommerce-product-specifications table { width: 100%; border: 0; border-collapse: collapse; }
.wp-block-woocommerce-product-specifications table, .wp-block-woocommerce-product-specifications tbody { display: block; }
.wp-block-woocommerce-product-specifications tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--wp--custom--layout--spec-min)), 1fr)); gap: var(--wp--preset--spacing--20); }
.wp-block-woocommerce-product-specifications tr { display: grid; align-content: start; gap: 0; padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40); border: 0; border-radius: var(--wp--custom--radius--input); background: var(--wp--preset--color--surface); }
.wp-block-woocommerce-product-specifications th, .wp-block-woocommerce-product-specifications td { display: block; padding: 0; border: 0; background: transparent; text-align: left; }
.wp-block-woocommerce-product-specifications .wp-block-product-specifications-item__label { font-size: var(--wp--preset--font-size--x-small); font-weight: var(--wp--custom--font-weight--bold); letter-spacing: var(--wp--custom--letter-spacing--eyebrow); text-transform: uppercase; color: var(--wp--preset--color--accent-4); }
.wp-block-woocommerce-product-specifications .wp-block-product-specifications-item__value { font-weight: var(--wp--custom--font-weight--bold); color: var(--wp--preset--color--contrast); }
.wp-block-woocommerce-product-specifications .wp-block-product-specifications-item__value p { margin: 0; }
.wp-block-woocommerce-product-specifications .wp-block-product-specifications-item__value a { color: inherit; text-decoration: none; }
.wp-block-woocommerce-product-specifications .wp-block-product-specifications-item__value a:hover { color: var(--wp--preset--color--link); text-decoration: underline; }

/* ---------- reviews: the #reviews anchor clears the sticky header; the average as a chip ---------- */
#reviews, .pty-pd-reviews { scroll-margin-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--wp--custom--layout--header-height) + var(--wp--preset--spacing--40)); }
.pty-pd-reviews .pty-rating { display: inline-flex; align-items: center; gap: var(--wp--preset--spacing--20); padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40); border-radius: var(--wp--custom--radius--chip); background: var(--wp--preset--color--accent-5); font-size: var(--wp--preset--font-size--medium); }
.pty-pd-reviews .pty-rating__avg { font-size: var(--wp--preset--font-size--large); font-weight: var(--wp--custom--font-weight--black); }
/* cards on the left, the form card on the right (sticky on desktop) */
.pty-reviews.wp-block-woocommerce-product-reviews { display: grid; gap: var(--wp--preset--spacing--60); align-items: start; }
@media (min-width: 1024px) {
	.pty-reviews.wp-block-woocommerce-product-reviews { grid-template-columns: minmax(0, 1fr) minmax(0, var(--wp--custom--layout--form-card)); gap: var(--wp--preset--spacing--70); }
	.pty-reviews #review_form_wrapper { position: sticky; top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--wp--custom--layout--header-height) + var(--wp--preset--spacing--40)); }
}
.pty-reviews > * { margin: 0 !important; }
.pty-reviews .wp-block-woocommerce-product-reviews-pagination:empty { display: none; }
/* the review list: WooCommerce reuses li.review, so the classic comment-list look is neutralised */
ol.wp-block-woocommerce-product-review-template { display: grid; gap: var(--wp--preset--spacing--30); width: 100%; max-width: none; margin: 0; padding: 0; list-style: none; }
.pty-reviews ol.wp-block-woocommerce-product-review-template > li.review, ol.wp-block-woocommerce-product-review-template > li { display: block; max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
/* one review (Card): avatar beside name, stars and date, text below */
.pty-review { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--wp--preset--spacing--40); }
.pty-review > * { margin: 0 !important; }
.pty-review > .pty-avatar, .pty-review > .wp-block-avatar { grid-row: 1 / span 2; }
.pty-review > .pty-review__head, .pty-review > .wp-block-woocommerce-product-review-content { grid-column: 2; }
.pty-review .wp-block-avatar img { width: var(--wp--custom--icon--xl); height: var(--wp--custom--icon--xl); border-radius: var(--wp--custom--radius--badge); }
.pty-review .wp-block-woocommerce-product-review-content { line-height: var(--wp--custom--line-height--body); }
.pty-review .wp-block-woocommerce-product-review-content p { margin: 0; }
.pty-review .wp-block-woocommerce-product-review-date a { color: inherit; text-decoration: none; }
.pty-review .wp-block-woocommerce-product-review-date a:hover { text-decoration: underline; }
/* the initials avatar printed by inc/woo.php */
.pty-avatar { display: grid; place-items: center; width: var(--wp--custom--icon--lg); height: var(--wp--custom--icon--lg); border-radius: var(--wp--custom--radius--badge); background: var(--wp--preset--color--soft); color: var(--wp--preset--color--contrast); font-size: var(--wp--preset--font-size--small); font-weight: var(--wp--custom--font-weight--black); }

/* star ratings drawn with the collection's star (WooCommerce's star font is not loaded) */
.woocommerce .star-rating { position: relative; float: none; display: block; width: calc(var(--wp--custom--icon--xs) * 5); height: var(--wp--custom--icon--xs); margin: 0; overflow: hidden; font-size: 0; line-height: 0; background: var(--wp--preset--color--accent-6); -webkit-mask: var(--wp--custom--icon-url--star-fill) 0 0 / var(--wp--custom--icon--xs) var(--wp--custom--icon--xs) repeat-x; mask: var(--wp--custom--icon-url--star-fill) 0 0 / var(--wp--custom--icon--xs) var(--wp--custom--icon--xs) repeat-x; }
.woocommerce .star-rating::before, .woocommerce .star-rating span::before { content: none !important; }
.woocommerce .star-rating span { position: absolute; inset: 0 auto 0 0; padding: 0; overflow: hidden; background: var(--wp--preset--color--star); }

/* ---------- review form card (WooCommerce's comment form): 24px all round, 16px between groups ---------- */
.pty-reviews #review_form_wrapper, .pty-reviews #review_form { margin: 0; padding: 0; background: transparent; }
#review_form_wrapper #review_form #respond.pty-form-card { display: block !important; margin: 0; padding: var(--wp--preset--spacing--40) !important; border: 0; border-radius: var(--wp--custom--radius--card) !important; background: var(--wp--preset--color--accent-5) !important; }
#review_form_wrapper #review_form #respond.pty-form-card > :not(#reply-title):not(form) { display: none; }
.pty-reviews #respond .comment-reply-title { display: block; margin: 0 0 var(--wp--preset--spacing--30) !important; font-size: var(--wp--preset--font-size--large); font-weight: var(--wp--custom--font-weight--black); letter-spacing: var(--wp--custom--letter-spacing--heading); line-height: var(--wp--custom--line-height--heading); }
.pty-reviews #respond .comment-reply-title small { display: none; }
.pty-reviews #respond form.comment-form { display: grid; gap: var(--wp--preset--spacing--30); margin: 0; padding: 0; }
.pty-reviews #respond form.comment-form > * { margin: 0 !important; padding: 0; }
.pty-reviews #respond form.comment-form > :is(input[type="hidden"], :empty:not(textarea)) { display: none; }
.pty-reviews #respond .comment-form label { display: block; margin: 0 0 calc(var(--wp--preset--spacing--20) / 2) !important; font-size: var(--wp--preset--font-size--small); font-weight: var(--wp--custom--font-weight--bold); color: var(--wp--preset--color--contrast); }
.pty-reviews #respond .comment-form .required { color: var(--wp--preset--color--error); text-decoration: none; }
.pty-reviews #respond .comment-form :is(textarea, input[type="text"], input[type="email"]) { width: 100%; box-sizing: border-box; background: var(--wp--preset--color--surface) !important; }
.pty-reviews #respond .comment-form-comment textarea { display: block; min-height: calc(var(--wp--custom--control--height) * 2) !important; }
.pty-reviews #respond .comment-form-cookies-consent { display: flex !important; align-items: center; gap: var(--wp--preset--spacing--30) !important; }
.pty-reviews #respond .comment-form-cookies-consent input { appearance: none; -webkit-appearance: none; width: var(--wp--custom--icon--md); height: var(--wp--custom--icon--md); flex: none; margin: 0; border: var(--wp--custom--border--strong) solid var(--wp--preset--color--border-strong); border-radius: calc(var(--wp--custom--radius--input) / 2); background: var(--wp--preset--color--surface); }
.pty-reviews #respond .comment-form-cookies-consent input:checked { background: var(--wp--preset--color--contrast); border-color: var(--wp--preset--color--contrast); }
/* rating input: stars flush with the text edge (each star is a 44px target) */
.comment-form .stars { display: inline-flex; margin: 0; }
.comment-form .stars button { width: var(--wp--custom--control--min); height: var(--wp--custom--control--min); display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--wp--preset--color--star); cursor: pointer; box-shadow: none; padding: 0; min-height: 0; }
.pty-reviews #respond .stars-wrapper { margin: 0 0 0 calc((var(--wp--custom--control--min) - var(--wp--custom--icon--md)) / -2) !important; }
.pty-reviews #respond .form-submit { display: block; margin-top: var(--wp--preset--spacing--20) !important; }
.pty-reviews #respond .form-submit input#submit { width: 100%; min-height: var(--wp--custom--control--height); border: 0; border-radius: var(--wp--custom--radius--button); background: var(--wp--preset--color--contrast); color: var(--wp--preset--color--on-contrast); box-shadow: var(--wp--preset--shadow--cta); font-family: var(--wp--preset--font-family--body); font-size: var(--wp--preset--font-size--small); font-weight: var(--wp--custom--font-weight--bold); cursor: pointer; }
.pty-reviews #respond .form-submit input#submit:hover { background: var(--wp--preset--color--accent-3); }
