/* Tanakoora — single product (R5/W8): gallery, summary, details, related, sticky buy bar. Look = live site (R33):
   one white rounded box with a soft shadow, dashed buy box, green «قیمت :» price, grey trust lines under the gallery. */

.tk-product__top { display: grid; gap: 20px; background: var(--card); border-radius: var(--shape-surface); box-shadow: var(--depth-surface); padding: 16px; }
.tk-product__top > * { min-inline-size: 0; } /* gallery track and long text must not widen the box past a phone screen */
@media (min-width: 900px) {
	.tk-product__top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "gallery summary" "trust summary"; grid-template-rows: auto 1fr; gap: 20px 32px; padding: 32px; align-items: start; }
	.tk-gallery { grid-area: gallery; }
	.tk-summary { grid-area: summary; }
	.tk-product__trust { grid-area: trust; }
}

/* Gallery: swipe track (scroll-snap) + thumbnails */
.tk-gallery { position: relative; }
.tk-gallery__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--card); touch-action: pan-x pan-y; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.tk-gallery__track::-webkit-scrollbar { display: none; }
.tk-gallery__track img { -webkit-user-drag: none; user-select: none; }
/* Previous/next arrows: always work, also where a swipe on the photo does not (some iPhone Safari versions in RTL) */
.tk-gallery__slide { flex: 0 0 100%; scroll-snap-align: center; margin: 0; aspect-ratio: 1; display: grid; place-items: center; }
.tk-gallery__slide img { inline-size: 100%; block-size: 100%; object-fit: contain; }
.tk-gallery__zoom { touch-action: pan-x pan-y; display: block; inline-size: 100%; block-size: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.tk-zoom { inline-size: 100vw; block-size: 100dvh; max-inline-size: 100vw; max-block-size: 100dvh; margin: 0; padding: 0; border: 0; background: var(--card); overflow: hidden; }
.tk-zoom::backdrop { background: var(--card); }
.tk-zoom__close { position: fixed; inset-block-start: calc(12px + env(safe-area-inset-top)); inset-inline-end: 12px; z-index: 2; background: color-mix(in srgb, var(--card) 90%, transparent); box-shadow: var(--depth-surface); }
.tk-zoom__track { display: flex; block-size: 100%; touch-action: none; will-change: transform; }
.tk-zoom__slide { flex: 0 0 100%; margin: 0; display: grid; place-items: center; overflow: hidden; }
.tk-zoom__slide img { max-inline-size: 100%; max-block-size: 100dvh; inline-size: auto; block-size: auto; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; cursor: zoom-in; will-change: transform; }
.tk-zoom.is-zoomed .tk-zoom__slide img { cursor: grab; }
.tk-zoom__count { position: fixed; inset-block-end: calc(16px + env(safe-area-inset-bottom)); inset-inline-start: 50%; transform: translateX(50%); margin: 0; padding: 4px 12px; border-radius: var(--shape-pill); background: color-mix(in srgb, var(--foreground) 70%, transparent); color: var(--primary-foreground); font-size: var(--text-xs); }
[dir="ltr"] .tk-zoom__count { transform: translateX(-50%); }
.tk-zoom__hint { position: fixed; inset-block-end: calc(56px + env(safe-area-inset-bottom)); inset-inline: 16px; margin: 0; text-align: center; font-size: var(--text-xs); color: var(--muted-foreground); pointer-events: none; transition: opacity var(--motion) var(--motion-ease); }
.tk-zoom__hint.is-gone, .tk-zoom.is-zoomed .tk-zoom__hint { opacity: 0; }
.tk-sg-btn { display: inline-flex; align-items: center; gap: 8px; margin: -4px 0 12px; font-size: var(--text-sm); }
.tk-sheet--wide { inline-size: 100%; }
@media (min-width: 900px) { .tk-sheet--wide { inline-size: 760px; } }
.tk-sg table { inline-size: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.tk-sg th, .tk-sg td { border-block-end: 1px solid var(--border); padding: 8px 4px; text-align: center; }
.tk-sg th { background: var(--muted); }
.tk-sg h3 { font-size: var(--text-base); margin: 16px 0 8px; }
.tk-gallery__thumbs { display: none; }
@media (min-width: 900px) {
	.tk-gallery__thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-block-start: 16px; }
	.tk-gallery__thumb { aspect-ratio: 1; padding: 4px; border: 1px solid transparent; border-radius: var(--shape-control); background: var(--card); cursor: pointer; opacity: .75; }
	.tk-gallery__thumb.is-on { border-color: var(--border); opacity: 1; }
	.tk-gallery__thumb img { inline-size: 100%; block-size: 100%; object-fit: contain; }
}
.tk-gallery__count { position: absolute; inset-block-end: 10px; inset-inline-end: 26px; margin: 0; background: color-mix(in srgb, var(--foreground) 55%, transparent); color: var(--primary-foreground); border-radius: var(--shape-pill); padding: 0 8px; font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .tk-gallery__count { display: none; } }

/* Summary */
.tk-summary .product_title { font-size: var(--text-xl); font-weight: 700; line-height: var(--leading-control); color: var(--foreground); margin: 0 0 4px; }
.tk-pmeta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-block-end: 12px; border-block-end: 1px solid var(--border); margin-block-end: 16px; }
.tk-pmeta__brand { color: var(--muted-foreground); font-size: var(--text-sm); }
.tk-pmeta__brand:hover { color: var(--primary); }
.tk-summary .woocommerce-product-details__short-description { color: var(--foreground); font-size: var(--text-sm); padding-block-end: 16px; border-block-end: 1px solid var(--border); margin-block-end: 24px; }
.tk-summary .woocommerce-product-details__short-description ul { padding-inline-start: 16px; }
.tk-summary .woocommerce-product-details__short-description li { line-height: var(--leading-reading); }

/* Buy box: dashed frame, size badge, red button, photo note, «قیمت :» in green */
.tk-buybox { border: 2px dashed var(--input); border-radius: var(--shape-control); padding: 16px; display: grid; justify-items: center; text-align: center; }
.tk-buybox .tk-size-badge { margin: 0 0 8px !important; }
.tk-buybox .tk-sg-btn { margin: 0 0 8px; color: var(--foreground); font-size: var(--text-sm); }
.tk-buybox form.cart { display: flex; justify-content: center; margin: 0; }
.tk-buybox > * { max-inline-size: 100%; min-inline-size: 0; }
.tk-buybox form.variations_form { display: grid; justify-items: center; gap: 8px; inline-size: 100%; } /* the one variable product: size select above the button */
.tk-buybox table.variations { inline-size: 100%; border-collapse: collapse; }
.tk-buybox table.variations th, .tk-buybox table.variations td { display: block; text-align: start; padding: 4px 0; }
.tk-buybox table.variations select { inline-size: 100%; min-block-size: var(--touch); border: 1px solid var(--border); border-radius: var(--shape-control); padding: 0 8px; background: var(--card); }
.tk-buybox form.cart .quantity { display: none; } /* one-of-a-kind pairs: quantity is always 1 */
.tk-buybox .single_add_to_cart_button { min-inline-size: 150px; min-block-size: var(--touch); font-size: var(--text-sm); }
.tk-buybox .stock { margin: 0 0 8px; font-size: var(--text-sm); color: var(--success); }
.tk-buybox .stock.out-of-stock { color: var(--primary); font-weight: 700; }
.tk-buybox .tk-photo-note { inline-size: 100%; text-align: start; }
.tk-buybox__price { display: flex; justify-content: space-between; align-items: center; inline-size: 100%; margin: 16px 0 0; padding-inline: 8px; font-size: var(--text-xl); color: var(--foreground); }
.tk-buybox__price .price { margin: 0; font-size: var(--text-2xl); font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }
.tk-buybox__price del { font-size: var(--text-base); color: var(--muted-foreground); font-weight: 400; }
.tk-buybox__price ins { text-decoration: none; }

/* Under the gallery: trust lines and product ID */
.tk-trust { list-style: none; margin: 0; padding: 16px 24px; background: var(--muted); border-radius: var(--shape-control); display: grid; gap: 8px; color: var(--foreground); font-size: var(--text-sm); }
.tk-sku { text-align: center; margin: 12px 0 0; font-size: var(--text-sm); font-weight: 700; color: var(--foreground); }
.tk-sku span { font-weight: 400; }

/* Details: description + specification table, no tabs (W27) */
.woocommerce-tabs { margin-block-start: 32px; }
.woocommerce-tabs .tabs { display: none; }
.woocommerce-tabs .panel { display: block !important; max-inline-size: 860px; margin-block-end: 24px; }
.woocommerce-tabs .panel > h2 { font-size: var(--text-lg); border-block-end: 1px solid var(--border); padding-block-end: 8px; }
.woocommerce-tabs .panel p, .woocommerce-tabs .panel li { line-height: var(--leading-reading); }
.shop_attributes { inline-size: 100%; border-collapse: collapse; }
.shop_attributes th, .shop_attributes td { text-align: start; padding: 8px 12px; border-block-end: 1px solid var(--border); font-size: var(--text-sm); }
.shop_attributes th { inline-size: 34%; color: var(--muted-foreground); font-weight: 400; }
.shop_attributes td p { margin: 0; }

/* Recently viewed: horizontal shelf */
.tk-recent { margin-block-start: 32px; }
.tk-recent h2 { font-size: var(--text-lg); }
.tk-recent .tk-shelf__row { grid-auto-flow: column; grid-auto-columns: 44%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.tk-recent .tk-shelf__row > li { scroll-snap-align: start; }
@media (min-width: 900px) { .tk-recent .tk-shelf__row { grid-auto-columns: 22%; } }

/* Related */
.related.products { margin-block-start: 32px; }
.related.products > h2 { font-size: var(--text-lg); }

/* Sticky buy bar on mobile (W28) */
.tk-buybar { position: fixed; inset-inline: 0; inset-block-end: calc(58px + env(safe-area-inset-bottom)); z-index: 44; display: flex; gap: 12px; align-items: center;
	padding: 8px 16px; background: var(--card); border-block-start: 1px solid var(--border); box-shadow: var(--depth-surface); }
.tk-buybar[hidden] { display: none; }
.tk-buybar__price { font-weight: 700; font-size: var(--text-base); color: var(--price); white-space: nowrap; }
.tk-buybar__price del { display: none; }
.tk-buybar__price ins { text-decoration: none; }
.tk-buybar .tk-btn { flex: 1; min-height: 46px; font-size: var(--text-base); }
@media (min-width: 900px) { .tk-buybar { display: none !important; } }

/* Reviews (only on pairs that have some): stars without WooCommerce's icon font */
.star-rating { --tk-star: 16px; position: relative; display: inline-block; inline-size: calc(var(--tk-star) * 5); block-size: var(--tk-star); vertical-align: middle; background: var(--border);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") 0 0 / var(--tk-star) var(--tk-star) repeat-x; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") 0 0 / var(--tk-star) var(--tk-star) repeat-x; }
.star-rating span { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--rating); font-size: 0; } /* width = rating; the text stays in aria-label */
#reviews .commentlist { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 16px; }
#reviews .comment_container { display: flex; gap: 12px; background: var(--muted); border-radius: var(--shape-control); padding: 12px 16px; }
#reviews .avatar { inline-size: 44px; block-size: 44px; border-radius: 50%; }
#reviews .meta { font-size: var(--text-sm); color: var(--muted-foreground); margin: 4px 0; }
#reviews .description p { margin: 0; }
#review_form textarea, #review_form input[type="text"], #review_form input[type="email"], #review_form select { inline-size: 100%; border: 1px solid var(--border); border-radius: var(--shape-control); padding: 8px 8px; background: var(--card); }

/* R17: defect note above the description */
.tk-defect { border: var(--line) solid var(--warning); background: color-mix(in srgb, var(--warning) 8%, var(--card)); border-radius: var(--shape-control); padding: 8px 16px; margin: 0 0 16px; }
.tk-defect strong { display: block; color: var(--warning); margin-block-end: 4px; }
.tk-defect p { margin: 0; color: var(--foreground); font-size: var(--text-sm); }

/* Plugin blocks in the short description (size box, photo note, Jalali dates: tanakoora-admin) and headings inside the
   description tab, brought onto the six-size type scale from the theme; the plugin stays untouched. */
.tk-buybox .tk-size-eu, .woocommerce-product-details__short-description .tk-size-eu { font-size: var(--text-lg); }
.woocommerce-product-details__short-description .tk-size-other,
.woocommerce-product-details__short-description .tk-size-fit,
.woocommerce-product-details__short-description .tk-photo-note span,
.woocommerce-product-details__short-description .tk-pd-item,
.tk-pd .tk-pd-item, .tk-pd time { font-size: var(--text-xs); }
.woocommerce-Tabs-panel h2 { font-size: var(--text-xl); }
.woocommerce-Tabs-panel h3 { font-size: var(--text-lg); }
.woocommerce-Tabs-panel h4 { font-size: var(--text-base); }
