.share-status {
  display: none;
}

html, body, button, input, textarea, select {
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
}

body { font-weight: 400; }
h1 { font-weight: 800; }
p { line-height: 1.9; }

.mainphoto {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  padding: 12px 54px;
}

.mainphoto img {
  grid-area: 1 / 1;
  display: block;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.thumb {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}

.product-actions .gallery-share {
  display: inline-grid;
  width: 44px;
  place-items: center;
  color: #17435c;
}

.gallery-share:hover {
  border-color: #315f79;
  background: #edf4f7;
}

.share-status:not(:empty) {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: #17435c;
  overflow-wrap: anywhere;
}

.product-price-label {
  font-weight: 600;
}

#configuredDiscount,
.purchase-notice,
#message:empty {
  display: none;
}

#total {
  color: #17435c !important;
}

.layout.panel {
  gap: 0;
  padding: 0;
  --product-panel-padding: clamp(14px, 2vw, 26px);
}

#productGalleryPanel,
#productDetails {
  min-width: 0;
  padding: var(--product-panel-padding);
}

#productGalleryPanel {
  display: flex;
  flex-direction: column;
}

.product-gallery-footer {
  margin-block-start: auto;
}

#productDetails {
  position: relative;
  display: flex;
  flex-direction: column;
}

#productDetails > #stock {
  align-self: flex-start;
}

#page:not(.product-load-error) #productDetails::before {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 1px;
  background: linear-gradient(transparent, #dce5ed 16%, #dce5ed 84%, transparent);
  content: "";
}

.product-purchase-section {
  margin-block-start: auto;
}

.product-purchase .cta {
  display: flex;
  gap: 0;
  align-items: stretch;
  min-height: 52px;
  margin-top: 14px;
}

.product-purchase #add {
  display: grid;
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  padding: 6px;
  overflow: hidden;
  place-items: center;
  background: linear-gradient(115deg, #315f79, #17435c);
  color: #fff;
  text-align: center;
}

.product-purchase #add > span {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: opacity 180ms ease;
}

.purchase-checkout-label,
.has-product-in-cart .purchase-add-label {
  opacity: 0;
}

.has-product-in-cart .purchase-checkout-label {
  opacity: 1;
}

.product-purchase-icon {
  flex: none;
}

.purchase-controls {
  position: relative;
  flex: 0 0 116px;
  min-width: 0;
  --cart-controls-width: clamp(148px, 53%, 210px);
  transition: flex-basis 280ms cubic-bezier(.22, .72, .25, 1);
}

.has-product-in-cart .purchase-controls {
  flex-basis: var(--cart-controls-width);
}

.purchase-quantity,
.product-cart-controls {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding-inline-start: 8px;
  opacity: 1;
  transition: opacity 150ms ease 90ms, visibility 0s;
}

.purchase-controls [inert] {
  visibility: hidden;
  opacity: 0;
  transition: opacity 90ms ease, visibility 0s 90ms;
}

.purchase-quantity label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.qty,
.product-cart-quantity {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid #d7e1e9;
  border-radius: 10px;
  background: #fff;
}

.qty strong,
.product-cart-quantity output {
  min-width: 28px;
  color: #203449;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.qty button,
.product-cart-quantity button,
.product-cart-remove {
  display: inline-grid;
  flex: none;
  width: 36px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: #fff;
  color: #203449;
  font-size: 17px;
}

.product-cart-quantity button:disabled {
  opacity: .4;
  cursor: default;
}

.product-cart-remove {
  width: 34px;
  background: #fff;
  color: #86555b;
}

.product-cart-remove:hover {
  background: #fcf0f1;
  color: #983545;
}

.product-purchase button:focus-visible {
  outline: 2px solid #315f79;
  outline-offset: -2px;
}

@media (min-width: 801px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  }
}

@media (max-width: 900px) {
  /* Keep the RTL viewport fixed while the gallery and cart controls update. */
  .store-product-page,
  .store-product-page body {
    overflow-x: clip;
  }
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #page:not(.product-load-error) #productDetails::before {
    inset: 0 0 auto;
    width: auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, #dce5ed 16%, #dce5ed 84%, transparent);
  }

  .mainphoto {
    height: clamp(220px, 65vw, 350px);
    padding: 8px 34px;
  }

  .thumbs {
    overflow-x: auto;
  }

  .thumb {
    flex: 0 0 54px;
    height: 50px;
  }

  .product-actions {
    gap: 5px;
  }

  .product-actions button {
    min-height: 44px;
    padding-inline: 6px;
  }

  .product-actions .gallery-share {
    flex: 0 0 44px;
  }

  #keySpecs {
    order: 1;
  }

  .product-configurator .configurator-choice {
    min-height: 44px;
  }
}

@media (max-width: 900px) {
  .store-product-page {
    --mobile-product-bottom-space: calc(
      var(--mobile-store-nav-height, 0px) + var(--mobile-product-purchase-height, 88px)
    );
    scroll-padding-bottom: var(--mobile-product-bottom-space);
  }

  .store-product-page body:has(.product-purchase-section) {
    padding-bottom: var(--mobile-product-bottom-space);
  }

  .store-product-page:has(.mobile-store-nav) {
    --mobile-store-nav-height: calc(64px + env(safe-area-inset-bottom, 0px));
    --mobile-product-purchase-safe-bottom: 0px;
  }

  #page[aria-busy="true"]:not(.product-load-error) #productDetails > .product-purchase-section {
    display: block;
  }

  .product-purchase-section {
    position: fixed;
    z-index: 6;
    inset: auto 0 var(--mobile-store-nav-height, 0px);
    box-sizing: border-box;
    margin: 0;
    padding: 10px max(12px, env(safe-area-inset-right))
      calc(10px + var(--mobile-product-purchase-safe-bottom, env(safe-area-inset-bottom)))
      max(12px, env(safe-area-inset-left));
    border-top: 1px solid #e2e8ef;
    background: #fff;
    box-shadow: 0 -4px 18px rgba(25, 49, 75, .08);
  }

  .product-purchase-section > .line {
    display: none;
  }

  .product-purchase {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(140px, 1fr);
    gap: 8px 12px;
    align-items: center;
  }

  .product-purchase .cta {
    margin-top: 0;
  }

  .product-purchase.has-product-in-cart .cta,
  .product-purchase #message {
    grid-column: 1 / -1;
  }

  .product-purchase #message {
    min-height: 0;
    margin-top: 0;
  }

  .product-purchase-price #total {
    font-size: clamp(16px, 4.7vw, 24px);
  }

  .product-purchase-price #total:empty::before {
    content: "در حال دریافت قیمت…";
    font-size: 13px;
  }

  .product-purchase-price #total:empty + .unit {
    visibility: hidden;
  }

  .product-purchase #add:disabled {
    opacity: .65;
  }

  .purchase-controls {
    flex-basis: 0;
    --cart-controls-width: clamp(154px, 53%, 210px);
    overflow: clip;
  }

  .purchase-quantity {
    display: none;
  }
}

@media (max-width: 360px) {
  main.wrap {
    padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .purchase-controls,
  .purchase-controls > *,
  .product-purchase #add > span {
    transition: none;
  }
}

.product-specs {
  margin: 0;
}

.product-specs .specrow {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: clamp(12px, 3vw, 32px);
  padding-block: 12px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.product-specs .specrow:last-child {
  border-bottom: 0;
}

.product-specs dt {
  color: #52677a;
}

.product-specs dd {
  margin: 0;
}

#page:has(.related-products:not([hidden])) .sections {
  margin-block-end: 26px;
}

.related-products {
  margin-block-end: 38px;
}

.related-products h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.related-product-cards {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-block-end: 8px;
  scroll-snap-type: inline proximity;
}

.related-product-card {
  flex: 0 0 clamp(148px, 24vw, 215px);
  min-width: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid #e3e9f0;
  border-radius: 13px;
  scroll-snap-align: start;
}

.related-product-card:focus-visible {
  outline: 2px solid #17435c;
  outline-offset: -3px;
}

.related-product-card .catalog-card-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 8px;
  background: #f4f7fa;
}

.related-product-card h3 {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.related-product-card .product-price--discounted {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "original original"
    "current discount";
  column-gap: 6px;
  align-items: end;
}

.related-product-card .product-price-original {
  grid-area: original;
}

.related-product-card .product-price--discounted .product-price-current {
  grid-area: current;
}

.related-product-card .product-price-discount {
  grid-area: discount;
  justify-self: end;
  font-size: 12px;
  white-space: nowrap;
}
