/* 1.12.0 — product page (gallery, sections, related), wishlist, sale badges. */

/* ---- Layout: gallery 60% / summary 40%, 40px gap (one column under 1024) ---- */
@media (min-width: 1024px) {
  .hf-product-page .hf-pdp { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: 40px; }
}
@media (max-width: 1023px) {
  .hf-product-page .hf-pdp { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-6); }
}
.hf-pdp > .hf-pdp-sections { grid-column: 1 / -1; min-width: 0; }

/* ---- Gallery: thumbnails in a column at the right of the photo on desktop ---- */
.hf-gallery__main { aspect-ratio: 1; }
@media (min-width: 1024px) {
  .hf-gallery:has(.hf-gallery__thumbs) { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-3); align-items: start; }
  .hf-gallery__thumbs { grid-column: 1; grid-row: 1; flex-direction: column; flex-wrap: nowrap; gap: var(--space-2); margin: 0; align-self: stretch; height: 0; min-height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 2px; }
  .hf-gallery__main { grid-column: 2; grid-row: 1; }
  .hf-gallery__thumb { width: 80px; }
}
@media (max-width: 1023px) {
  .hf-gallery__thumbs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-block-end: 2px; }
  .hf-gallery__thumbs::-webkit-scrollbar { display: none; }
}
@media (max-width: 767px) { .hf-pdp__gallery .hf-gallery__main { aspect-ratio: 1; } }
.hf-gallery__thumb { border-width: 2px; min-width: 44px; min-height: 44px; }
.hf-gallery__thumb:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.hf-gallery__thumb.is-broken img { visibility: hidden; }

/* Arrows: two plain chevrons, no circle, centred on the photo's far edges. */
.hf-gallery__nav { width: 44px; height: 64px; border: 0; border-radius: var(--radius-sm); background: transparent; box-shadow: none; color: var(--text-strong); filter: drop-shadow(0 0 1px var(--surface-card)) drop-shadow(0 0 3px var(--surface-card)); }
.hf-gallery__nav svg, .hf-gallery__nav i { width: 34px; height: 34px; stroke-width: 2.25; }
.hf-gallery__nav:hover { background: color-mix(in srgb, var(--surface-card) 55%, transparent); }
.hf-gallery__prev { right: 0; inset-inline-start: 0; }
.hf-gallery__next { left: 0; inset-inline-end: 0; }

/* Badges: «جديد» and «خصم N%» side by side, never stacked on each other. */
.hf-gallery__badges { position: absolute; top: var(--space-3); inset-inline-start: var(--space-3); z-index: 4; display: flex; flex-wrap: wrap; gap: var(--space-2); max-width: calc(100% - 2 * var(--space-3)); pointer-events: none; }
.hf-gallery__badges .hf-gallery__badge { position: static; }
.hf-gallery__badge--sale { background: var(--sale); color: #fff; }
.hf-pdp__gallery > .onsale { display: none; }

/* Hover magnifier (mouse only): a 2x layer that follows the pointer. */
.hf-gallery__lens { position: absolute; inset: 0; z-index: 2; background-repeat: no-repeat; background-size: 200%; background-color: var(--hf-photo-ground); opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease-out); }
.hf-gallery__main.is-zooming .hf-gallery__lens { opacity: 1; }
.hf-gallery__main.is-zooming .hf-gallery__nav { opacity: 0; }
@media (hover: hover) and (pointer: fine) { .hf-gallery__main img { cursor: zoom-in; } }
@media (prefers-reduced-motion: reduce) { .hf-gallery__lens { transition: none; } }
/* Failed photo: a calm placeholder on the same square, no layout shift. */
.hf-gallery__broken { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; gap: var(--space-2); color: var(--text-muted); font-size: var(--fs-sm); background: var(--hf-photo-ground); }
.hf-gallery__broken[hidden] { display: none; }
.hf-gallery__broken svg { width: 32px; height: 32px; }
.hf-gallery__main.is-broken img { visibility: hidden; }
.hf-gallery__zoom { z-index: 3; }

/* ---- Summary order (item 9.2): DOM order is the order; drop the old phone reordering ---- */
body .hf-product-page .hf-pdp__summary > * { order: 0; }
.hf-keyfacts { display: grid; gap: var(--space-2); margin: 0; }
.hf-shipping-note { display: flex; align-items: flex-start; gap: var(--space-2); margin: 0; color: var(--text-body); font-size: var(--fs-sm); line-height: var(--lh-snug); }
.hf-shipping-note svg, .hf-shipping-note i { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--text-muted); }
.hf-pdp__summary form.cart .hf-order-type-notice { flex: 1 1 100%; grid-column: 1 / -1; width: 100%; margin: 0; }
.hf-pdp__summary .woocommerce-variation-add-to-cart { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--space-3); width: 100%; }
.hf-pdp__summary .woocommerce-variation-add-to-cart .hf-qty { flex: none; }
.woocommerce div.hf-pdp.product .hf-pdp__summary form.cart :is(.single_add_to_cart_button, .hf-buy-now) { flex: 1 1 150px; min-width: 0; min-height: 48px; border-radius: var(--radius-pill); white-space: normal; line-height: 1.3; }
.hf-pdp__summary .single_variation_wrap { width: 100%; }
@media (max-width: 767px) {
  .hf-pdp__summary form.cart:not(.variations_form),
  .hf-pdp__summary .woocommerce-variation-add-to-cart { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hf-pdp__summary form.cart:not(.variations_form) > .hf-order-type-notice,
  .hf-pdp__summary .woocommerce-variation-add-to-cart > .hf-order-type-notice { grid-column: 1 / -1; }
}

/* Quantity: only the theme's − and + (no browser spinner), PDP and cart. */
input.qty::-webkit-outer-spin-button,
input.qty::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
input.qty[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* Options (item 9.6): default, hover, focus, selected (border + check), unavailable (struck, with a title reason). */
.hf-swatch__opt { position: relative; }
.hf-swatch__opt:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.hf-swatch__opt.is-active { border-color: var(--action); background: var(--action-soft, var(--bg-muted)); color: var(--text-strong); }
.hf-swatch__opt.is-active::after { content: "✓"; margin-inline-start: var(--space-2); font-weight: 700; color: var(--action); }
.hf-swatch__opt.is-unavailable { border-style: dashed; color: var(--text-muted); text-decoration: line-through; cursor: not-allowed; }
.hf-swatch__opt.is-unavailable:hover { border-color: var(--border-default); }

/* ---- Saved-product controls (item 5.2): one row of icon buttons ---- */
.hf-pdp__summary .hf-product-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
.hf-icon-control { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-default); border-radius: var(--radius-pill); background: var(--surface-card); color: var(--text-strong); cursor: pointer; text-decoration: none; transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.hf-icon-control:hover { border-color: var(--action); color: var(--text-brand); }
.hf-icon-control:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.hf-icon-control svg, .hf-icon-control i { width: 20px; height: 20px; }
.hf-icon-control[data-hf-save="compare"].is-active { border-color: var(--action); background: var(--action); color: var(--on-action); }
.hf-gallery__fav { position: absolute; top: var(--space-3); inset-inline-end: var(--space-3); z-index: 4; width: 48px; height: 48px; border-color: var(--border-subtle); box-shadow: var(--shadow-2); }
.hf-gallery__fav svg, .hf-gallery__fav i { width: 24px; height: 24px; }
.hf-icon-control--count { width: auto; min-width: 44px; grid-auto-flow: column; gap: var(--space-1); padding-inline: var(--space-3); }
.hf-icon-control__badge { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-body); }
.hf-compare-status:empty { display: none; }
.hf-compare-status { flex-basis: 100%; font-size: var(--fs-sm); color: var(--text-body); }

/* ---- Wishlist heart everywhere (item 5.4): a real red heart, filled ----
   Lucide swaps <i data-lucide> for <svg>, so the fill must target the svg too. */
[data-hf-save="wishlist"].is-active, [data-hf-save="wishlist"][aria-pressed="true"], .hf-wishlist__grid .hf-card__fav.is-active { color: var(--sale); border-color: color-mix(in srgb, var(--sale) 45%, transparent); }
[data-hf-save="wishlist"].is-active svg, [data-hf-save="wishlist"][aria-pressed="true"] svg, .hf-wishlist__grid .hf-card__fav.is-active svg { fill: currentColor; stroke: currentColor; }
.hf-card__fav.hf-pop svg, .hf-icon-control.hf-pop svg { animation: hf-pop var(--dur-slow) var(--ease-out); }
[data-hf-save="wishlist"] { overflow: visible; }
[data-hf-save="wishlist"]::after { content: ""; position: absolute; inset-block-start: 50%; inset-inline-start: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; pointer-events: none; opacity: 0; color: var(--sale);
  box-shadow: 0 -18px 0 currentColor, 13px -13px 0 currentColor, 18px 0 0 currentColor, 13px 13px 0 currentColor, 0 18px 0 currentColor, -13px 13px 0 currentColor, -18px 0 0 currentColor, -13px -13px 0 currentColor; }
[data-hf-save="wishlist"].hf-burst::after { animation: hf-burst 600ms var(--ease-out) forwards; }
@keyframes hf-burst { 0% { opacity: 1; transform: scale(.4); } 70% { opacity: .9; } 100% { opacity: 0; transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { [data-hf-save="wishlist"].hf-burst::after, .hf-icon-control.hf-pop svg { animation: none; } }

/* ---- Sections instead of tabs (item 3.1) ---- */
.hf-pdp-sections { display: grid; gap: var(--space-10); margin-top: var(--space-10); }
.hf-pdp-section { min-width: 0; }
.hf-pdp-section__title { margin: 0 0 var(--space-4); padding-block-end: var(--space-3); border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-h3); font-weight: var(--fw-semibold); color: var(--text-strong); }
.hf-pdp-section__body { color: var(--text-body); line-height: var(--lh-loose); }
.hf-pdp-section__body > :first-child { margin-top: 0; }
.hf-pdp-section__body h2 { font-size: var(--fs-h4); color: var(--text-strong); }
.hf-pdp-section--accordion { border-block: 1px solid var(--border-subtle); }
.hf-pdp-section--accordion > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 56px; margin: 0; padding: var(--space-3) 0; border: 0; list-style: none; cursor: pointer; }
.hf-pdp-section--accordion > summary::-webkit-details-marker { display: none; }
.hf-pdp-section--accordion > summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.hf-pdp-section--accordion > summary svg { width: 20px; height: 20px; flex: none; transition: transform var(--dur-fast) var(--ease-out); }
.hf-pdp-section--accordion[open] > summary svg { transform: rotate(-90deg); }
.hf-pdp-section--accordion > .hf-pdp-section__body { padding-block-end: var(--space-5); }
@media (prefers-reduced-motion: reduce) { .hf-pdp-section--accordion > summary svg { transition: none; } }

/* Materials and sizes: everything visible; the 3D model gets room (item 3.2). */
.hf-pdp-section--additional_information .hf-pdp__meta { margin: 0; padding: 0; border: 0; }
.hf-pdp-section .hf-size-compare__drawing:has(canvas) { height: clamp(300px, 80vw, 380px); max-height: none; }
@media (min-width: 768px) { .hf-pdp-section .hf-size-compare__drawing:has(canvas) { height: 460px; } }
/* One finger scrolls the page vertically; horizontal drag rotates, two fingers zoom. */
.hf-pdp-section .hf-size-compare__drawing:has(canvas), .hf-pdp-section .hf-size-compare__drawing canvas { touch-action: pan-y !important; }
.hf-size-scene__tools button { width: 44px; height: 44px; }
.hf-size-scene__tools button:first-child { width: auto; grid-auto-flow: column; gap: var(--space-2); padding-inline: var(--space-4); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-strong); }
.hf-size-scene__tools button:first-child::after { content: attr(title); }

/* Reviews (item 3.3): average + stars + count, then the list and the form. */
.hf-review-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin: 0 0 var(--space-5); }
.hf-review-summary__avg { font-size: var(--fs-h2); line-height: 1; color: var(--text-strong); }
.hf-review-summary .star-rating { margin: 0; }
.hf-review-summary__count { color: var(--text-body); font-size: var(--fs-sm); }
.hf-pdp-section--reviews .woocommerce-Reviews-title, .hf-pdp-section--reviews .woocommerce-noreviews { display: none; }
.hf-pdp-section--reviews .commentlist { display: grid; gap: var(--space-3); margin: 0 0 var(--space-6); padding: 0; list-style: none; }
.hf-pdp-section--reviews .commentlist > li { margin: 0; padding: var(--space-4); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-card); }
.hf-pdp-section--reviews .comment_container { display: flex; gap: var(--space-3); }
.hf-pdp-section--reviews .comment_container img.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; float: none; position: static; padding: 0; border: 0; }
.hf-pdp-section--reviews .comment-text { flex: 1; min-width: 0; margin: 0 !important; padding: 0 !important; border: 0 !important; display: grid; gap: var(--space-1); }
.hf-pdp-section--reviews .comment-text .star-rating { float: none; order: -1; margin: 0; }
.hf-pdp-section--reviews .comment-text .meta { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.hf-pdp-section--reviews .comment-text .meta strong { color: var(--text-strong); }
.hf-pdp-section--reviews .comment-text .description p { margin: 0; }

/* ---- Related products (items 4.1–4.4) ---- */
.hf-related-row { min-width: 0; }
.hf-related-row .related > h2 { margin: 0 0 var(--space-4); font-size: var(--fs-h3); }
.hf-related-row .hf-recommendations-controls { display: none; }
.hf-rel__viewport { position: relative; overflow: hidden; touch-action: pan-y; }
html .woocommerce .hf-related-row ul.products.hf-rel__track { display: flex; flex-wrap: nowrap; gap: 16px; margin: 0; padding: 4px 0; overflow: visible; will-change: transform; }
html .woocommerce .hf-related-row ul.products.hf-rel__track::before, html .woocommerce .hf-related-row ul.products.hf-rel__track::after { content: none; display: none; }
html .woocommerce .hf-related-row ul.products.hf-rel__track > li.product { flex: 0 0 calc((100% - 3 * 16px) / 4); width: auto; max-width: none; margin: 0; float: none; }
@media (max-width: 1023px) { html .woocommerce .hf-related-row ul.products.hf-rel__track > li.product { flex-basis: calc((100% - 2 * 16px) / 3); } }
@media (max-width: 767px) { html .woocommerce .hf-related-row ul.products.hf-rel__track > li.product { flex-basis: calc((100% - 16px) / 1.6); } }
/* Without the script the row still scrolls (no visible bar). */
.hf-related-row:not(.is-carousel) ul.products { overflow-x: auto; scrollbar-width: none; }
.hf-related-row:not(.is-carousel) ul.products::-webkit-scrollbar { display: none; }
.hf-rel__nav { position: absolute; top: 40%; z-index: 5; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border-default); border-radius: 50%; background: var(--surface-card); color: var(--text-strong); box-shadow: var(--shadow-2); cursor: pointer; transform: translateY(-50%); }
.hf-rel__nav svg, .hf-rel__nav i { width: 22px; height: 22px; }
.hf-rel__nav:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.hf-rel__prev { right: 6px; }
.hf-rel__next { left: 6px; }
.hf-related-row.is-static .hf-rel__nav { display: none; }
.hf-related-row .hf-related-all { margin-top: var(--space-4); }

/* ---- Phones: sticky buy bar + one floating element (items 9.4, 9.5) ---- */
.hf-sticky-buy { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.hf-sticky-buy button { min-width: 0; flex: 0 1 auto; white-space: nowrap; }
@media (max-width: 767px) {
  body.hf-has-sticky-buy { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  body.hf-sticky-buy-visible .hf-wa, body.hf-sticky-buy-visible .joinchat { display: none !important; }
}
.hf-pdp__summary .woocommerce-product-rating { margin: 0; }
.hf-attr-static--size .hf-attr-static__chip { display: block; line-height: var(--lh-snug); }
/* WooCommerce styles reviews through ids; match them so the cards win. */
#tab-reviews #reviews #comments ol.commentlist { display: grid; gap: var(--space-3); margin: 0 0 var(--space-6); padding: 0; }
#tab-reviews #reviews #comments ol.commentlist li { margin: 0; padding: var(--space-4); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-card); }
#tab-reviews #reviews #comments ol.commentlist li .comment_container { display: flex; align-items: flex-start; gap: var(--space-3); }
#tab-reviews #reviews #comments ol.commentlist li img.avatar { position: static; float: none; flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--bg-muted); }
#tab-reviews #reviews #comments ol.commentlist li .comment-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); margin: 0; padding: 0; border: 0; }
#tab-reviews #reviews #comments ol.commentlist li .comment-text .star-rating { float: none; margin: 0; }
#tab-reviews #reviews #comments ol.commentlist li .comment-text p.meta { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
#tab-reviews #reviews #comments ol.commentlist li .comment-text .description p { margin: var(--space-1) 0 0; color: var(--text-body); }
#tab-reviews #review_form #respond .form-submit input#submit, #tab-reviews #review_form #respond .form-submit .submit { min-height: 48px; padding-inline: var(--space-6); border-radius: var(--radius-pill); }
#tab-reviews #reply-title { display: block; margin-bottom: var(--space-2); font-size: var(--fs-h4); font-weight: var(--fw-semibold); color: var(--text-strong); }
.woocommerce div.product .hf-pdp__summary .woocommerce-product-rating, .woocommerce div.product .hf-pdp__summary form.cart { margin-bottom: 0; }
.woocommerce div.product .hf-pdp__summary .hf-product-question { margin-top: 0; }
