/* ============================================================
   G5-PRODUCT-CARDS.CSS — Gadget5 Unified Card System (v1.3)
   Fixes in this version:
   - Cart icon now truly dead-center (absolute positioning, immune
     to the theme/WooCommerce default button padding that was
     pushing it into a corner).
   - Wishlist heart no longer turns black on hover (theme's default
     button:hover style was leaking in) — now a clean white +
     turquoise ring.
   - Added round product marquee styling (right-to-left scroll),
     used via the [g5_product_marquee] shortcode.
   ============================================================ */
.g5-grid,
.g5-card-wrap,
.g5-card{
    --g5c-text: var(--g5-slate, var(--g5-text, #2F4F4F));
    --g5c-bg:   var(--g5-alice, var(--g5-bg, #F0F8FF));
}

.g5-grid{
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
@media (min-width: 700px){
    .g5-grid{ grid-template-columns: repeat(3, 1fr); gap: 22px; }
}
@media (min-width: 1024px){
    .g5-grid{ grid-template-columns: repeat(4, 1fr); gap: 26px; }
}

@media (max-width: 699px){
    .g5-shop-container,
    .woocommerce ul.products{
        padding-left: 8px !important;
        padding-right: 8px !important;
        max-width: 100% !important;
    }
}

/* ============================================================
   CARD
   ============================================================ */
.g5-card-wrap{ list-style: none; }

.g5-card{
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--g5-white);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--g5c-text) 8%, transparent);
    box-shadow:
        0 1px 2px rgba(0,0,0,.04),
        0 6px 14px -8px rgba(20,60,60,.18);
    transition: box-shadow .35s ease, transform .35s ease;
    outline: none;
}
.g5-card:focus-visible{
    box-shadow: 0 0 0 3px var(--g5-gold), 0 10px 24px -12px rgba(20,60,60,.18);
}

.g5-card::before{
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--g5-turquoise), var(--g5-gold), var(--g5-turquoise));
    background-size: 200% 100%;
    opacity: 0;
    z-index: 5;
    transition: opacity .3s ease;
}
@media (min-width: 900px){
    .g5-card:hover::before,
    .g5-card:focus-within::before{
        opacity: 1;
        animation: g5-topline-shimmer 1.4s linear infinite;
    }
}
@keyframes g5-topline-shimmer{
    0%   { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

@media (min-width: 900px){
    .g5-card:hover,
    .g5-card:focus-within{
        transform: scale(1.016);
        box-shadow:
            0 4px 6px rgba(0,0,0,.06),
            0 22px 44px -14px rgba(20,60,60,.32),
            0 0 0 1px color-mix(in srgb, var(--g5-turquoise) 28%, transparent);
    }
}
.g5-card::after{
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.5) 50%, transparent 60%);
    background-size: 250% 250%;
    background-position: 130% 130%;
    opacity: 0;
    pointer-events: none;
    transition: background-position .65s ease, opacity .4s ease;
    z-index: 3;
}
.g5-card:hover::after,
.g5-card:focus-within::after{
    background-position: -30% -30%;
    opacity: 1;
}
@media (prefers-reduced-motion: reduce){
    .g5-card, .g5-card::after, .g5-card::before{ transition: none !important; animation: none !important; }
}

/* ============================================================
   MEDIA AREA
   ============================================================ */
.g5-card-media{
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--g5c-bg);
    overflow: hidden;
}
.g5-card-media-link{ display: block; width: 100%; height: 100%; }
.g5-card-img{
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 5px;
    transition: transform .5s ease;
}
@media (min-width: 900px){
    .g5-card-img{ padding: 12px; }
    .g5-card:hover .g5-card-img{ transform: scale(1.045); }
}

/* ---- Wishlist heart: FIXED — no more black on hover ---- */
.g5-wishlist-btn{
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 4;
    width: 32px;
    height: 32px;
    border: none !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--g5-white) 88%, transparent) !important;
    backdrop-filter: blur(6px);
    box-shadow: 0 3px 8px rgba(0,0,0,.12);
    cursor: pointer;
    padding: 0 !important;
    transition: transform .15s cubic-bezier(.34,1.56,.64,1), background .2s ease, box-shadow .2s ease;
}
.g5-heart-icon{
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--g5c-text);
    stroke-width: 1.8;
    transition: fill .2s ease, stroke .2s ease;
    pointer-events: none;
}
.g5-wishlist-btn:hover,
.g5-wishlist-btn:focus-visible{
    background: #FFFFFF !important;
    transform: scale(1.08);
    box-shadow: 0 0 0 2px var(--g5-turquoise), 0 4px 10px rgba(0,0,0,.15);
}
.g5-wishlist-btn:active{
    transform: scale(0.9);
}
.g5-wishlist-btn.is-active{ background: #FFFFFF !important; }
.g5-wishlist-btn.is-active .g5-heart-icon{
    fill: var(--g5-gold);
    stroke: var(--g5-gold);
}
.g5-wishlist-btn.g5-pulse .g5-heart-icon{
    animation: g5-heart-pop .38s ease;
}
@keyframes g5-heart-pop{
    0%   { transform: scale(1); }
    35%  { transform: scale(1.35); }
    65%  { transform: scale(.9); }
    100% { transform: scale(1); }
}

.g5-save-badge{
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 4;
    background: var(--g5-gold);
    color: var(--g5c-text);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .2px;
    padding: 3px 8px;
    border-radius: 999px;
    box-shadow: 0 3px 8px rgba(0,0,0,.12);
}

.g5-card-panel{
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 3;
    max-height: 0;
    overflow: hidden;
    background: color-mix(in srgb, var(--g5-white) 92%, transparent);
    backdrop-filter: blur(8px);
    border-top: 1px solid color-mix(in srgb, var(--g5c-text) 10%, transparent);
    transition: max-height .5s cubic-bezier(.34,1.15,.4,1);
}
.g5-card-panel p{
    margin: 0;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.5;
    color: color-mix(in srgb, var(--g5c-text) 80%, transparent);
}
@media (min-width: 900px){
    .g5-card:hover .g5-card-panel,
    .g5-card:focus-within .g5-card-panel{
        max-height: 110px;
    }
}
.g5-card-panel.is-open{ max-height: 110px; }

/* ============================================================
   BODY
   ============================================================ */
.g5-card-body{
    padding: 6px 9px 0;
    flex: 1;
}
.g5-card-title-link{ text-decoration: none; }
.g5-card-title{
    margin: 0 0 2px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.28;
    color: var(--g5c-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.g5-card-price{
    font-size: 14px;
    font-weight: 700;
    color: var(--g5-turquoise);
    margin-bottom: 2px;
}
.g5-card-price del{
    font-size: 11px;
    font-weight: 400;
    color: color-mix(in srgb, var(--g5c-text) 45%, transparent);
    margin-right: 5px;
}
.g5-card-price ins{ text-decoration: none; }

/* ============================================================
   ACTIONS
   ============================================================ */
.g5-card-actions{
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px 9px;
}
.g5-btn{
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 999px;
    padding: 10px 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.g5-btn-buy-now{
    flex: 1;
    background: var(--g5-turquoise);
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--g5-turquoise) 55%, transparent);
    transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease;
}
.g5-btn-buy-now:hover{
    box-shadow: 0 8px 18px -4px color-mix(in srgb, var(--g5-turquoise) 65%, transparent);
}
.g5-btn:active{ transform: scale(.96); }
.g5-btn-oos{
    flex: 1;
    background: color-mix(in srgb, var(--g5c-text) 10%, transparent);
    color: color-mix(in srgb, var(--g5c-text) 55%, transparent);
    cursor: not-allowed;
    border-radius: 999px;
    padding: 10px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

/* ---- Round Add-to-Cart: icon now ABSOLUTE-centered so it can never
        be pushed off-center by the theme's own .button padding ---- */
.g5-btn-cart-round{
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: block;
    text-decoration: none !important;
    cursor: pointer;
    background: var(--g5-slate);
    box-shadow:
        0 4px 10px -2px color-mix(in srgb, var(--g5-slate) 50%, transparent),
        inset 0 2px 2px rgba(255,255,255,.15);
    border: none !important;
    padding: 0 !important;
    line-height: normal !important;
    box-sizing: border-box;
    transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease, background .25s ease;
    position: relative;
}

.g5-cart-icon-wrap{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 18px;
    height: 18px;
    pointer-events: none;
}
.g5-cart-icon,
.g5-check-icon{
    position: absolute;
    inset: 0;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #FFFFFF;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: opacity .22s ease, transform .22s ease;
}
.g5-check-icon{
    opacity: 0;
    transform: scale(.4) rotate(-15deg);
}
.g5-btn-cart-round.g5-added .g5-cart-icon{
    opacity: 0;
    transform: scale(.4) rotate(15deg);
}
.g5-btn-cart-round.g5-added .g5-check-icon{
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.g5-btn-cart-round:hover{
    box-shadow:
        0 8px 18px -2px color-mix(in srgb, var(--g5-slate) 55%, transparent),
        inset 0 2px 2px rgba(255,255,255,.2);
}
.g5-btn-cart-round:active{ transform: scale(.85) !important; }
.g5-btn-cart-round.g5-added{
    background: var(--g5-turquoise);
    box-shadow:
        0 6px 16px -2px color-mix(in srgb, var(--g5-turquoise) 55%, transparent),
        inset 0 2px 2px rgba(255,255,255,.2);
}

.g5-btn.g5-ripple,
.g5-btn-cart-round.g5-ripple{ position: relative; overflow: hidden; }
.g5-btn.g5-ripple::before,
.g5-btn-cart-round.g5-ripple::before{
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,.55) 0%, transparent 60%);
    opacity: 0;
    border-radius: inherit;
    animation: g5-ripple-fade .5s ease;
}
@keyframes g5-ripple-fade{
    0%   { opacity: .9; transform: scale(.3); }
    100% { opacity: 0;  transform: scale(1.6); }
}

@media (min-width: 480px){
    .g5-card-title{ font-size: 14.5px; }
    .g5-card-price{ font-size: 16px; }
}

/* ============================================================
   ROUND PRODUCT MARQUEE — [g5_product_marquee] shortcode.
   Place it between rows of cards (e.g. every 4-5 products) to
   break up long grids, matching the reference images you sent.
   ============================================================ */
.g5-marquee-wrap{
    width: 100%;
    overflow: hidden;
    padding: 16px 0;
    background: var(--g5c-bg);
    margin: 18px 0;
    border-radius: 14px;
}
.g5-marquee-track{
    display: flex;
    width: max-content;
    gap: 16px;
    animation: g5-marquee-scroll 30s linear infinite;
}
.g5-marquee-wrap:hover .g5-marquee-track{
    animation-play-state: paused;
}
.g5-marquee-item{
    flex: 0 0 auto;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    overflow: hidden;
    background: #FFFFFF;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 10px rgba(47,79,79,.14);
    transition: transform .2s ease, box-shadow .2s ease;
}
.g5-marquee-item:hover{
    transform: scale(1.1);
    box-shadow: 0 0 0 2px var(--g5-turquoise), 0 4px 14px rgba(47,79,79,.2);
}
.g5-marquee-item img{
    width: 100%;
    height: 100%;
    object-fit: cover;
}
@keyframes g5-marquee-scroll{
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce){
    .g5-marquee-track{ animation: none; }
}
