.ywp-selector, .ywp-gallery { --ywp-ui-accent: var(--wp--preset--color--contrast, currentColor); --ywp-ui-surface: var(--wp--preset--color--base, white); }
.ywp-selector { margin-block: 1rem; }
.ywp-selector:has(> .ywp-current[hidden]):not(:has(> .ywp-open)) { margin: 0; }
.ywp-current { font-weight: 600; }
.ywp-gallery { width: 100%; min-width: 0; }
.woocommerce div.product > .ywp-gallery { float: left; width: 48%; }
.ywp-gallery-stage { overflow: hidden; }
.ywp-gallery .ywp-gallery-panel { margin: 0; aspect-ratio: 4 / 5; display: flex; align-items: center; justify-content: center; }
.ywp-gallery .ywp-gallery-panel[hidden] { display: none; }
.ywp-gallery-panel img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ywp-thumbnails { display: flex; gap: .65rem; overflow-x: auto; padding: .4rem; margin: .75rem -.4rem 0; }
.ywp-gallery button.ywp-thumbnail { flex: 0 0 76px; width: 76px; padding: 3px; margin: 0; background: transparent; border: 1px solid transparent; border-radius: 2px; box-shadow: none; cursor: pointer; }
.ywp-thumbnail img { display: block; width: 100%; aspect-ratio: 4 / 5; height: auto; object-fit: contain; }
.ywp-gallery button.ywp-thumbnail[aria-pressed="true"] { border-color: var(--ywp-ui-accent); }
.ywp-gallery-actions { margin-block: 1rem; }
.ywp-open.wp-element-button { background: transparent; color: var(--ywp-ui-accent); border: 1px solid var(--ywp-ui-accent); padding: .75em 1.25em; font-family: inherit; cursor: pointer; box-shadow: none; }
.ywp-open[hidden] { display: none !important; }
.ywp-dialog { width: min(1280px, 94vw); max-width: 94vw; height: min(900px, 92vh); height: min(900px, 92dvh); max-height: 92vh; max-height: 92dvh; padding: 0; border: 0; border-radius: 8px; background: var(--ywp-ui-surface); color: inherit; overflow-y: auto; box-shadow: 0 16px 60px rgb(0 0 0 / 20%); }
.ywp-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.ywp-dialog-toolbar { position: sticky; top: 0; z-index: 2; background: var(--ywp-ui-surface); padding-bottom: 1rem; }
.ywp-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.5rem; background: var(--ywp-ui-surface); }
.ywp-dialog-header h2 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.25rem); }
.ywp-dialog button.ywp-close { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 2rem; line-height: 1; box-shadow: none; cursor: pointer; }
.ywp-filters { display: flex; gap: 1.5rem; overflow-x: auto; margin: 0 1.5rem; padding-top: .25rem; box-shadow: inset 0 -1px color-mix(in srgb, currentColor 22%, transparent); }
.ywp-filters button { flex-shrink: 0; margin: 0; padding: .8rem .35rem; background: transparent; color: inherit; border: 0; border-bottom: 4px solid transparent; border-radius: 0; font: inherit; box-shadow: none; cursor: pointer; transition: color .15s ease, border-color .15s ease; }
.ywp-filters button[aria-pressed="true"] { color: var(--ywp-ui-accent); border-bottom-color: var(--ywp-ui-accent); }
.ywp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 1rem; padding: .25rem 1.5rem 1.5rem; }
.ywp-dialog button.ywp-card { display: flex; flex-direction: column; align-items: stretch; gap: .6rem; margin: 0; padding: .65rem; border: 1px solid transparent; border-radius: 3px; background: transparent; color: inherit; font: inherit; text-align: start; box-shadow: none; cursor: pointer; }
.ywp-dialog button.ywp-card[aria-pressed="true"], .ywp-dialog button.ywp-card:hover { border-color: var(--ywp-ui-accent); }
.ywp-dialog button.ywp-card[hidden] { display: none; }
.ywp-card img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: contain; }
.ywp-card small { font-size: .8em; }
.ywp-card[aria-busy="true"] { opacity: .6; }
.ywp-message { margin: 0; padding: 0 1.5rem 1.25rem; }
.ywp-message:empty { display: none; }
.ywp-dialog button:focus-visible, .ywp-open:focus-visible, .ywp-thumbnail:focus-visible { outline: 2px solid var(--ywp-ui-accent); outline-offset: 3px; }
@media (max-width: 768px) { .woocommerce div.product > .ywp-gallery { float: none; width: 100%; } }
@media (max-width: 480px) { .ywp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding-inline: .75rem; } .ywp-dialog-header { padding-inline: .75rem; } .ywp-filters { margin-inline: .75rem; } }
/* Theme button display rules must not reveal an unavailable purchase action. */
.ywp-ready-controls .ywp-ready-add[hidden] { display: none !important; }
.ywp-ready-native-submit { display: none !important; }
.ywp-ready-message:not(:empty) { display: block; margin-block-start: .5rem; }

/* Quantity occupies its own row; the purchase buttons wrap underneath it. */
.ywp-purchase-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: .75rem; width: 100%; }
.ywp-purchase-actions .ywp-ready-controls, .ywp-purchase-actions .ywp-customize-group { display: contents; }
.woocommerce div.product form.cart .ywp-purchase-actions .quantity { float: none; margin: 0; display: flex; flex: 0 0 100%; width: 100%; min-width: 0; }
.woocommerce div.product form.cart .ywp-purchase-actions .quantity input.qty { flex: 0 0 auto; width: 6rem; min-width: 6rem; max-width: 100%; height: auto; min-height: 3rem; padding: .5rem; box-sizing: border-box; line-height: normal; text-align: center; }
.woocommerce div.product form.cart .ywp-purchase-actions button { float: none; margin: 0; box-sizing: border-box; }
.woocommerce div.product form.cart .ywp-purchase-actions .ywp-ready-add { background: var(--ywp-action-accent); color: var(--ywp-action-text); border: 1px solid var(--ywp-action-accent); cursor: pointer; }
.woocommerce div.product form.cart .ywp-purchase-actions .ywp-customize-outline { background: transparent; color: var(--ywp-action-accent); border: 1px solid var(--ywp-action-accent); box-shadow: none; }
.ywp-purchase-actions .ywp-ready-add:disabled { opacity: .5; cursor: not-allowed; }
.ywp-purchase-actions .ywp-ready-add:not(:disabled):hover { filter: brightness(.92); }
.ywp-purchase-actions .ywp-customize-outline:hover { background: color-mix(in srgb, var(--ywp-action-accent) 8%, transparent) !important; }
.ywp-purchase-actions .ywp-ready-add:focus-visible, .ywp-purchase-actions .ywp-customize-outline:focus-visible { outline: 2px solid var(--ywp-action-accent); outline-offset: 3px; }
.ywp-purchase-actions .ywp-ready-message { order: 4; flex-basis: 100%; }

.ywp-purchase-actions .ywp-ready-message:empty { display: none; }

@media (prefers-reduced-motion: reduce) { .ywp-filters button { transition: none; } }

/* Mouse focus must not add a theme ring around category filters. */
.ywp-dialog .ywp-filters button:focus:not(:focus-visible) { outline: none !important; box-shadow: none !important; }
.ywp-dialog .ywp-filters button:focus-visible { outline: 2px solid var(--ywp-ui-accent); outline-offset: -2px; box-shadow: none; }

.ywp-gallery-panel .ywp-zoom { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; cursor: zoom-in; }
.ywp-zoom:focus-visible { outline: 2px solid var(--ywp-ui-accent); outline-offset: -3px; }
.ywp-lightbox { --ywp-ui-accent: var(--wp--preset--color--contrast, currentColor); width: 94vw; max-width: 1600px; height: 92vh; height: 92dvh; max-height: 92dvh; padding: 1rem; box-sizing: border-box; border: 0; border-radius: 8px; background: var(--wp--preset--color--base, white); color: var(--wp--preset--color--contrast, #222); }
.ywp-lightbox[open] { display: flex; flex-direction: column; gap: .5rem; }
.ywp-lightbox::backdrop { background: rgb(0 0 0 / 75%); }
.ywp-lightbox-toolbar, .ywp-lightbox-navigation { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex: 0 0 auto; }
.ywp-lightbox-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y pinch-zoom; }
.ywp-lightbox-stage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.ywp-lightbox button { min-width: 44px; min-height: 44px; padding: .25rem .6rem; border: 1px solid var(--ywp-ui-accent); border-radius: 3px; background: transparent; color: var(--ywp-ui-accent); font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; box-shadow: none; }
.ywp-lightbox button[hidden] { display: none; }
.ywp-lightbox button:focus-visible { outline: 2px solid var(--ywp-ui-accent); outline-offset: 3px; }
.ywp-lightbox-status { font-size: .875rem; text-align: center; }
@media (max-width: 480px) { .ywp-lightbox { padding: .5rem; width: 96vw; } }

/* Scope the custom breakpoint to the Columns block containing this product's gallery and form. */
@media (width < 920px) {
    .wp-block-columns.ywp-product-columns { flex-direction: column; flex-wrap: nowrap !important; }
    .wp-block-columns.ywp-product-columns > .wp-block-column { flex-basis: auto !important; width: 100%; min-width: 0; margin-inline: 0; }
}
