.hcg-036b9b90-grid {
    display: grid;
    gap: 20px;
    /* Default to Elementor settings if provided, otherwise 3 */
    grid-template-columns: repeat(3, 1fr);
}

.hcg-036b9b90-card-wrapper {
    position: relative;
    /* Maintain height even when inner card is absolute */
}

/* Base card state */
.hcg-036b9b90-card {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, height 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    width: 100%;
    z-index: 1;
}

.hcg-036b9b90-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    flex-shrink: 0;
}

.hcg-036b9b90-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hcg-036b9b90-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.hcg-036b9b90-content-scrollable {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hcg-036b9b90-title,
.hcg-036b9b90-subtitle,
.hcg-036b9b90-desc {
    margin: 0;
}

.hcg-036b9b90-title {
    font-size: 1.25rem;
    font-weight: bold;
    flex-shrink: 0;
}

.hcg-036b9b90-subtitle {
    font-size: 1rem;
    color: #444;
    flex-shrink: 0;
}

/* Truncate description initially */
.hcg-036b9b90-desc-container {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
}

.hcg-036b9b90-desc {
    color: #666;
}

.hcg-036b9b90-actions {
    margin-top: 15px;
    flex-shrink: 0;
    /* Fixed at bottom */
    background: linear-gradient(to top, #ffffff 80%, rgba(255,255,255,0) 100%);
    padding-top: 10px;
}

.hcg-036b9b90-button {
    background: none;
    border: none;
    padding: 0;
    color: #0073e6;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    display: inline-block;
}

.hcg-036b9b90-button:hover {
    text-decoration: underline;
}

.hcg-036b9b90-collapse-btn {
    display: none;
}

/* ====== EXPANDED STATE ====== */
.hcg-036b9b90-card-wrapper.is-active {
    z-index: 1000;
}

.hcg-036b9b90-card.is-expanded {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
    /* Width will be set via JS to match grid container */
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    flex-direction: row;
    align-items: stretch;
    /* Give it a max height to allow scrolling if text is very long */
    max-height: 80vh;
}

/* Adjust image when expanded */
.hcg-036b9b90-card.is-expanded .hcg-036b9b90-image-wrapper {
    width: 40%;
    height: auto;
    aspect-ratio: auto;
}

/* Adjust content when expanded */
.hcg-036b9b90-card.is-expanded .hcg-036b9b90-content {
    width: 60%;
}

.hcg-036b9b90-card.is-expanded .hcg-036b9b90-content-scrollable {
    overflow-y: auto;
    padding-right: 10px; /* space for scrollbar */
}

.hcg-036b9b90-card.is-expanded .hcg-036b9b90-desc-container {
    display: block; /* Remove truncation */
    overflow: visible;
}

.hcg-036b9b90-card.is-expanded .hcg-036b9b90-expand-btn {
    display: none;
}

.hcg-036b9b90-card.is-expanded .hcg-036b9b90-collapse-btn {
    display: inline-block;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    /* Fallback grid override if elementor selectors fail */
    .hcg-036b9b90-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .hcg-036b9b90-card.is-expanded .hcg-036b9b90-image-wrapper {
        width: 35%;
    }
    .hcg-036b9b90-card.is-expanded .hcg-036b9b90-content {
        width: 65%;
    }
}
@media (max-width: 768px) {
    /* Fallback grid override if elementor selectors fail */
    .hcg-036b9b90-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }

    .hcg-036b9b90-card.is-expanded {
        position: relative; /* Change from absolute to relative for mobile */
        width: 100% !important; /* Force to column width */
        left: 0 !important;
        flex-direction: column;
        max-height: none;
        height: auto;
    }
    .hcg-036b9b90-card.is-expanded .hcg-036b9b90-image-wrapper {
        width: 100%;
        aspect-ratio: 16/9;
        height: auto;
    }
    .hcg-036b9b90-card.is-expanded .hcg-036b9b90-content {
        width: 100%;
        height: auto;
    }
    .hcg-036b9b90-card.is-expanded .hcg-036b9b90-content-scrollable {
        overflow-y: visible;
    }
    .hcg-036b9b90-card-wrapper {
        min-height: 0 !important; /* Reset wrapper min height on mobile */
    }
}