/**
 * BigDIAMOND catalogue product card.
 *
 * Loaded on every route that renders a WooCommerce product loop. The card owns
 * its own grid item: fixed image ratio, fixed slot order, and a body that grows
 * only in the title/spec area so price and CTA stay on the same baseline across
 * the whole row.
 */

.bd-card {
    --bd-card-pad: 16px;
    --bd-card-fade: 210ms;
    position: relative;
    display: flex;
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    background: var(--bd-surface-panel);
    transition: transform var(--bd-card-fade) var(--bd-ease-out),
        box-shadow var(--bd-card-fade) var(--bd-ease-out);
}

/* The card is the whole grid item; the <li> keeps WooCommerce's own classes. */
.bd-commerce.woocommerce ul.products li.product,
.bd-commerce.woocommerce-page ul.products li.product {
    overflow: hidden;
}

.bd-card:hover,
.bd-card:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(15, 42, 29, 0.1);
}

/* The catalogue uses image-led cards: hierarchy comes from type and spacing,
 * not another panel around every product. Other Woo loops retain their card. */
.bd-commerce .bd-catalog-results ul.products li.product,
.bd-commerce .bd-catalog-results .bd-card {
    border: 0;
    background: transparent;
}

.bd-commerce .bd-catalog-results .bd-card:hover,
.bd-commerce .bd-catalog-results .bd-card:focus-within {
    box-shadow: none;
}

/* -------------------------------------------------------------------------
 * Media
 * ---------------------------------------------------------------------- */

.bd-card__media {
    position: relative;
    display: block;
    background: #fff;
}

.bd-card__media-link {
    display: block;
    text-decoration: none;
}

.bd-card__media-link:focus-visible {
    outline: 2px solid var(--bd-primary);
    outline-offset: -2px;
}

/*
 * The frame reserves the full image box before any image decodes, so swapping
 * gallery panels — or loading one late — can never shift the layout.
 */
.bd-card__frame {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.bd-commerce ul.products li.product .bd-card__frame .bd-card__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    background: #fff;
    object-fit: contain;
    opacity: 0;
    transition: opacity var(--bd-card-fade) var(--bd-ease-out), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.bd-commerce ul.products li.product .bd-card__frame .bd-card__img--active {
    opacity: 1;
}

.bd-card:hover .bd-card__frame .bd-card__img--active,
.bd-card:focus-within .bd-card__frame .bd-card__img--active {
    transform: scale(1.03);
}

.bd-card__img--placeholder {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 1;
}

/* -------------------------------------------------------------------------
 * Badges
 * ---------------------------------------------------------------------- */

.bd-card__badges {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    max-width: calc(100% - 20px);
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    pointer-events: none;
}

.bd-card__badge {
    margin: 0;
    padding: 4px 8px;
    background: var(--bd-primary);
    color: var(--bd-on-primary);
    font: 700 10px/1.2 var(--bd-sans);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.bd-card__badge--sale {
    background: var(--bd-gold-ink);
}

.bd-card__badge--last-one {
    background: #7a4a12;
}

.bd-card__badge--out-of-stock {
    background: var(--bd-surface-highest);
    color: #5a1f1f;
}

/* -------------------------------------------------------------------------
 * Gallery indicators
 * ---------------------------------------------------------------------- */

.bd-card__gallery {
    position: absolute;
    right: 8px;
    bottom: 6px;
    left: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.bd-card__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
}

/*
 * The visible square stays small, but the button itself keeps a comfortable
 * 24px hit area with generous padding around the mark.
 */
.bd-card__dot {
    display: inline-flex;
    width: 24px;
    height: 24px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.bd-card__dot-mark {
    display: block;
    width: 7px;
    height: 7px;
    background: rgba(15, 42, 29, 0.28);
    box-shadow: 0 0 0 1px rgba(250, 249, 246, 0.75);
    transition: background var(--bd-card-fade) var(--bd-ease-out),
        transform var(--bd-card-fade) var(--bd-ease-out);
}

.bd-card__dot.is-active .bd-card__dot-mark,
.bd-card__dot:hover .bd-card__dot-mark {
    background: var(--bd-primary);
    transform: scale(1.28);
}

.bd-card__dot:focus-visible {
    outline: 2px solid var(--bd-primary);
    outline-offset: -3px;
}

/*
 * Counter text never sits directly on the photograph: it keeps its own opaque
 * plate so the contrast is independent of the image behind it.
 */
.bd-card__counter {
    padding: 2px 6px;
    background: var(--bd-surface-panel);
    color: var(--bd-primary);
    font: 700 10px/1.4 var(--bd-sans);
    letter-spacing: 0.06em;
    box-shadow: 0 0 0 1px var(--bd-border-soft);
}

/* Large galleries: drop the square rail, keep the exact count. */
.bd-card__gallery--compact .bd-card__dots {
    display: none;
}

/* -------------------------------------------------------------------------
 * Body
 * ---------------------------------------------------------------------- */

.bd-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: var(--bd-card-pad);
    gap: 8px;
}

.bd-commerce ul.products li.product .bd-card__title {
    display: -webkit-box;
    width: 100%;
    max-width: none;
    min-height: 3.9em;
    margin: 0;
    padding: 0;
    align-self: stretch;
    overflow: hidden;
    color: var(--bd-primary);
    font: 600 16px/1.32 var(--bd-sans);
    overflow-wrap: anywhere;
    text-wrap: wrap;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

/*
 * The colour is repeated for every link state on purpose. GeneratePress emits
 * `a, a:hover, a:focus, a:active { color: rgba(0,0,0,0) }` from the Customizer
 * when no link colour is configured, and `a:hover` (0,1,1) would otherwise
 * outrank a plain `.bd-card__title-link` (0,1,0) and turn the product name
 * invisible on hover. Naming the states here restores the win.
 */
.bd-card__title-link,
.bd-card__title-link:hover,
.bd-card__title-link:focus,
.bd-card__title-link:active,
.bd-card__title-link:visited {
    display: block;
    width: 100%;
    color: inherit;
    text-decoration: none;
}

/*
 * Hover/focus is carried by colour alone — no underline. Scoped this heavily to
 * outrank the `color: inherit` pinned on `.bd-card__title-link:hover` above and
 * WooCommerce's `.woocommerce ul.products li.product a` (0,3,3).
 */
.bd-commerce ul.products li.product .bd-card__title-link:hover,
.bd-commerce ul.products li.product .bd-card__title-link:focus-visible {
    color: var(--bd-gold-ink);
    text-decoration: none;
}

.bd-card__title-link:focus-visible {
    outline: 2px solid var(--bd-primary);
    outline-offset: 2px;
}

/*
 * Label and value form one hugging pair. The pair block is centred to match
 * the surrounding catalogue typography, but the text inside stays left-aligned
 * so the rows read as a specification list rather than two stray columns.
 */
.bd-card__specs {
    display: grid;
    max-width: 100%;
    margin: 0 auto;
    grid-template-columns: max-content minmax(0, max-content);
    gap: 1px 6px;
    color: var(--bd-muted);
    font: 400 11px/1.4 var(--bd-sans);
    text-align: left;
    opacity: 0.88;
}

.bd-card__spec {
    display: contents;
}

.bd-card__spec-label {
    margin: 0;
    font-weight: 400;
    color: #777;
}

.bd-card__spec-label::after {
    content: ":";
}

.bd-card__spec-value {
    margin: 0;
    color: var(--bd-text);
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* Price, availability and CTA are pinned to the bottom of every card. */
.bd-commerce ul.products li.product .bd-card__body .price {
    margin: auto 0 0;
    padding: 2px 0 0;
    color: var(--bd-gold-ink);
    font: 700 16px/1.3 var(--bd-sans);
}

.bd-commerce ul.products li.product .bd-card__body .bd-loop-availability {
    min-height: 0;
    margin: 1px 0 0;
    font-size: 11px;
    font-weight: 500;
}

.bd-card__cta {
    display: flex;
    margin-top: 4px;
    flex-direction: column;
}

.bd-commerce ul.products li.product .bd-card__cta .button {
    display: inline-flex;
    min-height: 44px;
    margin: 0;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.bd-commerce ul.products li.product .bd-card__cta .added_to_cart {
    margin-top: 8px;
    color: var(--bd-gold-ink);
    font: 700 11px/1.3 var(--bd-sans);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bd-commerce ul.products li.product .bd-card__body .star-rating {
    margin: 0;
    font-size: 0.8em;
}

/* -------------------------------------------------------------------------
 * Touch and small screens
 * ---------------------------------------------------------------------- */

@media (hover: none), (pointer: coarse) {
    /* Controls must never depend on hover to become reachable. */
    .bd-card__dot {
        width: 28px;
        height: 28px;
    }

    .bd-card__dot-mark {
        width: 8px;
        height: 8px;
    }

    .bd-card:hover {
        transform: none;
        box-shadow: none;
    }
}

@media (max-width: 600px) {
    .bd-card {
        --bd-card-pad: 12px;
    }

    .bd-commerce ul.products li.product .bd-card__title {
        font-size: 14px;
    }

    .bd-card__specs {
        font-size: 11px;
    }
}

/*
 * The three-line title reserve exists to align price and CTA across a row.
 * Mobile catalogues now keep a two-column row, so the reserve remains useful
 * even in the narrow container-query state.
 */
@container bd-catalog-results (max-width: 479px) {
    .bd-commerce ul.products li.product .bd-card__title {
        min-height: 3.9em;
    }
}

/* -------------------------------------------------------------------------
 * Compare toggle (media actions)
 * ---------------------------------------------------------------------- */

.bd-card__media {
    position: relative;
}

.bd-card__media-actions {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.bd-card__compare,
.bd-card__wishlist {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 4px;
    color: var(--bd-primary, #0F342A);
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 180ms ease, transform 180ms ease, color 180ms ease;
}

/* Standalone fallback if rendered without wrapper */
.bd-card > .bd-card__compare {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
}

.bd-card > .bd-card__wishlist {
    position: absolute;
    top: 48px;
    left: 10px;
    z-index: 3;
}

.bd-card:hover .bd-card__compare,
.bd-card:hover .bd-card__wishlist,
.bd-card:focus-within .bd-card__compare,
.bd-card:focus-within .bd-card__wishlist,
.bd-card__compare:focus,
.bd-card__compare:focus-visible,
.bd-card__compare:active,
.bd-card__wishlist:focus,
.bd-card__wishlist:focus-visible,
.bd-card__wishlist:active,
.bd-card__compare.is-active,
.bd-card__compare[aria-pressed="true"],
.bd-card__wishlist.is-active,
.bd-card__wishlist[aria-pressed="true"] {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0);
}

.bd-card__compare:hover,
.bd-card__compare:focus,
.bd-card__compare:focus-visible,
.bd-card__compare:active,
.bd-card__wishlist:hover,
.bd-card__wishlist:focus,
.bd-card__wishlist:focus-visible,
.bd-card__wishlist:active {
    background: transparent !important;
    color: var(--bd-gold, #B8924F) !important;
    transform: scale(1.15);
    outline: none;
}

.bd-card__compare:focus-visible,
.bd-card__wishlist:focus-visible {
    outline: 2px solid var(--bd-gold, #B8924F);
    outline-offset: 2px;
}

/* Active / Pressed states - must stay golden and visible under all circumstances */
.bd-card__compare.is-active,
.bd-card__compare[aria-pressed="true"],
.bd-card__wishlist.is-active,
.bd-card__wishlist[aria-pressed="true"] {
    background: transparent !important;
    color: var(--bd-gold, #B8924F) !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.bd-card__compare.is-active:hover,
.bd-card__compare.is-active:focus,
.bd-card__compare.is-active:active,
.bd-card__compare[aria-pressed="true"]:hover,
.bd-card__compare[aria-pressed="true"]:focus,
.bd-card__compare[aria-pressed="true"]:active,
.bd-card__wishlist.is-active:hover,
.bd-card__wishlist.is-active:focus,
.bd-card__wishlist.is-active:active,
.bd-card__wishlist[aria-pressed="true"]:hover,
.bd-card__wishlist[aria-pressed="true"]:focus,
.bd-card__wishlist[aria-pressed="true"]:active {
    background: transparent !important;
    color: var(--bd-gold, #B8924F) !important;
    opacity: 1 !important;
    visibility: visible !important;
    outline: none;
}

.bd-card__compare svg path {
    stroke: currentColor !important;
    fill: none !important;
}

.bd-card__wishlist.is-active svg path,
.bd-card__wishlist[aria-pressed="true"] svg path {
    fill: currentColor !important;
    stroke: currentColor !important;
}

.bd-card__compare-icon,
.bd-card__wishlist-icon,
.bd-card__compare svg,
.bd-card__wishlist svg {
    width: 20px;
    height: 20px;
    flex: none;
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12)) drop-shadow(0 0 1px rgba(255, 255, 255, 0.9));
    transition: transform 180ms ease, stroke 180ms ease, fill 180ms ease;
}

.bd-card__compare-label {
    display: none !important;
}

@media (max-width: 1024px), (hover: none) {
    .bd-card__compare,
    .bd-card__wishlist {
        opacity: 0.92;
        transform: none;
    }
}

/* -------------------------------------------------------------------------
 * Reduced motion
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .bd-card__compare {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .bd-card,
    .bd-commerce ul.products li.product .bd-card__frame .bd-card__img,
    .bd-card__dot-mark {
        transition: none;
    }

    .bd-card:hover,
    .bd-card:focus-within {
        transform: none;
    }
}

.bd-card-reduced-motion .bd-card,
.bd-card-reduced-motion .bd-commerce ul.products li.product .bd-card__frame .bd-card__img,
.bd-card-reduced-motion .bd-card__dot-mark {
    transition: none;
}

.bd-card-reduced-motion .bd-card:hover,
.bd-card-reduced-motion .bd-card:focus-within {
    transform: none;
}

@media (forced-colors: active) {
    .bd-card__dot-mark {
        background: ButtonText;
        box-shadow: 0 0 0 1px Canvas;
    }

    .bd-card__dot.is-active .bd-card__dot-mark {
        background: Highlight;
    }
}

/* ============================================================
 * High-Contrast Black & White Luxury: Product Card
 * ============================================================ */

.bd-product-card__subtitle {
    font-family: var(--bd-font-sans, "Manrope", sans-serif);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: #555555;
    margin: 0.25rem 0 0.5rem;
    line-height: 1.4;
}

.bd-commerce ul.products li.product .bd-card__cta .button {
    background: #0F4C3A !important;
    color: #FFFFFF !important;
    border: 1px solid #0F4C3A !important;
    font-family: var(--bd-font-sans, "Manrope", sans-serif) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    border-radius: 0 !important;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
}

.bd-commerce ul.products li.product .bd-card__cta .button:hover {
    background: #093327 !important;
    border-color: #093327 !important;
    color: #FFFFFF !important;
}

/* ============================================================
 * Family Cards & Metal Swatches
 * ============================================================ */

.bd-card__family {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 4px 0 8px;
    min-height: 22px;
}

.bd-card__family-badge {
    display: inline-flex;
    align-items: center;
    font-family: var(--bd-font-sans, "Manrope", sans-serif);
    font-size: 0.6875rem;
    font-weight: 500;
    color: #666666;
    background: #f5f4f2;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.bd-card__swatches {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bd-card__swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid transparent;
    padding: 1px;
    transition: transform 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    background: transparent;
}

.bd-card__swatch.is-active {
    border-color: #111111;
}

.bd-card__swatch:hover {
    transform: scale(1.18);
}

.bd-card__swatch-dot {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.bd-card__swatch--zolte .bd-card__swatch-dot {
    background: linear-gradient(135deg, #f7df94 0%, #cda032 100%);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.bd-card__swatch--biale .bd-card__swatch-dot {
    background: linear-gradient(135deg, #f8f8f8 0%, #cfcfcf 100%);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.bd-card__swatch--rozowe .bd-card__swatch-dot {
    background: linear-gradient(135deg, #f7c5ba 0%, #cb8578 100%);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.bd-price-prefix {
    font-size: 0.85em;
    font-weight: 400;
    color: #666666;
    margin-right: 3px;
}
