/* ==========================================================================
   MotoJoy — single-product.css
   The custom /parduotuve single product page: gallery, buy-box (variant
   swatches + qty + add-to-cart), fullscreen gallery, mobile sticky buy bar,
   info tabs/accordion, related products, and the add-to-cart toast.
   design-system-v0.1.html §06, tabs §07. New transitions are transform/opacity
   only and collapse under prefers-reduced-motion (section 9).

   Contents:
     1. Layout (gallery + info split)
     2. Gallery
     3. Product info + price + stock
     4. Variant swatches (§06)
     5. Quantity + add-to-cart
     6. Info tabs / accordion (§07)
     7. Additional-information list
     8. Related products + toast
     9. Reduced motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Layout
   -------------------------------------------------------------------------- */
.single-product-main {
  padding-block: var(--spacing-xl);
}

/* Whole product page sits on the reading width, not the wide shell. */
.single-product-main > .container {
  max-width: var(--wp--custom--width-content);
}

.ws-product {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
}

/* Anchors the media badge; sticky below takes over on desktop and anchors it too. */
.ws-gallery {
  position: relative;
}

@media (min-width: 992px) {
  .ws-product {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--spacing-xl);
    align-items: start;
  }

  /* Keep the gallery in view while scrolling the info column (desktop only). */
  .ws-gallery {
    position: sticky;
    /* Admin-bar term as in shop.css §sidebar: 0px for visitors. */
    top: calc(
      var(--wp-admin--admin-bar--height, 0px) +
      var(--header-height) +
      var(--spacing-md)
    );
  }
}

/* --------------------------------------------------------------------------
   2. Gallery
   -------------------------------------------------------------------------- */

.ws-gallery__stage {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  color: inherit;
  font: inherit;
  /* Flat plane. The red radial wash and the card->surface gradient under it
     were the "pink wash at the top, warm band at the bottom" — decoration, and
     §2 rejects gradient identity. */
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: zoom-in;
  appearance: none;
}

.ws-gallery__stage:hover,
.ws-gallery__stage:focus-visible {
  border-color: var(--color-control-border);
}

/* Same badge as the product cell — §8.7. A sibling of the stage, not inside
   it, so it stays out of the fullscreen button's name; clicks pass through. */
.ws-gallery__badge {
  position: absolute;
  z-index: 1;
  inset-block-start: 0;
  inset-inline-start: 0;
  padding: var(--wp--preset--spacing--1) var(--wp--preset--spacing--2);
  color: var(--wp--preset--color--text-on-dark);
  font-size: var(--wp--preset--font-size--label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--wp--custom--tracking-label);
  pointer-events: none;
}

.ws-gallery__badge--brand {
  background-color: var(--wp--preset--color--brand);
}

.ws-gallery__badge--ink {
  background-color: var(--wp--preset--color--ink);
}

.ws-gallery__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition:
    opacity 0.25s ease;
}

.ws-gallery__img.is-swapping {
  opacity: 0;
}

.ws-gallery__expand {
  position: absolute;
  right: var(--spacing-sm);
  bottom: var(--spacing-sm);
  width: 2.75rem;
  height: 2.75rem;
  background: rgba(17, 17, 17, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 0;
}

.ws-gallery__expand::before,
.ws-gallery__expand::after {
  content: "";
  position: absolute;
  width: 0.65rem;
  height: 0.65rem;
  /* The border shorthands below take currentColor, so set the colour here;
     a border-color would be reset by them. */
  color: var(--wp--preset--color--text-on-dark);
}

.ws-gallery__expand::before {
  top: 0.65rem;
  right: 0.65rem;
  border-top: 2px solid;
  border-right: 2px solid;
}

.ws-gallery__expand::after {
  bottom: 0.65rem;
  left: 0.65rem;
  border-bottom: 2px solid;
  border-left: 2px solid;
}

.ws-gallery__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.ws-gallery__thumb {
  width: 4rem;
  height: 4rem;
  padding: 0;
  overflow: hidden;
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.ws-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-gallery__thumb:hover,
.ws-gallery__thumb:focus-visible {
  border-color: rgba(255, 255, 255, 0.3);
}

.ws-gallery__thumb.is-active {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-edge);
}

.ws-gallery-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  color: var(--color-text);
  background: rgba(10, 10, 10, 0.98);
  border: 0;
  opacity: 0;
  transform: scale(0.98);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    display 0.22s allow-discrete;
}

.ws-gallery-dialog[open] {
  display: block;
  opacity: 1;
  transform: scale(1);
}

.ws-gallery-dialog.is-closing {
  opacity: 0;
  transform: scale(0.98);
}

.ws-gallery-dialog::backdrop {
  background: rgba(0, 0, 0, 0.9);
}

@starting-style {
  .ws-gallery-dialog[open] {
    opacity: 0;
    transform: scale(0.98);
  }
}

.ws-gallery-dialog__surface,
.ws-gallery-dialog__media {
  width: 100%;
  height: 100%;
}

.ws-gallery-dialog__surface {
  position: relative;
}

.ws-gallery-dialog__media {
  display: grid;
  place-items: center;
  padding: clamp(4rem, 8vw, 6rem);
  touch-action: pan-y;
}

.ws-gallery-dialog__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ws-gallery-dialog__close,
.ws-gallery-dialog__nav {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  color: var(--wp--preset--color--text-on-dark);
  font: inherit;
  font-size: 2rem;
  line-height: 1;
  background: rgba(26, 26, 26, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 0;
  cursor: pointer;
}

.ws-gallery-dialog__close {
  top: max(var(--spacing-md), env(safe-area-inset-top));
  right: var(--spacing-md);
}

.ws-gallery-dialog__nav {
  top: 50%;
  transform: translateY(-50%);
}

.ws-gallery-dialog__nav--prev {
  left: var(--spacing-md);
}

.ws-gallery-dialog__nav--next {
  right: var(--spacing-md);
}

.ws-gallery-dialog__count {
  position: absolute;
  bottom: max(var(--spacing-md), env(safe-area-inset-bottom));
  left: 50%;
  margin: 0;
  padding: 0.4rem 0.75rem;
  color: var(--wp--preset--color--text-on-dark);
  background: rgba(26, 26, 26, 0.88);
  border-radius: var(--radius-pill, 999px);
  transform: translateX(-50%);
}

/* --------------------------------------------------------------------------
   3. Product info + price + stock
   -------------------------------------------------------------------------- */
.ws-product__cat {
  margin: 0 0 var(--spacing-xs);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.ws-product__cat a {
  color: inherit;
}

.ws-product__title {
  margin: 0 0 var(--spacing-sm);
  font-size: clamp(1.6rem, 4vw, 2.25rem);
}

/* Price hierarchy mirrors the product card: bold amount + muted "su PVM". */
.ws-product__price {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  margin-bottom: var(--spacing-sm);
}

.ws-product__price-amount {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
}

.ws-product__price-amount del {
  margin-right: var(--spacing-xs);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.ws-product__price-amount ins {
  text-decoration: none;
}

.ws-product__price-sub {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.ws-product__stock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-sm);
  margin: 0 0 var(--spacing-md);
  font-size: 0.9375rem;
  color: var(--color-text);
}

.ws-product__stock-text {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--color-green);
  font-weight: 600;
}

.ws-product__stock-text::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  flex: 0 0 0.5rem;
  background-color: currentColor;
  border-radius: 0;
}

.ws-product__stock.is-out .ws-product__stock-text {
  color: var(--color-text-muted);
}

/* §3.4 marks out of stock with a hollow ○, not with no mark at all: §10 rules
   out a status carried by colour alone, and the ring is what distinguishes it
   from the filled ● at a glance. Inset shadow rather than a border so the mark
   keeps its 0.5rem box. */
.ws-product__stock.is-out .ws-product__stock-text::before {
  background-color: transparent;
  box-shadow: inset 0 0 0 1px currentColor;
}

/* Backorder: filled ● in warning yellow, "Užsakoma". */
.ws-product__stock.is-backorder .ws-product__stock-text {
  color: var(--color-warning);
}

.ws-product__stock.is-backorder .ws-product__stock-text::before {
  background-color: currentColor;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Low-stock badge.

   Moved here from woocommerce.css when the product card was retired. The card
   was its other consumer; this page is now the only one, so the rule lives
   with the template that renders it rather than in a shared file nothing else
   reads. Carried over unchanged — the pill radius and literal sizes below are
   pre-existing and predate the zero-radius rule in design-system.md §6 and the
   label role in §8.7; correcting them changes how this page looks, which is a
   separate decision from retiring the card.
   -------------------------------------------------------------------------- */
.mj-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.4em 0.62em;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: 0;
}

/* Low stock is a warning, not an error — §3.4 reserves red for "you cannot
   proceed". Paired with the triangle marker so the state is never colour-only. */
.mj-badge--stock {
  align-self: flex-start;
  color: var(--color-warning);
  background-color: var(--color-warning-tint);
  border: 1px solid var(--color-warning);
  border-radius: 0;
}

.mj-badge--stock::before {
  content: "▲";
  font-size: 0.85em;
  line-height: 1;
}

/* The .mj-badge display rule above otherwise overrides the native hidden UA rule. */
.ws-product__stock [data-ws-low-stock][hidden] {
  display: none;
}

/* Primary selling copy, not metadata — it sits directly under the price, so it
   reads as ink rather than muted. --color-text-muted is for meta, labels and
   secondary copy (§3.1). */
.ws-product__excerpt {
  margin-bottom: var(--spacing-lg);
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   4. Variant swatches (design-system §06)
   -------------------------------------------------------------------------- */
.ws-swatches {
  margin-bottom: var(--spacing-md);
}

.ws-swatches__label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.ws-swatches__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.ws-swatch {
  min-width: 2.75rem;
  min-height: 2.75rem; /* 44px touch target */
  padding: 0.625rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  background-color: var(--color-bg-card);
  border: 1.5px solid var(--color-control-border);
  border-radius: 0;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease;
}

/* Hover fills, it does not lift — §5.3. */
.ws-swatch:hover {
  background-color: var(--color-bg-surface);
}

/* Selected: the ink edge from §6.5, which names this element explicitly.
   The 1.5px control border stays as it is — adding border-color: ink on top of
   the 2px ring would read as one solid 3.5px slab. The ring carries the state.
   Paired with weight so the state is never colour-only (§3.4).
   Label 18.5:1, ring 18.5:1 against the card. */
.ws-swatch.is-selected,
.ws-swatch[aria-checked="true"] {
  color: var(--color-text);
  font-weight: 700;
  background-color: var(--color-bg-card);
  box-shadow: var(--shadow-edge);
}

/* No outline:none, no glow — the global :focus-visible ring applies. §9. */

/* Out of stock: dashed, dimmed, visible but not selectable. */
.ws-swatch.is-oos {
  color: var(--color-text-muted);
  border-style: dashed;
  opacity: 0.5;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   5. Quantity + add-to-cart
   -------------------------------------------------------------------------- */
.ws-buy__error {
  margin: 0 0 var(--spacing-sm);
  color: var(--color-accent-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.ws-buy__error[hidden] {
  display: none;
}

.ws-buy__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  align-items: stretch;
  margin-top: var(--spacing-md);
}

.ws-qty {
  display: inline-flex;
  align-items: center;
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ws-qty__btn {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ws-qty__btn:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.ws-qty__input {
  width: 3rem;
  height: 2.75rem;
  text-align: center;
  color: var(--color-text);
  background: none;
  border: none;
  border-inline: 1px solid var(--color-control-border);
  font-family: inherit;
  font-size: 1rem;
  appearance: textfield;
  -moz-appearance: textfield;
}

.ws-qty__input::-webkit-outer-spin-button,
.ws-qty__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ws-qty__input:focus-visible {
  outline: none;
}

.ws-add {
  flex: 1 1 12rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

/* Compact reassurance below the purchasing controls. */
.ws-product__info .ws-trust-badges {
  display: grid;
  align-items: center;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-sm) var(--spacing-md);
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

.ws-trust-badges__item {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: var(--spacing-sm);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--color-text-muted);
}

.ws-trust-badges__item svg {
  flex: 0 0 1rem;
  width: 1rem;
  height: 1rem;
  margin-top: 0.08em;
  color: var(--color-text);
}

.ws-trust-badges__item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 420px) {
  .ws-product__info .ws-trust-badges {
    grid-template-columns: 1fr;
  }
}

.ws-add__spinner {
  display: none;
  width: 1.1em;
  height: 1.1em;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--wp--preset--color--text-on-dark);
  border-radius: 50%;
  animation: ws-spin 0.7s linear infinite;
}

.ws-add.is-loading .ws-add__spinner {
  display: inline-block;
}

.ws-add.is-loading .ws-add__text {
  opacity: 0.85;
}

@keyframes ws-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   6. Info tabs / accordion (design-system §07)
   -------------------------------------------------------------------------- */
.ws-tabs {
  margin-top: var(--spacing-xl);
}

/* Accordion headers: mobile only. */
.ws-acc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--spacing-md) 0;
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
}

.ws-acc__icon {
  position: relative;
  width: 0.7em;
  height: 0.7em;
  flex-shrink: 0;
}

.ws-acc__icon::before,
.ws-acc__icon::after {
  content: "";
  position: absolute;
  background-color: currentColor;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.ws-acc__icon::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

.ws-acc__icon::after {
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
}

.ws-acc.is-open .ws-acc__icon::after {
  transform: translateX(-50%) scaleY(0);
  opacity: 0;
}

/* Tablist: desktop only (hidden on mobile, accordion takes over). */
.ws-tabs__list {
  display: none;
}

.ws-tab {
  position: relative;
  padding: 0.75rem 0.25rem;
  margin-right: 1.4rem;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}

.ws-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background-color: var(--color-accent);
  border-radius: 0;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ws-tab:hover {
  color: var(--color-text);
}

.ws-tab.is-active {
  color: var(--color-text);
}

.ws-tab.is-active::after {
  transform: scaleX(1);
}

.ws-tabs__panel {
  padding-block: var(--spacing-lg);
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* Description prose in the reading column, left-aligned with the product
   layout. Full ink: muted grey is for short secondary text, not long reading.
   Only text is capped: supplier descriptions carry fitment tables up to eight
   columns wide, which keep the full panel. Descendant, not child: some
   supplier descriptions wrap their text in bare <div>s. */
.ws-tabs__panel > .entry-content {
  color: var(--wp--preset--color--ink);
  font-size: var(--wp--custom--text-reading);
}

.ws-tabs__panel > .entry-content :is(p, ul, ol, h2, h3, h4, h5, h6, blockquote) {
  max-width: var(--wp--custom--width-reading);
}

.ws-tabs__panel[hidden] {
  display: none;
}

/* Reveal fade (opacity + slight translate, no height animation). */
.ws-tabs__panel.is-active {
  animation: ws-panel-in 0.25s ease;
}

@keyframes ws-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 768px) {
  .ws-acc {
    display: none;
  }

  .ws-tabs__list {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--color-border);
  }
}

/* --------------------------------------------------------------------------
   7. Specifications

   Its own section above the tabs rather than a panel inside them: context.md
   §4 names unclear specifications as one of three purchase blockers, and
   design-system.md §8.6 asks for a hairline table at the small text size.
   Rows use the same rule structure as .mj-product-cell__specs so a
   specification reads identically on the cell and on the page.

   Was the "additional information" list, whose provider had not existed since
   the previous client's meta box was removed.
   -------------------------------------------------------------------------- */
.ws-specs {
  margin-top: var(--spacing-xl);
}

.ws-specs__title {
  margin: 0 0 var(--spacing-md);
  font-size: var(--wp--preset--font-size--heading-3);
}

.ws-specs__list {
  margin: 0;
  font-size: var(--wp--preset--font-size--sm);
  border-block-start: 1px solid var(--color-border);
}

.ws-specs__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
  padding-block: var(--spacing-sm);
  border-block-end: 1px solid var(--color-border);
}

.ws-specs__row dt {
  font-weight: 600;
  color: var(--color-text-muted);
}

.ws-specs__row dd {
  margin: 0;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 600px) {
  .ws-specs__row {
    grid-template-columns: 18rem 1fr;
    gap: var(--spacing-lg);
  }
}

/* --------------------------------------------------------------------------
   7b. Key specifications, repeated in the buy box

   The few facts the purchase turns on, sitting with the price instead of only
   in the table below. Same source — motojoy_get_product_key_specs().
   -------------------------------------------------------------------------- */
.ws-product__key-specs {
  margin: 0;
  font-size: var(--wp--preset--font-size--sm);
  border-block-start: 1px solid var(--color-border);
}

.ws-product__key-spec {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-sm);
  padding-block: var(--spacing-xs);
  border-block-end: 1px solid var(--color-border);
}

.ws-product__key-spec dt {
  color: var(--color-text-muted);
}

.ws-product__key-spec dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   7c. Out-of-stock order request

   §8.6: the price stays, the action becomes "Užsakyti prekę", and the styling
   is neutral because §3.4 reserves red for "you cannot proceed" — this product
   can be ordered. The destination is the confirmed phone number until the form
   plugin is chosen (open-questions.md OQ #20).
   -------------------------------------------------------------------------- */
.ws-order-request {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.ws-order-request__action {
  align-self: flex-start;
}

.ws-order-request__note {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--wp--preset--font-size--sm);
}

/* --------------------------------------------------------------------------
   8. Related products
   Shared add-to-cart toast styles live in main.css.
   -------------------------------------------------------------------------- */
.ws-related {
  margin-top: var(--spacing-xl);
}

.ws-related__title {
  margin-bottom: var(--spacing-lg);
  font-size: clamp(1.4rem, 4vw, 2rem);
}

.ws-related__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* Two columns on a phone can't spare the full gap. */
  gap: var(--wp--preset--spacing--3);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 600px) {
  .ws-related__grid {
    gap: var(--spacing-md);
  }
}

.ws-related__item {
  display: flex;
}

.ws-related__item > .mj-product-cell {
  width: 100%;
}

@media (min-width: 768px) {
  .ws-related__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.ws-sticky-buy {
  display: none;
}

.ws-sticky-buy__sentinel {
  display: block;
  width: 100%;
  height: 1px;
  margin-top: -1px;
  pointer-events: none;
}

@media (max-width: 767px) {
  .ws-sticky-buy {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 300;
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding-top: var(--spacing-sm);
    padding-right: calc(clamp(var(--spacing-sm), 4vw, var(--spacing-md)) + env(safe-area-inset-right));
    padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom));
    padding-left: calc(clamp(var(--spacing-sm), 4vw, var(--spacing-md)) + env(safe-area-inset-left));
    background: rgba(17, 17, 17, 0.97);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(100%);
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.2s ease,
      transform 0.2s ease,
      visibility 0s linear 0.2s;
  }

  .ws-sticky-buy.is-visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .ws-sticky-buy__inner {
    display: grid;
    grid-template-columns:
      clamp(2.5rem, 12vw, 3rem)
      minmax(0, 1fr)
      clamp(7rem, 38%, 8.75rem);
    align-items: center;
    gap: var(--spacing-sm);
    box-sizing: border-box;
    width: 100%;
    max-width: min(36rem, 100%);
    margin-inline: auto;
  }

  .ws-sticky-buy__inner > * {
    min-width: 0;
  }

  .ws-sticky-buy__thumb {
    width: 100%;
    max-width: 3rem;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
  }

  .ws-sticky-buy__price {
    min-width: 0;
    overflow: hidden;
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .ws-sticky-buy__button {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 3rem;
    padding-inline: clamp(0.625rem, 3vw, var(--spacing-md));
    white-space: nowrap;
  }

  .ws-sticky-buy__button.is-loading [data-ws-sticky-label] {
    opacity: 0;
  }

  .ws-sticky-buy__button.is-loading .ws-add__spinner {
    display: block;
    position: absolute;
    inset: 0;
    margin: auto;
  }

  body.has-ws-sticky-buy .single-product-main {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }

}

/* --------------------------------------------------------------------------
   9. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ws-gallery__img,
  .ws-gallery__thumb,
  .ws-gallery-dialog,
  .ws-sticky-buy,
  .ws-swatch,
  .ws-qty__btn,
  .ws-tab,
  .ws-tab::after,
  .ws-acc__icon::before,
  .ws-acc__icon::after,
  .ws-gallery-dialog,
  .ws-gallery-dialog.is-closing {
    opacity: 1;
    transform: none;
  }

  .ws-tabs__panel.is-active,
  .ws-add__spinner {
    animation: none;
  }
}
