/* ============================================================
   Alazeez — Piece Card
   Plugin: alazeez-card
   Fully self-contained. Assumes no global CSS for the card.
   ============================================================ */

/* ------------------------------------------------------------
   1. Design tokens
   Override these here or in global CSS if the brand changes.
   ------------------------------------------------------------ */
:root {
    /* Card layout */
    --alazeez-card-bg: #ffffff;
    --alazeez-card-border: 1px solid transparent;
    --alazeez-card-border-hover: 1px solid #c5c5c5;

    /* Title */
    --alazeez-card-title-height: 40px;
    --alazeez-card-title-margin-top: 14px;

    /* Image area */
    --alazeez-card-image-bg: rgb(246 243 238);
    --alazeez-card-image-ratio: 1 / 1;

    /* Arrows (Updated to your new colors) */
    --alazeez-card-arrow-size: 32px;
    --alazeez-card-arrow-color: #000000;          /* Black icon */
    --alazeez-card-arrow-bg: #dddddd;             /* Light gray background */
    --alazeez-card-arrow-color-hover: #ffffff;    /* White icon on hover */
    --alazeez-card-arrow-bg-hover: #9d9c9c;       /* Darker gray on hover */
    --alazeez-card-arrow-offset: 8px;

    /* Animations */
    --alazeez-card-fade: 250ms ease;
    --alazeez-card-arrow-fade: 200ms ease;
}

/* ------------------------------------------------------------
   Reset for the featured image — overrides legacy absolute
   positioning from the old two-image hover setup.
   ------------------------------------------------------------ */
.product-card .first-image,
.image-container .first-image,
a .image-container .first-image {
    position: relative !important;
    opacity: 1 !important;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: none;
}

/* ------------------------------------------------------------
   2. Card wrapper
   ------------------------------------------------------------ */
.product-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: center;
    background: var(--alazeez-card-bg);
    border: var(--alazeez-card-border);
    position: relative;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.product-card:hover {
    border: var(--alazeez-card-border-hover);
}

.product-card *,
.product-card *::before,
.product-card *::after {
    box-sizing: border-box;
}

/* ------------------------------------------------------------
   3. Card links (image + title)
   ------------------------------------------------------------ */
.product-card .no-animation,
.product-card .product-card__title-link {
    display: block;
    width: 100%;
    text-decoration: none;
    color: inherit;
    outline: none;
}

.product-card .no-animation:focus-visible,
.product-card .product-card__title-link:focus-visible {
    outline: 2px solid var(--alazeez-card-arrow-color);
    outline-offset: 2px;
}

/* ------------------------------------------------------------
   4. Image area
   ------------------------------------------------------------ */
.image-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: var(--alazeez-card-image-ratio);
    background: var(--alazeez-card-image-bg); /* This is #f5f5f5 */
    
    /* NEW: Forces the multiply blend mode to only look at this container's background */
    isolation: isolate; 
}

/* Featured image — defines the layout box, fills container */
.first-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    
    /* NEW: The white-background blending trick */
    mix-blend-mode: multiply;
}

/* Shared image class (kept for compatibility) */
.product-img {
    display: block;
    max-width: 100%;
}

/* ------------------------------------------------------------
   5. Gallery slide layer
   ------------------------------------------------------------ */
.gallery-slides {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.gallery-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transition: opacity var(--alazeez-card-fade);
    pointer-events: none;
    will-change: opacity;
    
    /* Keep this so the slides don't bleed through each other */
    background-color: var(--alazeez-card-bg); 
    
    /* NEW: The white-background blending trick */
    mix-blend-mode: multiply; 
}

.gallery-slide.is-active {
    opacity: 1;
}

/* ------------------------------------------------------------
   6. Navigation arrows
   ------------------------------------------------------------ */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: var(--alazeez-card-arrow-size);
    height: var(--alazeez-card-arrow-size);
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 50%;
    
    /* Variables applied here */
    background: var(--alazeez-card-arrow-bg);
    color: var(--alazeez-card-arrow-color);
    
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity var(--alazeez-card-arrow-fade),
        background-color var(--alazeez-card-arrow-fade),
        color var(--alazeez-card-arrow-fade);

    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    -webkit-appearance: none;
    appearance: none;
}

.gallery-arrow svg {
    display: block;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.gallery-arrow--prev {
    left: var(--alazeez-card-arrow-offset);
}

.gallery-arrow--next {
    right: var(--alazeez-card-arrow-offset);
}

.gallery-arrow:hover {
    /* Variables applied here */
    background: var(--alazeez-card-arrow-bg-hover);
    color: var(--alazeez-card-arrow-color-hover);
}

.gallery-arrow:focus-visible {
    opacity: 1;
    pointer-events: auto;
    outline: 2px solid var(--alazeez-card-arrow-color);
    outline-offset: 2px;
}

/* Arrows reveal on card hover */
.product-card:hover .gallery-arrow {
    opacity: 1;
    pointer-events: auto;
}

/* Arrow hidden at ends (A2 behavior) */
.gallery-arrow.is-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Touch devices: always show arrows (no hover state available) */
@media (hover: none) {
    .gallery-arrow {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ------------------------------------------------------------
   7. Title
   ------------------------------------------------------------ */
.product-card .product-card__title-link {
    margin: var(--alazeez-card-title-margin-top) 0 0;
    padding: 0;
    text-transform: uppercase;
    font-weight: bold; 

    /* Layout */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    text-decoration: none;
}

/* ------------------------------------------------------------
   7.5 Metal Finish Color
   ------------------------------------------------------------ */
.product-card__metal {
    margin-top: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #777777; /* Muted gray for a luxury feel */
    height: 18px;   /* Fixed height to keep grid alignment */
    display: flex;
    align-items: flex-start;
    justify-content: center;
}


/* ------------------------------------------------------------
   8. Oxygen shortcode wrapper safety net
   ------------------------------------------------------------ */
.piece-card-shortcode {
    width: 100%;
    display: block;
}

/* ------------------------------------------------------------
   9. Reduced motion
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .gallery-slide,
    .gallery-arrow,
    .product-card {
        transition: none !important;
    }
}