/*
 * Commplify Case Study Grid Widget — Styles
 * Pixel-perfect reproduction of the ud-10/case-studies.html design,
 * scoped under .commplify-case-study-grid so it never leaks into the page.
 *
 * CSS custom properties fall back to sensible values so the widget works
 * even when the page does not define the Commplify design-token variables.
 */

/* ─── Token fallbacks ────────────────────────────────────────────────────── */
.commplify-case-study-grid {
    --csg-primary:            #6366f1;
    --csg-accent:             #ec4899;
    --csg-text-main:          #000000;
    --csg-text-muted:         #64748b;
    --csg-bg-surface:     #ffffff;
    --csg-bg-glass:          rgba(255, 255, 255, 0.65);
    --csg-border-glass:  rgba(0, 0, 0, 0.1);
    --csg-shadow-lg:        0 10px 30px -10px rgba(0, 0, 0, 0.1);
    --csg-br:      12px;

    box-sizing: border-box;
}
    /* --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.65);
    --border-glass: rgba(0, 0, 0, 0.1);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.3);
    --accent: #db2777;
    --accent-glow: rgba(219, 39, 119, 0.3);
    --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.1); */

.commplify-case-study-grid *,
.commplify-case-study-grid *::before,
.commplify-case-study-grid *::after {
    box-sizing: inherit;
}

/* ─── Section header ─────────────────────────────────────────────────────── */
.commplify-case-study-grid .csg-section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.commplify-case-study-grid .csg-section-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 0.75rem;
    color: var(--csg-text-main);
}

.commplify-case-study-grid .csg-section-header p {
    font-size: 1rem;
    color: var(--csg-text-muted);
    max-width: 640px;
    margin: 0 auto;
}

/* ─── Filter bar ─────────────────────────────────────────────────────────── */
.commplify-case-study-grid .case-filter {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Industry pills row */
.commplify-case-study-grid .industry-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.commplify-case-study-grid .industry-pill {
    padding: 0.4rem 1rem;
    border-radius: 99px;
    border: 1px solid var(--csg-border-glass);
    background: rgba(255, 255, 255, 0.05);
    color: var(--csg-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    font-family: inherit;
    line-height: 1.4;
    text-shadow: none;
}

.commplify-case-study-grid .industry-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--csg-text-main);
}

.commplify-case-study-grid .industry-pill.active {
    background: var(--csg-primary);
    border-color: var(--csg-primary);
    color: #fff;
}

/* Process filter column */
.commplify-case-study-grid .process-filter {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.commplify-case-study-grid .process-filter .process-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--csg-border-glass);
    background: rgba(255, 255, 255, 0.03);
    color: var(--csg-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    font-family: inherit;
    line-height: 1.4;
    text-align: left;
    white-space: nowrap;
    text-shadow: none;
}

.commplify-case-study-grid .process-filter .process-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--csg-text-main);
}

.commplify-case-study-grid .process-filter .process-item.active {
    background: var(--csg-primary);
    border-color: var(--csg-primary);
    color: #fff;
}

.commplify-case-study-grid .process-filter .process-item .icon {
    font-size: 1rem;
    flex-shrink: 0;
}

/* ─── Card grid ──────────────────────────────────────────────────────────── */
.commplify-case-study-grid .case-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

/* ─── Individual card ────────────────────────────────────────────────────── */
.commplify-case-study-grid .case-card {
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--csg-border-glass);
    background: var(--csg-bg-surface);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.commplify-case-study-grid .case-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.3);
}

/* Thumbnail */
.commplify-case-study-grid .case-card img,
.commplify-case-study-grid .case-card .csg-card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

/* Card body */
.commplify-case-study-grid .case-info {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.commplify-case-study-grid .case-info .case-tag {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--csg-primary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.commplify-case-study-grid .case-info h3 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--csg-text-main);
    margin: 0.2rem 0;
}

@media (min-width: 991px) {
    .commplify-case-study-grid.csg-single-card .case-info h3 {
        width: 50%;
    }
}

.commplify-case-study-grid .case-info .case-highlight {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--csg-accent);
    margin: 0;
}

.commplify-case-study-grid .case-info p {
    font-size: 0.88rem;
    color: var(--csg-text-muted);
    line-height: 1.55;
    flex: 1;
    margin: 0;
}

/* Card button */
.commplify-case-study-grid .case-info .btn {
    display: inline-block;
    margin-top: auto;
    padding: 0.5rem 1.1rem;
    border-radius: var(--csg-br);
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    align-self: flex-start;
}

.commplify-case-study-grid .case-info .btn-secondary {
    background: transparent;
    border: 1px solid var(--csg-border-glass);
    color: var(--csg-text-main);
}

.commplify-case-study-grid .case-info .btn-secondary:hover {
    background: var(--csg-border-glass);
}

/* ─── Hidden card (filtered out) ─────────────────────────────────────────── */
.commplify-case-study-grid .case-card[style*="display: none"],
.commplify-case-study-grid .case-card.csg-hidden {
    display: none !important;
}

/* ─── Empty state ────────────────────────────────────────────────────────── */
.commplify-case-study-grid .csg-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--csg-text-muted);
    padding: 2rem 0;
    font-size: 0.95rem;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .commplify-case-study-grid .case-filter {
        flex-direction: column;
        gap: 1.25rem;
    }

    .commplify-case-study-grid .process-filter {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .commplify-case-study-grid .csg-section-header h2 {
        font-size: 1.6rem;
    }

    .commplify-case-study-grid .case-grid {
        grid-template-columns: 1fr;
    }
}
