/* Masonry Grid Container */
.ct-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 0 auto;
    width: 100%;
    max-width: 1200px;
    padding: 20px;
}

.ct-grid.loaded {
    opacity: 1;
}

/* Card Base Styles */
.ct-card {
    position: relative;
    width: 100%;
    height: 250px;
    border-radius: 12px;
    overflow: hidden;
}

.ct-card-inner {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s ease;
}

/* Zoom effect on hover for ct-card-inner in minimal card type */
.card-type-minimal .ct-card:hover .ct-card-inner {
    transform: scale(1.1);
    transform-origin: bottom center;
}

/* Overlay gradient for cards */
.ct-card-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.8) 50%);
}

/* Custom gradient overlay - overrides default when enabled */
.ct-card[data-enable-gradient="true"] .ct-card-inner::before {
    background: linear-gradient(
        var(--gradient-direction, to bottom),
        var(--gradient-start-color, rgba(0,0,0,0)) 0%,
        var(--gradient-end-color, rgba(0,0,0,0.8)) var(--gradient-position, 50%)
    ) !important;
}

/* No overlay when explicitly disabled */
.ct-card[data-enable-gradient="false"] .ct-card-inner::before {
    background: none !important;
}

.ct-card[data-width="25"] h4,
.ct-card[data-width="40"] h4,
.ct-card[data-width="50"] h4,
.ct-card[data-width="60"] h4,
.ct-card[data-width="75"] h4,
.ct-card[data-width="100"] h4 {
    color: #ffffff;
    font-size: 1.2em;
    margin-left: 5px;
    margin-top: 5px;
    white-space: normal;
    word-wrap: break-word;
    text-align: left;
}

/* Background Colors - Assigned by position */
.ct-card:nth-child(5n+1) .ct-card-inner { background-color: #30D1E2; }
.ct-card:nth-child(5n+2) .ct-card-inner { background-color: #FEA4B8; }
.ct-card:nth-child(5n+3) .ct-card-inner { background-color: #40AEF2; }
.ct-card:nth-child(5n+4) .ct-card-inner { background-color: #FFC74E; }
.ct-card:nth-child(5n+5) .ct-card-inner { background-color: #7AAAE8; }

/* Minimal Card */
.card-type-minimal .ct-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    position: relative;
    text-align: center !important;
}

.card-type-minimal .ct-card-inner {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    background-size: 240px !important;
    background-position: bottom !important;
    background-repeat: no-repeat !important;
    z-index: 1;
    box-sizing: border-box;
}

.card-type-minimal .minimal-title {
    position: absolute;
    right: 24px;
    left: auto !important;
    width: auto;
    text-align: right !important;
    z-index: 2;
    padding: 0;
    margin: 0;
    color: white !important;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Gradient overlay */
.card-type-minimal .ct-card-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 120, 215, 0) 0%, rgba(0, 120, 215, 0.7) 30%);
    opacity: 0;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .ct-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 20px;
    }
    
    .ct-card {
        height: 130px !important;
    }
    
    .ct-card h4 {
        font-size: 18px;
        top: 15px;
        right: 15px;
        color: white;
    }
    
    .card-type-minimal .minimal-title {
        margin-top: 8px;
        margin-right: 2px;
    }
    .card-type-minimal .ct-card-inner {
        background-size: 160px !important;
    }
}

/* Tablet Layout */
@media (min-width: 768px) and (max-width: 991px) {
    .ct-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .ct-card h4 {
        font-size: 20px;
    }

}

/* Responsive Layouts */
@media (min-width: 992px) {
    .ct-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.ct-card a {
    text-decoration: none !important;
}

.ct-card {
    text-decoration: none;
}

.ct-card * {
    text-decoration: none;
}

/* Force remove underlines from all title links with high specificity */
.ct-card h4 a,
.ct-card-inner a {
    text-decoration: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}