/* ============================================================
   SFR PRODUCT ARCHIVE – Styles  v1.5.2
   ============================================================ */

.sfr-archive-wrap {
    --sfr-cols: 4;
    --sfr-gap-x: 16px;
    --sfr-gap-y: 16px;
    --sfr-card-radius: 4px;
    --sfr-img-height: 420px;
    --sfr-badge-sale: #6D0A0A;
    --sfr-badge-soldout: #000000;
    --sfr-title-color: inherit;
    --sfr-title-hover: #6D0A0A;
    --sfr-price-regular-color: #333;
    --sfr-price-sale-color: #6D0A0A;
    --sfr-transition-dur: 0.45s;
    --sfr-transition-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --sfr-spinner-color: #111;
    width: 100%;
}

/* ── Grid ── */
.sfr-archive-wrap .sfr-products {
    display: grid;
    grid-template-columns: repeat(var(--sfr-cols), 1fr);
    column-gap: var(--sfr-gap-x);
    row-gap: var(--sfr-gap-y);
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── Card entrance ── */
.sfr-archive-wrap .sfr-product-card {
    opacity: 0;
    transform: translateY(18px);
    animation: sfrFadeUp 0.55s ease forwards;
    position: relative;
}
@keyframes sfrFadeUp {
    to { opacity: 1; transform: translateY(0); }
}

/*
 * FIX-03: Stagger extended from 12 to 20 cards so a full 4-col × 5-row
 * initial grid (20 products) all animate in — previously cards 13-20
 * had no delay and snapped in instantly.
 * FIX-CSS1 (v1.5.1): Extended further to 40 cards to cover grids up to
 * 6-col × 7-row (42 products). Cards 21-40 stagger at 14ms intervals
 * (matching the existing cadence) so large grids still animate in smoothly.
 */
.sfr-products .sfr-product-card:nth-child(1)  { animation-delay: .08s }
.sfr-products .sfr-product-card:nth-child(2)  { animation-delay: .13s }
.sfr-products .sfr-product-card:nth-child(3)  { animation-delay: .18s }
.sfr-products .sfr-product-card:nth-child(4)  { animation-delay: .23s }
.sfr-products .sfr-product-card:nth-child(5)  { animation-delay: .28s }
.sfr-products .sfr-product-card:nth-child(6)  { animation-delay: .33s }
.sfr-products .sfr-product-card:nth-child(7)  { animation-delay: .38s }
.sfr-products .sfr-product-card:nth-child(8)  { animation-delay: .43s }
.sfr-products .sfr-product-card:nth-child(9)  { animation-delay: .48s }
.sfr-products .sfr-product-card:nth-child(10) { animation-delay: .53s }
.sfr-products .sfr-product-card:nth-child(11) { animation-delay: .58s }
.sfr-products .sfr-product-card:nth-child(12) { animation-delay: .63s }
.sfr-products .sfr-product-card:nth-child(13) { animation-delay: .68s }
.sfr-products .sfr-product-card:nth-child(14) { animation-delay: .73s }
.sfr-products .sfr-product-card:nth-child(15) { animation-delay: .78s }
.sfr-products .sfr-product-card:nth-child(16) { animation-delay: .83s }
.sfr-products .sfr-product-card:nth-child(17) { animation-delay: .88s }
.sfr-products .sfr-product-card:nth-child(18) { animation-delay: .93s }
.sfr-products .sfr-product-card:nth-child(19) { animation-delay: .98s }
.sfr-products .sfr-product-card:nth-child(20) { animation-delay: 1.03s }
.sfr-products .sfr-product-card:nth-child(21) { animation-delay: 1.08s }
.sfr-products .sfr-product-card:nth-child(22) { animation-delay: 1.13s }
.sfr-products .sfr-product-card:nth-child(23) { animation-delay: 1.18s }
.sfr-products .sfr-product-card:nth-child(24) { animation-delay: 1.23s }
.sfr-products .sfr-product-card:nth-child(25) { animation-delay: 1.28s }
.sfr-products .sfr-product-card:nth-child(26) { animation-delay: 1.33s }
.sfr-products .sfr-product-card:nth-child(27) { animation-delay: 1.38s }
.sfr-products .sfr-product-card:nth-child(28) { animation-delay: 1.43s }
.sfr-products .sfr-product-card:nth-child(29) { animation-delay: 1.48s }
.sfr-products .sfr-product-card:nth-child(30) { animation-delay: 1.53s }
.sfr-products .sfr-product-card:nth-child(31) { animation-delay: 1.58s }
.sfr-products .sfr-product-card:nth-child(32) { animation-delay: 1.63s }
.sfr-products .sfr-product-card:nth-child(33) { animation-delay: 1.68s }
.sfr-products .sfr-product-card:nth-child(34) { animation-delay: 1.73s }
.sfr-products .sfr-product-card:nth-child(35) { animation-delay: 1.78s }
.sfr-products .sfr-product-card:nth-child(36) { animation-delay: 1.83s }
.sfr-products .sfr-product-card:nth-child(37) { animation-delay: 1.88s }
.sfr-products .sfr-product-card:nth-child(38) { animation-delay: 1.93s }
.sfr-products .sfr-product-card:nth-child(39) { animation-delay: 1.98s }
.sfr-products .sfr-product-card:nth-child(40) { animation-delay: 2.03s }
.sfr-product-card.sfr-new { animation-delay: 0s !important; animation-duration: 0.4s !important; }

.sfr-archive-wrap .sfr-product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ── Image wrapper ── */
.sfr-archive-wrap .sfr-image-wrap {
    position: relative;
    width: 100%;
    height: var(--sfr-img-height);
    overflow: hidden;
    background: #f0f0ee;
    border-radius: var(--sfr-card-radius);
    isolation: isolate;
}

/* Shopify-style load progress bar */
.sfr-image-wrap::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    height: 2px; width: 0%;
    background: linear-gradient(90deg, #000 0%, #555 50%, #000 100%);
    z-index: 10;
    border-radius: 0 1px 1px 0;
    transition: width 1.2s cubic-bezier(0.2, 0, 0.2, 1);
}
.sfr-image-wrap.sfr-loading::before { width: 85%; }
.sfr-product-card.sfr-img-loaded .sfr-image-wrap::before {
    width: 100%;
    transition: width .25s ease, opacity .35s ease .25s;
    opacity: 0;
}

/* ── Primary image base state ──
   BUG-08 FIX: 'filter' added to transition so blur dissolve animates smoothly */
.sfr-archive-wrap .sfr-image-wrap .sfr-primary-img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 0;
    transform: scale(1.12);
    filter: blur(0px);
    transition:
        opacity  var(--sfr-transition-dur) var(--sfr-transition-ease),
        transform var(--sfr-transition-dur) var(--sfr-transition-ease),
        filter   var(--sfr-transition-dur) var(--sfr-transition-ease); /* BUG-08 FIX */
    will-change: transform, opacity, filter;
    backface-visibility: hidden;
}
.sfr-product-card.sfr-img-loaded .sfr-image-wrap .sfr-primary-img {
    opacity: 1;
    transform: scale(1);
}

/* ==============================================================
   HOVER EFFECTS  v1.4.2
   ============================================================== */

/* ── 1. FADE DISSOLVE ── */
.sfr-product-card.sfr-hover-fade:hover .sfr-image-wrap .sfr-primary-img {
    transform: scale(1.05);
}
.sfr-product-card.sfr-hover-fade .sfr-secondary-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; z-index: 2;
    opacity: 0;
    transform: scale(1.08);
    transition:
        opacity   .45s ease-in-out,
        transform .55s var(--sfr-transition-ease);
    pointer-events: none;
    will-change: transform, opacity;
    backface-visibility: hidden;
}
.sfr-product-card.sfr-hover-fade:hover .sfr-image-wrap .sfr-secondary-img {
    opacity: 1;
    transform: scale(1);
}

/* ── 2. SLIDE UP ──
   BUG-07 FIX: primary now shifts up slightly instead of doing nothing */
.sfr-product-card.sfr-hover-slide .sfr-secondary-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; z-index: 2;
    opacity: 1;
    transform: translateY(100%);
    transition: transform .55s cubic-bezier(0.22, 0.61, 0.36, 1);
    pointer-events: none;
    backface-visibility: hidden;
}
.sfr-product-card.sfr-hover-slide:hover .sfr-image-wrap .sfr-secondary-img {
    transform: translateY(0);
}
/* BUG-07 FIX: primary shifts up slightly giving depth to the reveal */
.sfr-product-card.sfr-hover-slide:hover .sfr-image-wrap .sfr-primary-img {
    transform: scale(1) translateY(-4%);
    transition:
        transform .55s cubic-bezier(0.22, 0.61, 0.36, 1),
        opacity   var(--sfr-transition-dur) var(--sfr-transition-ease),
        filter    var(--sfr-transition-dur) var(--sfr-transition-ease);
}

/* ── 3. ZOOM IN ── */
.sfr-product-card.sfr-hover-zoom .sfr-secondary-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; z-index: 2;
    opacity: 0;
    transform: scale(1.18);
    transition:
        opacity   .5s ease,
        transform .6s var(--sfr-transition-ease);
    pointer-events: none;
    will-change: transform, opacity;
    backface-visibility: hidden;
}
.sfr-product-card.sfr-hover-zoom:hover .sfr-image-wrap .sfr-secondary-img {
    opacity: 1;
    transform: scale(1);
}
.sfr-product-card.sfr-hover-zoom:hover .sfr-image-wrap .sfr-primary-img {
    transform: scale(1.06);
}

/* ── 4. BLUR DISSOLVE ──
   BUG-08 FIX: filter is now in the base transition (above) so blur animates */
.sfr-product-card.sfr-hover-blur .sfr-secondary-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; z-index: 2;
    opacity: 0;
    filter: blur(10px);
    transform: scale(1.04);
    transition:
        opacity   .5s ease,
        filter    .5s ease,
        transform .5s ease;
    pointer-events: none;
    will-change: filter, opacity;
    backface-visibility: hidden;
}
.sfr-product-card.sfr-hover-blur:hover .sfr-image-wrap .sfr-secondary-img {
    opacity: 1;
    filter: blur(0px);
    transform: scale(1);
}
/* Primary blurs out — works because base transition now includes filter (BUG-08) */
.sfr-product-card.sfr-hover-blur:hover .sfr-image-wrap .sfr-primary-img {
    filter: blur(8px);
    transform: scale(1.03);
    opacity: 0.6;
}

/* Overlay (all modes) */
.sfr-image-wrap .sfr-img-overlay {
    position: absolute; inset: 0; z-index: 3;
    background: rgba(0, 0, 0, 0);
    transition: background .4s ease;
    pointer-events: none;
}
.sfr-product-card:hover .sfr-img-overlay {
    background: rgba(0, 0, 0, 0.04);
}

/* ── Badges ── */
.sfr-archive-wrap .sfr-badge {
    position: absolute;
    top: 12px; left: 12px;
    z-index: 5;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #fff;
    white-space: nowrap;
    line-height: 1.4;
    animation: sfrBadgeIn .35s ease .25s both;
}
@keyframes sfrBadgeIn {
    from { opacity: 0; transform: scale(.8); }
    to   { opacity: 1; transform: scale(1);  }
}
.sfr-badge--sale    { background: var(--sfr-badge-sale); }
.sfr-badge--soldout { background: var(--sfr-badge-soldout); }

/* ── Product info ── */
.sfr-archive-wrap .sfr-product-info {
    padding: 12px 4px 6px;
}
.sfr-archive-wrap .sfr-product-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}
.sfr-archive-wrap .sfr-product-title a {
    text-decoration: none;
    color: var(--sfr-title-color);
    transition: color .25s ease;
}
.sfr-product-card:hover .sfr-product-title a {
    color: var(--sfr-title-hover);
}
.sfr-archive-wrap .sfr-product-price {
    font-size: 13px;
}
.sfr-archive-wrap .sfr-product-price del,
.sfr-archive-wrap .sfr-product-price del .woocommerce-Price-amount {
    opacity: .65;
    margin-right: 4px;
    color: var(--sfr-price-regular-color);
}
.sfr-archive-wrap .sfr-product-price > .woocommerce-Price-amount {
    color: var(--sfr-price-regular-color);
}
.sfr-archive-wrap .sfr-product-price ins,
.sfr-archive-wrap .sfr-product-price ins .woocommerce-Price-amount {
    text-decoration: none;
    font-weight: 600;
    color: var(--sfr-price-sale-color);
}

/* ==============================================================
   CIRCULAR SPINNER  v1.4.2
   BUG-01 FIX: circumference for r=18 is 113.1 (2π×18), not 56.5.
   All dasharray / dashoffset values recalculated accordingly.
   Short arc ≈ 10% visible  → offset 101.8  (≈ 113.1 × 0.90)
   Long  arc ≈ 78% visible  → offset  24.9  (≈ 113.1 × 0.22)
   ============================================================== */
.sfr-sentinel { height: 1px; }

.sfr-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 44px 0 48px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s ease;
}
/* FIX-JS2 (v1.5.2): display:flex re-declared here so sfr-visible overrides the
   display:none PHP sets when the initial render has only one page of results.
   JS clears the inline style before adding sfr-visible, so this is a fallback. */
.sfr-loader.sfr-visible { display: flex; opacity: 1; }

.sfr-spinner {
    width: 44px;
    height: 44px;
    position: relative;
    animation: sfrSpinRotate 1.5s linear infinite;
}
/* BUG-01 FIX: rotate on the container so SVG transform-origin stays clean */
@keyframes sfrSpinRotate {
    from { transform: rotate(-90deg); }   /* start arc from top */
    to   { transform: rotate(270deg); }
}

.sfr-spinner svg {
    width: 100%;
    height: 100%;
}

/* Faint static track ring */
.sfr-spinner__track {
    stroke: rgba(0, 0, 0, 0.08);
}

/* BUG-01 FIX: correct circumference = 113.1; dashoffset breathes 101.8 → 24.9 */
.sfr-spinner__arc {
    stroke: var(--sfr-spinner-color);
    stroke-dasharray: 113.1;          /* full circumference = 2π × 18 = 113.097… */
    stroke-dashoffset: 101.8;         /* initial: arc is ~10% visible */
    stroke-linecap: round;
    fill: none;
    animation: sfrArcBreath 1.5s ease-in-out infinite;
    transform-origin: 22px 22px;
}
@keyframes sfrArcBreath {
    0%   { stroke-dashoffset: 101.8; }   /* short tail ~10% */
    50%  { stroke-dashoffset: 24.9;  }   /* long  tail ~78% */
    100% { stroke-dashoffset: 101.8; }
}

.sfr-spinner__label {
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--sfr-spinner-color);
    animation: sfrLabelPulse 1.5s ease-in-out infinite;
}
@keyframes sfrLabelPulse {
    0%, 100% { opacity: .3; }
    50%      { opacity: .7; }
}

/* ── No products ── */
.sfr-no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 15px;
}

/* ── End of products message (FIX-05 v1.4.3) ── */
.sfr-end-message {
    text-align: center;
    padding: 0 0 48px;
    margin: 0;
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #aaa;
    animation: sfrEndFadeIn .6s ease forwards;
}
@keyframes sfrEndFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* ── Responsive: disable hover effects on touch ── */
@media (max-width: 767px) {
    .sfr-hover-fade .sfr-secondary-img,
    .sfr-hover-slide .sfr-secondary-img,
    .sfr-hover-zoom .sfr-secondary-img,
    .sfr-hover-blur .sfr-secondary-img { display: none !important; }
    .sfr-badge { font-size: 9px; padding: 4px 7px; }
}
