/* ==========================================================
   Events Grid for The Events Calendar
   Author:  Rajeev Ranjan
   Version: 1.5.1
   ========================================================== */

/* ── Wrapper ──────────────────────────────────────────────── */
.ecg-wrapper {
    font-family: inherit;
    margin: 2rem 0;
    width: 100%;
    box-sizing: border-box;
}

.ecg-wrapper *,
.ecg-wrapper *::before,
.ecg-wrapper *::after {
    box-sizing: border-box;
    font-family: inherit;
}

/* ── Grid ─────────────────────────────────────────────────── */
.ecg-grid {
    display: grid;
    gap: 1.5rem;
    width: 100%;
}

/* Desktop: honour chosen column count */
.ecg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.ecg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.ecg-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Large tablet (≤1024px): 4-col → 2, 3-col → 2 */
@media (max-width: 1024px) {
    .ecg-cols-3,
    .ecg-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

/* Small tablet (≤768px): everything → 2 columns */
@media (max-width: 768px) {
    .ecg-cols-2,
    .ecg-cols-3,
    .ecg-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .ecg-grid { gap: 1rem; }
}

/* Mobile (≤520px): everything → 1 column */
@media (max-width: 520px) {
    .ecg-cols-2,
    .ecg-cols-3,
    .ecg-cols-4 { grid-template-columns: 1fr; }
    .ecg-grid { gap: 1rem; }
}

/* ── Card ─────────────────────────────────────────────────── */
.ecg-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.ecg-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.11);
    transform: translateY(-4px);
}

/* Disable hover lift on touch devices */
@media (hover: none) {
    .ecg-card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* ── Image ────────────────────────────────────────────────── */
.ecg-image-wrap {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #f0f0f0;
    text-decoration: none;
    width: 100%;
}

.ecg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s ease;
}

.ecg-card:hover .ecg-image {
    transform: scale(1.05);
}

.ecg-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

.ecg-image-placeholder svg {
    width: 44px;
    height: 44px;
    color: #cccccc;
}

/* ── Date badge ───────────────────────────────────────────── */
.ecg-date-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #1a1a2e;
    color: #ffffff;
    border-radius: 8px;
    padding: 6px 10px;
    text-align: center;
    min-width: 44px;
    line-height: 1.2;
    pointer-events: none;
    z-index: 2;
}

.ecg-badge-day {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.ecg-badge-month {
    display: block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    opacity: 0.85;
}

@media (max-width: 520px) {
    .ecg-badge-day   { font-size: 1.1rem; }
    .ecg-badge-month { font-size: 0.6rem; }
    .ecg-date-badge  { padding: 5px 8px; min-width: 38px; }
}

/* ── Category tag ─────────────────────────────────────────── */
.ecg-category-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(91, 79, 207, 0.88);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 9px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 2;
    max-width: 55%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Card body ────────────────────────────────────────────── */
.ecg-body {
    padding: 1.1rem 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

@media (max-width: 520px) {
    .ecg-body { padding: 0.9rem 1rem 1.1rem; }
}

/* ── Title ────────────────────────────────────────────────── */
.ecg-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 0.6rem;
    color: #1a1a2e;
    word-break: break-word;
}

.ecg-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ecg-title a:hover {
    color: #5b4fcf;
}

@media (max-width: 520px) {
    .ecg-title { font-size: 0.95rem; }
}

/* ── Excerpt ──────────────────────────────────────────────── */
.ecg-excerpt {
    font-size: 0.875rem !important;
    color: #555555 !important;
    line-height: 1.65 !important;
    margin: 0 0 1rem !important;
    flex: 1;
    display: block !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    white-space: normal !important;
    max-height: none !important;
    word-break: break-word;
}

@media (max-width: 520px) {
    .ecg-excerpt { font-size: 0.825rem !important; }
}

/* ── Button ───────────────────────────────────────────────── */
.ecg-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    align-self: flex-start;
    background: #5b4fcf;
    color: #ffffff !important;
    padding: 0.55rem 1.15rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: background 0.2s ease, gap 0.2s ease;
    margin-top: auto;
    line-height: 1;
    white-space: nowrap;
}

.ecg-btn:hover {
    background: #4a3fbe;
    color: #ffffff !important;
    gap: 0.7rem;
}

.ecg-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke: #ffffff;
    transition: transform 0.2s ease;
}

.ecg-btn:hover svg {
    transform: translateX(3px);
}

/* Full-width button on mobile */
@media (max-width: 520px) {
    .ecg-btn {
        align-self: stretch;
        justify-content: center;
        padding: 0.65rem 1rem;
    }
}

/* ── States ───────────────────────────────────────────────── */
.ecg-no-events {
    font-size: 0.95rem;
    color: #777777;
    font-style: italic;
    padding: 1rem 0;
}

.ecg-notice {
    font-size: 0.95rem;
    color: #cc0000;
    background: #fff3f3;
    border-left: 3px solid #cc0000;
    padding: 0.75rem 1rem;
    border-radius: 4px;
}
