/* Product layout only; native Woo gallery, quantity and form remain the source. */
.woocommerce div.tst-product-detail {display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:var(--tst-space-7) var(--tst-space-7);align-items:start}
.woocommerce div.tst-product-detail::before,.woocommerce div.tst-product-detail::after {display:none}
.woocommerce div.tst-product-detail div.images,.woocommerce div.tst-product-detail div.summary {width:auto;float:none;margin:0;min-width:0}
.woocommerce div.tst-product-detail div.summary {padding:0;border:0;background:transparent;border-radius:0}
.woocommerce div.tst-product-detail .summary>.eyebrow {display:block;margin-bottom:var(--tst-space-4)}
.woocommerce div.tst-product-detail .product_title {font-size:var(--tst-type-page);line-height:var(--tst-leading-heading);margin-bottom:var(--tst-space-4)}
.woocommerce div.tst-product-detail .summary>.price,.woocommerce div.tst-product-detail .tst-product-price-row {font-size:var(--tst-type-price)!important;margin:var(--tst-space-5) 0}
.woocommerce div.tst-product-detail .woocommerce-product-details__short-description {font-size:var(--tst-type-reading);line-height:var(--tst-leading-reading);color:var(--tst-muted);display:block}
.woocommerce div.tst-product-detail .woocommerce-product-details__short-description p {margin:0 0 var(--tst-copy-gap)}
.tst-product-facts {display:flex;flex-wrap:wrap;gap:var(--tst-space-4) var(--tst-space-5);margin:0 0 var(--tst-space-5);font-size:var(--tst-type-label)}
.tst-product-facts dt {color:var(--tst-muted);font-size:var(--tst-type-caption)}
.tst-product-facts dd {margin:var(--tst-space-1) 0 0}
.tst-product-sales-note {color:var(--tst-muted);font-size:var(--tst-type-label)}
/* One Woo stock projection: quiet exceptions outside, full native detail in the sheet. */
.tst-product-detail .tst-product-stock>.tst-stock-detail,
.tst-product-detail .tst-product-stock[data-tst-stock-state="regular"] {display:none}
.tst-product-detail .tst-stock-exception {margin:0;color:var(--tst-warning);font-size:var(--tst-type-label);line-height:var(--tst-leading-ui)}
.tst-product-detail form.cart>.tst-stock-exception {margin-top:var(--tst-space-3)}
.tst-product-detail .tst-stock-exception[hidden] {display:none}
.woocommerce div.tst-product-detail form.variations_form>.stock {padding:0;margin:0;background:transparent;border-radius:0;color:var(--tst-warning);font-size:var(--tst-type-label);line-height:var(--tst-leading-ui)}
.tst-product-detail .tst-variant-stock .tst-product-stock,
.tst-product-detail .tst-variant-stock .tst-product-stock>.tst-stock-detail {display:block}
.tst-product-detail .tst-variant-stock .tst-stock-exception {display:none}
.woocommerce div.tst-product-detail .tst-product-event-context {padding:var(--tst-space-4);margin:var(--tst-space-5) 0;border-radius:var(--tst-radius-control);border:0;background:var(--tst-surface-subtle)}
.woocommerce div.tst-product-detail .tst-product-event-context p {margin:var(--tst-space-2) 0;font-size:var(--tst-type-label)}
.woocommerce div.tst-product-detail .tst-product-event-context a {font-size:var(--tst-type-label)}
.woocommerce div.tst-product-detail>.related,.woocommerce div.tst-product-detail>.upsells,.woocommerce div.tst-product-detail>.tstd-related {grid-column:1/-1;min-width:0;margin:0}
.tst-product-content {display:grid;gap:var(--tst-section-gap);margin-top:var(--tst-space-5)}
.tst-product-content-section {border-top:1px solid var(--tst-line);padding-top:var(--tst-space-5);min-width:0}
.tst-product-content-section h2 {font-size:var(--tst-type-section);line-height:var(--tst-leading-heading);margin:0 0 var(--tst-space-3)}
.tst-product-content-section p {color:var(--tst-muted);margin:0 0 var(--tst-copy-gap)}
.tst-product-content-section p:last-child {margin-bottom:0}
.woocommerce .tst-product-content table.shop_attributes {display:table;border:0;margin:0;width:100%;table-layout:fixed;font-size:var(--tst-type-label);line-height:var(--tst-leading-body)}
.woocommerce .tst-product-content table.shop_attributes tbody {display:table-row-group}
.woocommerce .tst-product-content table.shop_attributes tr {display:table-row}
.woocommerce .tst-product-content table.shop_attributes :is(th,td) {display:table-cell;border:0;border-bottom:1px solid var(--tst-line);padding:var(--tst-space-3);font-style:normal;text-align:left;vertical-align:top;background:transparent;overflow-wrap:anywhere}
.woocommerce .tst-product-content table.shop_attributes tr:nth-child(even) :is(th,td) {background:transparent}
.woocommerce .tst-product-content table.shop_attributes th {width:40%;font-weight:500;color:var(--tst-muted);padding-left:0}
.woocommerce .tst-product-content table.shop_attributes td {padding-right:0}
.woocommerce .tst-product-content table.shop_attributes td p {margin:0;padding:0;color:var(--tst-ink)}
.woocommerce .tst-product-content table.shop_attributes tr:last-child :is(th,td) {border-bottom:0}
.woocommerce div.tst-product-detail form.cart table.variations {display:block;margin:0 0 var(--tst-space-4);border:0}
.woocommerce div.tst-product-detail form.cart table.variations tbody {display:block}
.woocommerce div.tst-product-detail form.cart table.variations tr {display:grid;gap:var(--tst-space-2);margin-bottom:var(--tst-space-4)}
.woocommerce div.tst-product-detail form.cart table.variations :is(th,td) {display:block;width:100%;padding:0;text-align:left;vertical-align:top;border:0;line-height:var(--tst-leading-body)}
.woocommerce div.tst-product-detail form.cart table.variations label {font-size:var(--tst-type-label);font-weight:600}
.woocommerce div.tst-product-detail .tst-variation-control select[hidden] {display:none}
.tst-variation-swatches {display:flex;flex-wrap:wrap;gap:var(--tst-space-3)}
.woocommerce div.tst-product-detail button.tst-variation-swatch {display:flex;flex-direction:row;text-align:left;align-items:center;justify-content:center;gap:var(--tst-space-2);min-width:var(--tst-touch-min);min-height:var(--tst-touch-min);padding:var(--tst-space-2);border:1px solid var(--tst-control-border);border-radius:var(--tst-radius-input);background:var(--tst-surface);color:var(--tst-ink);font-size:var(--tst-type-label);line-height:var(--tst-leading-title);font-weight:500;max-width:100%;overflow-wrap:anywhere}
.woocommerce div.tst-product-detail button.tst-variation-swatch img {width:var(--tst-touch-min);height:auto;aspect-ratio:var(--tst-media-product);object-fit:contain;border-radius:var(--tst-radius-media)}
.woocommerce div.tst-product-detail button.tst-variation-swatch[aria-pressed="true"] {border-color:var(--tst-ink);box-shadow:inset 0 0 0 1px var(--tst-ink);background:var(--tst-selection-surface);color:var(--tst-on-selection)}
.woocommerce div.tst-product-detail button.tst-variation-swatch:not(:disabled):not([aria-pressed=true]):active {background:var(--tst-secondary-hover);color:var(--tst-ink);border-color:var(--tst-ink)}
.woocommerce div.tst-product-detail button.tst-variation-swatch:focus-visible {outline:2px solid var(--tst-focus);outline-offset:2px}
@media(hover:hover) and (pointer:fine) {
  .woocommerce div.tst-product-detail button.tst-variation-swatch:not(:disabled):not([aria-pressed=true]):hover {background:var(--tst-secondary-hover);color:var(--tst-ink);border-color:var(--tst-ink)}
}
.woocommerce div.tst-product-detail button.tst-variation-swatch:disabled {opacity:.45;cursor:not-allowed}
.woocommerce div.tst-product-detail form.cart .reset_variations {display:inline-flex;align-items:center;min-height:var(--tst-touch-min);margin:var(--tst-space-2) 0 0;font-size:var(--tst-type-label)}
.woocommerce div.tst-product-detail .woocommerce-product-gallery {opacity:1!important;position:relative}
.woocommerce div.tst-product-detail .woocommerce-product-gallery img {border-radius:var(--tst-radius-media);aspect-ratio:var(--tst-media-product);object-fit:contain;background:var(--tst-surface-subtle)}
.woocommerce div.tst-product-detail .flex-viewport {border-radius:var(--tst-radius-media)}
.woocommerce div.tst-product-detail div.images .flex-control-thumbs {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--tst-space-3);margin-top:var(--tst-space-3)}
.woocommerce div.tst-product-detail div.images .flex-control-thumbs li {width:auto!important;float:none!important;margin:0!important;min-width:0}
.woocommerce div.tst-product-detail div.images .flex-control-thumbs li img {border-radius:var(--tst-radius-media);border:2px solid transparent;opacity:1;min-height:var(--tst-touch-min)}
.woocommerce div.tst-product-detail div.images .flex-control-thumbs li img.flex-active {border-color:var(--tst-accent)}
.woocommerce div.tst-product-detail div.images .flex-control-thumbs li img:focus-visible {outline:2px solid var(--tst-focus);outline-offset:2px}
.woocommerce div.tst-product-detail div.images.woocommerce-product-gallery:not(.tst-gallery-ready) .woocommerce-product-gallery__wrapper {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--tst-space-3)}
.woocommerce div.tst-product-detail div.images.woocommerce-product-gallery:not(.tst-gallery-ready) .woocommerce-product-gallery__wrapper>:first-child {grid-column:1/-1}
.woocommerce div.tst-product-detail div.images.woocommerce-product-gallery:not(.tst-gallery-ready) .woocommerce-product-gallery__wrapper>* {width:100%;min-width:0}
/* Match native Woo gallery specificity so its drawn magnifier cannot overlap the shared icon. */
.woocommerce div.tst-product-detail div.images .woocommerce-product-gallery__trigger {width:var(--tst-touch-min);height:var(--tst-touch-min);display:grid;place-items:center;inset:auto var(--tst-space-3) auto auto;top:var(--tst-space-3);background:var(--tst-surface);border-radius:var(--tst-radius-round);z-index:2}
.woocommerce div.tst-product-detail div.images .woocommerce-product-gallery__trigger::before,.woocommerce div.tst-product-detail div.images .woocommerce-product-gallery__trigger::after {display:none;content:none}
.woocommerce div.tst-product-detail div.images .woocommerce-product-gallery__trigger img {width:24px;height:24px;background:none;border-radius:0}
.tst-product-gallery-count {position:absolute;top:var(--tst-space-3);left:var(--tst-space-3);background:var(--tst-surface);border-radius:var(--tst-radius-badge);padding:var(--tst-space-1) var(--tst-space-2);font-size:var(--tst-type-caption);z-index:2}
.tst-product-gallery-note {font-size:var(--tst-type-caption);color:var(--tst-muted);margin:var(--tst-space-2) 0 0}
.woocommerce div.tst-product-detail form.cart .tst-product-actions {display:flex;align-items:center;gap:var(--tst-space-3);margin:0;width:100%}
.woocommerce div.tst-product-detail form.cart .tst-product-actions :is(.single_add_to_cart_button,.tst-buy-now) {float:none;flex:1;min-width:0;max-width:none;min-height:var(--tst-control-height);padding:var(--tst-space-3) var(--tst-space-4);line-height:var(--tst-leading-title);font-size:var(--tst-type-label)}
.woocommerce div.tst-product-detail .tst-product-quantity {display:flex;align-items:center;min-width:0;flex:none;height:var(--tst-touch-min)}
/* Override Woo's form.cart quantity margin without shrinking any touch target. */
.woocommerce div.tst-product-detail form.cart .tst-product-quantity div.quantity {margin:0;float:none}
.woocommerce div.tst-product-detail .tst-product-quantity input.qty {border:0;box-shadow:none;width:var(--tst-touch-min);min-height:var(--tst-touch-min);padding:var(--tst-space-1);text-align:center;font-size:var(--tst-type-body);border-radius:0;background:transparent}
.woocommerce div.tst-product-detail .tst-product-quantity input.qty::-webkit-inner-spin-button {appearance:none}
.woocommerce div.tst-product-detail .tst-quantity-value {display:grid;place-items:center;min-width:var(--tst-touch-min);min-height:var(--tst-touch-min);padding:var(--tst-space-1);font-size:var(--tst-type-body);font-weight:400;color:var(--tst-ink)}
.woocommerce div.tst-product-detail .tst-product-quantity :is(input.qty,.tst-quantity-value)[hidden] {display:none}
.woocommerce div.tst-product-detail .tst-quantity-step {border:0;background:transparent;padding:0;display:grid;place-items:center;min-width:var(--tst-touch-min);min-height:var(--tst-touch-min);color:var(--tst-muted)}
.woocommerce div.tst-product-detail .tst-quantity-step[hidden] {display:none}
.woocommerce div.tst-product-detail .tst-quantity-step img {width:var(--tst-space-3);height:var(--tst-space-3)}
.woocommerce div.tst-product-detail .summary button.tstd-save--icon {margin:0;padding:0;min-width:var(--tst-control-height);width:var(--tst-control-height);height:var(--tst-control-height);border:1px solid var(--tst-line);display:grid;place-items:center;background:var(--tst-surface)}
@media(max-width:900px) {
  .woocommerce div.tst-product-detail {grid-template-columns:minmax(0,1fr);gap:var(--tst-space-3)}
  .woocommerce div.tst-product-detail div.summary {display:contents}
  .woocommerce div.tst-product-detail .summary>.eyebrow {order:-4;margin:0;font-size:var(--tst-type-caption)}
  .woocommerce div.tst-product-detail .product_title {order:-3;margin:0;font-size:var(--tst-type-page)}
  .woocommerce div.tst-product-detail div.images {order:-2;width:100%;max-width:none;justify-self:stretch}
  .woocommerce div.tst-product-detail .summary>.price,.woocommerce div.tst-product-detail .tst-product-price-row {order:-1;margin:0;font-size:var(--tst-type-price)!important}
  .woocommerce div.tst-product-detail .woocommerce-product-details__short-description {margin:0;max-width:none}
  .woocommerce div.tst-product-detail .tst-product-facts {margin:0}
  .woocommerce div.tst-product-detail .tst-product-event-context {margin:0}
  .woocommerce div.tst-product-detail .tst-product-content {order:40}
  .woocommerce div.tst-product-detail .product_meta {order:41}
  .woocommerce div.tst-product-detail .tst-product-help {order:42}
  .woocommerce div.tst-product-detail>.tstd-related {order:45}
  .woocommerce div.tst-product-detail>.related,.woocommerce div.tst-product-detail>.upsells {order:50}
  .woocommerce div.tst-product-detail div.images .flex-control-thumbs {gap:var(--tst-space-2);margin-top:var(--tst-space-2)}
  .woocommerce div.tst-product-detail .summary button.tstd-save--icon {width:var(--tst-touch-min);min-width:var(--tst-touch-min);height:var(--tst-touch-min);min-height:var(--tst-touch-min)}
  .woocommerce div.tst-product-detail form.cart {margin:0}
  .woocommerce div.tst-product-detail form.variations_form .variations {margin-bottom:var(--tst-space-4)}
  .woocommerce div.tst-product-detail :is(a,button,input,select,summary) {scroll-margin-bottom:calc(var(--tst-dock-clearance) + var(--tst-action-dock-gap) + var(--tst-action-bar-height) + var(--tst-space-4) + env(safe-area-inset-bottom))}
}

@media(max-width:600px) {
  /* Split the section gap around the divider instead of stacking two gaps. */
  .tst-product-content {gap:calc(var(--tst-section-gap) / 2);margin-top:var(--tst-group-gap)}
  .tst-product-content-section {padding-top:calc(var(--tst-section-gap) / 2)}
}
/* Mobile sheet adapter: shared schedule/dialog geometry, native Woo controls. */
.tst-variant-context {display:flex;align-items:center;gap:var(--tst-space-3);min-width:0}
.tst-variant-context>div {min-width:0;overflow-wrap:anywhere}
.tst-product-variant-sheet .tst-variant-image {width:calc(2 * var(--tst-touch-min));height:auto;aspect-ratio:var(--tst-media-product);object-fit:contain;border-radius:var(--tst-radius-media);flex:none}
.tst-product-variant-sheet .tst-dialog-head h2 {margin:0 0 var(--tst-space-2)}
.tst-variant-price {font-size:var(--tst-type-section);font-weight:600;line-height:var(--tst-leading-body)}
.tst-variant-body {padding:var(--tst-panel-padding)}
.tst-variant-status {font-size:var(--tst-type-label);color:var(--tst-muted);margin:0 0 var(--tst-space-3)}
.tst-variant-status:empty {display:none}
.tst-variant-quantity {display:flex;align-items:center;justify-content:space-between;gap:var(--tst-space-3);font-size:var(--tst-type-label);margin-top:var(--tst-space-4)}
.tst-variant-footer {padding:var(--tst-panel-padding);border-top:1px solid var(--tst-line)}
.woocommerce div.tst-product-detail .tst-product-variant-sheet .tst-product-actions>:is(.tstd-save,.tst-buy-now) {display:none}
.woocommerce div.tst-product-detail .tst-product-variant-sheet .tst-product-quantity input.qty {width:var(--tst-touch-min)}
@media(max-width:900px) {
  /* Closed rail opens the picker; Woo's disabled class still guards submission. */
  .woocommerce div.tst-product-detail form.tst-variant-sheet-enabled>[data-floating-cart]>.single_add_to_cart_button.disabled {opacity:1;cursor:pointer;pointer-events:auto}
  body.tst-variant-sheet-open .tstd-bottom {visibility:hidden}
  .woocommerce div.tst-product-detail .tst-product-variant-sheet :is(a,button,input,select) {scroll-margin-bottom:var(--tst-space-4)}
}
.woocommerce div.tst-product-detail form.cart .tst-product-variant-sheet .tst-variant-close.button {width:var(--tst-touch-min);height:var(--tst-touch-min);min-height:var(--tst-touch-min);padding:0;display:grid;place-items:center;align-self:start;--tst-button-bg:transparent;--tst-button-edge:transparent;--tst-button-hover-bg:var(--tst-secondary-hover)}
.tst-product-variant-sheet .tst-dialog-head>button>.tst-icon {width:var(--tst-icon-glyph-size);height:var(--tst-icon-glyph-size);max-width:none}
.tst-variant-quantity[hidden] {display:none}
@media(forced-colors:active) {
  .woocommerce div.tst-product-detail button.tst-variation-swatch[aria-pressed="true"] {outline:2px solid Highlight;outline-offset:2px}
}
/* Product content inside the shared action-sheet shell. */
.tst-product-variant-sheet .tst-variant-footer {display:flex;flex-direction:column;gap:var(--tst-space-3)}
.tst-product-variant-sheet .tst-variant-quantity {margin:0}
@media(max-width:900px) and (max-height:600px) {
  .tst-product-variant-sheet .tst-variant-footer {gap:var(--tst-space-2)}
  .tst-product-variant-sheet .tst-variant-image {width:var(--tst-touch-min)}
  .tst-product-variant-sheet .tst-dialog-head h2 {margin-bottom:var(--tst-space-1)}
}
.tst-product-variant-sheet .tst-variant-body:focus-visible {outline:2px solid var(--tst-focus);outline-offset:calc(-1 * var(--tst-space-1))}

/* Two native purchase intentions share the same selected variation and quantity. */
.woocommerce div.tst-product-detail form.cart .tst-product-actions[data-floating-cart]:has(.tst-buy-now)>.single_add_to_cart_button {--tst-button-bg:var(--tst-secondary-surface);--tst-button-hover-bg:var(--tst-secondary-hover);--tst-button-ink:var(--tst-ink);--tst-button-edge:var(--tst-line);--tst-button-icon:brightness(0)}
.woocommerce div.tst-product-detail .tst-product-variant-sheet .tst-dialog-head {gap:var(--tst-space-2)}
.tst-variant-meta {display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--tst-space-1) var(--tst-space-2)}
.tst-variant-stock:empty {display:none}
.woocommerce div.tst-product-detail .tst-variant-stock .stock {margin:0;padding:0;background:transparent;border-radius:0;color:var(--tst-muted);font-size:var(--tst-type-label);font-weight:400;line-height:var(--tst-leading-ui)}
.woocommerce div.tst-product-detail .tst-variant-stock .out-of-stock {color:var(--tst-warning)}
.woocommerce div.tst-product-detail form.tst-variant-sheet-enabled>.single_variation_wrap .tst-variant-quantity {margin:var(--tst-space-3) 0}

/* Shared purchase-sheet owner: native controls are moved, never duplicated. */
.tst-product-price-row {display:flex;align-items:center;justify-content:space-between;gap:var(--tst-space-4)}
.woocommerce div.tst-product-detail .tst-product-price-row>.price {margin:0;flex:1;min-width:0}
.woocommerce div.tst-product-detail .tst-product-price-row>.tstd-save {align-self:center}
.tst-purchase-selection {display:flex;align-items:center;justify-content:space-between;min-height:var(--tst-control-height);width:100%;padding:var(--tst-space-3) 0;border:0;border-block:1px solid var(--tst-line);background:transparent;color:var(--tst-ink);font-size:var(--tst-type-label);text-align:start}
.tst-purchase-selection[hidden],.tst-product-purchase-sheet .tst-variant-body[hidden] {display:none}
.tst-product-purchase-sheet .tst-variant-stock {margin-top:var(--tst-space-2)}
.tst-purchase-errors:empty {display:none}
.tst-purchase-errors .woocommerce-error {margin:0}
@media(max-width:900px) {
  .woocommerce div.tst-product-detail .tst-product-price-row {order:-1}
  .woocommerce div.tst-product-detail form.tst-purchase-sheet-enabled>table.variations {display:none}
  /* Woo .show() writes an inline display during init/reset. The closed native
     wrapper must stay parked; opening moves it into the dialog, out of this rule. */
  .woocommerce div.tst-product-detail form.tst-purchase-sheet-enabled>.single_variation_wrap {display:none!important}
  .woocommerce div.tst-product-detail form.tst-purchase-sheet-enabled>.tst-product-quantity {display:none}
}
