/* Scoped, mobile-first product page. Product data and purchase rules remain server-owned. */
.product-detail { --pd-surface:#fff; --pd-subtle:#f8fafc; --pd-border:#e5e7eb; --pd-text:#1f2937; --pd-muted:#6b7280; --pd-accent:#ea580c; color:var(--pd-text); }
.dark .product-detail { --pd-surface:#242424; --pd-subtle:#191919; --pd-border:#404040; --pd-text:#f9fafb; --pd-muted:#b6b6b6; --pd-accent:#fb6a22; }
.product-detail, .product-detail * { box-sizing:border-box; }
.product-detail :is(a,button,input,select,textarea,summary):focus-visible { outline:2px solid var(--pd-accent); outline-offset:2px; }
.product-detail-container { min-width:0; padding-block:1rem 2rem; }
.product-detail-breadcrumb { display:none; flex-wrap:wrap; align-items:center; gap:.35rem; min-width:0; margin-bottom:.9rem; color:var(--pd-muted); font-size:.78rem; line-height:1.8; }
.product-detail-crumb { display:flex; align-items:center; gap:.35rem; min-inline-size:0; max-inline-size:100%; }
.product-detail-crumb > :is(a, [aria-current]) { min-inline-size:0; overflow-wrap:anywhere; }
.product-detail-crumb > svg { flex:none; inline-size:.75rem; block-size:.75rem; }
.product-detail-crumb:dir(rtl) > svg { transform:scaleX(-1); }
.product-detail-breadcrumb a:hover { color:var(--pd-accent); }
.product-detail-errors { margin-bottom:1rem; padding:.8rem 1rem; border:1px solid #fecaca; border-radius:.75rem; background:#fef2f2; color:#991b1b; }
.product-detail-main, .product-detail-meta { min-width:0; border:1px solid var(--pd-border); border-radius:1rem; background:var(--pd-surface); }
.product-detail-main { padding:.75rem; }
.product-detail-top { display:grid; grid-template-areas:'gallery' 'details' 'offer'; gap:1rem; min-width:0; }
.product-detail-gallery, .product-detail-details, .product-detail-offer { min-width:0; }
.product-detail-gallery { grid-area:gallery; }
.product-detail-details { grid-area:details; }
.product-detail-offer { grid-area:offer; }
.product-detail-gallery-main, .product-detail-gallery-empty { display:flex; align-items:center; justify-content:center; width:100%; aspect-ratio:1; overflow:hidden; border:1px solid var(--pd-border); border-radius:.8rem; background:#fff; }
/* The global Swiper wrapper rule is in the components layer and uses !important. */
@layer components {
  .product-detail .product-detail-gallery-main .swiper-wrapper,
  .product-detail .product-detail-thumbs .swiper-wrapper,
  .product-detail .product-image-viewer-stage .swiper-wrapper { height:100% !important; padding-bottom:0 !important; }
}
.product-detail-gallery-main .swiper-slide { display:flex; align-items:center; justify-content:center; height:100%; min-width:0; padding:1rem 2.25rem; }
.product-detail-gallery-main img { display:block; width:100%; height:100%; max-width:100%; max-height:100%; object-fit:contain; }
.product-detail-static { padding:1rem; }
.product-detail-static img { width:100%; height:100%; object-fit:contain; }
.product-detail-gallery-empty { color:var(--pd-muted); }
.product-detail-gallery-main :is(.swiper-button-prev,.swiper-button-next) { display:grid; place-items:center; width:36px; height:36px; margin-top:-18px; border:1px solid var(--pd-border); border-radius:50%; background:var(--pd-surface); color:var(--pd-accent); }
.product-detail-gallery-main :is(.swiper-button-prev,.swiper-button-next)::after { font-size:.95rem; font-weight:800; }
.product-detail-thumbs { width:100%; height:70px; margin-top:.65rem; overflow:hidden; }
.product-detail-thumbs .swiper-wrapper { align-items:stretch; }
.product-detail-thumbs .swiper-slide { display:flex; align-items:center; justify-content:center; height:100%; min-width:0; border:1px solid var(--pd-border); border-radius:.55rem; background:#fff; }
.product-detail-thumbs .swiper-slide-thumb-active { border:2px solid var(--pd-accent); }
.product-detail-thumb { display:grid; place-items:center; width:100%; height:100%; padding:.3rem; border:0; background:transparent; cursor:pointer; }
.product-detail-thumb img { display:block; width:100%; height:100%; object-fit:contain; }
.product-detail-taxonomy { display:flex; flex-wrap:wrap; gap:.3rem .6rem; color:var(--pd-muted); font-size:.78rem; }
.product-detail-taxonomy a:hover { color:var(--pd-accent); }
.product-detail-title { margin:.45rem 0 .35rem; color:var(--pd-text); font-size:clamp(1.14rem, 2.2vw, 1.5rem); font-weight:800; line-height:1.55; overflow-wrap:break-word; }
.product-detail-model { margin:0; color:var(--pd-muted); font-size:.8rem; line-height:1.8; overflow-wrap:anywhere; }
.product-detail-model bdi { color:var(--pd-text); }
.product-detail-stock { display:flex; align-items:center; gap:.4rem; margin:.8rem 0; color:var(--pd-muted); font-size:.85rem; }
.product-detail-stock span { width:.5rem; height:.5rem; flex:none; border-radius:50%; background:currentColor; }
.product-detail-stock.is-available { color:#15803d; }
.product-detail-stock.is-unavailable { color:#b45309; }
.dark .product-detail-stock.is-available { color:#4ade80; }
.dark .product-detail-stock.is-unavailable, .dark .product-detail-unavailable { color:#fbbf24; }
.product-detail-features { padding-top:.8rem; border-top:1px solid var(--pd-border); }
.product-detail-features h2 { margin:0 0 .65rem; font-size:.95rem; font-weight:800; }
.product-detail-features ul { display:grid; gap:.45rem; margin:0; padding:0; list-style:none; }
.product-detail-features li { display:flex; gap:.5rem; align-items:start; color:var(--pd-text); font-size:.83rem; line-height:1.7; }
.product-detail-features li > span:first-child { color:#16a34a; font-weight:800; }
.product-detail-offer { padding-top:1rem; border-top:1px solid var(--pd-border); }
.product-detail-price-block { display:flex; flex-direction:column; align-items:flex-start; gap:.2rem; min-width:0; }
.product-detail-price-block > span { color:var(--pd-muted); font-size:.77rem; }
.product-detail-old-price { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; color:var(--pd-muted); font-size:.82rem; }
.product-detail-discount { padding:.1rem .4rem; border-radius:.35rem; background:var(--pd-accent); color:#fff; }
.product-detail-price { color:var(--pd-text); font-size:1.45rem; font-weight:900; line-height:1.5; white-space:nowrap; }
.product-detail-price small { font-size:.78rem; font-weight:600; }
.product-detail-cart-form { display:grid; grid-template-columns:auto 1fr; align-items:center; gap:.6rem; margin-top:.65rem; }
.product-detail-cart-form label { color:var(--pd-muted); font-size:.82rem; }
.product-detail-quantity { display:flex; align-items:center; justify-self:end; width:128px; max-width:100%; height:42px; overflow:hidden; border:1px solid var(--pd-border); border-radius:.55rem; }
.product-detail-quantity button { width:40px; height:100%; flex:none; color:var(--pd-text); font-size:1.2rem; }
.product-detail-quantity input { width:100%; min-width:0; height:100%; border:0; background:transparent; color:var(--pd-text); text-align:center; direction:ltr; appearance:textfield; }
.product-detail-quantity input::-webkit-inner-spin-button, .product-detail-quantity input::-webkit-outer-spin-button { appearance:none; margin:0; }
.product-detail-add { display:grid; grid-column:1 / -1; place-items:center; width:100%; min-height:46px; padding:.65rem 1rem; border:0; border-radius:.55rem; color:#fff; font-size:.9rem; font-weight:800; text-align:center; text-decoration:none; }
.product-detail-add:hover { color:#fff; }
.product-detail-unavailable { margin:.75rem 0 0; color:#b45309; font-size:.85rem; font-weight:700; }
.product-detail-meta { margin-top:.85rem; overflow:hidden; }
.product-detail-tabs { display:none; }
.product-detail-section + .product-detail-section { border-top:1px solid var(--pd-border); }
.product-detail-section > summary { display:flex; align-items:center; justify-content:space-between; gap:1rem; min-height:48px; padding:.7rem 1rem; color:var(--pd-text); font-size:.9rem; font-weight:800; cursor:pointer; list-style:none; }
.product-detail-section > summary::-webkit-details-marker { display:none; }
.product-detail-section > summary::marker { content:''; }
.product-detail-section > summary::after { content:'⌄'; color:var(--pd-muted); font-size:1rem; transition:transform .2s; }
.product-detail-section[open] > summary::after { transform:rotate(180deg); }
.product-detail-section-content { min-width:0; padding:0 1rem 1rem; color:var(--pd-text); }
.product-detail-section-content h2 { margin:0 0 .65rem; font-size:1rem; font-weight:800; }
.product-detail-description { margin:0; color:var(--pd-text); font-size:.86rem; line-height:2; white-space:pre-line; overflow-wrap:anywhere; }
.product-detail-specs { display:grid; margin:0; }
.product-detail-specs div { display:grid; grid-template-columns:minmax(90px,30%) minmax(0,1fr); gap:.75rem; padding:.65rem 0; border-bottom:1px solid var(--pd-border); font-size:.82rem; line-height:1.8; }
.product-detail-specs div:last-child { border-bottom:0; }
.product-detail-specs dt { font-weight:800; }
.product-detail-specs dd { min-width:0; margin:0; overflow-wrap:anywhere; }
.product-detail-review-stats { margin:0 0 1rem; color:var(--pd-muted); font-size:.83rem; }
.product-detail-contributions { display:grid; gap:.75rem; }
.product-detail-contributions article { padding:.85rem; border:1px solid var(--pd-border); border-radius:.65rem; background:var(--pd-subtle); }
.product-detail-contributions article p { margin:0; line-height:1.85; overflow-wrap:anywhere; }
.product-detail-contributions article p + p { margin-top:.4rem; }
.product-detail-contributions article [aria-label^='امتیاز'] { color:#d97706; }
.product-detail-contribution-form { display:grid; gap:.75rem; margin-top:1.25rem; }
.product-detail-contribution-form label { display:grid; gap:.35rem; font-size:.85rem; font-weight:700; }
.product-detail-contribution-form :is(select,textarea) { width:100%; min-width:0; padding:.65rem; border:1px solid var(--pd-border); border-radius:.55rem; background:var(--pd-surface); color:var(--pd-text); font-weight:400; }
.product-detail-contribution-form button { justify-self:start; min-height:44px; padding:.6rem 1rem; border-radius:.55rem; background:var(--pd-accent); color:#fff; font-weight:800; }
.product-detail-login-link { display:inline-block; margin-top:1rem; color:var(--pd-accent); }
.product-detail-related { margin-top:1.5rem; }
.product-detail-related h2 { margin-bottom:1rem; color:var(--pd-text); font-size:1.2rem; font-weight:800; }
.product-detail-related-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:1rem; }
.product-detail-related-grid > div { min-width:0; }
/* Keep the shared mobile navigation available after this page without covering its controls. */
body:has(.product-detail) nav.fixed.bottom-0 { position:static; }
@media (min-width:640px) { .product-detail-container { padding-block:1.25rem 2.5rem; } .product-detail-main { padding:1.25rem; } .product-detail-related-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (min-width:768px) {
  .product-detail-breadcrumb { display:flex; }
  .product-detail-top { grid-template-columns:minmax(0,1fr) minmax(0,1fr); grid-template-rows:auto auto; grid-template-areas:'gallery details' 'gallery offer'; gap:1rem 1.25rem; align-content:start; align-items:start; }
  .product-detail-gallery { align-self:center; }
  .product-detail-offer { padding:1.25rem; border:1px solid var(--pd-border); border-radius:.75rem; background:var(--pd-subtle); }
  .product-detail-tabs { display:block; border-bottom:1px solid var(--pd-border); }
  .product-detail-tabs [role=tablist] { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
  .product-detail-tabs [role=tab] { appearance:none; position:relative; min-height:54px; padding:.7rem .45rem; border:0; border-bottom:3px solid transparent; border-radius:0; background:transparent; color:var(--pd-muted); font-size:.86rem; font-weight:800; line-height:1.5; }
  .product-detail-tabs [role=tab]::before, .product-detail-tabs [role=tab]::after { content:none !important; }
  .product-detail-tabs [role=tab][aria-selected=true] { border-color:var(--pd-accent); color:var(--pd-text); }
  .product-detail-section { display:none; }
  .product-detail-section[open] { display:block; }
  .product-detail-section + .product-detail-section { border-top:0; }
  .product-detail-section > summary { display:none; }
  .product-detail-section-content { padding:1.1rem 1.35rem; }
  .product-detail-section-content h2 { font-size:1.15rem; }
  .product-detail-description { font-size:.91rem; }
}
@media (min-width:1200px) {
  .product-detail-main { padding:1.5rem; }
  .product-detail-top { grid-template-columns:minmax(0,.9fr) minmax(0,1.15fr) minmax(280px,.95fr); grid-template-rows:auto; grid-template-areas:'gallery details offer'; gap:1.25rem; align-items:center; }
  .product-detail-gallery-main, .product-detail-gallery-empty { aspect-ratio:1; }
  .product-detail-gallery { width:100%; max-width:390px; }
  .product-detail-title { font-size:clamp(1.2rem,1.6vw,1.5rem); text-wrap:balance; }
  .product-detail-offer { display:flex; flex-direction:column; gap:1.25rem; align-self:center; padding:1.5rem; border:1px solid var(--pd-border); }
  .product-detail-price { font-size:1.6rem; }
  .product-detail-related-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
@media (prefers-reduced-motion:reduce) { .product-detail-section > summary::after { transition:none; } }

.product-technology-term {
    color: #934006;
    text-decoration: underline dotted;
    text-underline-offset: .2em;
}

.dark .product-technology-term { color: #fdba74; }

.product-technology-panel {
    position: fixed;
    inset: auto;
    box-sizing: border-box;
    width: min(22rem, calc(100vw - 24px));
    max-height: min(19rem, calc(100dvh - 100px));
    overflow: auto;
    margin: 0;
    padding: .85rem 1rem;
    padding-inline-end: 3rem;
    border: 1px solid var(--pd-border);
    border-radius: .75rem;
    color: var(--pd-text, #202633);
    background: var(--pd-surface, #fff);
    box-shadow: 0 12px 32px #17243e29;
    white-space: normal;
    font-size: .85rem;
    line-height: 1.8;
    text-align: start;
}
.dark .product-technology-panel { color: #f3f4f6; background: #1f2937; border-color: #475569; }
.product-technology-panel > strong, .product-technology-panel > span { display: block; }
.product-technology-panel > a {
    display: inline-block;
    margin-block-start: .35rem;
    color: #934006;
    text-decoration: underline;
    text-underline-offset: .2em;
}
.dark .product-technology-panel > a { color: #fdba74; }
.product-technology-panel > button {
    position: absolute;
    inset-block-start: .25rem;
    inset-inline-end: .25rem;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: .5rem;
    font-size: 1.25rem;
}
.product-technology-panel :focus-visible, .product-technology-term:focus-visible {
    outline: 2px solid #ff6b00;
    outline-offset: 2px;
}

.product-detail-enlarge { display:block; width:100%; height:100%; min-width:0; cursor:zoom-in; }
.product-detail-enlarge:focus-visible { outline:2px solid var(--pd-accent); outline-offset:2px; }
html:has(.product-image-viewer[open]) { overflow:hidden; }
.product-image-viewer {
  box-sizing:border-box; position:fixed; inset:0; margin:auto;
  width:min(100% - 1rem, 72rem); height:min(100dvh - 1rem, 54rem);
  max-width:none; max-height:none; padding:0; overflow:hidden;
  border:1px solid var(--pd-border); border-radius:.8rem;
  background:var(--pd-surface); color:var(--pd-text);
}
.product-image-viewer[open] { display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
.product-image-viewer::backdrop { background:#111827c7; }
.product-image-viewer-tools { display:flex; flex-wrap:wrap; gap:.25rem; align-items:center; padding:.25rem .5rem; }
.product-image-viewer-tools h2 { flex:1; font-size:1rem; font-weight:700; }
.product-image-viewer-tools button {
  min-width:44px; min-height:44px; padding:0 .25rem; border-radius:.4rem;
  font-size:1.35rem; color:var(--pd-text);
}
.product-image-viewer-tools button:focus-visible { outline:2px solid var(--pd-accent); outline-offset:-2px; }
.product-image-viewer-tools button[aria-disabled=true] { opacity:.45; }
.product-image-viewer footer { justify-content:center; padding-bottom:max(.25rem, env(safe-area-inset-bottom)); }
.product-image-viewer-tools output { min-width:3.5rem; text-align:center; font-size:.875rem; }
.product-image-viewer-tools button svg { display:block; width:1.15rem; height:1.15rem; margin:auto; }
.product-image-viewer:dir(rtl) .product-image-viewer-tools button svg { transform:scaleX(-1); }
.product-image-viewer-stage { width:100%; height:100%; min-width:0; touch-action:none; background:#fff; }
.product-image-viewer-stage img { display:block; width:auto; height:auto; max-width:100%; max-height:100%; }
.product-image-viewer-stage :is(.swiper-zoom-container,img) { touch-action:none; }
@media (prefers-reduced-motion: reduce) {
  .product-image-viewer-stage :is(.swiper-zoom-container,img) { transition-duration:0s !important; }
}
