/* ==========================================================================
   KOMET IL — effects.css  (styles for JS-injected UI: back-to-top, toast,
   PDP compare button, compare-add state). Merged into the Global Kit
   custom_css (tokens untouched). Class prefix: sp-… / komet-… . RTL-safe.
   Source of truth: sites/komet/custom-code/effects.css (kept beside effects.js).
   ========================================================================== */

/* --- back-to-top floating button -----------------------------------------
   Bound to the id, not just the class: this sheet is the first <link> on the page, so a
   class selector loses every tie to Hello's reset (`[type=button]` = pink #c36 border,
   width:auto) and to the Kit's `.elementor-kit-12 button` (12px/24px padding, brand fill,
   10px radius). Seen live 2026-09-23 as a 72×46 blue rectangle with a pink outline sitting
   under the WhatsApp button. Every property the two rules set is restated here. */
#sp-to-top.sp-to-top{
  position:fixed; inset-block-end:20px; inset-inline-end:20px; z-index:1200;
  width:46px; height:46px; min-height:0; padding:0; margin:0;
  display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--line-2,#c7d0d8); border-radius:50%;
  background:var(--bg,#fcfcfb); color:var(--ink,#173557);
  font-size:1rem; line-height:1;
  box-shadow:0 8px 28px rgba(23,53,87,.14); cursor:pointer;
  transition:opacity .25s ease, transform .25s ease, background .2s ease;
}
#sp-to-top.sp-to-top[hidden]{ display:none }
#sp-to-top.sp-to-top:hover,
#sp-to-top.sp-to-top:focus-visible{ background:var(--brand,#0069b4); color:#fff; border-color:var(--brand,#0069b4); transform:translateY(-2px) }
#sp-to-top .komet-ico{ width:22px; height:22px }
@media (prefers-reduced-motion:reduce){ #sp-to-top.sp-to-top{ transition:none } }

/* --- floating buttons: shared corner + the cart's sticky checkout bar -----
   Three fixed buttons share the bottom of the screen: back-to-top (rule above; inline-end,
   i.e. left in RTL, bottom 20px), the Kit's WhatsApp button (left 24px / bottom 24px, 58px,
   z-index 9990; bottom 84px at <=720px) and sp-komet-a11y's #sp-a11y-btn (inline-start,
   i.e. right, bottom 18px, 52px, z-index 99999).
   Above 720px back-to-top sat exactly under the WhatsApp button and could not be clicked,
   so where that button exists back-to-top stacks above it (24 + 58 + 14). :where() keeps
   this at the base rule's (1,1,0), so the cart rule below still wins. */
@media (min-width:721px){
  :where(body:has(a.komet-whatsapp-float)) #sp-to-top.sp-to-top{ inset-block-end:96px }
}
/* Below 783px WooCommerce's Cart block pins "להמשיך לתשלום בקופה" to the bottom of the
   screen (.wc-block-cart__submit-container--sticky: fixed, 16px padding around a 58px
   button = 90px, z-index 9999; hidden again at max-height:500px, hence the min-height).
   The accessibility button covered the checkout button, and the other two sat on its
   edge. On the cart every floating button, and the accessibility panel that opens above
   its button, moves up by the bar's 90px. body.woocommerce-cart lifts these over the
   inline #sp-a11y-btn (1,0,0) and the Kit's a.komet-whatsapp-float (0,1,1) by specificity,
   whatever the load order. */
@media (max-width:782px) and (min-height:501px){
  body.woocommerce-cart #sp-a11y-btn{ inset-block-end:108px }
  body.woocommerce-cart #sp-a11y-panel{ inset-block-end:170px }
  body.woocommerce-cart #sp-to-top.sp-to-top{ inset-block-end:110px }
  body.woocommerce-cart a.komet-whatsapp-float{ bottom:calc(174px + env(safe-area-inset-bottom,0px)) }
}

/* --- catalogue: results anchor + mobile filter actions -------------------
   sp-search scrolls the results into view after "החל סינון" (and closes the filter
   drawer on narrow screens). The header is fixed, so the anchor needs its height as
   scroll margin: 159px on desktop, 131px at phone width, plus the admin bar when
   logged in as staff. */
.sp-results{ scroll-margin-top:175px }
.admin-bar .sp-results{ scroll-margin-top:207px }
@media (max-width:1080px){
  .sp-results{ scroll-margin-top:145px }
  .admin-bar .sp-results{ scroll-margin-top:191px }
  /* The open drawer lists every filter group, several screens tall; the actions stay
     pinned to the bottom of the screen so a tick is always one tap away from the
     results. Start padding keeps the row clear of the accessibility button (RTL: right). */
  .sp-facets-slot.is-open .sp-facets .sp-facets__actions{
    position:sticky; inset-block-end:0; z-index:5;
    flex-direction:row; align-items:center;
    margin-inline:-4px; padding:12px 4px; padding-inline-start:76px;
    background:var(--bg,#fcfcfb);
    box-shadow:0 -10px 18px -14px rgba(23,53,87,.35);
  }
  .sp-facets-slot.is-open .sp-facets .sp-facets__apply{ flex:1 1 auto; width:auto!important }
  .sp-facets-slot.is-open .sp-facets .sp-facets__clear{ flex:0 0 auto; width:auto!important }
}

/* --- toast (compare feedback) -------------------------------------------- */
.sp-toast{
  position:fixed; inset-block-end:24px; inset-inline-start:50%; transform:translate(50%,140%);
  z-index:1300; max-width:min(92vw,420px);
  background:var(--ink,#173557); color:var(--on-ink,#fcfcfb);
  padding:12px 18px; border-radius:var(--radius-md,10px); font-size:.92rem; line-height:1.4;
  box-shadow:0 12px 40px rgba(23,53,87,.28); opacity:0; pointer-events:none;
  transition:transform .3s cubic-bezier(.2,.7,.2,1), opacity .3s ease;
}
.sp-toast.is-on{ transform:translate(50%,0); opacity:1 }
@media (prefers-reduced-motion:reduce){ .sp-toast{ transition:opacity .2s ease } }

/* --- compare page: make [hidden] win over the template's display rules ----
   The compare template styles .cmp-empty{display:grid} and the matrix wrapper
   with explicit display, which override the low-specificity [hidden] attribute
   (display:none). effects.js toggles [hidden] to switch empty-state ↔ matrix,
   so we must let [hidden] win. */
.cmp-empty[hidden],
[data-sp-compare][hidden]{ display:none !important }

/* --- PDP compare button + generic compare-add active state --------------- */
.sp-cmp-btn{ margin-inline-start:2px }
[data-sp-compare-add]{ position:relative }
[data-sp-compare-add].is-on{
  background:var(--brand,#0069b4); color:#fff; border-color:var(--brand,#0069b4);
}
[data-sp-compare-add].is-on .komet-ico{ color:#fff }

/* ---- product_cat archive media (v1.1.0) --------------------------------------------------
   Markup comes from [sp_komet_cat_image] and [sp_komet_subcats] in the loader, so the styles
   ship with it rather than living in the Kit. RTL: logical properties only.

   SPECIFICITY NOTE, learned the hard way: this stylesheet is enqueued from an mu-plugin at the
   default wp_enqueue_scripts priority, so it is the FIRST <link> on the page — ahead of
   elementor-frontend and ahead of the Kit. Every tie is therefore LOST here, not won. Two
   rules that matter both sit at (0,1,1) and would beat a bare `.wrapper img` selector only by
   order, which we do not have:
     .elementor-kit-12 img { border-radius: 10px }
     .elementor img        { height: auto; max-width: 100% }
   So the image rules below are bound to the image's OWN class as well — (0,2,0) — which wins
   on specificity regardless of load order. Dropping that class qualifier silently reverts the
   crop and the corners. */

/* Term photograph beside the archive title. 4:3 matches the sources exactly — object-fit is
   contain so a future non-4:3 upload letterboxes instead of losing the working end of an
   instrument. */
.sp-cathero__media{flex:0 0 auto;margin:0;width:clamp(140px,26vw,260px);aspect-ratio:4/3;overflow:hidden;border-radius:var(--radius-md,10px);border:1px solid var(--line,#dfe5ea);background:linear-gradient(180deg,#f8fafb,#e9edf1)}
.sp-cathero__media .sp-cathero__img{display:block;width:100%;height:100%;object-fit:contain;object-position:center;border-radius:0}

/* Subcategory strip. This is the only place 78 of the 95 term images are visible at all. It
   carries NO product counts on purpose: the sp-search sidebar already lists the same children
   with their counts, and printing that list twice on one screen — once as a filter, once as a
   link — reads as a defect. The strip is the picture menu; the facet stays the filter. */
.sp-subcats{margin-block:clamp(20px,3vw,32px) 0}
/* (0,2,0): a bare .sp-subcats__h at (0,1,0) loses to the Kit's .elementor-kit-12 h2 (0,1,1)
   and the heading renders at page-title size. */
.sp-subcats h2.sp-subcats__h{font-size:var(--fs-h3,1.15rem);font-weight:700;line-height:1.25;color:var(--ink,#173557);margin:0 0 14px;letter-spacing:normal}
.sp-subcats__grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:clamp(12px,1.5vw,18px)}
/* min-width:0 on the tile: a grid item's automatic minimum is its min-content, and an <img>
   with an intrinsic 1200px would contribute that width and burst the track. */
.sp-subcats__grid>*{min-width:0}
.sp-subcat{display:flex;flex-direction:column;min-width:0;border:1px solid var(--line,#dfe5ea);border-radius:var(--radius-md,10px);overflow:hidden;background:var(--bg,#fff);box-shadow:var(--elev-1,0 1px 2px rgba(23,53,87,.06));text-decoration:none;transition:box-shadow .2s ease,transform .2s ease,border-color .2s ease}
.sp-subcat:hover{box-shadow:var(--elev-2,0 12px 28px rgba(23,53,87,.12));transform:translateY(-2px);border-color:var(--line-2,#c9d4dd);text-decoration:none}
/* Its own top radius, so the photo's corners never depend on the parent's overflow clip alone. */
.sp-subcat__media{display:block;aspect-ratio:4/3;overflow:hidden;background:linear-gradient(180deg,#f8fafb,#e9edf1);border-start-start-radius:calc(var(--radius-md,10px) - 1px);border-start-end-radius:calc(var(--radius-md,10px) - 1px)}
.sp-subcat__media .sp-subcat__img{display:block;width:100%;height:100%;object-fit:contain;object-position:center;border-radius:0;transition:transform .4s ease}
.sp-subcat:hover .sp-subcat__media .sp-subcat__img{transform:scale(1.03)}
.sp-subcat__body{display:flex;align-items:center;padding:10px 12px;border-top:1px solid var(--line,#dfe5ea)}
.sp-subcat__t{min-width:0;font-size:.9rem;font-weight:700;color:var(--ink,#173557);line-height:1.25}
.sp-subcat:hover .sp-subcat__t{color:var(--brand,#0069b4)}
/* Head-shape drawings (2026-09-18): tall narrow symbols from the manufacturer's facet, in the
   sidebar option and in the product page's "צורה" spec row. Stroke/fill are currentColor. */
.sp-shape-ico{width:14px;height:30px;flex:0 0 auto;color:var(--ink,#173557);margin-inline-end:2px}
.sp-facets .sp-facet__option .sp-shape-ico{margin-inline:2px 4px}
.sp-facets details[data-sp-facet="shape"] .sp-facet__option{min-height:30px}
.sp-specrow--head_shape .sp-specrow__v{display:inline-flex;align-items:center;gap:8px}
.sp-specrow--head_shape .sp-shape-ico{height:26px}
/* Tile without a photograph: the area's pictogram on the same plate (2026-09-18). */
.sp-subcat__media .sp-subcat__ph{display:grid;place-items:center;width:100%;height:100%;color:var(--brand,#0069b4)}
.sp-subcat__ph .komet-ico{width:44px;height:44px;opacity:.85}
@media(max-width:560px){.sp-subcats__grid{grid-template-columns:repeat(auto-fill,minmax(132px,1fr))}}

/* ---- header mega menu: Latin names ending in a mark (2026-09-23) --------------------------
   The komet_mega_categories / komet_mega_applications links are RTL blocks holding the bare
   name. In "ER DentinPost®" the trailing ® is bidi-neutral at the end of an RTL paragraph, so
   it resolves to RTL and is painted on the far side of the Latin run: "®ER DentinPost".
   unicode-bidi:plaintext would fix that item but turns every Latin-first name ("ER טיטניום")
   into an LTR paragraph, left-aligned and with its words swapped; isolate does not change a
   block's own paragraph. A trailing LEFT-TO-RIGHT MARK gives the neutral a strong LTR
   neighbour instead: it stays with the Latin run, and names ending in Hebrew, a digit or a
   bracket pair render as before. Invisible, zero-width, not copied with the text; the second
   declaration keeps it out of the accessible name where "content: x / alt" is supported. */
.mega-grid .mega-col li > a::after,
.mega-grid .mega-cat > span::after{ content:"\200E"; content:"\200E" / "" }

/* ---- product page price box (2026-09-23) --------------------------------------------------
   [sp_b2b_price] prints the amount as a bare text node followed by
   <small class="sp-b2b-price__vat"> ללא מע״מ</small>, inside a span the page template makes
   direction:ltr + isolate at 2rem. At phone width the box is a no-wrap flex row (price column
   + VAT switch); the column got ~187px and the line broke inside the label ("₪83.17 ללא" /
   "מע״מ", three lines on narrower screens). The label is now one atomic unit (it moves under
   the amount as a whole when it must; the margin replaces its leading space, which an
   inline-block drops), amounts never break, and below 768px the switch takes its own row
   when the two do not fit side by side. None of these properties is set by the template's
   price rules, and each selector is at least as specific as the template's rule for the same
   element, so the earlier load order does not matter. */
.sp-priceblock .sp-b2b-price .sp-b2b-price__vat{ display:inline-block; white-space:nowrap; margin-inline-start:.3em }
.sp-priceblock .sp-b2b-price del,
.sp-priceblock .sp-b2b-price ins,
.sp-priceblock .sp-b2b-price .amount{ white-space:nowrap }
@media (max-width:767px){
  .sp-priceblock-w .sp-priceblock.komet-price{ flex-wrap:wrap; row-gap:10px }
}
