/*
 * Product page: photo on the left, buying on the right, the text below in rows,
 * and four more in the shop's own cards (card.css).
 */
body.wauw-theme.single-product main.wauw-product-main { --sp-line: color-mix(in srgb, var(--wp--preset--color--contrast) 18%, transparent); box-sizing: border-box; padding: 1.25rem max(var(--wauw-gutter), calc((100% - 96rem) / 2)) clamp(4rem, 7vw, 6.5rem) !important; background: var(--wp--preset--color--base); font-variant-numeric: lining-nums; }
.wauw-product-main :where(h1, h2) { color: inherit; font-weight: 400; }

/* ---------- Breadcrumb ---------- */
.wauw-product-main .wc-block-breadcrumbs, .wauw-product-main .woocommerce-breadcrumb { margin: 0; }
.wauw-product-main .woocommerce-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; margin: 0 !important; padding: 0; color: var(--wp--preset--color--accent-4); font-size: 0.95rem; line-height: 1.4; }
.wauw-product-main .woocommerce-breadcrumb:is(*)::before, .wauw-product-main .woocommerce-breadcrumb:is(*)::after { content: none; }
.wauw-product-main .woocommerce-breadcrumb span { display: inline-flex; align-items: center; min-height: 2.75rem; }
.wauw-product-main .woocommerce-breadcrumb span + span::before { content: "/"; margin-inline: 0.6rem; opacity: 0.6; }
.wauw-product-main .woocommerce-breadcrumb a { display: inline-flex; align-items: center; min-height: 2.75rem; color: inherit; text-decoration: none; }
.wauw-product-main .woocommerce-breadcrumb a:hover { color: var(--wp--preset--color--contrast); text-decoration: underline 1px; text-underline-offset: 0.3em; }
/* The last crumb is the name right below it. */
.wauw-product-main .woocommerce-breadcrumb span:not(:has(a)) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Photo and buying panel ---------- */
.sp-top { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: clamp(2rem, 5.5vw, 6rem); align-items: start; margin-top: 1rem; }
.sp-gallery { position: sticky; top: calc(var(--wauw-header) + var(--wp-admin--admin-bar--height, 0px) + 1.5rem); min-width: 0; }
.woocommerce .sp-gallery .wp-block-woocommerce-product-image-gallery { max-width: none; }
.sp-gallery .woocommerce-product-gallery.images { float: none !important; width: 100% !important; margin: 0 !important; }
.sp-gallery .woocommerce-product-gallery__image { background: #fff; }
.sp-gallery .woocommerce-product-gallery__image a { display: block; }
/* The whole photo, whatever its shape, never taller than the window. */
.wauw-product-gallery .woocommerce-product-gallery__image img { width: 100%; height: auto; max-height: max(24rem, calc(100svh - var(--wauw-header) - 6rem)); aspect-ratio: auto; object-fit: contain; background: none; }
.wauw-product-gallery .woocommerce-product-gallery__image img.is-wide { aspect-ratio: 4 / 3; object-fit: cover; }
.wauw-product-gallery .flex-control-thumbs { grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: 0.75rem; margin: 0.75rem 0 0 !important; }
.wauw-product-gallery .flex-control-thumbs img { object-fit: contain; background: #fff; opacity: 0.6; }
.wauw-product-gallery .flex-control-thumbs img.flex-active { box-shadow: 0 0 0 1px var(--wp--preset--color--contrast); }
.woocommerce div.product .sp-gallery div.images .woocommerce-product-gallery__trigger { position: absolute; top: 1rem; right: 1rem; z-index: 3; display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: var(--wx-ivory); color: var(--wx-ink); font-size: 0; text-indent: 0; }
.woocommerce div.product .sp-gallery div.images .woocommerce-product-gallery__trigger::before { position: static; box-sizing: border-box; width: 1.05rem; height: 1.05rem; border: 0; border-radius: 0; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Cpath d='M9 3H3v6M15 3h6v6M9 21H3v-6M15 21h6v-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.7'%3E%3Cpath d='M9 3H3v6M15 3h6v6M9 21H3v-6M15 21h6v-6'/%3E%3C/svg%3E") center / contain no-repeat; }
.woocommerce div.product .sp-gallery div.images .woocommerce-product-gallery__trigger::after { content: none; }

.sp-panel { min-width: 0; padding-top: clamp(0rem, 1.5vw, 1.5rem); }
.sp-panel > * { max-width: 34rem; }
.sp-brand { margin: 0; color: var(--wp--preset--color--accent-4); }
.sp-panel h1 { margin: 0.2em 0 0; font-size: clamp(2rem, 3vw, 2.9rem); line-height: 1.12; letter-spacing: -0.015em; text-wrap: balance; }
.sp-price { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 1.1rem; }
.sp-price .wc-block-components-product-price { display: flex; flex-wrap: wrap; gap: 0 0.75rem; align-items: baseline; font-size: 1.4rem; font-weight: 600; line-height: 1.3; }
.sp-price ins { text-decoration: none; }
.sp-price del { color: var(--wp--preset--color--accent-4); font-weight: 400; opacity: 1; }
.sp-off { padding: 0.3rem 0.8rem; border-radius: 999px; background: #8a3a14; color: #f7f3ec; font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.sp-lede { margin-top: 1.4rem; line-height: 1.65; }
.sp-lede > :first-child { margin-top: 0; }
.sp-lede > :last-child { margin-bottom: 0; }
.sp-lede :is(ul, ol) { padding-left: 1.2rem; }

.sp-buy { margin-top: 1.6rem; scroll-margin-top: 8rem; }
.woocommerce div.product .sp-buy p.stock { display: flex; gap: 0.6rem; align-items: center; margin: 0 0 0.9rem; color: var(--wp--preset--color--contrast); font-size: 1rem; }
.woocommerce div.product .sp-buy p.in-stock::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #1c7a4f; }
.woocommerce div.product .sp-buy p.out-of-stock { margin: 0; font-weight: 600; }
.sp-buy form.cart { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }
.woocommerce div.product .sp-buy form.cart { margin: 0; padding: 0; }
.woocommerce div.product .sp-buy form.cart::before, .woocommerce div.product .sp-buy form.cart::after { content: none; }
.woocommerce div.product .sp-buy form.cart div.quantity { display: flex; float: none; align-items: stretch; margin: 0; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--wp--preset--color--contrast); }
.sp-buy .quantity .qty { box-sizing: border-box; width: 2.6rem; min-height: 3rem; margin: 0; padding: 0; border: 0; background: none; color: inherit; font-size: 1rem; font-weight: 600; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.sp-buy .quantity .qty::-webkit-inner-spin-button { display: none; }
.sp-step { width: 2.9rem; padding: 0; border: 0; border-radius: 999px; background: none; color: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer; }
.sp-step:hover { text-decoration: underline 1px; }
.woocommerce div.product .sp-buy form.cart .single_add_to_cart_button { flex: 1 1 12rem; float: none; min-height: 3rem; padding: 0.4rem 1.5rem; border: 0; border-radius: 999px; background: var(--wp--preset--color--contrast); box-shadow: inset 0 0 0 1px var(--wp--preset--color--contrast); color: var(--wx-ivory); font-family: var(--wx-body); font-size: 1rem; font-weight: 600; line-height: 1.3; letter-spacing: 0; text-transform: none; cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.woocommerce div.product .sp-buy form.cart .single_add_to_cart_button:is(:hover, .is-in) { background: transparent; color: var(--wp--preset--color--contrast); }
.woocommerce div.product .sp-buy form.cart .single_add_to_cart_button:is(:disabled, .disabled, [aria-disabled]) { padding: 0.4rem 1.5rem; opacity: 0.6; cursor: not-allowed; }

/* Variations */
.sp-buy .variations_form { display: block; }
.sp-buy table.variations { display: block; width: 100%; margin: 0 0 1.2rem; border: 0; }
.sp-buy table.variations :is(tbody, tr, th, td) { display: block; padding: 0; border: 0; text-align: left; line-height: 1.5; background: none; }
.sp-buy table.variations tr + tr { margin-top: 0.9rem; }
.sp-buy table.variations label { font-weight: 600; }
.sp-buy table.variations select { box-sizing: border-box; width: 100%; min-width: 0; min-height: 3rem; margin: 0.25rem 0 0; padding: 0 2.6rem 0 1.25rem; border: 1px solid var(--wp--preset--color--contrast); border-radius: 999px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' fill='none' stroke='%23123a30' stroke-width='1.3'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") calc(100% - 1.2rem) 50% / 0.7rem no-repeat; color: inherit; font-size: 1rem; -webkit-appearance: none; appearance: none; }
.sp-buy .reset_variations { display: inline-flex; align-items: center; min-height: 2.75rem; }
.sp-buy .woocommerce-variation-add-to-cart { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.sp-buy .woocommerce-variation-price { margin-bottom: 0.6rem; font-size: 1.25rem; font-weight: 600; }

.sp-facts { display: grid; margin: 1.9rem 0 0; border-top: 1px solid var(--sp-line); }
.sp-facts div { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: 0 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--sp-line); }
.sp-facts dt { font-weight: 600; }
.sp-facts dd { margin: 0; }
.sp-out { margin-top: 1rem; }
.sp-out p { margin: 0 0 1.1rem; line-height: 1.6; }
.sp-out .wx-btn { text-decoration: none; }

/* WooCommerce notices, when the form was posted without script */
.sp-panel > .wc-block-store-notices.alignwide { max-width: 34rem; }
.sp-panel .woocommerce-notices-wrapper > *, .sp-panel .wc-block-components-notice-banner { margin: 0 0 1.5rem; padding: 0.9rem 1.25rem; border: 0; border-radius: 0.75rem; background: var(--wx-ink); color: var(--wx-ivory); font-size: 1rem; }
.sp-panel .wc-block-components-notice-banner > svg { display: none; }
.sp-panel .wc-block-components-notice-banner__content { display: flex; flex-wrap: wrap; gap: 0 1.5rem; align-items: center; justify-content: space-between; }
/* As deep as WooCommerce's own rule, which prints the link in grey. */
.sp-panel .wc-block-components-notice-banner > .wc-block-components-notice-banner__content a { display: inline-flex; float: none; align-items: center; min-height: 2.75rem; margin: 0; padding: 0; border: 0; background: none; color: inherit !important; font-size: 1rem; font-weight: 600; letter-spacing: 0; text-decoration: underline 1px !important; text-transform: none; text-underline-offset: 0.3em; opacity: 1; }

/* ---------- The text, row by row ---------- */
.sp-chapters { margin-top: clamp(3.5rem, 6vw, 6rem); }
.sp-chapter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr); gap: 1rem clamp(2rem, 5.5vw, 6rem); padding: clamp(1.75rem, 3vw, 2.75rem) 0; border-top: 1px solid var(--sp-line); }
.sp-chapter h2 { margin: 0; font-size: clamp(1.5rem, 2.2vw, 2rem); line-height: 1.2; }
.sp-chapter__text { line-height: 1.7; }
.sp-chapter__text :is(p, ul, ol) { max-width: 42rem; margin: 0 0 1em; }
.sp-chapter__text > :last-child { margin-bottom: 0; }
.sp-chapter__text :is(ul, ol) { padding-left: 1.2rem; }
.sp-chapter__text li + li { margin-top: 0.35rem; }
.sp-chapter dl { columns: 2 18rem; column-gap: clamp(2rem, 4vw, 4rem); margin: 0; }
.sp-chapter dl > div { break-inside: avoid; padding-bottom: 1.25rem; }
.sp-chapter dt { font-weight: 600; }
.sp-chapter dd { margin: 0.1rem 0 0; }

.sp-reviews { padding: clamp(1.75rem, 3vw, 2.75rem) 0; border-top: 1px solid var(--sp-line); }
.sp-reviews h2 { margin: 0 0 1.25rem; font-size: clamp(1.5rem, 2.2vw, 2rem); line-height: 1.2; }
.sp-reviews ol { max-width: 44rem; margin: 0; padding: 0; list-style: none; }

/* ---------- Related ---------- */
.sp-related { margin-top: clamp(3rem, 5vw, 5rem); }
.sp-related h2 { margin: 0 0 1.25rem; font-size: clamp(1.6rem, 2.6vw, 2.4rem); line-height: 1.2; }

/* ---------- The bar on a phone ---------- */
.sp-bar { display: none; }

@media (max-width: 1239px) {
	.sp-related .wauw-card:nth-child(4) { display: none; }
}
@media (max-width: 959px) {
	.sp-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
	.sp-facts div { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 699px) {
	body.wauw-theme.single-product main.wauw-product-main { padding-top: 0.5rem !important; }
	.sp-top { display: block; margin-top: 0.25rem; }
	.sp-gallery { position: static; margin-inline: calc(-1 * var(--wauw-gutter)); }
	.wauw-product-gallery .woocommerce-product-gallery__image img { max-height: 100vw; }
	.sp-panel { padding-top: 1.5rem; }
	.sp-chapter { grid-template-columns: minmax(0, 1fr); }
	.sp-related .wauw-card:nth-child(4) { display: flex; }

	.sp-bar { position: fixed; right: 0; bottom: 0; left: 0; z-index: 60; display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: 0.6rem var(--wauw-gutter) calc(0.6rem + env(safe-area-inset-bottom)); background: var(--wp--preset--color--base); box-shadow: 0 -1px 0 var(--sp-line); transition: opacity 0.25s, visibility 0.25s; }
	.sp-bar.is-off { opacity: 0; visibility: hidden; }
	.sp-bar p { display: grid; min-width: 0; margin: 0; line-height: 1.3; }
	.sp-bar__name { overflow: hidden; color: var(--wp--preset--color--accent-4); font-size: 0.9rem; text-overflow: ellipsis; white-space: nowrap; }
	.sp-bar__price { display: flex; gap: 0.5rem; align-items: baseline; font-weight: 600; white-space: nowrap; }
	.sp-bar__price ins { text-decoration: none; }
	.sp-bar__price del { font-size: 0.9rem; font-weight: 400; }
	.sp-bar .wx-btn { flex: none; text-decoration: none; }
	.single-product .wauw-toast { bottom: calc(5rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
	.wauw-product-main *, .sp-bar { transition: none !important; }
}
/* On the narrowest phones the trail starts at Handil, so it stays on one line. */
@media (max-width: 23rem) {
	.wauw-product-main .woocommerce-breadcrumb span:first-child { display: none; }
	.wauw-product-main .woocommerce-breadcrumb span:nth-child(2)::before { content: none; }
}
