/*
 * Angus Alchemy – Shop layout and product listings (Hover State, Nov 2026)
 *
 * 1. Sticky category link bar on the Shop page
 * 2. Consistent product cards in every Elementor product grid
 */

:root {
    --aa-gold: #b79e4b;
    --aa-copper: #b87333;
    --aa-ink: #1b1b1a;
    --aa-charcoal: #3c3c3b;
    --aa-light-gray: #f5f5f5;
    /* Set by shop.js from the height of the sticky site header */
    --aa-header-offset: 0px;
    --aa-shop-nav-height: 56px;
}

/* ---------- 1. Category link bar ---------- */

.aa-shop-nav-widget {
    position: sticky;
    top: var(--aa-header-offset);
    /* Below both site headers (desktop header z-index 50, phone/tablet 99) so that when
       the bar unsticks at the end of the products and scrolls up, it passes under the header. */
    z-index: 40;
    width: 100%;
    margin-bottom: 10px !important;

    /* Bar background spans the full screen width (the links stay centred in
       .aa-shop-nav__inner); body has overflow-x: clip, so 100vw can't add a scrollbar. */
    .aa-shop-nav {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        box-sizing: border-box;
        background: transparent;
        box-shadow: none;
        transition:
            background-color 0.25s ease,
            box-shadow 0.25s ease;
    }

    /* While pinned under the header (class set by shop.js) */
    &.is-stuck .aa-shop-nav {
        background: #fff;
        box-shadow: 0 2px 6px rgba(27, 27, 26, 0.08);
    }

    .aa-shop-nav__inner {
        display: flex;
        justify-content: center;
        gap: 8px;
        max-width: 1140px;
        margin: 0 auto;
        padding: 10px 16px;
    }

    /* Secondary buttons, as in the homepage proposal ("Shop all", "View basket"):
       dark outline and text; filled dark for hover and the current section. */
    .aa-shop-nav__link {
        flex: 0 0 auto;
        padding: 8px 17px; /* + 1px border = same size as before */
        border: 1px solid var(--aa-ink);
        background: transparent;
        color: var(--aa-ink);
        font-family: "Rokkitt", serif;
        font-size: 17px;
        font-weight: 700;
        letter-spacing: 1px;
        line-height: 1.2;
        text-transform: uppercase;
        text-decoration: none;
        white-space: nowrap;
        transition:
            background-color 0.25s ease,
            color 0.25s ease;
    }

    .aa-shop-nav__link:hover,
    .aa-shop-nav__link:focus-visible,
    .aa-shop-nav__link.is-active,
    .aa-shop-nav__link[aria-current="true"] {
        background: var(--aa-ink);
        color: #fff;
    }

    .aa-shop-nav__link:focus-visible {
        outline: 2px solid var(--aa-charcoal);
        outline-offset: 2px;
    }
}

/* Land each section below the header and the link bar.
   (Not nested: the sections sit beside the bar, not inside it.) */
.aa-shop-section {
    scroll-margin-top: calc(
        var(--aa-header-offset) + var(--aa-shop-nav-height) + 10px
    );
}

/* Phones and tablets (up to 1024px, Elementor's tablet breakpoint): a
   "Shop by category ▾" button with a panel of the category buttons replaces the row */
.aa-shop-nav__mobile {
    display: none;
}

@media (max-width: 1024px) {
    .aa-shop-nav-widget .aa-shop-nav__inner {
        display: none;
    }

    .aa-shop-nav-widget .aa-shop-nav__mobile {
        position: relative;
        display: flex;
        align-items: center;
        gap: 12px;
        /* 20px in from the sides = the product column's padding on phones, so the
           button lines up with the headings and cards; same 20px above it */
        padding: 20px;
    }


    /* Secondary-button look: 1px dark outline, Rokkitt, chevron on the right */
    .aa-shop-nav-widget .aa-shop-nav__toggle {
        flex: 1 1 auto;
        min-width: 0;
        height: 44px;
        margin: 0;
        padding: 0 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        border: 1px solid var(--aa-ink);
        border-radius: 0;
        background: transparent;
        color: var(--aa-ink);
        font-family: "Rokkitt", serif;
        font-size: 15px;
        font-weight: 700;
        letter-spacing: 1px;
        line-height: 1;
        text-transform: uppercase;
        cursor: pointer;
        transition:
            background-color 0.25s ease,
            color 0.25s ease;
    }

    .aa-shop-nav-widget .aa-shop-nav__toggle:hover,
    .aa-shop-nav-widget .is-open .aa-shop-nav__toggle {
        background: var(--aa-ink);
        color: #fff;
    }

    .aa-shop-nav-widget .aa-shop-nav__toggle-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .aa-shop-nav-widget .aa-shop-nav__chevron {
        flex: 0 0 auto;
        transition: transform 0.25s ease;
    }

    .aa-shop-nav-widget .is-open .aa-shop-nav__chevron {
        transform: rotate(180deg);
    }

    .aa-shop-nav-widget .aa-shop-nav__toggle:focus-visible {
        outline: 2px solid var(--aa-charcoal);
        outline-offset: 2px;
    }

    /* Panel drops down under the bar, over the products */
    .aa-shop-nav-widget .aa-shop-nav__panel {
        position: absolute;
        /* starts at the main button's bottom edge (the bar has 20px below it),
           so there is 20px between the button and the first option */
        top: calc(100% - 20px);
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 20px; /* 20px sides = same width as the main button */
        background: #fff;
        box-shadow: 0 8px 16px rgba(27, 27, 26, 0.12);
    }

    /* While the panel is open the bar is white too (even at the top of the page),
       so the button and the options read as one white block */
    .aa-shop-nav-widget .aa-shop-nav.has-open-panel {
        background: #fff;
    }

    .aa-shop-nav-widget .aa-shop-nav__panel[hidden] {
        display: none;
    }

    .aa-shop-nav-widget .aa-shop-nav__panel .aa-shop-nav__link {
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 9px 14px;
        margin: 0;
        text-align: center;
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    html:has(.aa-shop-nav) {
        scroll-behavior: smooth;
    }
}

/* ---------- 2. Product cards (every Elementor product grid) ---------- */

/*
 * Laid out like the homepage cocktail cards: photo edge to edge at the top,
 * name, price and buttons in a padded area below, buttons pinned to the bottom.
 *
 * Selectors start with the widget + .elementor-products-grid + .elementor-grid so they
 * outrank Elementor Pro's own "li.product { display: var(--button-align-display); padding: 0 }".
 */
.elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product {
    display: flex;
    flex-direction: column;
    padding: 0 0 22px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
    transition: box-shadow 0.25s ease;
}

/* Slight lift on hover only (no shadow at rest) */
.elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product:hover {
    box-shadow: 0 4px 16px rgba(27, 27, 26, 0.1);
}

/* Link holding photo, name and price grows to fill the card, pushing the buttons down */
.elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product > a.woocommerce-loop-product__link {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

/* Same square photo for every product, edge to edge.
   !important: Elementor sets a per-widget image radius that would round the photo's
   bottom corners inside the card. */
.elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    margin: 0 0 18px !important;
    border-radius: 0 !important;
}

.elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product .woocommerce-loop-product__title,
.elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product .price {
    padding-left: 20px !important;
    padding-right: 20px !important;
}

/* Price sits straight under the name; the spare space collects below it,
   so only the buttons line up along the bottom of the card. */
.elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product .price {
    margin-top: 0;
    margin-bottom: 16px;
}

/* Add to basket: full width inside the padding, pinned to the bottom (the link above grows).
   Colours come from Elementor (gold, copper on hover); this fades between them. */
.elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product > .button {
    display: block;
    width: auto;
    margin-left: 20px;
    margin-right: 20px;
    box-sizing: border-box;
    text-align: center;
    transition:
        background-color 0.25s ease,
        color 0.25s ease;
}

/* "View basket" (added by WooCommerce after Add to basket): secondary button,
   styled like the homepage proposal's outline buttons (e.g. "Shop all"). */
body .elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product > a.added_to_cart.wc-forward {
    display: block;
    width: auto;
    margin: 10px 20px 0;
    margin-inline-start: 20px;
    padding: calc(0.618em + 1px) calc(1em + 1px); /* + 1px border = same size as before */
    border: 1px solid var(--aa-ink);
    background: transparent;
    color: var(--aa-ink);
    font-family: "Rokkitt", serif;
    font-size: 100%;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    box-sizing: border-box;
    transition:
        background-color 0.25s ease,
        color 0.25s ease;
}

body .elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product > a.added_to_cart.wc-forward:hover,
body .elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product > a.added_to_cart.wc-forward:focus-visible {
    background: var(--aa-ink);
    color: #fff;
}

@media (max-width: 767px) {
    .elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product {
        padding-bottom: 14px;
    }

    .elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product img {
        margin-bottom: 12px !important;
    }

    .elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product .woocommerce-loop-product__title,
    .elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product .price {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product > .button,
    body .elementor-widget-woocommerce-products.elementor-products-grid ul.products.elementor-grid li.product > a.added_to_cart.wc-forward {
        margin-left: 12px;
        margin-right: 12px;
        margin-inline-start: 12px;
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* Gift Cards: the FareHarbor card fills whatever width it is given (1120px wide,
   816px tall on desktop), so cap it at a single product-card size and centre it.
   Outranks Elementor's `.elementor.elementor .e-con > .elementor-widget { max-width: 100% }`. */
.elementor.elementor .e-con > .elementor-widget-shortcode.aa-shop-gift-card {
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- 3. Category pages ---------- */

/* Phones: 12px between the breadcrumb ("Home / Gin") and the products, matching the
   12px under the Shop's section titles. Removes WooCommerce's own space under the
   breadcrumb and sets Elementor's widget gap. */
@media (max-width: 767px) {
    .elementor-location-archive .elementor-widget-woocommerce-breadcrumb .woocommerce-breadcrumb {
        margin-bottom: 0;
    }

    .elementor-location-archive .elementor-widget-woocommerce-breadcrumb:not(:last-child) {
        margin-block-end: 12px;
    }
}
