/* Categories Images Frontend Styles */

/* =========================================
   FIXED GRID LAYOUT FOR LENSARISIKO
   ========================================= */

/* 1. The Grid Container */
.bwx-taxonomy-list.bwx-grid {
    display: grid;
    grid-gap: 24px; /* Increased gap for a cleaner look */
    /* Ensure cards stay readable by setting a healthy min-width */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.bwx-taxonomy-list.bwx-grid .bwx-item {
    list-style: none;
    margin: 0;
}

/* 2. The Card Wrapper */
.bwx-taxonomy-list.bwx-grid .bwx-item.bwx-card {
    border: 1px solid #edf2f7;
    border-radius: 12px; /* Smoother rounded corners */
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bwx-taxonomy-list.bwx-grid .bwx-item.bwx-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e0;
}

/* 3. Link Structure (Flexbox) */
.bwx-taxonomy-list.bwx-grid .bwx-link {
    display: flex;
    flex-direction: row;
    align-items: stretch; /* Forces image height to match text height */
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.bwx-taxonomy-list.bwx-grid .bwx-link:hover {
    text-decoration: none;
    color: inherit;
}

.bwx-taxonomy-list.bwx-grid .bwx-link:hover .bwx-term-name,
.bwx-taxonomy-list.bwx-grid .bwx-link:hover .bwx-term-description {
    text-decoration: none;
    color: inherit;
}

/* 4. Left Side: Media/Image */
.bwx-taxonomy-list.bwx-grid .bwx-card__media {
    flex: 0 0 40%; /* Image takes up 40% of the card */
    min-width: 120px;
    position: relative;
    overflow: hidden;
    background: #f7fafc;
}

.bwx-taxonomy-list.bwx-grid .bwx-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.5s ease;
}

.bwx-item.bwx-card:hover .bwx-card__image {
    transform: scale(1.08); /* Subtle zoom on hover */
}

/* 5. Right Side: Content Area */
.bwx-taxonomy-list.bwx-grid .bwx-card__content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 6. Typography Fixes */
.bwx-taxonomy-list.bwx-grid .bwx-term-name {
    margin: 0 0 8px 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #2d3748; /* Deep professional blue-grey */
    line-height: 1.3;
}

.bwx-taxonomy-list.bwx-grid .bwx-term-description {
    margin: 0;
    font-size: 0.9rem;
    color: #718096; /* Soft grey for description */
    line-height: 1.5;
}

/* 7. Mobile View (Stacking) */
@media (max-width: 640px) {
    .bwx-taxonomy-list.bwx-grid .bwx-link {
        flex-direction: column;
    }
    
    .bwx-taxonomy-list.bwx-grid .bwx-card__media {
        width: 100%;
        height: 180px; /* Fixed height for mobile stack */
        flex: none;
    }
}

/* Inline Layout */
.bwx-taxonomy-list.bwx-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.bwx-taxonomy-list.bwx-inline .bwx-item {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
}

/* List Layout (Default) */
.bwx-taxonomy-list.bwx-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bwx-taxonomy-list.bwx-list .bwx-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

/* Common */
.bwx-term-name {
    display: block;
    font-weight: bold;
    margin-top: 5px;
    color: inherit;
    text-decoration: none;
}

.bwx-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.bwx-term-count {
    display: inline-block;
    background: #f0f0f1;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.8em;
    margin-left: 5px;
    vertical-align: middle;
}

/* Card-style list items: split layout with image left and content right */
.bwx-taxonomy-list.bwx-list .bwx-item.bwx-card {
    list-style: none;
    margin: 0 0 12px 0;
    border: 1px solid #ececec;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.bwx-taxonomy-list.bwx-list .bwx-item.bwx-card .bwx-link {
    display: flex;
    align-items: stretch;
    color: inherit;
    text-decoration: none;
}

.bwx-card__media {
    flex: 0 0 140px;
    max-width: 140px;
    height: 100%;
    overflow: hidden;
    background: #f6f6f6;
}

.bwx-card__media img.bwx-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bwx-card__content {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.bwx-term-description {
    margin: 6px 0 0 0;
    color: #666;
    font-size: 0.95em;
}

.bwx-taxonomy-list.bwx-list .bwx-item.bwx-card .bwx-link:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

/* Responsive: stack for small screens */
@media (max-width: 560px) {
    .bwx-taxonomy-list.bwx-list .bwx-item.bwx-card .bwx-link {
        flex-direction: column;
    }
    .bwx-card__media {
        width: 100%;
        max-width: none;
        flex: 0 0 auto;
        height: 160px;
    }
}
