/* ==========================================================================
   WOCXO Resources — Card Grid & Filters
   Scoped under .wocxo-resources to avoid Astra conflicts.
   ========================================================================== */

/* --- Elementor Layout Override: content column expands, sidebar shrinks -- */

/* The Elementor single-post template uses 3x col-33.
   Make the column holding the resources grid take the lion's share,
   and let sibling columns (social icons, sidebar) shrink to fit. */

.elementor-column:has(.wocxo-resources) {
    width: 100% !important;
    flex: 1 1 0% !important;
}

/* Sibling columns (sidebar, social share) shrink to content width */
.elementor-section:has(.wocxo-resources) .elementor-column:not(:has(.wocxo-resources)) {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 280px;
}

/* Ensure the parent section uses flex properly */
.elementor-section:has(.wocxo-resources) > .elementor-container {
    display: flex !important;
    flex-wrap: nowrap !important;
}

.wocxo-resources {
    max-width: none;
    margin: 0;
    padding: 0 1rem;
    font-family: inherit;
}

/* --- Affiliate Disclosure ------------------------------------------------ */

.wocxo-resources__disclosure {
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: #555;
    line-height: 1.6;
}

.wocxo-resources__disclosure p {
    margin: 0;
}

/* --- Filter Tabs --------------------------------------------------------- */

.wocxo-resources__filters {
    margin-bottom: 2rem;
}

.wocxo-resources__filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.wocxo-resources__filter-btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: 2px solid #ddd;
    border-radius: 999px;
    background: #fff;
    color: #333;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.wocxo-resources__filter-btn:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.wocxo-resources__filter-btn:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

.wocxo-resources__filter-btn--active,
.wocxo-resources__filter-btn[aria-selected="true"] {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

/* --- Live Region (screen-reader only) ------------------------------------ */

.wocxo-resources__live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* --- Card Grid ----------------------------------------------------------- */

.wocxo-resources__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.wocxo-resources__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    font-size: 1.1rem;
    padding: 3rem 1rem;
}

/* --- Card ---------------------------------------------------------------- */

.wocxo-resources__card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wocxo-resources__card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.wocxo-resources__card[hidden] {
    display: none;
}

/* Card Image */
.wocxo-resources__card-image {
    position: relative;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.wocxo-resources__card-image img {
    width: 100%;
    height: 240px;
    object-fit: contain;
    padding: 1rem;
}

/* Card Body */
.wocxo-resources__card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.25rem;
}

/* Badge */
.wocxo-resources__badge {
    display: inline-block;
    align-self: flex-start;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    color: #fff;
    background: #666;
}

.wocxo-resources__badge--book       { background: #2e86ab; }
.wocxo-resources__badge--tool       { background: #a23b72; }
.wocxo-resources__badge--course     { background: #f18f01; }
.wocxo-resources__badge--podcast    { background: #c73e1d; }
.wocxo-resources__badge--equipment  { background: #3b1f2b; }
.wocxo-resources__badge--supplement { background: #44803f; }

/* Title */
.wocxo-resources__card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    line-height: 1.3;
    color: #222;
}

/* Category label */
.wocxo-resources__card-category {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.75rem;
}

/* Description */
.wocxo-resources__card-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #444;
    flex: 1;
    margin-bottom: 1rem;
}

.wocxo-resources__card-desc p {
    margin: 0 0 0.5rem;
}

.wocxo-resources__card-desc p:last-child {
    margin-bottom: 0;
}

/* Action Buttons */
.wocxo-resources__card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.wocxo-resources__btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s, opacity 0.2s;
    flex: 1;
    min-width: 0;
}

.wocxo-resources__btn:focus-visible {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

.wocxo-resources__btn--primary {
    background: #0073aa;
    color: #fff;
}

.wocxo-resources__btn--primary:hover {
    background: #005a87;
    color: #fff;
}

.wocxo-resources__btn--secondary {
    background: #ff9900;
    color: #111;
}

.wocxo-resources__btn--secondary:hover {
    background: #e68a00;
    color: #111;
}

.wocxo-resources__btn--review {
    background: #f0f0f0;
    color: #333;
}

.wocxo-resources__btn--review:hover {
    background: #e0e0e0;
    color: #333;
}

/* --- Responsive ---------------------------------------------------------- */

@media (max-width: 640px) {
    .wocxo-resources__grid {
        grid-template-columns: 1fr;
    }

    .wocxo-resources__card-actions {
        flex-direction: column;
    }

    .wocxo-resources__btn {
        flex: none;
        width: 100%;
    }
}

@media (min-width: 641px) and (max-width: 900px) {
    .wocxo-resources__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Reduced Motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
    .wocxo-resources__card,
    .wocxo-resources__filter-btn,
    .wocxo-resources__btn {
        transition: none;
    }

    .wocxo-resources__card:hover {
        transform: none;
    }
}
