/* =============================================================
   WooCommerce Category Grid for Elementor – Front-end Styles
   Version: 1.0.0
============================================================= */

/* ── Grid wrapper ──────────────────────────────────────────── */
.wcg-grid {
    display: grid;
    /* Default: 4 cols – overridden by Elementor responsive selectors */
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── Card ──────────────────────────────────────────────────── */
.wcg-card {
    position: relative;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 300ms ease;
    will-change: transform;
}

.wcg-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* ── Image wrap ────────────────────────────────────────────── */
.wcg-card__image-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    /* aspect-ratio padding-top set inline via Elementor for ratio mode */
    padding-top: 100%; /* default 1:1 */
    background: #f3f3f3;
}

.wcg-card__image-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 400ms ease;
    display: block;
}

.wcg-card:hover .wcg-card__image-wrap img {
    transform: scale(1.05);
}

/* ── Content (below mode) ──────────────────────────────────── */
.wcg-card__content {
    padding: 16px;
}

.wcg-card__name {
    margin: 0 0 4px;
    padding: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: #1a1a1a;
}

.wcg-card__count {
    display: block;
    font-size: 0.8rem;
    color: #888888;
    margin-bottom: 6px;
}

.wcg-card__desc {
    font-size: 0.85rem;
    color: #555555;
    line-height: 1.5;
    margin: 6px 0 0;
}

/* ── Button ────────────────────────────────────────────────── */
.wcg-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 9px 20px;
    background: #2c2c2c;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 4px;
    transition: background 250ms ease, color 250ms ease, transform 200ms ease;
    cursor: pointer;
}

.wcg-btn:hover {
    background: #444444;
    transform: translateY(-1px);
}

/* ── Overlay mode ──────────────────────────────────────────── */
.wcg-card--overlay .wcg-card__image-wrap {
    /* occupy the full card when overlay */
    position: relative;
    z-index: 0;
}

.wcg-card--overlay .wcg-card__overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;      /* overridden by Elementor selector */
    justify-content: flex-end;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 60%);
    transition: background 300ms ease;
}

.wcg-card--overlay:hover .wcg-card__overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.15) 70%);
}

.wcg-card--overlay .wcg-card__content {
    padding: 0;
    width: 100%;
}

.wcg-card--overlay .wcg-card__name {
    color: #ffffff;
}

.wcg-card--overlay .wcg-card__count {
    color: rgba(255,255,255,0.75);
}

.wcg-card--overlay .wcg-card__desc {
    color: rgba(255,255,255,0.85);
}

/* ── No-categories fallback ────────────────────────────────── */
.wcg-no-categories {
    color: #888;
    font-style: italic;
    padding: 20px 0;
}

/* ── Elementor responsive overrides (tablet & mobile) ─────── */
/*
   Elementor injects its own selectors via the responsive_control
   for "columns". We only need to supply a sensible baseline for
   screens where Elementor may not emit styles.
*/
@media (max-width: 1024px) {
    .wcg-grid:not([style*="grid-template-columns"]) {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .wcg-grid:not([style*="grid-template-columns"]) {
        grid-template-columns: 1fr;
    }
}
