/**
 * Sugar Hill Farm — shop-archive.css
 * Shop archive page (category + main shop) layout & filter sidebar.
 * Loaded on WooCommerce archive pages.
 */

/* ============================================================
   SHOP HERO
   ============================================================ */
.shf-shop-hero {
    min-height: 300px;
    background: linear-gradient(155deg, var(--shf-forest) 0%, #1e4519 60%, #122b0f 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0 var(--shf-s4) 52px;
    position: relative;
    overflow: hidden;
}

.shf-shop-hero__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.shf-shop-hero__content {
    position: relative;
    z-index: 1;
    max-width: var(--shf-max-w);
    margin-inline: auto;
    width: 100%;
}

.shf-shop-hero__content .shf-heading {
    font-size: clamp(34px, 5vw, 56px);
    margin-bottom: 12px;
}

.shf-shop-hero__sub {
    font-size: 14px;
    color: rgba(255,255,255,0.52);
    font-weight: 300;
    max-width: 420px;
    line-height: 1.65;
}

/* ============================================================
   SHOP PAGE WRAPPER
   ============================================================ */
.shf-shop-page {
    background: var(--shf-cream);
    min-height: 60vh;
}

/* ============================================================
   TWO-COLUMN LAYOUT
   ============================================================ */
.shf-shop-layout {
    max-width: var(--shf-max-w);
    margin-inline: auto;
    padding: 0 var(--shf-s4) var(--shf-s6);
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 48px;
    align-items: start;
}

/* When sidebar is hidden */
.shf-shop-layout--no-sidebar {
    grid-template-columns: 1fr;
}

.shf-shop-layout--no-sidebar .shf-shop-sidebar {
    display: none;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.shf-shop-sidebar {
    position: sticky;
    top: calc(66px + 16px);
    max-height: calc(100vh - 82px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--shf-border) transparent;
}

.shf-shop-sidebar__inner {
    background: var(--shf-white);
    border: 1px solid var(--shf-border);
    border-radius: 3px;
    overflow: hidden;
}

.shf-shop-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--shf-border);
    background: var(--shf-parchment);
}

.shf-shop-sidebar__title {
    font-family: var(--shf-font-sans);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--shf-charcoal);
}

.shf-shop-sidebar__clear {
    font-family: var(--shf-font-sans);
    font-size: 11px;
    color: var(--shf-stone);
    text-decoration: underline;
    text-underline-offset: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.15s;
}

.shf-shop-sidebar__clear:hover {
    color: var(--shf-red);
}

.shf-shop-sidebar__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: var(--shf-forest);
    color: var(--shf-white);
    font-family: var(--shf-font-sans);
    font-size: 9px;
    font-weight: 600;
    border-radius: 50%;
    padding: 0 4px;
}

/* Sidebar sections */
.shf-sidebar-section {
    border-bottom: 1px solid var(--shf-border);
}

.shf-sidebar-section:last-of-type {
    border-bottom: none;
}

.shf-sidebar-section__toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: var(--shf-font-sans);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--shf-charcoal);
    text-align: left;
    transition: background 0.15s;
}

.shf-sidebar-section__toggle:hover {
    background: var(--shf-parchment);
}

.shf-sidebar-toggle-icon {
    font-family: var(--shf-font-sans);
    font-size: 16px;
    font-weight: 300;
    color: var(--shf-stone);
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.shf-sidebar-section__body {
    padding: 4px 20px 16px;
    overflow: hidden;
    transition: max-height 0.28s ease, padding 0.28s;
}

.shf-sidebar-section__body.is-collapsed {
    max-height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
}

/* Category links */
.shf-sidebar-cat-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-family: var(--shf-font-sans);
    font-size: 13px;
    font-weight: 300;
    color: var(--shf-stone);
    text-decoration: none;
    border-bottom: 1px solid var(--shf-border);
    transition: color 0.15s;
}

.shf-sidebar-cat-link:last-child {
    border-bottom: none;
}

.shf-sidebar-cat-link:hover,
.shf-sidebar-cat-link.is-active {
    color: var(--shf-forest);
}

.shf-sidebar-cat-link.is-active {
    font-weight: 500;
}

.shf-sidebar-cat-count {
    font-size: 11px;
    color: var(--shf-border);
    font-weight: 300;
}

/* Checkboxes */
.shf-sidebar-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
}

.shf-sidebar-checkbox {
    width: 15px;
    height: 15px;
    accent-color: var(--shf-forest);
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 2px;
}

.shf-sidebar-check label {
    font-family: var(--shf-font-sans);
    font-size: 13px;
    font-weight: 300;
    color: var(--shf-charcoal);
    cursor: pointer;
    line-height: 1.35;
}

.shf-sidebar-check:hover label {
    color: var(--shf-forest);
}

/* ============================================================
   PRICE RANGE SLIDER
   ============================================================ */
.shf-price-slider-wrap {
    position: relative;
    height: 24px;
    margin: 12px 0 8px;
}

.shf-price-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    height: 4px;
    background: var(--shf-border);
    border-radius: 2px;
    pointer-events: none;
}

.shf-price-fill {
    position: absolute;
    height: 100%;
    background: var(--shf-forest);
    border-radius: 2px;
    transition: left 0.1s, width 0.1s;
}

/* Dual range inputs stacked */
.shf-price-range {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    pointer-events: none;
    outline: none;
}

.shf-price-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--shf-white);
    border: 2px solid var(--shf-forest);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    transition: border-color 0.15s, transform 0.15s;
}

.shf-price-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    border-color: var(--shf-sage);
}

.shf-price-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--shf-white);
    border: 2px solid var(--shf-forest);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.shf-price-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.shf-price-label {
    font-family: var(--shf-font-sans);
    font-size: 12px;
    color: var(--shf-stone);
    font-weight: 400;
}

/* Apply button (mobile only) */
.shf-filter-apply-btn {
    display: none;
    width: calc(100% - 40px);
    margin: 16px 20px;
    justify-content: center;
}

/* ============================================================
   SORT BAR
   ============================================================ */
.shf-shop-sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 20px;
    border-bottom: 1px solid var(--shf-border);
    margin-bottom: 28px;
    gap: var(--shf-s3);
    flex-wrap: wrap;
    background: var(--shf-cream);
    transition: box-shadow 0.2s;
    z-index: 50;
}

.shf-shop-sort-bar.is-sticky {
    position: sticky;
    padding: 12px 20px;
    margin-left: calc(-1 * var(--shf-s4));
    margin-right: calc(-1 * var(--shf-s4));
    border-bottom-color: var(--shf-border);
    box-shadow: 0 2px 16px rgba(0,0,0,0.07);
}

.shf-shop-sort-bar__left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.shf-shop-sort-bar__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.shf-shop-filter-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--shf-font-sans);
    font-size: 11px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-weight: 500;
    color: var(--shf-charcoal);
    background: none;
    border: 1px solid var(--shf-border);
    border-radius: var(--shf-radius);
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.shf-shop-filter-toggle:hover {
    border-color: var(--shf-forest);
    color: var(--shf-forest);
}

.shf-shop-sort-bar__filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    background: var(--shf-forest);
    color: var(--shf-white);
    font-size: 9px;
    font-weight: 600;
    border-radius: 50%;
    padding: 0 3px;
}

.shf-shop-sort-bar__count {
    font-family: var(--shf-font-sans);
    font-size: 13px;
    color: var(--shf-stone);
    font-weight: 300;
}

.shf-shop-sort-bar__count strong {
    color: var(--shf-charcoal);
    font-weight: 500;
}

.shf-shop-sort-bar__count em {
    font-style: italic;
    color: var(--shf-forest);
    font-weight: 400;
}

/* Active filter pills */
.shf-active-filter-pill {
    font-family: var(--shf-font-sans);
    font-size: 11px;
    font-weight: 400;
    padding: 5px 11px;
    background: rgba(27,58,24,0.07);
    border: 1px solid rgba(27,58,24,0.2);
    border-radius: 20px;
    color: var(--shf-forest);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.shf-active-filter-pill:hover {
    background: rgba(192,57,43,0.07);
    border-color: rgba(192,57,43,0.25);
    color: var(--shf-red);
}

/* Sort select */
.shf-sort-select {
    font-family: var(--shf-font-sans);
    font-size: 12px;
    color: var(--shf-charcoal);
    border: 1px solid var(--shf-border);
    padding: 8px 32px 8px 12px;
    border-radius: var(--shf-radius);
    background: var(--shf-white);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23767268' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.shf-sort-select:focus {
    border-color: var(--shf-forest);
}

.shf-shop-sort-form {
    display: flex;
    align-items: center;
}

/* ============================================================
   PRODUCT GRID — shop specific overrides
   ============================================================ */
.shf-shop-product-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* Out of stock overlay */
.shf-product-card__oos {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--shf-font-sans);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--shf-stone);
    backdrop-filter: blur(2px);
}

/* Out-of-stock add button */
.shf-product-card__add--oos {
    width: 100%;
    font-family: var(--shf-font-sans);
    font-size: 11px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    font-weight: 400;
    padding: 11px;
    background: none;
    color: var(--shf-stone);
    border: 1px solid var(--shf-border);
    border-radius: var(--shf-radius);
    cursor: pointer;
    transition: all 0.18s;
    text-align: center;
    display: block;
    text-decoration: none;
}

.shf-product-card__add--oos:hover {
    border-color: var(--shf-forest);
    color: var(--shf-forest);
}

/* Product card image link wrapper */
.shf-product-card__img-link {
    display: block;
    text-decoration: none;
}

/* Quick-view overlay on image (injected by JS) */
.shf-product-card__quick-view {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: rgba(27,58,24,0.9);
    color: var(--shf-white);
    font-family: var(--shf-font-sans);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.22s, transform 0.22s;
    pointer-events: none;
}

.shf-product-card:hover .shf-product-card__quick-view {
    opacity: 1;
    transform: none;
    pointer-events: all;
}

/* Product name link reset */
.shf-product-card__name a {
    text-decoration: none;
    color: inherit;
    transition: color 0.15s;
}

.shf-product-card__name a:hover {
    color: var(--shf-forest);
}

/* WC star ratings inside cards */
.shf-product-card__stars .star-rating {
    color: var(--shf-gold) !important;
    font-size: 12px !important;
    display: inline-block !important;
    float: none !important;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.shf-shop-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--shf-s6) var(--shf-s4);
}

.shf-shop-empty__icon {
    font-size: 56px;
    margin-bottom: 20px;
}

.shf-shop-empty__title {
    font-family: var(--shf-font-serif);
    font-size: 28px;
    font-weight: 400;
    color: var(--shf-charcoal);
    margin-bottom: 10px;
}

.shf-shop-empty__body {
    font-size: 15px;
    color: var(--shf-stone);
    font-weight: 300;
    margin-bottom: 28px;
    max-width: 400px;
    margin-inline: auto;
}

.shf-shop-empty__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
   MOBILE FILTER OVERLAY
   ============================================================ */
.shf-mobile-filter-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 298;
    opacity: 0;
    pointer-events: none; /* CRITICAL: never block taps when invisible */
    transition: opacity 0.25s;
}

.shf-mobile-filter-overlay.is-visible {
    opacity: 1;
    pointer-events: all;
}

/* ============================================================
   RESPONSIVE — SHOP
   ============================================================ */
@media (max-width: 1100px) {
    .shf-shop-layout {
        grid-template-columns: 210px 1fr;
        gap: 32px;
    }

    .shf-shop-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {

    /* Sidebar becomes fixed drawer on mobile */
    .shf-shop-layout {
        grid-template-columns: 1fr;
        padding-top: var(--shf-s3);
    }

    .shf-shop-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 300px;
        max-width: 85vw;
        max-height: 100vh;
        z-index: 299;
        background: var(--shf-white);
        transform: translateX( -100% );
        transition: transform 0.3s ease;
        border-right: 1px solid var(--shf-border);
        box-shadow: 4px 0 24px rgba(0,0,0,0.1);
        overflow-y: auto;
        border-radius: 0;
    }

    .shf-shop-sidebar.is-mobile-open {
        transform: translateX( 0 );
    }

    .shf-shop-sidebar__inner {
        border: none;
        border-radius: 0;
        min-height: 100%;
    }

    /* Show mobile overlay */
    .shf-mobile-filter-overlay {
        display: block;
    }

    /* Show apply button on mobile */
    .shf-filter-apply-btn {
        display: flex;
    }

    /* Mobile close button (injected by CSS, triggered by JS close btn) */
    .shf-shop-sidebar__header {
        position: sticky;
        top: 0;
        background: var(--shf-parchment);
        z-index: 1;
        padding: 18px 20px;
    }

    .shf-shop-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .shf-shop-sort-bar.is-sticky {
        position: static;
        margin-left: 0;
        margin-right: 0;
        padding: 14px 0 20px;
        box-shadow: none;
    }
}

@media (max-width: 500px) {
    .shf-shop-product-grid {
        grid-template-columns: 1fr;
    }

    .shf-shop-sort-bar__right {
        width: 100%;
        justify-content: space-between;
    }
}

/* ============================================================
   PRODUCT CARD ACTIONS ROW
   Add to Cart + View Details side by side
   ============================================================ */
.shf-product-card__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.shf-product-card__view-link {
    display: block;
    text-align: center;
    font-family: var(--shf-font-sans);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 400;
    color: var(--shf-stone);
    text-decoration: none;
    padding: 8px 0;
    transition: color 0.18s;
}

.shf-product-card__view-link:hover {
    color: var(--shf-forest);
}
