/* =========================================================================
   Easy Elements — Product Grid Lite
   Two refined skins inspired by premium e-commerce (Aesop, Glossier, Apple):
     1. Default  — Refined card with quiet elegance, subtle hover, balanced ratio
     2. Minimal  — Clean editorial layout with serene whitespace and micro details
   ========================================================================= */

:root {
    --eel-pgl-primary:        #111111;
    --eel-pgl-primary-hover:  #2a2a2a;
    --eel-pgl-accent:         #c5302a;
    --eel-pgl-text:           #1a1a1a;
    --eel-pgl-muted:          #767676;
    --eel-pgl-border:         #ececec;
    --eel-pgl-card-bg:        #ffffff;
    --eel-pgl-image-bg:       #f4f3f0;
    --eel-pgl-shadow-quiet:   0 1px 3px rgba(17, 17, 17, 0.04);
    --eel-pgl-shadow-hover:   0 8px 24px rgba(17, 17, 17, 0.08);
    --eel-pgl-radius:         4px;
    --eel-pgl-ease:           cubic-bezier(0.4, 0, 0.2, 1);
    --eel-pgl-ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
}

/* -------------------------------------------------------------------------
   Base layout (shared by both skins)
   ------------------------------------------------------------------------- */
.eel-pgl {
    width: 100%;

    &-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 32px;
    }

    &-item {
        position: relative;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }

    &-image {
        position: relative;
        overflow: hidden;
        line-height: 0;
        background: var(--eel-pgl-image-bg);
        aspect-ratio: 4 / 3;

        a {
            display: block;
            position: relative;
            height: 100%;
        }

        img {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform .8s var(--eel-pgl-ease-out);
            will-change: transform;
        }
    }

    &-badge {
        position: absolute;
        top: 12px;
        left: 12px;
        z-index: 2;
        display: inline-block;
        background: #fff;
        color: var(--eel-pgl-text);
        font-size: 10px;
        font-weight: 600;
        line-height: 1;
        padding: 6px 10px;
        border-radius: 2px;
        text-transform: uppercase;
        letter-spacing: .1em;
    }

    &-content {
        display: flex;
        flex-direction: column;
        align-items: flex-start;  // Default — overridden by Card → Alignment control.
        gap: 6px;
    }

    &-title {
        // Layout reset only — typography is fully controlled via Elementor.
        margin: 0;

        a {
            color: inherit;
            text-decoration: none;
            transition: color .25s ease;
        }
    }
    .eel-pgl-title{
        font-size: 20px;
    }

    &-price {
        // Layout reset only — base typography is fully controlled via Elementor.
        margin: 0;

        // Old (strikethrough) price — slightly smaller, lighter, faded.
        del {
            opacity: .55;
            margin-right: 8px;
            font-weight: 400;
            font-size: 0.85em;
        }

        // Sale (current) price — slightly larger and bolder than the base.
        ins {
            background: transparent;
            text-decoration: none;
            font-size: 1.1em;
            font-weight: 600;
        }
    }

    &-excerpt {
        // Layout reset only — typography is fully controlled via Elementor.
        margin: 4px 0 0;
    }

    &-addtocart {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        padding: 10px 18px;
        font-size: 12px;
        font-weight: 500;
        line-height: 1;
        letter-spacing: .12em;
        text-transform: uppercase;
        text-decoration: none;
        cursor: pointer;
        transition: background-color .3s ease, color .3s ease, border-color .3s ease, gap .3s var(--eel-pgl-ease-out);

        // Arrow icon (hidden by default, slides in on hover)
        &::after {
            content: '';
            display: inline-block;
            width: 0;
            height: 12px;
            background-color: currentColor;
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E");
            -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E");
            mask-repeat: no-repeat;
            -webkit-mask-repeat: no-repeat;
            mask-position: center;
            -webkit-mask-position: center;
            mask-size: contain;
            -webkit-mask-size: contain;
            opacity: 0;
            transform: translateX(-4px);
            transition: width .3s var(--eel-pgl-ease-out), opacity .25s ease, transform .3s var(--eel-pgl-ease-out);
        }

        &:hover,
        &:focus {
            gap: 8px;

            &::after {
                width: 14px;
                opacity: 1;
                transform: translateX(0);
            }
        }

        &.added { display: none; }

        &.loading {
            opacity: .6;
            pointer-events: none;
        }
    }

    // "View Cart" link inserted by WC after a successful AJAX add-to-cart.
    // The Add-to-Cart button hides via `.added` class, so this link sits alone —
    // remove the inline-spacing margin so it doesn't look orphaned.
    .added_to_cart {
        display: inline-flex;
        align-items: center;
        margin-left: 0;
        font-size: 12px;
        font-weight: 500;
        color: var(--eel-pgl-muted);
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    &-empty,
    &-notice {
        padding: 40px 24px;
        text-align: center;
        background: #fafafa;
        border: 1px solid var(--eel-pgl-border);
        border-radius: var(--eel-pgl-radius);
        color: var(--eel-pgl-muted);
        font-size: 14px;
    }
}

/* -------------------------------------------------------------------------
   SKIN 1 — Default (refined card, quiet elegance)
   ------------------------------------------------------------------------- */
.eel-pgl-skin-default {
    .eel-pgl-item {
        background: var(--eel-pgl-card-bg);
        border-radius: var(--eel-pgl-radius);
        overflow: hidden;
        box-shadow: var(--eel-pgl-shadow-quiet);
        transition: box-shadow .4s var(--eel-pgl-ease);

        &:hover {
            box-shadow: var(--eel-pgl-shadow-hover);

            .eel-pgl-image img {
                transform: scale(1.03);
            }

            .eel-pgl-title a {
                color: var(--eel-pgl-primary-hover);
            }
        }
    }

    .eel-pgl-content {
        padding: 18px 20px 22px;
        gap: 8px;
    }

    .eel-pgl-addtocart {
        // Alignment is inherited from .eel-pgl-content's `align-items` (controlled via Card → Alignment).
        margin-top: 10px;
        background: var(--eel-pgl-primary);
        color: #fff;
        border: 1px solid var(--eel-pgl-primary);
        border-radius: 2px;

        &:hover,
        &:focus {
            background: transparent;
            color: var(--eel-pgl-primary);
        }
    }
}

/* -------------------------------------------------------------------------
   SKIN 2 — Minimal (editorial, no card chrome)
   ------------------------------------------------------------------------- */
.eel-pgl-skin-minimal {
    .eel-pgl-item {
        background: transparent;
        box-shadow: none;
        border-radius: 0;

        &:hover {
            .eel-pgl-image img {
                transform: scale(1.03);
            }

            .eel-pgl-title a::after {
                transform: scaleX(1);
                transform-origin: left center;
            }
        }
    }

    .eel-pgl-image {
        margin-bottom: 16px;
        border-radius: 0;
    }

    .eel-pgl-badge {
        background: var(--eel-pgl-text);
        color: #fff;
    }

    .eel-pgl-content {
        padding: 0;
        gap: 4px;
    }

    .eel-pgl-title {
        // Skin-only structural tweak — typography stays user-controlled.
        margin-bottom: 2px;

        a {
            position: relative;
            display: inline;
            background-image: linear-gradient(currentColor, currentColor);
            background-size: 0% 1px;
            background-position: 0 100%;
            background-repeat: no-repeat;
            transition: background-size .4s var(--eel-pgl-ease-out);

            &:hover {
                background-size: 100% 1px;
            }
        }
    }

    .eel-pgl-price {
        // Skin-only color tweak — font-size/weight stay user-controlled.
        ins .amount,
        > .amount {
            color: var(--eel-pgl-text);
        }
    }

    .eel-pgl-addtocart {
        // Alignment is inherited from .eel-pgl-content's `align-items` (controlled via Card → Alignment).
        margin-top: 6px;
        padding: 0;
        background: transparent;
        color: var(--eel-pgl-text);
        border: 0;
        text-transform: uppercase;
        letter-spacing: .14em;
        font-size: 11px;
        background-image: linear-gradient(currentColor, currentColor);
        background-size: 100% 1px;
        background-position: 0 100%;
        background-repeat: no-repeat;
        padding-bottom: 4px;

        &:hover,
        &:focus {
            background: transparent;
            color: var(--eel-pgl-accent);
            background-image: linear-gradient(currentColor, currentColor);
            background-size: 100% 1px;
            background-position: 0 100%;
            background-repeat: no-repeat;
        }
    }
}

/* -------------------------------------------------------------------------
   Responsive — gracefully degrade columns
   ------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .eel-pgl-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (max-width: 600px) {
    .eel-pgl-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }
}

/* -------------------------------------------------------------------------
   Reduced motion accessibility
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .eel-pgl-image img,
    .eel-pgl-addtocart,
    .eel-pgl-title a,
    .eel-pgl-skin-default .eel-pgl-item {
        transition: none !important;
    }
}
