/* =========================================
   Product Category Grid Widget — Styles
   Light-weight, pure CSS animations.
   Loaded only when the widget is used.
========================================= */

/* ---- Base ---- */
.wwe-cat-grid {
    width: 100%;
}

/* ---- Section Title ---- */
.wwe-cat-grid__title {
    margin: 0 0 24px 0;
    transition: color 0.3s ease;
}

/* ---- Grid ---- */
.wwe-cat-grid__list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* =========================================
   Card
   The card itself is a positioning context.
   The image-wrap fills the card completely.
   The button sits absolutely at the bottom.
========================================= */
.wwe-cat-grid__item {
    position: relative;
    overflow: visible; 
    display: grid;
    grid-template-rows: var(--wwe-img-height, 280px) auto;
    width: 100%; /* Default overridden by inline calc() */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ---- Image Wrapper — fixed height container ---- */
.wwe-cat-grid__image-wrap {
    grid-row: 1;
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;        /* clips image to border-radius */
}

/* ---- Image Link ---- */
.wwe-cat-grid__image-link {
    position: absolute;
    inset: 0;
    display: block;
    border-radius: inherit;
    overflow: hidden;
    text-decoration: none;
}

/* ---- Image — always fills wrapper, no blank space ---- */
.wwe-cat-grid__image {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;              /* fills space, no gaps */
    object-position: center center;
    transition-property: transform, filter, opacity;
    transition-duration: 400ms;
    transition-timing-function: ease;
}

/* ---- Image Overlay ---- */
.wwe-cat-grid__overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: background-color 0.3s ease;
}

/* =========================================
   Image Hover Animations (pure CSS)
========================================= */

/* Image hover animations — triggered by hovering ANYWHERE on the card item.
   This ensures button hover also animates the image. */
.wwe-cat-grid__item.wwe-img-anim--grow:hover .wwe-cat-grid__image {
    transform: scale(1.1);
}
.wwe-cat-grid__item.wwe-img-anim--shrink:hover .wwe-cat-grid__image {
    transform: scale(0.92);
}
.wwe-cat-grid__item.wwe-img-anim--rotate:hover .wwe-cat-grid__image {
    transform: scale(1.1) rotate(3deg);
}
.wwe-cat-grid__item.wwe-img-anim--blur:hover .wwe-cat-grid__image {
    filter: blur(3px);
}
.wwe-cat-grid__item.wwe-img-anim--grayscale .wwe-cat-grid__image {
    filter: grayscale(100%);
}
.wwe-cat-grid__item.wwe-img-anim--grayscale:hover .wwe-cat-grid__image {
    filter: grayscale(0%);
}
.wwe-cat-grid__item.wwe-img-anim--brightness:hover .wwe-cat-grid__image {
    filter: brightness(1.25);
}
.wwe-cat-grid__item.wwe-img-anim--slide-up:hover .wwe-cat-grid__image {
    transform: translateY(-8px) scale(1.03);
}
@keyframes wwe-flash {
    0%, 50%, 100% { opacity: 1; }
    25%, 75%      { opacity: 0.5; }
}
.wwe-cat-grid__item.wwe-img-anim--flash:hover .wwe-cat-grid__image {
    animation: wwe-flash 0.6s ease;
}

/* =========================================
   Category Button
========================================= */
/* ---- Button Wrap ---- */
.wwe-cat-grid__button-wrap {
    grid-row: 2;
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center; /* Centers the button horizontally */
    align-items: flex-start; /* Prevents button from stretching vertically */
    width: 100%;
}

/* ---- Button ---- */
.wwe-cat-grid__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    white-space: nowrap;

    padding: 10px 16px;
    background-color: #ffffff;
    color: #111111;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;

    transition-property: color, background-color, border-color, box-shadow, transform, width;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

/* ---- Full Width variant ---- */
.wwe-cat-grid__button--full-width {
    width: 100%;
    border-radius: 0;
}

/* ---- Button Text ---- */
.wwe-cat-grid__button-text {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Icon Swapping Logic ---- */
.wwe-btn-icon-wrap {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}
.wwe-btn-icon-wrap svg,
.wwe-btn-icon-wrap i {
    width: 1em;
    height: 1em;
    font-size: inherit;
    fill: currentColor;
    color: inherit;
    display: block;
}

/* Normal icon always visible; hover icon hidden by default */
.wwe-icon-normal { display: inline-flex; align-items: center; }
.wwe-icon-hover  { display: none; align-items: center; }

/* On hover: swap icons */
.wwe-cat-grid__button:hover .wwe-icon-normal { display: none; }
.wwe-cat-grid__button:hover .wwe-icon-hover  { display: inline-flex; }


/* =========================================
   Button Hover Animations
   NOTE: normal buttons use translateX(-50%)
   for centering, so animations must include it.
   Full-width buttons don't, so they get plain transforms.
========================================= */

/* Grow */
.wwe-btn-anim--grow:hover {
    transform: scale(1.05);
}

/* Shrink */
.wwe-btn-anim--shrink:hover {
    transform: scale(0.95);
}

/* Pulse */
@keyframes wwe-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}
.wwe-btn-anim--pulse:hover {
    animation: wwe-pulse 0.6s ease;
}

/* Float */
.wwe-btn-anim--float:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

/* Push */
.wwe-btn-anim--push:hover {
    transform: scale(0.96);
}

/* Wobble */
@keyframes wwe-wobble {
    15%  { transform: translateX(-6px) rotate(-3deg); }
    30%  { transform: translateX(4px) rotate(2deg); }
    45%  { transform: translateX(-3px) rotate(-1deg); }
    60%  { transform: translateX(2px) rotate(0.5deg); }
    75%  { transform: translateX(-1px) rotate(-0.3deg); }
    100% { transform: translateX(0); }
}
.wwe-btn-anim--wobble:hover {
    animation: wwe-wobble 0.7s ease;
}

/* =========================================
   Empty State
========================================= */
.wwe-cat-grid__empty {
    padding: 24px;
    text-align: center;
    background: #f8f9fa;
    color: #6c757d;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    font-size: 14px;
}
